Highlight new visitor decisions in the camera preview
This commit is contained in:
parent
f75ee629d1
commit
37e37e5be1
|
|
@ -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="25" android:versionName="0.3.20">
|
package="com.it_screen.edgevision" android:versionCode="26" android:versionName="0.3.21">
|
||||||
<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.20
|
# EVAx10 Video analitics v0.3.21
|
||||||
|
|
||||||
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.20.apk`.
|
creation. The signed test build is `build/EVAx10-Video-analitics-0.3.21.apk`.
|
||||||
|
|
||||||
```text
|
```text
|
||||||
adb install --no-incremental -r EVAx10-Video-analitics-0.3.20.apk
|
adb install --no-incremental -r EVAx10-Video-analitics-0.3.21.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.20-Face-ReID-PoC.apk` as the separate package
|
`build/EVAx10-Video-analitics-0.3.21-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.
|
||||||
|
|
|
||||||
4
build.sh
4
build.sh
|
|
@ -20,14 +20,14 @@ 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.20.apk
|
apk=build/EVAx10-Video-analitics-0.3.21.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
|
||||||
sed -e 's/package="com.it_screen.edgevision"/package="com.it_screen.edgevision.facereidpoc"/' \
|
sed -e 's/package="com.it_screen.edgevision"/package="com.it_screen.edgevision.facereidpoc"/' \
|
||||||
-e 's/android:name=".MainActivity"/android:name="com.it_screen.edgevision.MainActivity"/' \
|
-e 's/android:name=".MainActivity"/android:name="com.it_screen.edgevision.MainActivity"/' \
|
||||||
AndroidManifest.xml > "$manifest"
|
AndroidManifest.xml > "$manifest"
|
||||||
apk=build/EVAx10-Video-analitics-0.3.20-Face-ReID-PoC.apk
|
apk=build/EVAx10-Video-analitics-0.3.21-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
|
||||||
|
|
|
||||||
|
|
@ -724,6 +724,7 @@ public final class MainActivity extends Activity {
|
||||||
addVisitEvent("#" + track.id + " · Сопоставление неопределённое. Unique Visitors без изменений.");
|
addVisitEvent("#" + track.id + " · Сопоставление неопределённое. Unique Visitors без изменений.");
|
||||||
break;
|
break;
|
||||||
case CREATED:
|
case CREATED:
|
||||||
|
track.newVisitorHighlightUntil = SystemClock.elapsedRealtime() + 2500;
|
||||||
addVisitEvent("#" + track.id + " · Открыта сессия V" + assignment.visitorId +
|
addVisitEvent("#" + track.id + " · Открыта сессия V" + assignment.visitorId +
|
||||||
(FaceReId.CONTROLLED_POC ? ". Новая запись в оценке." : ". Re-ID отключён."));
|
(FaceReId.CONTROLLED_POC ? ". Новая запись в оценке." : ". Re-ID отключён."));
|
||||||
break;
|
break;
|
||||||
|
|
@ -735,7 +736,8 @@ public final class MainActivity extends Activity {
|
||||||
if (track.state == PersonTracker.State.TEMPORARILY_LOST) continue;
|
if (track.state == PersonTracker.State.TEMPORARILY_LOST) continue;
|
||||||
PersonTracker.Box box = track.box;
|
PersonTracker.Box box = track.box;
|
||||||
overlays.add(new DrawBox(new RectF(box.left, box.top, box.right, box.bottom),
|
overlays.add(new DrawBox(new RectF(box.left, box.top, box.right, box.bottom),
|
||||||
"#" + track.id + " " + (track.confirmed ? track.analytics.label() : "Pending")));
|
"#" + track.id + " " + (track.confirmed ? track.analytics.label() : "Pending"),
|
||||||
|
track.newVisitorHighlightUntil));
|
||||||
}
|
}
|
||||||
int activeTracks = tracker.count(PersonTracker.State.ACTIVE);
|
int activeTracks = tracker.count(PersonTracker.State.ACTIVE);
|
||||||
if (generation != run) return;
|
if (generation != run) return;
|
||||||
|
|
@ -1043,7 +1045,13 @@ public final class MainActivity extends Activity {
|
||||||
private static final class DrawBox {
|
private static final class DrawBox {
|
||||||
final RectF rect;
|
final RectF rect;
|
||||||
final String label;
|
final String label;
|
||||||
DrawBox(RectF rect, String label) { this.rect = rect; this.label = label; }
|
final long highlightUntil;
|
||||||
|
DrawBox(RectF rect, String label) { this(rect, label, 0); }
|
||||||
|
DrawBox(RectF rect, String label, long highlightUntil) {
|
||||||
|
this.rect = rect;
|
||||||
|
this.label = label;
|
||||||
|
this.highlightUntil = highlightUntil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class Preview extends View {
|
private final class Preview extends View {
|
||||||
|
|
@ -1060,21 +1068,27 @@ public final class MainActivity extends Activity {
|
||||||
paint.setColor(Color.WHITE);
|
paint.setColor(Color.WHITE);
|
||||||
paint.setStyle(Paint.Style.FILL);
|
paint.setStyle(Paint.Style.FILL);
|
||||||
canvas.drawBitmap(frame, null, new RectF(x, y, x + width, y + height), paint);
|
canvas.drawBitmap(frame, null, new RectF(x, y, x + width, y + height), paint);
|
||||||
|
long now = SystemClock.elapsedRealtime();
|
||||||
for (DrawBox box : boxes) {
|
for (DrawBox box : boxes) {
|
||||||
RectF rect = box.rect;
|
RectF rect = box.rect;
|
||||||
RectF target = new RectF(x + rect.left * width, y + rect.top * height,
|
RectF target = new RectF(x + rect.left * width, y + rect.top * height,
|
||||||
x + rect.right * width, y + rect.bottom * height);
|
x + rect.right * width, y + rect.bottom * height);
|
||||||
paint.setColor(0xff68e2bf);
|
boolean newVisitor = now < box.highlightUntil;
|
||||||
paint.setStrokeWidth(2);
|
String label = newVisitor ? "Новый посетитель" : box.label;
|
||||||
|
paint.setColor(newVisitor ? 0xffff9f33 : 0xff68e2bf);
|
||||||
|
paint.setStrokeWidth(newVisitor ? 6 * getResources().getDisplayMetrics().density : 2);
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
canvas.drawRect(target, paint);
|
canvas.drawRect(target, paint);
|
||||||
paint.setStyle(Paint.Style.FILL);
|
paint.setStyle(Paint.Style.FILL);
|
||||||
paint.setTextSize(17);
|
paint.setTextSize(17);
|
||||||
|
paint.setTypeface(newVisitor ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
|
||||||
float top = Math.max(y + 20, target.top);
|
float top = Math.max(y + 20, target.top);
|
||||||
paint.setColor(0xff0d212c);
|
paint.setColor(newVisitor ? 0xffff9f33 : 0xff0d212c);
|
||||||
canvas.drawRect(target.left, top - 20, target.left + paint.measureText(box.label) + 8, top + 2, paint);
|
float labelWidth = paint.measureText(label) + 8;
|
||||||
paint.setColor(Color.WHITE);
|
float labelLeft = Math.max(x, Math.min(target.left, x + width - labelWidth));
|
||||||
canvas.drawText(box.label, target.left + 3, top - 3, paint);
|
canvas.drawRect(labelLeft, top - 20, labelLeft + labelWidth, top + 2, paint);
|
||||||
|
paint.setColor(newVisitor ? 0xff201000 : Color.WHITE);
|
||||||
|
canvas.drawText(label, labelLeft + 3, top - 3, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ final class PersonTracker {
|
||||||
State state = State.DETECTED;
|
State state = State.DETECTED;
|
||||||
Box box, observed;
|
Box box, observed;
|
||||||
long lastSeen, confirmationStart, predictionTime, activeSince;
|
long lastSeen, confirmationStart, predictionTime, activeSince;
|
||||||
|
long newVisitorHighlightUntil;
|
||||||
int hits = 1;
|
int hits = 1;
|
||||||
boolean confirmed;
|
boolean confirmed;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue