Raspberry Pi 5 CPU Usage: Offloading AI Preprocessing to the GPU
Raspberry Pi 5 CPU usage with a Sixfab AI HAT+: GPU preprocessing cuts the preprocessing stage's CPU by 79-98%. Measured on a live camera, with full method.
Moving camera preprocessing from the CPU to the GPU removes most of the preprocessing stage's CPU use in a DEEPX camera pipeline for edge AI on Raspberry Pi 5. We measured it on a live camera: Raspberry Pi 5 CPU usage for the preprocessing stage falls by 83% (11.1% to 1.9% of one core at 1080p30, NV12 input). With a DEEPX DX-M1 NPU on a Sixfab AI HAT+ doing the inference, whole-system CPU falls 54% when preprocessing is the only work (4.3% to 2.0%) and 14% to 18% in the full pipeline, depending on the dxinfer use-ort setting. A second contribution, an optimized postprocess decoder, lowers the 720p detections-only pipeline's CPU by a further 15% to 34% depending on the scene, but only with use-ort=false. With the default use-ort=true it makes no measurable difference. This post gives the numbers, the method, what we got wrong along the way, and how to measure it on your own setup.
TL;DR (updated 1 Dec 2026)
- GPU preprocessing cuts the preprocessing stage's CPU by 79-83% with NV12 camera input and 98% with RGB888 (1080p30).
- Detections only at 720p30: about 17% CPU with DX-STREAM's default settings, 10.7% with
use-ort=falseand our postprocess library.- Our postprocess optimizations save a further 15-34%, but only with
use-ort=false.- DX-STREAM used 65% less CPU than dx_app with detections only (
use-ort=false).- H.264 recording, not inference, is the biggest cost: about +44 points of CPU.
What did we measure?
We tested a Raspberry Pi 5 with a Sixfab AI HAT+, which carries a DEEPX DX-M1 NPU (M.2 form factor; DX-RT reports it as variant M1M), pointed at a live camera and running a YOLO26n object detection pipeline. Each sample was taken once per second; warm-up and measurement windows differ by test (8 to 30 s warm-up, 30 s to 4 min windows) and are listed in the methodology.
| Item | Value |
|---|---|
| Board | Raspberry Pi 5 Model B Rev 1.0, 8 GB |
| AI accelerator | Sixfab AI HAT+ with a DEEPX DX-M1 NPU (reported by DX-RT as M1M), M.2, 3 NPU cores |
| PCIe link | Gen3 x1 (Raspberry Pi 5 defaults to Gen2; the AI HAT+ quickstart setup enables Gen3) |
| Camera | Raspberry Pi Camera Module 3 Wide (imx708), libcamera 0.8.0, NV12 dma-buf, 30 fps |
| OS / kernel | Raspberry Pi OS based on Debian 13 (trixie), kernel 6.18.50+rpt-rpi-2712 |
| DEEPX software | DX-AllSuite v2.5.0: DX-RT 3.5.0, NPU driver 2.7.0, firmware 2.7.6, DX-STREAM 3.2.0 |
| Model | YOLO26n, 640x640 input |
| Pipeline | GStreamer 1.26.2: camera, dxpreprocess, dxinfer, dxpostprocess |
dxinfer use-ort | false in all 13-14 Nov runs; both settings in the 18 Nov matrix |
| Python | 3.13 (Debian 13 system Python) |
| CPU governor | ondemand (unchanged) |
| Cooling | Passive AI HAT+ cooler; no CPU throttling during the runs |
| Power supply | Official Raspberry Pi power supply |
| Storage | microSD card |
How much CPU does a camera AI pipeline use on Raspberry Pi 5?
With detections only at 720p and 30 fps, DX-STREAM uses about 17% of the CPU (the mean of the four cores) with its default settings and GPU preprocessing. With dxinfer use-ort=false and our postprocess library it uses 10.7%, about 0.36 of one core for the pipeline plus a small amount for the DX-RT service. The NPU runs at 8.8% utilization, so most of its capacity is free.
| Configuration (720p, live camera) | Runs | CPU, 4-core mean | Application, % of one core | NPU |
|---|---|---|---|---|
| Idle desktop | 1 | 1.0% | n/a | 0% |
DX-STREAM, detections only, default use-ort=true, our library (18 Nov session) | 3 | 16.9 ± 0.1% | not logged | not logged |
DX-STREAM, detections only, default use-ort=true, DX-STREAM's library (18 Nov session) | 3 | 17.2 ± 0.3% | not logged | not logged |
| DX-STREAM, detections only, GPU preprocessing | 2 | 10.7 ± 0.1% | 36 | 8.8% |
| DX-STREAM, detections only, CPU preprocessing | 2 | 11.5 ± 0.1% | 39 | 8.8% |
| DX-STREAM, detections only, default postprocess library | 1 | 15.9% | 56 | 8.8% |
| DX-STREAM, detections only, 1080p camera | 1 | 12.2% | 41 | 8.8% |
| dx_app, detections only | 2 | 30.8 ± 0.0% | 115 | 8.8% |
| DX-STREAM + H.264 recording | 2 | 55.6 ± 0.8% | 214 | 8.8% |
| DX-STREAM + H.264 recording, default postprocess library | 1 | 63.4% | 244 | 8.8% |
| dx_app + H.264 recording | 2 | 73.5 ± 0.5% | 283 | 8.8% |
Apart from the two 18 Nov rows, all DX-STREAM rows ran with use-ort=false, GPU preprocessing and our postprocess optimizations unless the row says otherwise. The 18 Nov rows come from a later session, so compare them with each other rather than with the other rows. The three recording rows ran within one 12-minute window, because recording CPU depends on how much detail the camera sees (see the methodology). Detections-only CPU did not drift within the session: DX-STREAM read 10.7% in the recorded runs at 18:05 and 10.8% in runs with our headless benchmark tool about an hour later (30 s windows). The standard deviation for the multi-run rows in this table was 0.8 points or less. The 1.0% idle figure includes the measurement tool itself. The four detections-only DX-STREAM camera runs with the optimized library printed zero detections (the other runs did not log them), while the dx_app detections-only runs printed about 6,760 detection lines each with this model export, roughly five per frame, on the same scene (see below).
Does GPU preprocessing reduce CPU usage on Raspberry Pi 5?
Yes. Offloading preprocessing to the GPU through DX-STREAM's GLES backend cut the preprocessing thread from 11.1% to 1.9% of one core (-83%) and the whole-system CPU load by 54% when preprocessing is the only work. In the full pipeline at 1080p30 it cut whole-system CPU by 18.3% with use-ort=false and our postprocess optimizations, 12.6% with the default postprocess library, and 14% with the default use-ort=true (18 Nov re-test). The test used a live camera and the CPU path (libyuv) as the baseline.
Metric (1080p30 live camera, NV12 input, use-ort=false) | CPU (libyuv) | GPU (GLES) | Change |
|---|---|---|---|
| Preprocessing thread, % of one core (3 runs each) | 11.12 ± 0.14 | 1.89 ± 0.11 | -83% |
| Whole-system CPU, preprocessing only (4-core mean) | 4.28% | 1.97% | -54% |
| Process CPU, preprocessing only, % of one core | 14.1 | 5.1 | -64% |
| Preprocessing thread, full pipeline | 11.15 ± 0.12 | 2.32 ± 0.06 | -79% |
| Whole-system CPU, full pipeline, default postprocess (3 runs each) | 19.77 ± 0.35% | 17.29 ± 0.45% | -12.6% |
| Whole-system CPU, full pipeline, optimized postprocess (2 runs of 4 min each) | 14.87% | 12.15% | -18.3% |
| Application, % of one core, optimized postprocess | 52 | 41 | -21% |
GPU clock (v3d) | 0 MHz | 960 MHz | GPU in use |
Four things to know before you rely on this:
- The saving is a fixed amount of work. It is about 2.3 to 2.9 points of the four-core total (about 9 to 12 points of one core) at 1080p30. It is 54% of a light workload and 12.6% to 18% of a full one, because inference handling, postprocessing and the DX-RT runtime still run on the CPU.
- It shrinks at lower resolution. At 720p30 the preprocessing thread falls from 4.7% to 2.4% of one core, and whole-system CPU from 11.5% to 10.7% (-0.8 points, -7%). The CPU ran at a slightly higher mean clock in the GPU runs (2.01 vs 1.94 GHz), which makes the true saving smaller, roughly half a point. The GPU matters most for high resolutions and frame rates.
- GLES only works on camera frames that arrive as dma-buf.
libcamerasrcprovides them. A video file decoded to system memory falls back to the CPU path for every frame, so file-based tests show no difference. - The GPU wait costs no CPU. Preprocessing takes 2.4 ms of wall time per frame on the GPU path (3.7 ms on the CPU path) at 1080p, but only about 0.77 ms of that is CPU time. The rest is the thread sleeping while the GPU finishes.
Does the camera input format matter? NV12 vs RGB888
Yes. The software (non-GPU) preprocessing path in DX-STREAM picks its library by input format: NV12 goes through libyuv, while 3-channel RGB888/BGR888 goes through OpenCV. That is why the size of the saving depends on the format: libyuv on NV12 is already cheap (the process-level comparison in the table above reads 14.1% to 5.1%, -64%), while the OpenCV path on RGB888 costs several times more, as the 18 Nov measurements below show.
To reproduce the picture on our hardware we re-ran the GPU/CPU comparison on 18 Nov with both camera formats (full pipeline, our postprocess library, use-ort=true, 3 runs per cell in alternating order, 10 s warm-up + 30 s window). The preprocessing stage's threads are the streaming thread of the queue in front of dxpreprocess plus any worker threads it spawns (100% = one core); whole system is the 4-core mean:
| Camera input, 1080p30 | Software path | GPU path (GLES) | Thread change | Whole system: software -> GPU |
|---|---|---|---|---|
| NV12 (libyuv / GLES) | 18.9 ± 0.3% | 4.0 ± 0.1% | -79% | 20.2% -> 17.3% |
| RGB888 (OpenCV / GLES) | 196.5 ± 0.3% | 3.5 ± 0.1% | -98% | 64.0% -> 16.9% |
All six cells held 30.0 fps with no dropped frames. Three things stand out:
- libyuv on NV12 is already cheap (one thread at ~19% of a core); OpenCV on RGB888 at 30 fps is not: on our run it spread over four threads at ~49% each, about two whole cores. The OpenCV build parallelizes the resize; our measurements count all the threads it uses.
- The GPU path does not care about the input format: 3.5-4.0% of one core for NV12 or RGB888, with the v3d clock at 960 MHz during GPU cells and 0 during software cells.
- The earlier rows in this post are NV12 runs, so their 54% / 83% / 18.3% savings are the NV12 case; the -98% figure belongs to RGB888 input.
Can the postprocess stage use less CPU, and what does NMS cost?
Yes, on the raw-tensor path. We built on the postprocess library that ships with DX-STREAM and added optimizations. One scoping note first, from the 18 Nov re-test described below: every number in this section was measured with dxinfer use-ort=false, the raw-tensor path where the library decodes the NPU output itself. In the default configuration (use-ort=true) ONNX Runtime does that decoding and only the NMS part of our library still applies. On the raw-tensor path the optimizations cut the dxpostprocess thread from 26.8% to 4.5% of one core (-83%) and the whole-system CPU from 16.3% to 10.8% (-34%) at 720p30 with detections only. With NMS off the optimized decoder matches a re-implementation of the default decoder on synthetic test frames, and with NMS on (the default) it returns fewer boxes. The camera scene had no detections, which is the best case for the saving: the default decoder calls the exponential for every logit whatever the scene, and the optimized one only for the few that pass the threshold.
On a busy scene (a dog video, which adds video decoding to the base) the saving is 4.1 points (-15%) with NMS on, against 5.5 points on the empty scene. These busy-scene runs come from the 14 Nov set, which ran the variants in a fixed order. The default-library figure comes from three runs with a 4-point range; without the highest run (29.2%) the saving would be about 3 points (-12%). The same set also had an NMS-off run of our library (21.68%), but its 1.19-point gap to the NMS-on runs is the fixed-order difference that the alternating re-test later showed to be drift (see the NMS section), so we do not report a separate NMS-off saving. Part of the saving does not depend on the scene: the optimized decoder still compares all 672,000 logits per frame, but it avoids the exponential for all but the passing cells.
Metric (use-ort=false; 720p30 camera unless the row says otherwise; GPU preprocessing unless the row says otherwise) | Default library | With our optimizations | Change |
|---|---|---|---|
dxpostprocess thread, % of one core | 26.8 | 4.5 | -83% |
| Whole-system CPU, empty camera scene, headless benchmark tool, 3 runs each | 16.32 ± 0.44% | 10.84 ± 0.59% | -34% |
| Whole-system CPU, busy scene (dog video file, CPU preprocessing, 3 runs each, fixed order), with NMS on | 26.98 ± 2.04% | 22.87 ± 0.86% | -15% (4.1 points) |
| Application, % of one core | 58 | 37 | -37% |
Decoding time per frame, offline test (original decoder re-implemented, -O2, one core, synthetic mostly-background frame) | 7.2 ms | 1.13 ms | -84% |
The default decoder calls std::exp about 672,000 times per frame (80 classes at 8,400 grid cells) to turn class logits into probabilities. Our optimization uses the fact that the sigmoid is monotonic: it finds the best class on the raw logits and applies the exponential only to the few cells that pass the confidence threshold. With NMS off, it matched our re-implementation of the original decoder on 50 random test frames. Build type matters: an early build of ours had no compiler optimization and, in one run we did not keep, used 97% of one core in the full pipeline instead of 37%.
Does use-ort decide whether the postprocess optimization runs?
use-ort decide whether the postprocess optimization runs?Yes, and we missed it in our first reporting. The official yolo26-n_640x640.dxnn model from DX-STREAM's setup.sh has two tasks: npu_0 [NPU] -> cpu_0 [CPU, ONNX Runtime] -> output0. The dxinfer property use-ort (default true, the setting in DX-STREAM's own run_rpi_camera_yolo26n.sh pipeline) controls whether DX-RT runs that CPU task:
use-ort=true: the library receives one already-decoded tensor[1,N,6]and takes a cheap single-tensor path. Our decoder optimization is not executed at all; the original and our library behave the same, and only the added NMS still applies.use-ort=false: the CPU task is skipped, the library receives the six raw tensors and decodes them itself - this is the only configuration where the decoder optimization has an effect.
We ran the full 2x2 matrix on 18 Nov (live camera 720p, GPU preprocessing, 3 runs per cell, cell order rotated every repetition, whole-system CPU, 4-core mean; every cell held 30.0 fps with no dropped frames):
| Postprocess library | use-ort=true (default) | use-ort=false |
|---|---|---|
| DX-STREAM original | 17.23 ± 0.26% | 16.49 ± 0.34% |
| Ours (NMS 0.5) | 16.92 ± 0.10% | 11.05 ± 0.49% |
On the default path the difference between the libraries is 0.31 points, at the noise level. On the raw-tensor path the optimized decoder saves 5.4 points (-33%). Our earlier runs (including all the -12% to -34% postprocess figures elsewhere in this post, the 10.7% detections-only figure and the dx_app comparison) had use-ort=false hard-coded in their pipelines, so read them as raw-tensor-path results. A second set of runs from 17 Nov agrees: 16.98 ± 0.47% vs 11.11 ± 0.13% with use-ort=false, 17.57 vs 17.55% with use-ort=true.
How many overlapping boxes does the model return, and what does NMS cost?
The YOLO26n export we used returns several overlapping candidate boxes per object, and the decoder we started from has no NMS step. On the DEEPX sample dog video (300 frames) the decoder produced 8,745 boxes, 29 per frame. With class-wise NMS (IoU 0.5) it produced 1,088, 3.6 per frame (-88%).
This is consistent with how YOLO26 is built. Ultralytics trains it with two heads, a one-to-many head and a one-to-one head; the default export gives the raw one-to-many outputs and leaves NMS to the consumer, while an export with nms=False gives the NMS-free one-to-one outputs (Ultralytics: end-to-end detection in YOLO26). The 29 boxes per frame suggest the six raw tensors here come from the one-to-many head. The older model-zoo file we also tried has one extra output (TopK_output_0) that this export does not, which points to an end-to-end export. We have not confirmed how either file was exported. If you compile your own model, a one-to-one (nms=False) export may make the NMS step unnecessary; we did not test that.
We could not measure a reliable NMS cost. The whole-system difference is small, and the pipeline process itself did not use measurably more CPU (87.7% vs 87.8% of one core on the dog video, 37.8% vs 38.6% on the camera). Our first NMS table (14 Nov) ran every variant in a fixed order, so drift could have crept in; we replaced it with alternating-order re-runs on the default path (use-ort=true, so the single-tensor path, the configuration most people will use):
| NMS off vs on (IoU 0.5), optimized library, 30 s runs, order alternates | NMS off | NMS on | Change |
|---|---|---|---|
| Live camera 720p, 18 Nov, 4 runs each, whole-system CPU | 17.05 ± 0.22% | 17.00 ± 0.25% | -0.05 points, within noise |
| Dog video (CPU preprocessing), 17 Nov, 3 runs each, whole-system CPU | 26.68 ± 0.23% | 26.60 ± 0.85% | -0.08 points, within noise |
| Dog video, same window: DX-STREAM original library for reference | 27.74 ± 0.78% (no NMS) | - | ours is ~1 point lower with or without NMS |
On the default path NMS costs nothing measurable, busy scene or empty scene. The old fixed-order numbers (+1.19 points on the dog video, +0.34 on the camera) did not survive the alternating-order re-runs and should be read as drift. Two limits apply. First, the re-runs used the default path, where the library receives an already-decoded tensor; the 29-boxes-per-frame figure comes from the raw-tensor path, and we have not re-measured NMS there with alternating order. Second, the ~1-point gap to the original library on the dog video is larger than the 0.31 points the camera matrix shows for the same path, and we have not explained it; it is within about 1.5 standard deviations of the original library's runs.
The dog-video baseline is higher because the run includes decoding the video, played as one long looped clip, and a video file always takes the CPU preprocessing path. We looked at the annotated output for the dog and person videos: the classes are right (dog, person, tie) and most objects get one box. NMS has a known weakness, which we also saw: where same-class objects overlap heavily, such as three dogs in one frame, they can merge into one box, and a smaller dog was missed in one frame we inspected. A higher IoU threshold (0.7 instead of 0.5) keeps more neighboring boxes. We did not measure detection accuracy.
Is DX-STREAM more CPU-efficient than dx_app?
On this camera and model, yes: with detections only DX-STREAM used 10.7% CPU against 30.8% for dx_app (-65%), and with H.264 recording 55.6% against 73.5% (-24%). These DX-STREAM figures were measured with use-ort=false. Part of the gap comes from the postprocess optimizations: with the default postprocess library DX-STREAM used 15.9% (-48%) and 63.4% with recording (-14%). With DX-STREAM's default use-ort=true, detections only measured about 17% in the 18 Nov session, which would put the gap near 45%; that session did not include dx_app, so treat this as an estimate. The recording rows were measured in the same 12-minute window; the detections-only rows about 40 minutes apart, which does not matter because detections-only CPU stayed within 0.2 points across the session.
720p30, live camera, DX-STREAM with use-ort=false | DX-STREAM | dx_app | Difference |
|---|---|---|---|
| Detections only | 10.7 ± 0.1% | 30.8 ± 0.0% | -65% |
| H.264 recording | 55.6 ± 0.8% | 73.5 ± 0.5% | -24% |
The difference comes from how frames reach the model. dx_app opens the camera through OpenCV and converts NV12 to BGR on the CPU. DX-STREAM hands the NV12 frame to the preprocessing stage directly, and the GPU does the resize and color conversion.
Choose DX-STREAM if you want the lowest CPU load, a GStreamer pipeline you can extend with other elements, and zero-copy camera input. Choose dx_app if you want readable per-model application code in C++ or Python and the simplest path to a working demo. One caveat applies to our comparison: the YOLO26n export we used did not give compatible output with dx_app, while the older YOLO26n file from the DEEPX model zoo worked correctly with it. DX-STREAM returned correct classes with both. In the detections-only runs dx_app printed about 6,760 detection lines each with this export (roughly five per frame), while DX-STREAM, looking at the same scene, printed none. dx_app therefore spent some CPU decoding and printing detections that DX-STREAM did not produce. So the CPU comparison is "same model, same camera", not "two apps that did the same work and both returned correct results".
What costs the most CPU: inference, preprocessing or video encoding?
Video encoding costs the most. With H.264 recording at 720p, x264 used about 110 to 125% of one core and the color conversion before it about 60%. Inference itself is mostly on the NPU. On the default use-ort=true path, the model's ONNX Runtime CPU task is the largest non-encoding cost: it puts whole-system CPU about 6 points above the raw-tensor path with our decoder (16.92% vs 11.05% in the 18 Nov matrix).
For the detections-only pipeline (720p, GPU preprocessing, optimized postprocess, use-ort=false), the application used about 36% of one core, spread like this:
| Component | % of one core |
|---|---|
| DX-RT worker threads | 22.4 |
| libcamera (camera manager, IPA, push thread) | 5.6 |
dxpostprocess (turns raw NPU output into boxes) | 4.5 |
dxpreprocess (GPU path) | 2.4 |
Does writing the video to disk matter?
Not at the bitrate we recorded. The video grew by 35 to 45 KB per second (about 0.3 Mbit/s, because the scene was mostly static), and changing only the destination changed nothing:
| 720p, H.264 recording | CPU, 4-core mean |
|---|---|
| DX-STREAM, encode and write to disk | 54.6 ± 0.6% (2 runs) |
| DX-STREAM, encode and discard (no disk write) | 54.2% (1 run) |
| DX-STREAM, OSD element in the pipeline, no encoding (no boxes in the scene) | 10.7% (1 run) |
| DX-STREAM, detections only, no drawing | 10.7 ± 0.1% (2 runs) |
| dx_app, encode and write to disk | 73.5 ± 0.5% (2 runs) |
| dx_app, encode and write to RAM (tmpfs) | 73.0% (1 run) |
| dx_app, no saving | 30.6% (1 run) |
The DX-STREAM rows in this table come from the same earlier window, so compare them with each other and not with the 55.6% row. A busy scene produces a much higher bitrate, so check disk writes again if your scene has a lot of motion or detail. We could not measure the cost of drawing boxes, because there were no boxes in the scene. If you need to reduce CPU, reduce encoding: a faster x264 preset, a lower resolution or frame rate, or no video. Raspberry Pi 5 has no hardware H.264 encoder, so encoding runs on the CPU. At 1080p our recording pipeline also hit a single-thread limit in the color conversion stage and the saved video dropped to about 22 fps (1,256 frames in 56.5 s).
How can you measure it on your own setup?
Every number in this post comes from standard Linux sources, so you can measure the same things with standard tools:
- Set up the AI HAT+ with the AI HAT+ quickstart (DX-RT 3.5.0, DX-STREAM 3.2.0) and run DX-STREAM's own
run_rpi_camera_yolo26n.shcamera pipeline. It usesuse-ort=trueand DX-STREAM's postprocess library, the configuration behind the "about 17%" figure. - Whole-system CPU: run
mpstat 1(from thesysstatpackage). 100 minus%idleon theallrow is the 4-core mean used in this post. Let the pipeline warm up for about 10 s, then average 30 s or more. - Per-thread CPU: run
pidstat -t -p <pid> 1on the pipeline process. A GStreamer element runs in the streaming thread of the queue in front of it, so the preprocessing cost is that queue's thread. - NPU utilization:
dxtop. - GPU in use:
vcgencmd measure_clock v3dreads about 960 MHz while GLES preprocessing runs and 0 when it does not. - To compare variants, switch
dxpreprocessbetween its GPU and CPU paths (see DX-STREAM's documentation for the element's properties) and setuse-ort=falseondxinferfor the raw-tensor path.
What to expect with DX-STREAM's default settings and GPU preprocessing: about 17% whole-system CPU at 30.0 fps at 720p30; at 1080p30 with NV12 input, about 17% with GPU preprocessing and about 20% with CPU preprocessing. Test GPU preprocessing on a live camera: a video file decoded to system memory always takes the CPU path.
What is the methodology?
- Hardware and software: as listed in the first table. The DX-STREAM plugins were built on a second Raspberry Pi 5 with the same OS and architecture and copied over (the bundle's SHA-256 matched on both ends), so they are not the packaged binaries.
- Measurement sources:
/proc/statfor system CPU,/proc/<pid>/statfor per-process and per-thread CPU, the DX-RT monitor (dxtop) for per-core NPU utilization, sysfs for frequency. - Protocol: one sample per second. Recorded runs: 12 s warm-up and a 45 s window. Headless benchmark-tool runs: 8 s warm-up and a 30 s window. The 1080p preprocessing comparison: 3 runs per variant in alternating order, 30 s warm-up, 60 s window. The longer-run comparison: a 2-minute warm-up run, then four 4-minute runs in the order GPU, CPU, CPU, GPU, analyzing the last 2 minutes of each. The 17-18 Nov re-tests (
use-ortmatrix, NMS, input-format): 8-10 s warm-up and a 30 s window, 3-4 runs per cell, cell order rotated or alternated every repetition so drift hits every variant. We report mean ± standard deviation where there is more than one run, and mark single runs. use-ortsetting:falsein every 13-14 Nov pipeline; both settings in the 18 Nov matrix;truein the 18 Nov input-format and NMS re-tests.- One measurement window per comparison. The camera looked at a mostly static scene, but its detail changed between sessions with the light, and the encoder's cost follows scene detail: the same DX-STREAM recording configuration read 50.1% in an earlier session and 54.6% to 55.6% in two later ones. So each recording comparison in this post uses runs taken in the same window, and we do not compare a recording row from one window with a row from another.
- Clean system: each run checked that no other known workload (an NPU stress test, another pipeline, a video encoder) was running before it started. Recorded runs waited up to 90 s to start from the same defined state.
- Units: "CPU, 4-core mean" is 100% when all four cores are fully busy. "% of one core" is 100% when one core is fully busy.
- Thread attribution: a GStreamer element runs in the streaming thread of the queue in front of it. We verified the mapping for
dxpreprocess: per-frame wall time times 30 fps matched the thread's CPU (3.7 ms x 30 = 11.1%). - Build: the optimized postprocess library is a release build (meson
buildtype=release).
What did we get wrong along the way?
Eight things changed our conclusions, and we think you should know about them:
- Our first build of the optimized postprocess library had no compiler optimization. We rebuilt it as a release build and re-measured every number that involves it. The saving is larger than we first reported.
- Recording CPU depends on the scene. Our first comparison of DX-STREAM and dx_app used runs from different sessions and said DX-STREAM used about half the CPU. Measured in the same window, the saving with recording is 24%, and it is 65% with detections only. We re-measured dx_app in the same session.
- A background container skewed our first end-to-end runs. Another process was using the NPU and about 40% of one core while we measured. We discarded those runs and measured again on an idle system.
- A simulated camera gave misleading results. A Python-fed dma-buf source showed no GPU benefit. A real camera showed an 83% reduction in the preprocessing thread. All numbers in this post come from the real camera.
- Our test video had bounding boxes baked into it. That distorted an early look at class labels. DEEPX's official sample clips gave correct classes. The CPU measurements were unaffected because they used the live camera.
- We first blamed our own harness for 20% of the CPU. A debugger showed those threads belonged to the DX-RT runtime.
- Our pipelines had
use-ort=falsehard-coded without us noting it (found in the 18 Nov re-test). Our postprocess numbers, the 10.7% headline and the dx_app comparison therefore describe the raw-tensor path, not the default ONNX Runtime configuration. The default-setting figures are now given next to them. - We had not isolated the camera input format (found in the 18 Nov re-test). NV12 vs RGB888 decides how large the preprocessing saving is: 79-83% with NV12, 98% with RGB888.
What are the limits of this benchmark?
- One board, one camera, one model, one scene. The camera looked at a mostly static scene, so postprocessing and drawing had little to do; a busy scene costs more (our dog-video test is the other extreme).
- Short measurement windows (30 s to 4 min) and small run counts. The standard deviation was 0.9 points or less for most multi-run rows, but reached 2.0 points (a 4-point range) for the default library on the dog video, and this is not a long-duration soak test.
- The live camera scene appears to have contained nothing the model detects: the four detections-only camera runs with the optimized library printed zero detections, and the other camera runs did not log detections. A separate check with a person in front of the camera confirmed that the camera pipeline detects; the measured scene itself was empty. The postprocess saving on that scene (-34%) is the best case; on a busy scene (a dog video) we measured -15% (4.1 points), or about -12% (3 points) without the highest default-library run. Drawing boxes was not tested with objects in view.
- The CPU governor was left on
ondemand, so the mean clock differed between configurations (about 1.94 GHz for CPU preprocessing and 2.0 GHz for GPU preprocessing with detections only, 2.18 GHz with the default postprocess library, 2.4 GHz for recording and dx_app). A CPU percentage at different clocks is not strictly comparable; pinning the governor would remove this. - We measured CPU, not detection accuracy. With NMS off the optimized decoder matched a re-implementation of the default decoder on 50 synthetic frames; with NMS on (the default) it returns fewer boxes than the default library.
- Single runs are marked in the tables.
- In the 14 Nov tests the variants always ran in the same order, and the dog-video default-library runs include one high run. The 17-18 Nov re-runs alternate the order and replace the 14 Nov NMS numbers; the busy-scene postprocess comparison and the NMS cost on the raw-tensor path have not been re-run that way.
- All 13-14 Nov figures were measured with
use-ort=falsehard-coded in the pipelines; the 18 Nov matrix gives bothuse-ortsettings. - The 18 Nov input-format test left OpenCV's thread count at its default (4 worker threads observed on the RGB888 run); pinning it would move the software-path total but not the GPU numbers. Its NV12 software preprocessing thread measured 18.9% against 11.1% in the 13-14 Nov sessions at the same resolution, cause unresolved (possibly a camera ISP mode difference between sessions), so rely on the within-matrix GPU/CPU comparison rather than the cross-session thread level.
- Recorded runs had GStreamer debug logging on for the GPU backend; headless benchmark-tool runs did not. SSH and a remote-access service were active during all runs.
- The dog video is a different load from the camera (decoding, CPU preprocessing), so its percentages are not comparable with the camera rows.
Frequently asked questions
How much CPU does camera AI use on a Raspberry Pi 5 with a DEEPX NPU?
With detections only at 720p and 30 fps, about 17% of the four-core CPU using DX-STREAM's default settings with GPU preprocessing. With use-ort=false and our postprocess optimizations it is 10.7% (about 0.36 of one core), and 15.9% with use-ort=false and DX-STREAM's default postprocess library. With H.264 video recording added it is 55.6% (use-ort=false).
Does GPU preprocessing reduce CPU usage on Raspberry Pi 5?
Yes. The preprocessing thread dropped from 11.1% to 1.9% of one core (-83%) at 1080p30. Whole-system CPU dropped 54% with preprocessing only (4.28% to 1.97%), and 14% to 18% in the full pipeline (20.2% to 17.3% with the default use-ort=true, 14.87% to 12.15% with use-ort=false and the postprocess optimizations). At 720p the saving is smaller, about half a point to 0.8 points (11.5% to 10.7%). It needs camera frames delivered as dma-buf, such as libcamerasrc output.
Does saving video to disk increase CPU usage?
Not at the bitrate we measured. The video grew by 35 to 45 KB per second because the scene was mostly static. Encoding it (x264) is what costs CPU: removing the encoder took the pipeline from 54.6% to 10.7%.
Does adding NMS to the postprocess cost CPU?
Not measurably on the default path. The YOLO26n export we used returns several overlapping candidate boxes per object (29 per frame on a dog video), which matches YOLO26's one-to-many head; class-wise NMS brings that to 3.6. Alternating-order re-runs on the default use-ort=true path measure no cost: 17.05% vs 17.00% on the live camera (4 runs each) and 26.68% vs 26.60% on a busy dog video (3 runs each). The earlier fixed-order numbers (+1.19 points) did not survive the re-runs. We have not re-measured NMS cost on the raw-tensor path.
Do the postprocess optimizations apply to the default DX-STREAM pipeline?
Only partly. The official YOLO26n model has a CPU task (ONNX Runtime) before the postprocess library, and dxinfer use-ort=true (the default, and the setting in DX-STREAM's own demo pipeline) runs it, so the library gets one already-decoded tensor and our decoder optimization is skipped - the 18 Nov matrix reads 17.23% vs 16.92%, a difference at the noise level. With use-ort=false the library decodes the raw tensors and the optimized decoder saves 5.4 points of whole-system CPU (16.49% vs 11.05%). NMS applies in both configurations.
Does the camera input format change the GPU preprocessing saving?
Yes. With NV12 input the software path uses libyuv and the preprocessing stage's threads fall from 18.9% to 4.0% of one core when moved to the GPU (-79%). With RGB888 input the software path uses OpenCV, which needs about two whole cores at 1080p30, so the GPU path cuts it by 98% (196.5% to 3.5%; whole-system 64.0% to 16.9%). The process-level NV12 comparison earlier in this post reads -64%; the near-total saving belongs to RGB888 input.
What is the difference between DX-STREAM and dx_app?
Both are DEEPX software. DX-STREAM is a set of GStreamer elements for building camera pipelines. dx_app is a collection of per-model application templates in C++ and Python. On our setup, with use-ort=false, DX-STREAM used 65% less CPU with detections only and 24% less with video recording; with the default postprocess library the figures are 48% and 14%. With DX-STREAM's default use-ort=true, the detections-only gap is an estimated 45% (measured in a different session). The two apps did not produce the same detections with our model export, so this compares CPU on the same model and camera, not equal work.
Do the postprocess optimizations change the detections?
With NMS off the optimized decoder matches a re-implementation of the default decoder: 0 of 50 random test frames differed. NMS is on by default and removes duplicate boxes, so the full optimized library returns fewer boxes than the default one. We did not measure detection accuracy.
Can I test GPU preprocessing with a video file?
No. GLES preprocessing needs camera frames delivered as dma-buf, such as libcamerasrc output. A video file decoded to system memory takes the CPU path for every frame, so it shows no GPU benefit.
Updated about 21 hours ago
