Keep tracking settings available and separate diagnostics from visitor totals
This commit is contained in:
parent
192f41a63b
commit
706c556e90
|
|
@ -1,5 +1,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.it_screen.edgevision" android:versionCode="8" android:versionName="0.3.3">
|
package="com.it_screen.edgevision" android:versionCode="9" android:versionName="0.3.4">
|
||||||
<uses-sdk android:minSdkVersion="30" android:targetSdkVersion="34"/>
|
<uses-sdk android:minSdkVersion="30" android:targetSdkVersion="34"/>
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
<uses-feature android:name="android.hardware.camera.any" android:required="true"/>
|
<uses-feature android:name="android.hardware.camera.any" android:required="true"/>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# EVAx10 Video analitics v0.3.3
|
# EVAx10 Video analitics v0.3.4
|
||||||
|
|
||||||
A separate native Android experiment for consenting adult volunteers.
|
A separate native Android experiment for consenting adult volunteers.
|
||||||
Package `com.it_screen.edgevision`. The existing FaceAPI baseline is
|
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
|
`./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.
|
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
|
Model assets load locally and are verified before ONNX Runtime session
|
||||||
creation. The signed test build is `build/EVAx10-Video-analitics-0.3.3.apk`.
|
creation. The signed test build is `build/EVAx10-Video-analitics-0.3.4.apk`.
|
||||||
|
|
||||||
```text
|
```text
|
||||||
adb install --no-incremental -r EVAx10-Video-analitics-0.3.3.apk
|
adb install --no-incremental -r EVAx10-Video-analitics-0.3.4.apk
|
||||||
adb shell am start -W -n com.it_screen.edgevision/.MainActivity
|
adb shell am start -W -n com.it_screen.edgevision/.MainActivity
|
||||||
adb logcat -s EdgeVision EdgeVisionBench
|
adb logcat -s EdgeVision EdgeVisionBench
|
||||||
```
|
```
|
||||||
|
|
|
||||||
4
build.sh
4
build.sh
|
|
@ -47,5 +47,5 @@ PY
|
||||||
if [[ ! -f build/poc-debug.p12 ]]; then
|
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
|
"$jdk/bin/keytool.exe" -genkeypair -keystore build/poc-debug.p12 -storepass android -alias edgevision -keyalg RSA -keysize 2048 -validity 3650 -dname CN=EdgeVision
|
||||||
fi
|
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.3.apk build/aligned.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.4.apk build/aligned.apk
|
||||||
"$jdk/bin/java.exe" -jar "$(wslpath -w "$tools/lib/apksigner.jar")" verify --verbose build/EVAx10-Video-analitics-0.3.3.apk
|
"$jdk/bin/java.exe" -jar "$(wslpath -w "$tools/lib/apksigner.jar")" verify --verbose build/EVAx10-Video-analitics-0.3.4.apk
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public final class MainActivity extends Activity {
|
||||||
private DiagnosticsPanel diagnostics;
|
private DiagnosticsPanel diagnostics;
|
||||||
private final java.text.SimpleDateFormat eventClock = new java.text.SimpleDateFormat("HH:mm:ss", Locale.ROOT);
|
private final java.text.SimpleDateFormat eventClock = new java.text.SimpleDateFormat("HH:mm:ss", Locale.ROOT);
|
||||||
private Preview preview;
|
private Preview preview;
|
||||||
private Button start, stop, test, trackingSettings;
|
private Button start, stop, test;
|
||||||
private Spinner resolution, interval, detection, classification, provider, threadCount, faceModel, ageModel;
|
private Spinner resolution, interval, detection, classification, provider, threadCount, faceModel, ageModel;
|
||||||
private boolean running;
|
private boolean running;
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ public final class MainActivity extends Activity {
|
||||||
Intent picker = new Intent(Intent.ACTION_OPEN_DOCUMENT).setType("image/*").addCategory(Intent.CATEGORY_OPENABLE);
|
Intent picker = new Intent(Intent.ACTION_OPEN_DOCUMENT).setType("image/*").addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
startActivityForResult(picker, 2);
|
startActivityForResult(picker, 2);
|
||||||
});
|
});
|
||||||
trackingSettings = button(actions, "Tracking settings", this::editTrackingSettings);
|
button(actions, "Tracking settings", this::editTrackingSettings);
|
||||||
LinearLayout row1 = new LinearLayout(this), row2 = new LinearLayout(this);
|
LinearLayout row1 = new LinearLayout(this), row2 = new LinearLayout(this);
|
||||||
left.addView(row1);
|
left.addView(row1);
|
||||||
left.addView(row2);
|
left.addView(row2);
|
||||||
|
|
@ -176,12 +176,14 @@ public final class MainActivity extends Activity {
|
||||||
scroll.addView(right);
|
scroll.addView(right);
|
||||||
stats = text("", 14);
|
stats = text("", 14);
|
||||||
diagnostics = new DiagnosticsPanel(this);
|
diagnostics = new DiagnosticsPanel(this);
|
||||||
LinearLayout summary = new LinearLayout(this);
|
right.addView(stats);
|
||||||
summary.setGravity(Gravity.TOP);
|
TextView unique = text("Уникальные посетители — пока не считаются", 14);
|
||||||
summary.addView(stats, new LinearLayout.LayoutParams(0, -2, 1));
|
unique.setPadding(0, 10, 0, 0);
|
||||||
Button more = button(summary, "More", diagnostics::show);
|
right.addView(unique);
|
||||||
more.setContentDescription("More");
|
LinearLayout diagnosticsActions = new LinearLayout(this);
|
||||||
right.addView(summary);
|
diagnosticsActions.setGravity(Gravity.END);
|
||||||
|
button(diagnosticsActions, "More", diagnostics::show);
|
||||||
|
right.addView(diagnosticsActions);
|
||||||
|
|
||||||
TextView journalTitle = text("Журнал трекинга", 16);
|
TextView journalTitle = text("Журнал трекинга", 16);
|
||||||
journalTitle.setPadding(0, 16, 0, 6);
|
journalTitle.setPadding(0, 16, 0, 6);
|
||||||
|
|
@ -214,9 +216,12 @@ public final class MainActivity extends Activity {
|
||||||
EditText fps = trackingField(form, "Target Tracking FPS", "tracking_fps", 5);
|
EditText fps = trackingField(form, "Target Tracking FPS", "tracking_fps", 5);
|
||||||
EditText visitorTimeout = trackingField(form, "Visitor Session Timeout (minutes)",
|
EditText visitorTimeout = trackingField(form, "Visitor Session Timeout (minutes)",
|
||||||
"visitor_session_timeout_minutes", VisitorSessions.DEFAULT_TIMEOUT_MINUTES);
|
"visitor_session_timeout_minutes", VisitorSessions.DEFAULT_TIMEOUT_MINUTES);
|
||||||
|
form.addView(text("Таймаут сессии применяется сразу. Остальные настройки вступают в силу при следующем Start.", 14));
|
||||||
form.addView(text("Count Once Per Track: true\nBiometric Matching: false", 14));
|
form.addView(text("Count Once Per Track: true\nBiometric Matching: false", 14));
|
||||||
|
ScrollView fields = new ScrollView(this);
|
||||||
|
fields.addView(form);
|
||||||
android.app.AlertDialog dialog = new android.app.AlertDialog.Builder(this)
|
android.app.AlertDialog dialog = new android.app.AlertDialog.Builder(this)
|
||||||
.setTitle("Tracking settings").setView(form)
|
.setTitle("Tracking settings").setView(fields)
|
||||||
.setNegativeButton("Cancel", null).setPositiveButton("Save", null).create();
|
.setNegativeButton("Cancel", null).setPositiveButton("Save", null).create();
|
||||||
dialog.setOnShowListener(ignored -> dialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE)
|
dialog.setOnShowListener(ignored -> dialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE)
|
||||||
.setOnClickListener(button -> {
|
.setOnClickListener(button -> {
|
||||||
|
|
@ -308,7 +313,6 @@ public final class MainActivity extends Activity {
|
||||||
start.setEnabled(!value);
|
start.setEnabled(!value);
|
||||||
test.setEnabled(!value);
|
test.setEnabled(!value);
|
||||||
stop.setEnabled(value);
|
stop.setEnabled(value);
|
||||||
trackingSettings.setEnabled(!value);
|
|
||||||
for (Spinner control : new Spinner[]{resolution, interval, detection, classification, provider, threadCount, faceModel, ageModel})
|
for (Spinner control : new Spinner[]{resolution, interval, detection, classification, provider, threadCount, faceModel, ageModel})
|
||||||
control.setEnabled(!value);
|
control.setEnabled(!value);
|
||||||
}
|
}
|
||||||
|
|
@ -321,8 +325,7 @@ public final class MainActivity extends Activity {
|
||||||
(String) provider.getSelectedItem(), Integer.parseInt(threadCount.getSelectedItem().toString()),
|
(String) provider.getSelectedItem(), Integer.parseInt(threadCount.getSelectedItem().toString()),
|
||||||
faceModels.get(faceModel.getSelectedItemPosition()), demographicModels.get(ageModel.getSelectedItemPosition()),
|
faceModels.get(faceModel.getSelectedItemPosition()), demographicModels.get(ageModel.getSelectedItemPosition()),
|
||||||
preferences.getInt("tracking_confirm_ms", 1000), preferences.getInt("tracking_lost_ms", 10000),
|
preferences.getInt("tracking_confirm_ms", 1000), preferences.getInt("tracking_lost_ms", 10000),
|
||||||
preferences.getInt("tracking_fps", 5), preferences.getInt("visitor_session_timeout_minutes",
|
preferences.getInt("tracking_fps", 5));
|
||||||
VisitorSessions.DEFAULT_TIMEOUT_MINUTES) * 60000L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startCamera() {
|
private void startCamera() {
|
||||||
|
|
@ -413,7 +416,9 @@ public final class MainActivity extends Activity {
|
||||||
List<PersonTracker.Detection> people = personDetector.detect(frame);
|
List<PersonTracker.Detection> people = personDetector.detect(frame);
|
||||||
List<PersonTracker.Event> events = tracker.update(people, now, config.confirmMs, config.lostMs);
|
List<PersonTracker.Event> events = tracker.update(people, now, config.confirmMs, config.lostMs);
|
||||||
double trackingMs = ms(inferenceAt);
|
double trackingMs = ms(inferenceAt);
|
||||||
visitorSessions.expire(now, config.visitorTimeoutMs);
|
int visitorTimeoutMinutes = preferences.getInt("visitor_session_timeout_minutes",
|
||||||
|
VisitorSessions.DEFAULT_TIMEOUT_MINUTES);
|
||||||
|
visitorSessions.expire(now, visitorTimeoutMinutes * 60000L);
|
||||||
for (PersonTracker.Event event : events) {
|
for (PersonTracker.Event event : events) {
|
||||||
if (event.state == PersonTracker.State.TEMPORARILY_LOST) visitorSessions.temporarilyLost(event.track.id);
|
if (event.state == PersonTracker.State.TEMPORARILY_LOST) visitorSessions.temporarilyLost(event.track.id);
|
||||||
if (event.state == PersonTracker.State.CLOSED) visitorSessions.trackClosed(event.track.id);
|
if (event.state == PersonTracker.State.CLOSED) visitorSessions.trackClosed(event.track.id);
|
||||||
|
|
@ -507,7 +512,7 @@ public final class MainActivity extends Activity {
|
||||||
final String tracking = visitEvents.isEmpty() ? "Ожидание посетителей" : String.join("\n\n", visitEvents);
|
final String tracking = visitEvents.isEmpty() ? "Ожидание посетителей" : String.join("\n\n", visitEvents);
|
||||||
final JSONObject detail;
|
final JSONObject detail;
|
||||||
if (sampled) {
|
if (sampled) {
|
||||||
JSONObject report = metrics(config, size, cameraFps, faceMs, ageMs, totalMs, sourceDrops, faceCount, trackingMs);
|
JSONObject report = metrics(config, size, cameraFps, faceMs, ageMs, totalMs, sourceDrops, faceCount, trackingMs, visitorTimeoutMinutes);
|
||||||
benchmark.add(report);
|
benchmark.add(report);
|
||||||
detail = report;
|
detail = report;
|
||||||
android.util.Log.i("EdgeVisionBench", report.toString());
|
android.util.Log.i("EdgeVisionBench", report.toString());
|
||||||
|
|
@ -550,7 +555,7 @@ public final class MainActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject metrics(Settings config, String size, double cameraFps, double faceMs, double ageMs,
|
private JSONObject metrics(Settings config, String size, double cameraFps, double faceMs, double ageMs,
|
||||||
double totalMs, long sourceDrops, int faces, double trackingMs) throws Exception {
|
double totalMs, long sourceDrops, int faces, double trackingMs, int visitorTimeoutMinutes) throws Exception {
|
||||||
long now = SystemClock.elapsedRealtime(), cpu = android.os.Process.getElapsedCpuTime();
|
long now = SystemClock.elapsedRealtime(), cpu = android.os.Process.getElapsedCpuTime();
|
||||||
Object cpuPercent = lastCpuAt == 0 ? JSONObject.NULL : round(100.0 * (cpu - lastCpu) / Math.max(1, now - lastCpuAt));
|
Object cpuPercent = lastCpuAt == 0 ? JSONObject.NULL : round(100.0 * (cpu - lastCpu) / Math.max(1, now - lastCpuAt));
|
||||||
lastCpuAt = now;
|
lastCpuAt = now;
|
||||||
|
|
@ -572,7 +577,7 @@ public final class MainActivity extends Activity {
|
||||||
.put("average_dwell_s", tracker.averageDwellSeconds())
|
.put("average_dwell_s", tracker.averageDwellSeconds())
|
||||||
.put("tracking_target_fps", config.trackingFps).put("confirmation_ms", config.confirmMs)
|
.put("tracking_target_fps", config.trackingFps).put("confirmation_ms", config.confirmMs)
|
||||||
.put("lost_timeout_ms", config.lostMs)
|
.put("lost_timeout_ms", config.lostMs)
|
||||||
.put("visitor_session_timeout_minutes", config.visitorTimeoutMs / 60000L)
|
.put("visitor_session_timeout_minutes", visitorTimeoutMinutes)
|
||||||
.put("open_visitor_sessions", visitorSessions.openCount())
|
.put("open_visitor_sessions", visitorSessions.openCount())
|
||||||
.put("created_visitor_sessions", visitorSessions.totalCreated())
|
.put("created_visitor_sessions", visitorSessions.totalCreated())
|
||||||
.put("reid_status", visitorSessions.matchingEnabled() ? "Enabled" : "Disabled")
|
.put("reid_status", visitorSessions.matchingEnabled() ? "Enabled" : "Disabled")
|
||||||
|
|
@ -701,11 +706,10 @@ public final class MainActivity extends Activity {
|
||||||
final String resolution, provider;
|
final String resolution, provider;
|
||||||
final int interval, threads;
|
final int interval, threads;
|
||||||
final int confirmMs, lostMs, trackingFps;
|
final int confirmMs, lostMs, trackingFps;
|
||||||
final long visitorTimeoutMs;
|
|
||||||
final float detection, classification;
|
final float detection, classification;
|
||||||
final ModelRegistry.Entry face, age;
|
final ModelRegistry.Entry face, age;
|
||||||
Settings(String resolution, int interval, float detection, float classification, String provider,
|
Settings(String resolution, int interval, float detection, float classification, String provider,
|
||||||
int threads, ModelRegistry.Entry face, ModelRegistry.Entry age, int confirmMs, int lostMs, int trackingFps, long visitorTimeoutMs) {
|
int threads, ModelRegistry.Entry face, ModelRegistry.Entry age, int confirmMs, int lostMs, int trackingFps) {
|
||||||
this.resolution = resolution;
|
this.resolution = resolution;
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
this.detection = detection;
|
this.detection = detection;
|
||||||
|
|
@ -717,7 +721,6 @@ public final class MainActivity extends Activity {
|
||||||
this.confirmMs = confirmMs;
|
this.confirmMs = confirmMs;
|
||||||
this.lostMs = lostMs;
|
this.lostMs = lostMs;
|
||||||
this.trackingFps = trackingFps;
|
this.trackingFps = trackingFps;
|
||||||
this.visitorTimeoutMs = visitorTimeoutMs;
|
|
||||||
}
|
}
|
||||||
boolean sameModels(Settings other) {
|
boolean sameModels(Settings other) {
|
||||||
return other.face == face && other.age == age && other.provider.equals(provider) && other.threads == threads;
|
return other.face == face && other.age == age && other.provider.equals(provider) && other.threads == threads;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue