EVAx10_Video_analitics/ARCHITECTURE.md

3.2 KiB

Edge Vision v0.1 architecture

VideoSource emits immutable bitmap frames and camera metrics. Camera2 consumes latest YUV frames on its own looper, samples preview frames and rotates by the sensor orientation. It preserves the negotiated source resolution in metrics and downsamples the analysis image to at most 640 pixels wide. RTSP, USB and file sources can implement the same interface. The test-image source is available for deterministic local smoke tests.

InferenceEngine exposes providers, reusable model sessions, named tensor execution and runtime metrics. OrtEngine verifies manifest size and SHA-256, validates the ONNX session against declared input and outputs and profiles first-run node assignment. Accelerator selection and actual node placement are shown separately. The owner serializes all use and release of ORT sessions on one worker. A future RKNN implementation can implement this interface without camera or analytics changes.

Adapters convert pixels and decode outputs independently of the source. YuNet implements face detection. Two Cydral ONNX sessions produce the age distribution and classification probabilities independently. Adapter types are explicit in the model manifest. Compatible weights can be replaced independently after license review and a new build. A new tensor contract requires an adapter.

The worker admits at most one frame at a time. Busy, interval and preview-sampling skips are counted. Camera HAL losses are unavailable. The UI consumes the latest preview and normalized face boxes. Camera permission and lifecycle are owned by the separate native APK. Inference results from stopped generations are discarded.

NanoDet detects people. The body tracker assigns IDs using two-stage association of stronger and weaker boxes. Constant-velocity Kalman filters predict position and size, while IoU, center distance, scale, elapsed time, and one-to-one minimum-cost assignment govern matches. Track states progress through DETECTED, PENDING, ACTIVE, TEMPORARILY_LOST and CLOSED. Only the first transition into ACTIVE increments visits. Lost tracks retain their ID until the configured timeout, with motion extrapolation limited to 650 ms.

YuNet and Cydral run separately from tracking. Faces can be assigned only to the head region of an active person track; ambiguous overlaps are skipped. Per-track age uses a median of multiple observations, and the appearance estimate uses a voting threshold. Stats keep a single demographic contribution per visit. No facial embedding is generated. The aggregate buckets and total count persist privately on-device; track IDs, geometry, observations and the tracking log are session-local.

The dashboard reports current active and lost track counts, cumulative created/restored/closed counters, and average dwell from first to last observation for confirmed tracks. The live camera has no labelled reference, so ID Switches is N/A. Tracking latency includes person detector and geometric association, while total processing latency includes face analytics when scheduled.

Model selection, provider, interval, threads and confidence are kept in an independent session configuration. Digital DNA can map declarative fields to that configuration in a later version. The current APK has no network permission.