Keep technical track totals in diagnostics
This commit is contained in:
parent
627bbdd9e5
commit
59ee0842b9
|
|
@ -1,5 +1,5 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.it_screen.edgevision" android:versionCode="6" android:versionName="0.3.1">
|
||||
package="com.it_screen.edgevision" android:versionCode="7" android:versionName="0.3.2">
|
||||
<uses-sdk android:minSdkVersion="30" android:targetSdkVersion="34"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-feature android:name="android.hardware.camera.any" android:required="true"/>
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# EVAx10 Video analitics v0.3.1
|
||||
# EVAx10 Video analitics v0.3.2
|
||||
|
||||
A separate native Android experiment for consenting adult volunteers.
|
||||
Package `com.it_screen.edgevision`. The existing FaceAPI baseline is
|
||||
|
|
@ -10,10 +10,10 @@ installable as `com.it_screen.audiencepoc`.
|
|||
`./build.sh` builds the ARM64, API 30+ APK with the Windows Android SDK 35
|
||||
and JDK 17 via WSL. The script pins and verifies the upstream Maven AAR.
|
||||
Model assets load locally and are verified before ONNX Runtime session
|
||||
creation. The signed test build is `build/EVAx10-Video-analitics-0.3.1.apk`.
|
||||
creation. The signed test build is `build/EVAx10-Video-analitics-0.3.2.apk`.
|
||||
|
||||
```text
|
||||
adb install --no-incremental -r EVAx10-Video-analitics-0.3.1.apk
|
||||
adb install --no-incremental -r EVAx10-Video-analitics-0.3.2.apk
|
||||
adb shell am start -W -n com.it_screen.edgevision/.MainActivity
|
||||
adb logcat -s EdgeVision EdgeVisionBench
|
||||
```
|
||||
|
|
@ -51,13 +51,12 @@ Before Start, open **Tracking settings** to configure confirmation (default
|
|||
5). Each confirmed body track counts once, and biometric matching is
|
||||
disabled. Those two settings are enforced by the implementation.
|
||||
|
||||
The right panel starts with totals and demographic breakdowns. The framed
|
||||
The right panel starts with Current visitors, an estimate of people visible now. Confirmed track totals and their demographic breakdowns are in More. The framed
|
||||
**Журнал трекинга** shows time-stamped confirmation, temporary loss,
|
||||
restoration, and closure by track ID. A restoration lists the time since
|
||||
first and last observation. **More** opens a scrollable diagnostics
|
||||
dialog with live values and definitions. A restored ID does not increment **Total visits**.
|
||||
The counter includes the existing persisted visits until **Reset Statistics**
|
||||
is used. Reset while someone is in the frame starts a new tracking session.
|
||||
Confirmed Tracks includes the existing persisted confirmed-track total until **Reset Statistics** is used. It is not a unique-visitor history. Reset while someone is in the frame starts a new tracking session.
|
||||
|
||||
Position, shape and motion determine association. A return close to the
|
||||
last known path within the timeout can reuse the ID. A return after
|
||||
|
|
|
|||
4
build.sh
4
build.sh
|
|
@ -47,5 +47,5 @@ PY
|
|||
if [[ ! -f build/poc-debug.p12 ]]; then
|
||||
"$jdk/bin/keytool.exe" -genkeypair -keystore build/poc-debug.p12 -storepass android -alias edgevision -keyalg RSA -keysize 2048 -validity 3650 -dname CN=EdgeVision
|
||||
fi
|
||||
"$jdk/bin/java.exe" -jar "$(wslpath -w "$tools/lib/apksigner.jar")" sign --ks build/poc-debug.p12 --ks-pass pass:android --out build/EVAx10-Video-analitics-0.3.1.apk build/aligned.apk
|
||||
"$jdk/bin/java.exe" -jar "$(wslpath -w "$tools/lib/apksigner.jar")" verify --verbose build/EVAx10-Video-analitics-0.3.1.apk
|
||||
"$jdk/bin/java.exe" -jar "$(wslpath -w "$tools/lib/apksigner.jar")" sign --ks build/poc-debug.p12 --ks-pass pass:android --out build/EVAx10-Video-analitics-0.3.2.apk build/aligned.apk
|
||||
"$jdk/bin/java.exe" -jar "$(wslpath -w "$tools/lib/apksigner.jar")" verify --verbose build/EVAx10-Video-analitics-0.3.2.apk
|
||||
|
|
|
|||
|
|
@ -17,9 +17,12 @@ final class DiagnosticsPanel {
|
|||
private final Activity activity;
|
||||
private final Map<String, TextView> values = new LinkedHashMap<>();
|
||||
private JSONObject latest = new JSONObject();
|
||||
private TextView demographicView;
|
||||
private int confirmedTracks;
|
||||
private String demographicsText = "";
|
||||
// Key, display name, unit, and explanation.
|
||||
private static final String[][] METRICS = {
|
||||
{"total_visits", "Total visits", "", "Число подтверждённых визитов с последнего сброса. Восстановление трека его не увеличивает."},
|
||||
{"total_visits", "Confirmed Tracks", "", "Число подтверждённых треков с последнего сброса. Одному человеку могут соответствовать несколько треков."},
|
||||
{"active_tracks", "Active Tracks", "", "Подтверждённые треки людей, видимых в текущем кадре."},
|
||||
{"lost_tracks", "Lost Tracks", "", "Треки, которые временно пропали. Их ID сохраняются до истечения таймаута."},
|
||||
{"lost_events", "Track Losses", "", "Сколько раз за сессию треки переходили в состояние временной потери. Один трек может пропадать несколько раз."},
|
||||
|
|
@ -65,6 +68,17 @@ final class DiagnosticsPanel {
|
|||
refresh();
|
||||
}
|
||||
|
||||
void updateConfirmedTracks(int count, int[] genders, int[] ages) {
|
||||
confirmedTracks = count;
|
||||
StringBuilder summary = new StringBuilder("Распределение оценок по подтверждённым трекам");
|
||||
for (int i = 0; i < genders.length; i++)
|
||||
summary.append("\n").append(AudienceAggregator.GENDERS[i]).append(" ").append(genders[i]);
|
||||
for (int i = 0; i < ages.length; i++)
|
||||
summary.append("\n").append(AudienceAggregator.AGES[i]).append(" ").append(i == 0 ? "N/A" : ages[i]);
|
||||
demographicsText = summary.toString();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void show() {
|
||||
if (!values.isEmpty()) return;
|
||||
ScrollView scroll = new ScrollView(activity);
|
||||
|
|
@ -87,13 +101,19 @@ final class DiagnosticsPanel {
|
|||
description.setPadding(0, dp(3), 0, dp(13));
|
||||
content.addView(description);
|
||||
}
|
||||
demographicView = new TextView(activity);
|
||||
demographicView.setTextSize(14);
|
||||
content.addView(demographicView);
|
||||
refresh();
|
||||
AlertDialog dialog = new AlertDialog.Builder(activity, AlertDialog.THEME_DEVICE_DEFAULT_DARK)
|
||||
.setTitle("Diagnostic Dashboard")
|
||||
.setView(scroll)
|
||||
.setPositiveButton("Закрыть", null)
|
||||
.create();
|
||||
dialog.setOnDismissListener(ignored -> values.clear());
|
||||
dialog.setOnDismissListener(ignored -> {
|
||||
values.clear();
|
||||
demographicView = null;
|
||||
});
|
||||
dialog.show();
|
||||
Window window = dialog.getWindow();
|
||||
if (window != null) {
|
||||
|
|
@ -107,12 +127,14 @@ final class DiagnosticsPanel {
|
|||
private void refresh() {
|
||||
if (values.isEmpty()) return;
|
||||
for (String[] metric : METRICS) {
|
||||
Object value = latest.opt(metric[0]);
|
||||
Object value = metric[0].equals("total_visits") ? confirmedTracks : latest.opt(metric[0]);
|
||||
String display = value == null || value == JSONObject.NULL ? "N/A" : value + metric[2];
|
||||
TextView row = values.get(metric[0]);
|
||||
String label = metric[1] + " " + display;
|
||||
if (!label.contentEquals(row.getText())) row.setText(label);
|
||||
}
|
||||
if (demographicView != null && !demographicsText.contentEquals(demographicView.getText()))
|
||||
demographicView.setText(demographicsText);
|
||||
}
|
||||
|
||||
private int dp(int value) {
|
||||
|
|
|
|||
|
|
@ -414,14 +414,14 @@ public final class MainActivity extends Activity {
|
|||
if (event.previous == PersonTracker.State.TEMPORARILY_LOST) {
|
||||
message = "Трек восстановлен. Впервые обнаружен " + durationAgo(now - event.track.firstSeen) +
|
||||
" назад, последнее наблюдение " + durationAgo(now - event.previousSeen) +
|
||||
" назад. Движение и положение совпали. Total без изменений.";
|
||||
" назад. Движение и положение совпали. Прежний ID сохранён.";
|
||||
} else {
|
||||
totals.countVisit(event.track.analytics);
|
||||
changed = true;
|
||||
message = "Новый визит. Наблюдение подтверждено за " + durationAgo(now - event.track.confirmationStart) + ". Total +1.";
|
||||
message = "Трек подтверждён. Наблюдение длилось " + durationAgo(now - event.track.confirmationStart) + ".";
|
||||
}
|
||||
break;
|
||||
case DETECTED: message = "Человек обнаружен. Создан трек. Total пока без изменений."; break;
|
||||
case DETECTED: message = "Человек обнаружен. Создан предварительный трек."; break;
|
||||
case PENDING: message = "Проверяем, что человек остаётся в кадре. Подтверждение — " + durationAgo(config.confirmMs) + "."; break;
|
||||
case TEMPORARILY_LOST: message = "Человек временно вне зоны детекции. ID сохраняется до " + durationAgo(config.lostMs) + " от последнего наблюдения."; break;
|
||||
case CLOSED: message = "Последнее наблюдение " + durationAgo(now - event.previousSeen) + " назад. Таймаут истёк, трек закрыт."; break;
|
||||
|
|
@ -555,11 +555,10 @@ public final class MainActivity extends Activity {
|
|||
private static double round(double value) { return Math.round(value * 10) / 10.0; }
|
||||
|
||||
private void updateStats(int current, int visits, int[] genders, int[] ages) {
|
||||
StringBuilder body = new StringBuilder("Total visits ").append(visits).append("\nCurrent visitors ").append(current);
|
||||
for (int i = 0; i < genders.length; i++) body.append('\n').append(AudienceAggregator.GENDERS[i]).append(" ").append(genders[i]);
|
||||
body.append("\n\nEstimated age (adult-only)");
|
||||
for (int i = 0; i < ages.length; i++) body.append('\n').append(AudienceAggregator.AGES[i]).append(" ").append(i == 0 ? "N/A" : ages[i]);
|
||||
if (!body.toString().contentEquals(stats.getText())) stats.setText(body);
|
||||
String currentLabel = "Current visitors " + current +
|
||||
"\nОценка числа людей, которых камера сейчас видит.";
|
||||
if (!currentLabel.contentEquals(stats.getText())) stats.setText(currentLabel);
|
||||
diagnostics.updateConfirmedTracks(visits, genders, ages);
|
||||
}
|
||||
|
||||
private void failed(long run, String reason) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue