EVAx10_Video_analitics/VISITOR_TRACKING_REPORT.md

118 lines
5.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Visitor tracking verification
## Tracker and model
The tracker is implemented in Java, using the two-confidence-pass
association idea described in [ByteTrack](https://github.com/FoundationVision/ByteTrack)
(MIT). No tracker library or copied source is bundled. Matching uses
constant-velocity Kalman prediction of center and dimensions, IoU,
center distance, box scale, and minimum-cost one-to-one assignment.
A weak detection can extend a confirmed track. Only stronger detections
can start IDs.
NanoDet-Plus is sourced from the [pinned OpenCV Zoo model directory](https://github.com/opencv/opencv_zoo/blob/48b10fa505aeb51fbd127fc60a5c660040e823b7/models/object_detection_nanodet/README.md#license),
which explicitly covers the weights with Apache-2.0. The bundled graph
uses 256×256 instead of 416×416. Weight tensors were retained, while graph
shape constants and input declarations were adapted. Only COCO class
`person` is decoded. ONNX Runtime on the PC ran the exact approved tensor
contract before Android deployment.
On this RK3566, creating the NanoDet session with XNNPACK caused a native
ORT abort. NanoDet therefore runs on CPU. Existing face detector provider
selection is still available and Cydral runs on CPU. Tracking latency in
the dashboard includes body model inference and association. Total
processing also includes face analytics when scheduled.
## Labelled tracker scenarios
`tests/PersonTrackerTest.java` sends a sequence of labelled person boxes
to the production tracker and feeds its state changes to the production
aggregator. These tests isolate matching and counting from the camera
and detector. Head turn, look down, and covered face use weak body
detections to exercise independence from face visibility. This does not
measure the body detector's response to real poses.
Each numeric cell contains actual/expected. A loss is a transition to
TEMPORARILY_LOST. A switch is a changed track ID for the same ground-truth
person. A new visit after closing is labelled as a new ground-truth visit.
| Scenario | Visits | Losses | Restored | Closed | ID switches |
| --- | ---: | ---: | ---: | ---: | ---: |
| One person, stationary for five simulated minutes | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 |
| Head turn | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 |
| Looks down | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 |
| Face covered | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 |
| Moves across the frame | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 |
| Two people cross, one observation hidden | 2/2 | 1/1 | 1/1 | 0/0 | 0/0 |
| Occlusion for 2.8 s | 2/2 | 1/1 | 1/1 | 0/0 | 0/0 |
| Leaves for 5 s and returns nearby | 1/1 | 1/1 | 1/1 | 0/0 | 0/0 |
| Leaves permanently | 1/1 | 1/1 | 0/0 | 1/1 | 0/0 |
| New visit after timeout | 2/2 | 1/1 | 0/0 | 1/1 | 0/0 |
| Three simultaneous entries | 3/3 | 0/0 | 0/0 | 0/0 | 0/0 |
| Age/presentation estimate changes | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 |
Run with a Java 17 JDK:
```bash
mkdir -p build/tracker-tests
javac -encoding UTF-8 -d build/tracker-tests \
src/PersonTracker.java src/Motion.java src/VisitorAnalytics.java src/Audience.java \
tests/PersonTrackerTest.java
java -cp build/tracker-tests com.it_screen.edgevision.PersonTrackerTest
```
## Recovery limits
A lost track is eligible until its last observation ages out. Motion
extrapolation is capped at 650 ms. Beyond that point, overlap with
the last observation and proximity to the predicted center dominate.
Reappearance far from the previous route can start a second visit before
timeout. Another person entering almost the same place at that time can
inherit the lost ID. Prolonged overlapping paths can swap IDs or merge
detections. Lower FPS increases displacement between samples and makes
these failures more likely. No live ID-switch metric is available without
ground-truth annotation.
Use the live journal to see which track changed state and whether Total
changed. For controlled field verification, record starting/ending
`Total visits`, event counts, and manually label expected IDs for the
scenarios above. Do not mix real-camera observations with simulated ID
switch results.
## Physical RK3566 run
Installed and verified APK **0.3.0** on the Android 13 RK3566 tablet.
Used the internal camera at 640×480 with two inference threads, a
5 FPS tracking target and a 500 ms face interval. NanoDet was on CPU.
YuNet used XNNPACK with CPU fallback. Both Cydral sessions also ran.
The 288 exported measurements cover app uptime 3–325 s. The device
created **one track** and kept Total visits at **9** throughout the sampled
interval, including **23 losses and 23 restorations**. Zero tracks closed
and zero runtime errors were recorded. Final dwell was **322.57 s**.
Ground-truth identity and individual pose actions were not annotated on
the live camera, so ID switches and pose-specific hardware outcomes are
unmeasured. The controlled outcomes in the previous table are from the
labelled tracker tests.
| Metric | Minimum | Median | Maximum |
| --- | ---: | ---: | ---: |
| Tracking FPS | 3.6 | 4.8 | 5.6 |
| Person detector + tracking | 110.2 ms | 118.5 ms | 169.0 ms |
| Full processing | 111.9 ms | 186.4 ms | 269.2 ms |
| Process PSS | 117.4 MiB | 141.9 MiB | 174.6 MiB |
The first FPS window can overshoot the steady-state target. Later frames
can take longer when face analytics and demographic inference are due.
Android thermal status was 0 at the sampled end of the run. The SoC
thermal zone read 75 °C near the end.
Raw aggregate measurements are in
[JSON](benchmarks/person-tracker-rk3566.json) and
[CSV](benchmarks/person-tracker-rk3566.csv). The installed APK SHA-256
matched the local artifact.
```text
998c664e6f3e8c6663b6e9563f2dd3f6211eb1a639b36cb106784e872c2677f5
```