Skip to main content

YOLO: deployment and quantization

Build a small, inspectable business application: detect the existing COCO person class, test each detection against a configurable image region, and write debounced occupancy events for a dashboard or an operator's review queue. The downloadable project includes source, configuration, two licensed input clips and tests.

This is the last stage of the continuous x86 toolchain → new model compilation and target comparison → board application walkthrough. It uses freshly compiled TI YOLOX-tiny-lite 8210, not the 8200/8220 models supplied with the image. No activation replacement or retraining is needed for this existing class; architecture and trained weights stay matched.

Demonstration, not a safety system

The warehouse footage is openly licensed third-party material, not a Mo62A customer deployment or an endorsement. The outlined region is illustrative, not a real restricted area. Detection misses are visible, particularly for small or occluded people. Neither a cleared event nor an empty detection list proves that an area is safe or empty. Do not connect this example to machinery or safety interlocks.

1. Finish the model acceptance steps​

Before continuing, complete the previous page's CPU check, 32-frame/three-iteration calibration, host TIDL check and eight-frame target comparison. The model uses 8-bit base quantization with selected 16-bit outputs; it is not an all-8-bit result.

The target comparison passed for both raw output tensors on all eight images. The provider reported one subgraph and 326/326 nodes offloaded. This describes the inference graph, not the whole application: decoding, resize/padding, coordinate restoration, zone rules, drawing and video writing still use the CPU in this implementation.

On the board, the transferred project contains:

mo62a-zone-demo/
bundle/ # original model, fresh artifacts, bundle.json
evaluation/ # eight exact PNG inputs and their manifest
host-images/ # x86 TIDL reference outputs
evaluation.mp4 # new warehouse input, not the first-NPU-demo video
model.py logic.py run_images.py run_video.py
inspect_bundle.py zone.json SOURCE.txt

Use the existing V1.1.0 development stack from the version map. The compatible combination includes host tools, target libraries and C7x firmware. Do not install the x86 requirements on the board or replace its TI ONNX Runtime with a generic wheel. Stop other inference applications before this test.

2. Check the input and configure the region​

In the board shell:

cd "$HOME/mo62a-zone-demo"
python3 -B inspect_bundle.py --bundle bundle
printf '%s %s\n' \
fba367bfad48335444a236123afde022c28dd7ed4dce9d9b1422179d295d49c5 \
evaluation.mp4 | sha256sum -c -
cat zone.json

The supplied configuration is:

{
"schema_version": 1,
"zone_id": "demo_aisle",
"polygon": [[0.62, 0.55], [0.74, 0.55], [0.74, 0.83], [0.62, 0.83]],
"score_threshold": 0.4,
"dwell_seconds": 0.5,
"clear_seconds": 0.5
}

Coordinates are normalized to the image: [0,0] is the upper left, [1,1] the lower right. Vertices must follow the perimeter of a strictly convex polygon. The application uses each person box's bottom-center point, including the boundary, to decide whether that detection is inside. This is an image-space approximation, not a calibrated floor-plane position.

A continuous detection inside for 0.5 seconds emits zone_occupied. Once occupied, 0.5 seconds without an inside detection emits zone_cleared. These intervals use source-video timestamps, not the slower processing wall clock. There is no person identity or tracking: multiple people can contribute to one zone interval.

The compiler's detection floor is 0.3. The application therefore accepts thresholds from 0.3 through 1.0; lowering a JSON threshold cannot recover boxes already discarded by compiled postprocessing. Raising the threshold may reduce false detections while increasing misses. For a new input, redraw the region and validate both detections and event behavior.

3. Run the full video on Mo62A​

The example is headless: it requires no HDMI, live camera, IMX219 initialization or display server. Use a new output directory for every run:

set -o pipefail
sudo python3 -B -u run_video.py \
--bundle bundle --video evaluation.mp4 --config zone.json \
--backend tidl \
--credit 'Video: domdomegg / Wikimedia Commons / CC BY 4.0 | Illustrative ROI; no endorsement' \
--output results-video-1 2>&1 | tee run-video-1.log

Keep SOURCE.txt with the input and any redistributed result. The program checks model/artifact integrity, writes per-frame records, saves actual event frames and prints a final summary. A successful run must report completed: true and all 611 frames; session creation alone is not success. Run only one inference instance at a time.

The recording below comes from this application's actual Mo62A output. It is a single video element with a poster, not a second static image layered over a recording. The MP4 was transcoded from the board's MJPEG output without changing its detections or event timing.

Playback is 30 fps because it preserves the source timeline. Processing was approximately 7.8 fps, not real-time 30 fps. The displayed inference-call milliseconds are only one part of that work.

Short animated event preview (source time 6–10 s, reduced to 8 fps):

A shortened animation of actual board output around the occupied and cleared events, not a live camera stream

4. Read the business outputs​

OutputPurpose
events.jsonlOne JSON object per occupied/cleared transition; suitable for ingestion by another application
events.csvThe same transitions for tabular review
frames.jsonlEvery processed frame's timestamp, detected people, region membership and state
summary.jsonCompletion/failure, versions, input hash, settings, timings and final state
annotated.aviBoard-rendered MJPEG video, requiring no hardware encoder
first-frame.jpg, event-0001.jpg, event-0002.jpgActual first/event-frame evidence for this run

Read the results on the board:

python3 -m json.tool results-video-1/summary.json
cat results-video-1/events.jsonl
cat results-video-1/events.csv

The repeated tests emitted zone_occupied at source time 7.367 s, after detection began at 6.867 s, and zone_cleared at 8.667 s. The recorded occupancy_duration_s is 1.3 s: last confirmed occupancy interval before the clear debounce, not time between emitted events. It does not measure a person's true time in a real-world zone.

Inspection of actual Mo62A full-video completion, processing speed and two occupancy events

The following is the actual cleared-event frame. A cleared state reflects the detector and configured rules, not proof that no person is present:

Actual Mo62A output at the cleared event with the illustrative region still visible and no claim of physical safety

For a dashboard, consume event records and attach the corresponding evidence frame for human review. Add your own delivery acknowledgement, duplicate handling, retention/access controls and health status before integration. The sample intentionally has no external alarm destination, cloud credentials or machine-control output.

End of file, decoder failure or application failure must be a separate offline/fault condition. They do not emit a synthetic cleared event. Check completed, the process exit status and last_zone_state; do not treat absence of new JSON lines as an empty area. A startup failure can exit before any summary exists, so a missing summary must also count as failure.

5. Retrieve and inspect the result​

On your host:

scp -r YOUR_USERNAME@BOARD_IP_ADDRESS:mo62a-zone-demo/results-video-1 .
scp YOUR_USERNAME@BOARD_IP_ADDRESS:mo62a-zone-demo/SOURCE.txt .

Open annotated.avi in a compatible player. For browser playback, transcode on the host without altering the source frame rate:

ffmpeg -n -i results-video-1/annotated.avi \
-c:v libx264 -crf 22 -pix_fmt yuv420p -movflags +faststart \
-an results-video-1.mp4

Inspect both event frames and the full sequence, including misses. Use the original input and timestamps to distinguish detector behavior from a business-rule mistake. A video that merely contains boxes does not establish accuracy.

6. Repeat and understand the measurements​

The example completed three consecutive full runs, each processing 611 frames with identical event timestamps and detections. The original installed YOLOX baseline was checked before and after; no firmware/package update or reboot was needed for these runs. This is a short repeatability test, not a multi-day endurance qualification.

The measured results and downloadable records are listed in Performance & benchmarks. The timed region covers OpenCV decoding, preprocessing, synchronous inference, zone rules, drawing and MJPEG/file output, but excludes session creation. No power measurement or labeled accuracy evaluation was performed. Do not convert inference latency alone into application FPS.

For your deployment:

  1. Use a fixed, suitable camera view and independently labeled representative data. The sample camera moves slightly, so its fixed image-space region is illustrative only.
  2. Measure missed/false detections and event precision/recall under occlusion, small-object scale, empty scenes and changing light.
  3. Compare floating-point and quantized outputs, then evaluate complete-model task metrics; numerical agreement alone is insufficient.
  4. Test interrupted streams, restart/recovery, storage limits, concurrent workloads and sustained operation. For live cameras, use actual capture timestamps and a separately tested decode/display pipeline.
  5. Train/export a matched model for classes it does not already know. This example does not detect defects, identify workers or establish PPE compliance.

Sources, licenses and TI guidance​

Both clips are by domdomegg under CC BY 4.0:

  • Loading docks 1, revision 929950166: evaluation/demo input; cropped to 1280 × 720 at x=0, y=300.
  • Loading docks 2, revision 929950182: calibration input; cropped to 1280 × 720 at x=100, y=250.

Both were converted to constant 30 fps H.264 with audio removed. Result media adds model detections, an illustrative region, timestamps and attribution; the preview is shortened and rescaled. Complete URLs, original/derived hashes and modification notes are in SOURCE.txt and sources.json. Preserve this attribution when sharing. Copyright permission does not automatically grant trademark, privacy or publicity rights; no affiliation, customer deployment or endorsement is claimed.

The AM62A model guide describes host import and model metadata. TI's YOLO E2E discussion discusses version-specific architecture/training requirements, not universal support for arbitrary exports. Our claims here are limited to the pinned model and measured Mo62A results.

Source: inhandnet/mo-docs · 7ba0dc46