Vision Field Notes

Running YOLO on a Raspberry Pi 5: What to Expect

The Raspberry Pi 5 is a capable small board and a popular first step into edge AI. It can run YOLO detection on its CPU. Whether that is fast enough depends on the model, the input size, the export format and what else the board is doing. This article sets realistic expectations, walks through a sensible setup, and shows how to measure performance yourself rather than relying on someone else's numbers.

I will not quote frame-rate figures here. They depend on the model variant, the resolution, the runtime, the cooling and the software version, and published numbers go out of date quickly. Measure on your own board.

What the Pi 5 is, and is not

The Pi 5 has a quad-core Arm CPU and no dedicated neural accelerator. Standard YOLO inference runs on those CPU cores. This has some consequences:

The right question is not whether the Pi can run YOLO, but whether it can run your model fast enough for your task. A parking-lot counter that updates a few times per second has very different needs from a real-time safety system.

Hardware basics that matter

A few choices avoid most early trouble:

Software setup

Use a 64-bit Raspberry Pi OS. Then create a virtual environment and install the packages you need:

sudo apt update
python3 -m venv .venv
source .venv/bin/activate
pip install ultralytics

Package availability and install steps for Arm can change, so check the current Ultralytics documentation for Raspberry Pi if an install step fails. If you plan to use ONNX Runtime, install onnxruntime for your platform.

Keep the system image and dependencies stable once things work. Reproducible environments matter on small devices, and containers help. See Dockerize a Computer Vision App for Edge and Cloud.

Choosing a model

On a CPU-only board, model size is the main lever.

See Nano, Small, Medium: How to Choose a YOLO Model Size for a method that starts from your hardware budget.

Also check the licence if the product is commercial. Ultralytics models are AGPL-3.0 with a commercial option, so check the current licence. See YOLO Licenses Explained: AGPL, GPL and Commercial Use.

Export formats: do not run raw PyTorch

Running the .pt model directly works, but is usually not the fastest option on a CPU. Ultralytics can export to other formats:

from ultralytics import YOLO

model = YOLO("yolo11n.pt")
model.export(format="onnx")    # ONNX
model.export(format="ncnn")    # NCNN

Then load the exported model for prediction:

onnx_model = YOLO("yolo11n.onnx")
results = onnx_model("frame.jpg")

Options to try on the Pi:

Format Notes
PyTorch (.pt) Easiest, usually not the fastest on CPU
ONNX with ONNX Runtime Portable, good CPU support. See Export YOLO to ONNX and Run It with ONNX Runtime
NCNN A lightweight inference framework designed for mobile and Arm devices; Ultralytics documents it for Raspberry Pi

Which one wins depends on your model and software versions. Benchmark each on your board with identical input, rather than assuming.

Tuning for the CPU

Two rows of small squares over a time arrow. The top row, frames read from the camera, is a continuous run of blue squares. The bottom row, frames sent to the model with N equal to 3, has a green square under every third blue square, with arrows down to it, and empty outlines in between.
Frame skipping with N = 3. Every frame is still read so the buffer never goes stale, but only every third one costs a model call.
Diagram of five boxes in a row: camera (USB, CSI or RTSP), a capture thread that reads every frame, a latest-frame-only slot where old frames are dropped, an inference thread that runs every Nth frame, and post-processing with NMS, tracking and alerts. An orange bracket under the inference thread is labelled model call alone. A longer blue bracket from the capture thread to post-processing is labelled full loop, what your users experience.
Capture and inference run in separate threads joined by a one-frame slot, so the model always works on a recent frame. When you benchmark, time both the model call and the full loop, because the full loop is what users feel.

Measure it yourself

Do not trust numbers from other setups. A simple, honest method:

  1. Warm up: run the model several times first, because the first calls are slower.
  2. Time the model call alone, and also the full loop including capture, resize and post-processing. The latter is what your users experience.
  3. Run for long enough to include thermal effects, such as several minutes, and watch whether speed drops.
  4. Record the model, format, input size, thread count, cooling and power supply with the result.
  5. Compare one change at a time.

Full guidance is in Measuring FPS and Latency Correctly. You can check throttling with vcgencmd get_throttled and temperature with vcgencmd measure_temp. See Raspberry Pi documentation for the meaning of the values.

Realistic expectations

For tasks like counting people crossing a line, a lower processing rate is often enough, provided the tracker still follows objects between processed frames. See People Counting with Line Crossing: A Practical Tutorial.

Common mistakes

Checklist

Next steps: export and run the model in Export YOLO to ONNX and Run It with ONNX Runtime, and learn to benchmark properly in Measuring FPS and Latency Correctly.