lesingo

ADR-0007: Parallel native inference workers

Context

Physical-device profiling showed that a synchronous MediaPipe call constrained both useful detector throughput and the camera preview. The Samsung SM-M536B initially delivered about 10 preview frames per second while one CPU detector reported a 195 ms inference sample.

VisionCamera 5 can discard analyzer frames while busy, but a long synchronous native call still occupies its FrameOutput callback. MediaPipe GPU delegation was also tested with both int8 and float32 EfficientDet-Lite0 variants. On this device, the int8 graph rejected the GPU tensor path and the float32 graph did not complete reliably. Shipping that path would claim acceleration without a usable result.

Decision

For the performance-first Android slice:

Consequences

Positive

Negative and risks

Validation

On the Samsung SM-M536B running Android 14, the final debug configuration produced approximately 30 preview FPS and 29.8 to 30.2 detector FPS. Warm inference latency samples were 70 to 112 ms, process CPU ranged from about 324% to 339%, and resident memory ranged from about 529 to 533 MB. No fatal error appeared during the final run.

The same scene and debug build measured about 10 preview FPS and a 195 ms single-worker inference sample before this change.

References