Find out why your detector shows old frames
Separate capture delay, queueing, inference, transfer, and display before choosing an accelerator.
Opening the Python editor…
Requirements and learning goals
Before you start
- The Wendy starter project from the YOLO walkthrough
- A working inference pipeline with timestamps
You will be able to
- Measure end-to-end latency
- Report percentiles
- Avoid an ever-growing frame queue
The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?
Edge runs a trained model on a nearby device, such as a Jetson, instead of sending every input to a remote server. An accelerator is hardware that can speed up some model operations. This lesson helps you find the actual bottleneck before changing hardware, and check that a fast detector is acting on fresh images.
Declare the required GPU and device access, then inspect runtime evidence. Access to an accelerator does not prove the model uses it.
Measure observation age
Throughput counts completed work. measures how long one observation takes to become useful. A smooth camera feed can display detections from a second ago.
Give each frame an ID and capture time. Record preprocessing, queueing, inference, and consumption times. Use one monotonic clock for local intervals; cross-device timestamps need an explicit clock relationship.
Save this calculation as latency_summary.py beside detect.py in the starter project:
from statistics import median
from math import ceil
latencies = [31, 32, 30, 33, 35, 31, 34, 36, 90, 120]
ordered = sorted(latencies)
p95 = ordered[ceil(0.95 * len(ordered)) - 1]
print("median ms", median(ordered))
print("p95 ms", p95)Stop the previous attached run with Ctrl+C and run it on the same Wendy target:
wendy run --env LESSON_SCRIPT=latency_summary.pyExpect median ms 33.5 and p95 ms 120 in the Wendy logs and the results page's run.log. These are calculations over sample numbers, not measurements of your target. The starter uses CPU inference even on a GPU-equipped device.
Replace these illustrative numbers with at least a hundred measured frames. Report startup separately and repeat after sustained operation.
Bound the queue
If capture outpaces inference, an unlimited queue makes results progressively older. Live control often needs the newest waiting frame; archival processing may need every frame. State which policy you implement and count dropped frames.
Verify accelerator use through the runtime's selected backend and profiling. Hardware access alone does not prove acceleration. Wendy's GPU guide describes target-specific resource exposure. When timing asynchronous execution, synchronize or use runtime timing events.
Common snag: timing only the GPU submission call. Also include decoding, transfers, and delivery to the consumer.
The Go2 assistant separates display from perception and checks capture viewpoint. Optional extension: inject inference delay and verify that your controller rejects observations that have become too old.
Before you move on
Can you do each of these?
- Measure end-to-end latency
- Report percentiles
- Avoid an ever-growing frame queue
0 of 2 checkpoints solved. Try checkpoint 1