Show selected tracking settings below camera controls
This commit is contained in:
parent
3a97fc397b
commit
60e2db9212
|
|
@ -1,5 +1,5 @@
|
|||
<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-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-feature android:name="android.hardware.camera.any" android:required="true"/>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
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.15.apk`.
|
||||
creation. The signed test build is `build/EVAx10-Video-analitics-0.3.16.apk`.
|
||||
|
||||
```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 logcat -s EdgeVision EdgeVisionBench
|
||||
```
|
||||
|
|
@ -96,7 +96,7 @@ or an Android low-memory signal is red.
|
|||
### Controlled Face Re-ID PoC
|
||||
|
||||
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
|
||||
that all adult test participants consent. Keep other people out of the camera view.
|
||||
The default build excludes the SFace weights and implementation.
|
||||
|
|
|
|||
4
build.sh
4
build.sh
|
|
@ -20,7 +20,7 @@ if [[ ! -f build/ort.aar ]]; then
|
|||
fi
|
||||
python3 tools/check-production-assets.py
|
||||
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
|
||||
python3 tools/check-poc-assets.py
|
||||
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:label="EVAx10 Video analitics"/android:label="EVAx10 Video analitics · Face Re-ID PoC"/' \
|
||||
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
|
||||
rm -rf build/classes build/dex
|
||||
mkdir -p build/classes build/dex
|
||||
|
|
|
|||
|
|
@ -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 Preview preview;
|
||||
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;
|
||||
|
||||
@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);
|
||||
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);
|
||||
left.addView(row1);
|
||||
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.setSelection(1);
|
||||
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);
|
||||
}
|
||||
|
||||
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() {
|
||||
LinearLayout form = column();
|
||||
form.setPadding(24, 10, 24, 10);
|
||||
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,
|
||||
"Сколько времени человек должен наблюдаться, чтобы трек подтвердился и учитывался в Current visitors. 1000 мс = 1 с.");
|
||||
EditText lost = trackingField(form, "Lost Track Timeout (ms)", "tracking_lost_ms", 10000,
|
||||
"Сколько времени хранится 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)",
|
||||
"visitor_session_timeout_minutes", VisitorSessions.DEFAULT_TIMEOUT_MINUTES,
|
||||
"Сколько минут с последнего обнаружения открыта сессия посетителя, даже если трек закрылся. Таймаут сам по себе не связывает разные треки.");
|
||||
|
|
@ -297,7 +315,7 @@ public final class MainActivity extends Activity {
|
|||
trackingSettingNote(form, FaceReId.CONTROLLED_POC ?
|
||||
"Сопоставление выполняется локально. При Stop и истечении таймаута шаблоны удаляются из памяти." :
|
||||
"Сопоставление людей между разными треками отключено.");
|
||||
trackingSettingNote(form, "Таймаут сессии и порог Re-ID применяются сразу. Настройки трекинга вступают в силу при следующем Start.");
|
||||
trackingSettingNote(form, "Таймаут сессии и порог Re-ID применяются сразу. Частота трекинга, интервал лица и таймауты трека применяются при следующем Start.");
|
||||
ScrollView fields = new ScrollView(this);
|
||||
fields.addView(form);
|
||||
android.app.AlertDialog dialog = new android.app.AlertDialog.Builder(this)
|
||||
|
|
@ -318,8 +336,10 @@ public final class MainActivity extends Activity {
|
|||
throw new IllegalArgumentException();
|
||||
preferences.edit().putInt("tracking_confirm_ms", confirmationMs).putInt("tracking_lost_ms", lostMs)
|
||||
.putInt("tracking_fps", trackingFps)
|
||||
.putInt("face_interval_ms", (Integer) faceInterval.getSelectedItem())
|
||||
.putInt("visitor_session_timeout_minutes", visitorTimeoutMinutes)
|
||||
.putInt("reid_similarity_percent", threshold).apply();
|
||||
updateTrackingSettingsSummary();
|
||||
dialog.dismiss();
|
||||
} 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%",
|
||||
|
|
@ -332,6 +352,21 @@ public final class MainActivity extends Activity {
|
|||
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) {
|
||||
TextView heading = trackingSettingLabel(form, label);
|
||||
EditText field = new EditText(this);
|
||||
|
|
@ -419,13 +454,13 @@ public final class MainActivity extends Activity {
|
|||
start.setEnabled(!value);
|
||||
test.setEnabled(!value && !FaceReId.CONTROLLED_POC);
|
||||
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);
|
||||
}
|
||||
|
||||
private Settings readSettings() {
|
||||
return new Settings(resolution.getSelectedItem().toString(),
|
||||
Integer.parseInt(interval.getSelectedItem().toString()),
|
||||
preferences.getInt("face_interval_ms", 500),
|
||||
Float.parseFloat(detection.getSelectedItem().toString()),
|
||||
Float.parseFloat(classification.getSelectedItem().toString()),
|
||||
(String) provider.getSelectedItem(), Integer.parseInt(threadCount.getSelectedItem().toString()),
|
||||
|
|
|
|||
Loading…
Reference in New Issue