Show selected tracking settings below camera controls

This commit is contained in:
EVA x10 Development 2026-11-25 10:54:02 +01:00
parent 3a97fc397b
commit 60e2db9212
4 changed files with 60 additions and 25 deletions

View File

@ -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="20" android:versionName="0.3.15"> package="com.it_screen.edgevision" android:versionCode="21" android:versionName="0.3.16">
<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"/>

View File

@ -1,4 +1,4 @@
# EVAx10 Video analitics v0.3.15 # EVAx10 Video analitics v0.3.16
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.15.apk`. creation. The signed test build is `build/EVAx10-Video-analitics-0.3.16.apk`.
```text ```text
adb install --no-incremental -r EVAx10-Video-analitics-0.3.15.apk adb install --no-incremental -r EVAx10-Video-analitics-0.3.16.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
``` ```
@ -96,7 +96,7 @@ or an Android low-memory signal is red.
### Controlled Face Re-ID PoC ### Controlled Face Re-ID PoC
Build with `./build.sh --face-reid-poc`. Install Build with `./build.sh --face-reid-poc`. Install
`build/EVAx10-Video-analitics-0.3.15-Face-ReID-PoC.apk` as the separate package `build/EVAx10-Video-analitics-0.3.16-Face-ReID-PoC.apk` as the separate package
`com.it_screen.edgevision.facereidpoc`. Start requires on-device confirmation `com.it_screen.edgevision.facereidpoc`. Start requires on-device confirmation
that all adult test participants consent. Keep other people out of the camera view. that all adult test participants consent. Keep other people out of the camera view.
The default build excludes the SFace weights and implementation. The default build excludes the SFace weights and implementation.

View File

@ -20,7 +20,7 @@ if [[ ! -f build/ort.aar ]]; then
fi fi
python3 tools/check-production-assets.py python3 tools/check-production-assets.py
manifest=AndroidManifest.xml manifest=AndroidManifest.xml
apk=build/EVAx10-Video-analitics-0.3.15.apk apk=build/EVAx10-Video-analitics-0.3.16.apk
if [[ $variant == poc ]]; then if [[ $variant == poc ]]; then
python3 tools/check-poc-assets.py python3 tools/check-poc-assets.py
manifest=build/AndroidManifest-face-reid-poc.xml manifest=build/AndroidManifest-face-reid-poc.xml
@ -28,7 +28,7 @@ if [[ $variant == poc ]]; then
-e 's/android:name=".MainActivity"/android:name="com.it_screen.edgevision.MainActivity"/' \ -e 's/android:name=".MainActivity"/android:name="com.it_screen.edgevision.MainActivity"/' \
-e 's/android:label="EVAx10 Video analitics"/android:label="EVAx10 Video analitics · Face Re-ID PoC"/' \ -e 's/android:label="EVAx10 Video analitics"/android:label="EVAx10 Video analitics · Face Re-ID PoC"/' \
AndroidManifest.xml > "$manifest" AndroidManifest.xml > "$manifest"
apk=build/EVAx10-Video-analitics-0.3.15-Face-ReID-PoC.apk apk=build/EVAx10-Video-analitics-0.3.16-Face-ReID-PoC.apk
fi fi
rm -rf build/classes build/dex rm -rf build/classes build/dex
mkdir -p build/classes build/dex mkdir -p build/classes build/dex

View File

@ -55,7 +55,8 @@ public final class MainActivity extends Activity {
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; private Button start, stop, test;
private Spinner resolution, interval, detection, classification, provider, threadCount, faceModel, ageModel; private TextView trackingSettingsSummary;
private Spinner resolution, detection, classification, provider, threadCount, faceModel, ageModel;
private boolean running; private boolean running;
@Override public void onCreate(Bundle state) { @Override public void onCreate(Bundle state) {
@ -173,12 +174,21 @@ 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);
}); });
button(actions, "Tracking settings", this::editTrackingSettings); LinearLayout trackingSettingsRow = new LinearLayout(this);
trackingSettingsRow.setGravity(Gravity.CENTER_VERTICAL);
trackingSettingsRow.setBackgroundColor(0xff1a2833);
Button trackingGear = button(trackingSettingsRow, "⚙", this::editTrackingSettings);
trackingGear.setContentDescription("Tracking settings");
trackingGear.setTextSize(22);
trackingSettingsSummary = text("", 13);
trackingSettingsSummary.setPadding(4, 6, 10, 6);
trackingSettingsSummary.setOnClickListener(v -> editTrackingSettings());
trackingSettingsRow.addView(trackingSettingsSummary, new LinearLayout.LayoutParams(0, -2, 1));
left.addView(trackingSettingsRow);
updateTrackingSettingsSummary();
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);
interval = setting(row1, "Face interval ms", "100", "200", "500", "1000");
interval.setSelection(2);
detection = setting(row1, "Detection threshold", "0.5", "0.6", "0.7", "0.8", "0.9"); detection = setting(row1, "Detection threshold", "0.5", "0.6", "0.7", "0.8", "0.9");
detection.setSelection(1); detection.setSelection(1);
classification = setting(row1, "Class. threshold", "0.6", "0.7", "0.8", "0.9", "0.95"); classification = setting(row1, "Class. threshold", "0.6", "0.7", "0.8", "0.9", "0.95");
@ -266,25 +276,33 @@ public final class MainActivity extends Activity {
if (!value.contentEquals(view.getText())) view.setText(value); if (!value.contentEquals(view.getText())) view.setText(value);
} }
private void updateTrackingSettingsSummary() {
String summary = "Tracking settings · " + preferences.getInt("tracking_fps", 5) + " FPS"
+ " · лицо каждые " + preferences.getInt("face_interval_ms", 500) + " мс"
+ " · подтверждение " + preferences.getInt("tracking_confirm_ms", 1000) + " мс"
+ " · потеря трека " + preferences.getInt("tracking_lost_ms", 10000) + " мс"
+ " · сессия " + visitorTimeoutMinutes() + " мин";
if (FaceReId.CONTROLLED_POC)
summary += " · Re-ID " + preferences.getInt("reid_similarity_percent", DEFAULT_REID_THRESHOLD) + "%";
trackingSettingsSummary.setText(summary);
}
private void editTrackingSettings() { private void editTrackingSettings() {
LinearLayout form = column(); LinearLayout form = column();
form.setPadding(24, 10, 24, 10); form.setPadding(24, 10, 24, 10);
form.setFocusableInTouchMode(true); form.setFocusableInTouchMode(true);
List<Integer> fpsOptions = new ArrayList<>();
for (int rate = 1; rate <= 15; rate++) fpsOptions.add(rate);
Spinner fps = trackingChoice(form, "Target Tracking FPS", fpsOptions,
preferences.getInt("tracking_fps", 5), 5,
"Целевая частота трекинга. Большее значение помогает при быстром движении и повышает нагрузку.");
Spinner faceInterval = trackingChoice(form, "Face interval (ms)", List.of(100, 200, 500, 1000),
preferences.getInt("face_interval_ms", 500), 500,
"Интервал поиска лица для оценки возраста, пола и Re-ID в PoC. Увеличение интервала снижает нагрузку, но замедляет сопоставление.");
EditText confirmation = trackingField(form, "Confirmation Time (ms)", "tracking_confirm_ms", 1000, EditText confirmation = trackingField(form, "Confirmation Time (ms)", "tracking_confirm_ms", 1000,
"Сколько времени человек должен наблюдаться, чтобы трек подтвердился и учитывался в Current visitors. 1000 мс = 1 с."); "Сколько времени человек должен наблюдаться, чтобы трек подтвердился и учитывался в Current visitors. 1000 мс = 1 с.");
EditText lost = trackingField(form, "Lost Track Timeout (ms)", "tracking_lost_ms", 10000, EditText lost = trackingField(form, "Lost Track Timeout (ms)", "tracking_lost_ms", 10000,
"Сколько времени хранится ID трека после последнего обнаружения. Если трек восстановится в это время, ID сохранится. 10 000 мс = 10 с."); "Сколько времени хранится ID трека после последнего обнаружения. Если трек восстановится в это время, ID сохранится. 10 000 мс = 10 с.");
TextView fpsLabel = trackingSettingLabel(form, "Target Tracking FPS");
Spinner fps = new Spinner(this);
fps.setId(View.generateViewId());
fpsLabel.setLabelFor(fps.getId());
fps.setContentDescription("Target Tracking FPS");
List<Integer> fpsOptions = new ArrayList<>();
for (int rate = 1; rate <= 15; rate++) fpsOptions.add(rate);
choices(fps, fpsOptions);
fps.setSelection(Math.max(1, Math.min(15, preferences.getInt("tracking_fps", 5))) - 1);
form.addView(fps);
trackingSettingNote(form, "Сколько кадров в секунду трекер старается обработать. Большее значение помогает при быстром движении и повышает нагрузку. Фактическая частота видна в More.");
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,
"Сколько минут с последнего обнаружения открыта сессия посетителя, даже если трек закрылся. Таймаут сам по себе не связывает разные треки."); "Сколько минут с последнего обнаружения открыта сессия посетителя, даже если трек закрылся. Таймаут сам по себе не связывает разные треки.");
@ -297,7 +315,7 @@ public final class MainActivity extends Activity {
trackingSettingNote(form, FaceReId.CONTROLLED_POC ? trackingSettingNote(form, FaceReId.CONTROLLED_POC ?
"Сопоставление выполняется локально. При Stop и истечении таймаута шаблоны удаляются из памяти." : "Сопоставление выполняется локально. При Stop и истечении таймаута шаблоны удаляются из памяти." :
"Сопоставление людей между разными треками отключено."); "Сопоставление людей между разными треками отключено.");
trackingSettingNote(form, "Таймаут сессии и порог Re-ID применяются сразу. Настройки трекинга вступают в силу при следующем Start."); trackingSettingNote(form, "Таймаут сессии и порог Re-ID применяются сразу. Частота трекинга, интервал лица и таймауты трека применяются при следующем Start.");
ScrollView fields = new ScrollView(this); ScrollView fields = new ScrollView(this);
fields.addView(form); fields.addView(form);
android.app.AlertDialog dialog = new android.app.AlertDialog.Builder(this) android.app.AlertDialog dialog = new android.app.AlertDialog.Builder(this)
@ -318,8 +336,10 @@ public final class MainActivity extends Activity {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
preferences.edit().putInt("tracking_confirm_ms", confirmationMs).putInt("tracking_lost_ms", lostMs) preferences.edit().putInt("tracking_confirm_ms", confirmationMs).putInt("tracking_lost_ms", lostMs)
.putInt("tracking_fps", trackingFps) .putInt("tracking_fps", trackingFps)
.putInt("face_interval_ms", (Integer) faceInterval.getSelectedItem())
.putInt("visitor_session_timeout_minutes", visitorTimeoutMinutes) .putInt("visitor_session_timeout_minutes", visitorTimeoutMinutes)
.putInt("reid_similarity_percent", threshold).apply(); .putInt("reid_similarity_percent", threshold).apply();
updateTrackingSettingsSummary();
dialog.dismiss(); dialog.dismiss();
} catch (IllegalArgumentException error) { } catch (IllegalArgumentException error) {
Toast.makeText(this, "Confirmation 0–10000 ms, lost 1000–120000 ms, FPS 1–15, session timeout 1–1440 min, Re-ID 1–100%", Toast.makeText(this, "Confirmation 0–10000 ms, lost 1000–120000 ms, FPS 1–15, session timeout 1–1440 min, Re-ID 1–100%",
@ -332,6 +352,21 @@ public final class MainActivity extends Activity {
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
} }
private Spinner trackingChoice(LinearLayout form, String label, List<Integer> options,
int selected, int fallback, String explanation) {
TextView heading = trackingSettingLabel(form, label);
Spinner field = new Spinner(this);
field.setId(View.generateViewId());
field.setContentDescription(label);
heading.setLabelFor(field.getId());
choices(field, options);
int position = options.indexOf(selected);
field.setSelection(position >= 0 ? position : options.indexOf(fallback));
form.addView(field);
trackingSettingNote(form, explanation);
return field;
}
private EditText trackingField(LinearLayout form, String label, String key, int fallback, String explanation) { private EditText trackingField(LinearLayout form, String label, String key, int fallback, String explanation) {
TextView heading = trackingSettingLabel(form, label); TextView heading = trackingSettingLabel(form, label);
EditText field = new EditText(this); EditText field = new EditText(this);
@ -419,13 +454,13 @@ public final class MainActivity extends Activity {
start.setEnabled(!value); start.setEnabled(!value);
test.setEnabled(!value && !FaceReId.CONTROLLED_POC); test.setEnabled(!value && !FaceReId.CONTROLLED_POC);
stop.setEnabled(value); stop.setEnabled(value);
for (Spinner control : new Spinner[]{resolution, interval, detection, classification, provider, threadCount, faceModel, ageModel}) for (Spinner control : new Spinner[]{resolution, detection, classification, provider, threadCount, faceModel, ageModel})
control.setEnabled(!value); control.setEnabled(!value);
} }
private Settings readSettings() { private Settings readSettings() {
return new Settings(resolution.getSelectedItem().toString(), return new Settings(resolution.getSelectedItem().toString(),
Integer.parseInt(interval.getSelectedItem().toString()), preferences.getInt("face_interval_ms", 500),
Float.parseFloat(detection.getSelectedItem().toString()), Float.parseFloat(detection.getSelectedItem().toString()),
Float.parseFloat(classification.getSelectedItem().toString()), Float.parseFloat(classification.getSelectedItem().toString()),
(String) provider.getSelectedItem(), Integer.parseInt(threadCount.getSelectedItem().toString()), (String) provider.getSelectedItem(), Integer.parseInt(threadCount.getSelectedItem().toString()),