DEV Community

Cover image for What Edge AI Models Can ESP32-P4 Actually Run? From ESP-DL Support to Real-Time Vision Validation

What Edge AI Models Can ESP32-P4 Actually Run? From ESP-DL Support to Real-Time Vision Validation

ZedIoT on November 12, 2026

An ESP-DL model listing may say "ESP32-P4 supported," but that does not answer the question a camera product has to answer: will a result arrive wh...
Collapse
 
crtdrops profile image
Israel Negrete Lepe •

The split between "supported", "loads", "fast once" and "fast enough with the camera, display and network running" is the right one, and it's rare to see a post say outright that it isn't claiming FPS for devices it hasn't tested.

I'd add two checks to the measured path. They're about method, not about the P4, which I haven't measured. First, report the distribution, not the mean. On a Raspberry Pi 5, a much bigger device, so only the method carries over, YOLO26n with half an hour on one process plus half an hour on four gave an average of 347 ms, and not one inference landed between 268 and 397 ms. The mean described a frame that never happened. Second, run it long enough to get hot: a short test can pass on a board that only starts slowing down after ten minutes.

For the entrance-device case, which number would you use to decide "the result is still useful": the p95 of the full path, or the time from someone appearing to the display waking up?

Collapse
 
zediot profile image
ZedIoT •

The 347 ms mean with nothing between 268 and 397 ms is the most useful number in this thread, and it makes the point better than any argument: you were reporting the latency of a frame that never occurred. That is the same failure mode as quoting a single peak RSS, just in the time domain.

On the method additions, I'd take both and add a third. Distributions first, absolutely, but report them per stage rather than only end-to-end, because the camera-to-inference slice and the inference-to-display slice have different tail shapes. A p95 that lives in capture tells you to fix exposure or the queue, while one that lives in inference tells you to shrink the model. Reporting only the full-path p95 hides which of the two you bought. Second, running long enough to get hot is the check most people skip, and it's the one that separates a number from a spec. I'd go further and say pick the duration from the deployment, not from the test: a device that runs eight hours a day needs an eight-hour soak at the target ambient temperature, and the interesting output is the drift between the first ten minutes and the last ten.

Third, and this is specific to the P4 class of parts: record whether the board was doing anything else. With a single camera and no display, the CPU has slack; add a display refresh and a network upload and the same model gets a different p95 without a single line of model code changing.

On your question, I'd use neither alone, because they answer different questions and the product fails on the second one. The p95 of the full path is the number for capacity planning and for regression testing across firmware revisions. The time from a person appearing to the display waking up is the number that decides whether the result is still useful, and it will always be worse than the p95 because it includes the detector's own confirmation and the display's refresh interval. My rule is to set the acceptance threshold on the wake-to-visible number and then use the p95 as the instrument I track to see if I am drifting toward it. If the wake-to-visible time is the one you gate on, you can't accidentally ship a build that passes tests while feeling slow to the person standing at the door.

One caveat worth stating, since you flagged that no inference landed in that 268-397 ms gap: a 60-point sample is enough to show the mean is a poor summary, but it isn't enough to trust a p95. If you want a tail number, sample at least a few hundred runs, or say "the distribution was bimodal" and leave the tail claim out.

Collapse
 
crtdrops profile image
Israel Negrete Lepe •

Per-stage distributions are the better version of my first check: an end-to-end p95 can't tell you whether to fix the queue or shrink the model. Gating on wake-to-visible and tracking the p95 as the instrument is a rule I'll borrow.

One correction on the sample, since your caveat depends on it: it wasn't 60 points. The Pi run had 25,898 inferences, 13,813 with one process and 12,085 with four, and every one was kept. The empty gap between 268 and 397 ms is in that full set. Your caveat still holds at the extremes, though: with one process the p99 was 137.7 ms and the maximum 267.9, and only 51 inferences went past 150 ms, so the far tail rests on few points.

Thread Thread
 
zediot profile image
ZedIoT •

Fair correction, and the 25,898 inferences matter more than the number I was arguing about. My "60 points" was inferred from the gap being described as empty, not measured by me, so I'll take your figure.

What changes with your numbers is the shape of the caveat, not its existence. With 12,085 inferences at one process and a p99 of 137.7 ms against a max of 267.9, the body of the distribution is well established and the far tail is not: 51 samples past 150 ms in 12,085 is 0.4%, which means the p99.9 lives on roughly 12 points. So the honest claim is that the median and p95 are solid, the p99 is indicative, and anything past the max you measured is unmeasured rather than impossible. That is a narrower claim than "the tail rests on few points", and it is also more useful, because it tells a reader exactly which percentile they can plan against.

The four-process run is the more interesting one. 13,813 versus 12,085 is only a 14% throughput gain for 4x the processes, and if the per-inference latency still spread the same way, the contention cost is being paid in the tail rather than the mean. That is the same conclusion this article reaches about the P4 camera pipeline: adding parallel work does not shrink the queue, it relocates it. If you still have the raw run, the p95-to-max ratio for one process versus four would settle it in a single number.

On per-stage reporting, one practical note from our side. On the P4 we could only get clean per-stage numbers by timestamping at three points (CSI frame-ready, inference done, DSI vsync) and accepting that the camera timestamp has its own jitter. If your Pi harness timestamps only at the API boundary, the stage split will look tighter than the hardware actually is.

Thread Thread
 
crtdrops profile image
Israel Negrete Lepe •

Small fix first: the counts are the other way around. 13,813 is one process and 12,085 is four, and both phases ran 30 minutes, so four processes didn't gain throughput, they lost it: 7.68 inferences per second with one, 6.72 with four.

The ratio you asked for, from the raw run: max over p95 is 1.98 with one process (135.2 to 267.9 ms) and 1.15 with four (608.3 to 702.3 ms). The p99.9 is 167.7 and 662.1. So on this Pi the contention was paid in the body, not the tail: every inference took about 4.6 times longer, and the distribution got relatively tighter. The one-process run is the one with the loose tail.

On timestamps, your warning applies in full: these numbers are inference only, with random input. No camera and no display, so there is no stage split to look tighter; there is only one stage. Your three points (frame-ready, inference done, vsync) are what it would take to say anything about the whole system.

Thread Thread
 
zediot profile image
ZedIoT •

Thanks for the correction, and the direction matters: I had read 13,813 as the four-process run, which made 4x processes look like a 14% win. With one process at 7.68 inf/s and four at 6.72 inf/s, four processes actually lose 12.5% of throughput while every inference gets ~4.6x slower. That is a much stronger result than the one I was building on, and it changes what the Pi is telling you: this is not a tail-latency problem, it is a serialization problem. Four processes on a Pi sharing one memory bus and one set of cores are not adding capacity, they are adding context switches and cache pressure to the same budget.

The max-over-p95 ratio is the cleanest number in the thread. 1.98 for one process versus 1.15 for four says the one-process run has the loose tail and the four-process run is comparatively tight around a much worse center. For planning that is the opposite of what people usually assume: concurrency bought predictability at the cost of the body. If you are sizing a system, the one-process configuration is the one where a p95 budget can still be blown by a single bad inference, and the four-process configuration is the one where you already blew it on every inference. Neither is a tail story.

What I would want next, if the harness is already there: the p50 and p95 for each configuration, not just max and p99.9. With p95 of 135.2 ms and max 267.9 ms on one process, the ratio is 1.98, but p99.9 at 167.7 ms sits close to p95, which suggests the tail is thin and a handful of outliers do all the work. If p50 is around 120 ms, then one process has a ~2x spread between typical and worst, and that is a configuration you can still defend. Four processes at p95 608.3 ms and p99.9 662.1 ms has almost no spread at all, which usually means a hard constraint, not contention noise: something is scheduling at a fixed interval and everything is queuing behind it.

On timestamps, we agree completely, and your framing is the right one. Inference-only with random input is one stage, and a one-stage number cannot say anything about a camera-to-display budget. The reason we bother with the three-point split on the P4 is not precision for its own sake: it is that the camera timestamp and the vsync timestamp fail in different ways (dropped frames versus missed deadlines), and an end-to-end number hides which one you are paying for. On a Pi with no camera and no display, there is nothing to hide, so the single-stage number is honest as long as it is labeled that way, which yours is.

If you do run the camera path later, the thing worth measuring is not the mean but the gap between inference-done and vsync on each frame. That gap is where the pipeline either has headroom or does not, and it is the number that decides whether a second model fits.