File size: 4,654 Bytes
1e8252b e674dfb 1e8252b afef12f 9422383 8924a13 9422383 8924a13 9422383 565a0d7 9422383 565a0d7 9422383 d31e060 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 afef12f 9422383 d31e060 9422383 d31e060 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 565a0d7 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 ebfbb04 9422383 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | ---
license: apache-2.0
pipeline_tag: object-detection
base_model: yolo26n
tags:
- arm
- arm-optimized
- edge-linux
- raspberry-pi-5
- xnnpack
---
# Arm Runtime for YOLO26 on Raspberry Pi 5
## About
This runtime runs YOLO26n on Raspberry Pi 5 with Raspberry Pi OS Trixie. It is
a fixed-graph implementation that uses model-specific memory planning, custom
operators, and operator fusion to maximize throughput on the Raspberry Pi CPU.
The runtime supports the standard YOLO26n model and compatible fine-tuned
variants at square resolutions of 320, 480, 640, 800, 960, and 1280 pixels.
## Performance
The following YOLO26n results were measured on Raspberry Pi 5 at 640x640,
batch 1, against the 128-image, 1,025-instance
[`coco-128-by-sa`](https://huggingface.co/datasets/Arm/coco-128-by-sa/tree/97d6ea181e9dd0784db880b705e426ad23d424e1)
published dataset revision. Inference time excludes
preprocessing and postprocessing.
| Runtime | Inference (ms/image) | mAP50-95 |
| --- | ---: | ---: |
| Arm Runtime (this project) | 36.60 | 0.4863 |
| NCNN | 67.20 | 0.4902 |
| MNN | 90.90 | 0.4753 |
| OpenVINO | 102.00 | 0.4812 |
| ONNX Runtime | 126.90 | 0.4812 |
| ExecuTorch | 136.90 | 0.4880 |
See the [performance baseline](benchmarks/reporting/baseline.md) for the Arm
Runtime measurement and host context.
## Quick start
### Prerequisites
On Raspberry Pi OS Trixie, install the required packages:
```bash
sudo apt update
sudo apt install --yes --no-install-recommends \
ca-certificates \
curl \
git \
libgl1 \
libglib2.0-0t64 \
make \
patch \
python3 \
python3-venv \
tar \
gzip
```
Clone the repository:
```bash
git clone https://github.com/arm/Optimized-Runtimes.git
cd Optimized-Runtimes/yolo26-raspberry-pi-5
```
### Run an example
Run object detection on a sample video using the standard YOLO26n checkpoint:
```bash
make example-video
```
For a fine-tuned checkpoint, your own video, or live camera input, see
[Usage](#usage).
### Run the benchmark
Run the [Ultralytics benchmark harness](https://docs.ultralytics.com/guides/raspberry-pi/#raspberry-pi-5-yolo26-benchmarks)
using this runtime:
```bash
make ultralytics-benchmark
```
See the [Ultralytics benchmark documentation](benchmarks/ultralytics/README.md)
for configuration options.
## Usage
### Acquiring a runtime
A prebuilt runtime library is available from this repository's releases. The
example and benchmark targets download the release matching the checked-out
project version when no runtime exists under `dist/runtime/`.
To build the runtime from source, install the native build prerequisites:
```bash
sudo apt update
sudo apt install --yes --no-install-recommends \
build-essential \
ca-certificates \
cmake \
curl \
git \
patch \
python3 \
python3-venv \
tar \
gzip
```
Then run:
```bash
make runtime
```
The resulting runtime is installed under `dist/runtime/`, where the examples
and benchmark consume it automatically.
### Acquiring a model
The examples and benchmark require a YOLO26n checkpoint converted for this
runtime. If the default model is absent, their Make targets download the pinned
standard YOLO26n checkpoint and convert it automatically.
The benchmark normally uses the standard model because its classes match the
default COCO dataset. To use a compatible fine-tuned checkpoint with the video
or camera examples, convert it first:
```bash
make model CHECKPOINT=/path/to/your-checkpoint.pt
```
The default conversion uses 640x640 input and writes the model under
`dist/models/`. Select another supported resolution with, for example:
```bash
make model CHECKPOINT=/path/to/your-checkpoint.pt RESOLUTION=320
```
## Examples and benchmarks
The examples use the [Python API](src/runtime/api/python/arm_yolo26n/README.md).
Their Make targets prepare missing default runtime and model artifacts
automatically.
- [Object detection on prerecorded video](examples/video/README.md)
- [Object detection on live video from a Raspberry Pi Camera](examples/picamera2/README.md)
- [Ultralytics benchmark](benchmarks/ultralytics/README.md)
## Other information
Run `make help` for other useful commands.
### Project layout
- `src/converter/` - Converts compatible YOLO26n PyTorch checkpoints into the runtime model format.
- `src/runtime/` - Implements the fixed YOLO26n runtime.
- `src/runtime/patches/` - Contains project changes to XNNPACK and pthreadpool.
- `src/runtime/api/python/arm_yolo26n/` - Provides the Python API.
- `examples/` - Contains prerecorded-video and live-camera examples.
- `benchmarks/ultralytics/` - Integrates the runtime with the Ultralytics benchmark.
|