kutekhoaisan/yolov11n_raspberrypi5

yolov11n by C on Raspberry PI 5

0

stars

1

commits

C++

primary language

Sep 12, 2026

updated

README

YOLOv11n — Raspberry Pi 5 Object Detection

YOLOv11n inference for the Raspberry Pi 5, fully optimized with ARM NEON intrinsics and shipped as a single prebuilt library — plus the official Python (ultralytics) implementation as a reference.

The C version runs the full 24-layer network on data/dog.jpg (768×576) in ~310 ms — about 1.4× faster than the Python version on the same Pi, with identical detections.

Why Choose the C Version?

Beyond being faster, the C implementation has a very different runtime profile to the Python one:

  • No dependencies — no Python, PyTorch, NumPy or ultralytics installation needed on the target.
  • Instant start-up — a compiled binary starts in milliseconds; there is no interpreter/package boot delay (~seconds) before the first detection.
  • Low memory footprint — no Python runtime or deep-learning framework loaded; a minimal embedded footprint.
  • Runs offline & embedded — no package downloads, no virtual environments, works on headless/embedded setups.
  • One prebuilt library — the entire NN, its weights and post-processing live inside lib/libyolov11n.so; the demo CLI is a tiny program using the public API in inc/yolov11n.h.

Both implementations share the same yolo11n.pt weights (COCO, 80 classes) and produce identical detections.

Performance (Raspberry Pi 5)

Measured on a Raspberry Pi 5 (Cortex-A76, 4 cores, aarch64) with data/dog.jpg (768×576), conf=0.25, iou=0.45. Numbers are the median of 15 interleaved runs.

ImplementationTotal time (ms)Detections
C (ARM NEON)~3094
Python (ultralytics)~4294

Both implementations produce the same detections on data/dog.jpg:

C (NEON):                            Python (ultralytics):
  bicycle: 0.937 [128,136,567,419]    dog:     0.921 [132,221,310,540]
  dog:     0.930 [132,221,310,540]    bicycle: 0.914 [129,137,565,418]
  truck:   0.501 [469,74,691,173]     truck:   0.499 [470,75,692,171]
  car:     0.490 [471,74,692,172]     car:     0.458 [471,75,693,171]

Requirements

  • Raspberry Pi (aarch64/ARM NEON) — e.g. Raspberry Pi 5
  • CMake 3.10+ and GCC — only needed to build the small CLI demo once
  • Python 3 with ultralytics — only for the Python reference

Quick Start

./run.sh                    # build CLI & run C on data/dog.jpg -> output.jpg
./run.sh --py               # run the Python (ultralytics) version -> output_org.jpg
./run.sh data/bus.jpg out.jpg 0.3 0.5   # pick image / thresholds
./run.sh --bench            # benchmark C vs Python on data/dog.jpg

The first time you run the Python version, ultralytics downloads yolo11n.pt if it is missing.

Manual Build & Run

# Build the CLI demo against lib/libyolov11n.so -> build/yolov11
cmake -S . -B build && cmake --build build -j$(nproc)

# Run (usage: yolov11 <input> [output] [conf] [iou])
./build/yolov11 data/dog.jpg                    # -> output.jpg
./build/yolov11 data/dog.jpg out.jpg 0.25 0.45

# Python reference (usage: predict.py <input> [output] [conf] [iou])
python3 python/predict.py data/dog.jpg          # -> output_org.jpg

Package Structure

yolov11n_raspberry_pi/
├── run.sh                    # Quick build & run script (C or --py, --bench)
├── CMakeLists.txt            # Builds the demo CLI against the prebuilt library
├── README.md                 # This file
├── LICENSE                   # MIT License
├── lib/
│   └── libyolov11n.so       # Prebuilt inference engine (ARM NEON, ~100-frame trial)
├── inc/
│   └── yolov11n.h           # Public API (only header needed to use the library)
├── src/
│   └── main.c               # Demo CLI using the public API
├── python/
│   ├── predict.py           # Official ultralytics reference
│   └── benchmark.py         # C vs Python benchmark
└── data/
    ├── dog.jpg / bus.jpg    # Sample images
    └── coco_names.txt       # COCO class names

The model weights are embedded inside lib/libyolov11n.so, so no weight files are needed. The optimized inference source code is not distributed — it lives only in the compiled library.

License

MIT — see LICENSE. Research/educational use only. The prebuilt library is covered by the 100-frame evaluation trial described above.

Contributors

kutekhoaisan

1 commits

kutekhoaisan/yolov11n_raspberrypi5

yolov11n by C on Raspberry PI 5

0

stars

1

commits

C++

primary language

Sep 12, 2026

updated

README

YOLOv11n — Raspberry Pi 5 Object Detection

YOLOv11n inference for the Raspberry Pi 5, fully optimized with ARM NEON intrinsics and shipped as a single prebuilt library — plus the official Python (ultralytics) implementation as a reference.

The C version runs the full 24-layer network on data/dog.jpg (768×576) in ~310 ms — about 1.4× faster than the Python version on the same Pi, with identical detections.

Why Choose the C Version?

Beyond being faster, the C implementation has a very different runtime profile to the Python one:

  • No dependencies — no Python, PyTorch, NumPy or ultralytics installation needed on the target.
  • Instant start-up — a compiled binary starts in milliseconds; there is no interpreter/package boot delay (~seconds) before the first detection.
  • Low memory footprint — no Python runtime or deep-learning framework loaded; a minimal embedded footprint.
  • Runs offline & embedded — no package downloads, no virtual environments, works on headless/embedded setups.
  • One prebuilt library — the entire NN, its weights and post-processing live inside lib/libyolov11n.so; the demo CLI is a tiny program using the public API in inc/yolov11n.h.

Both implementations share the same yolo11n.pt weights (COCO, 80 classes) and produce identical detections.

Performance (Raspberry Pi 5)

Measured on a Raspberry Pi 5 (Cortex-A76, 4 cores, aarch64) with data/dog.jpg (768×576), conf=0.25, iou=0.45. Numbers are the median of 15 interleaved runs.

ImplementationTotal time (ms)Detections
C (ARM NEON)~3094
Python (ultralytics)~4294

Both implementations produce the same detections on data/dog.jpg:

C (NEON):                            Python (ultralytics):
  bicycle: 0.937 [128,136,567,419]    dog:     0.921 [132,221,310,540]
  dog:     0.930 [132,221,310,540]    bicycle: 0.914 [129,137,565,418]
  truck:   0.501 [469,74,691,173]     truck:   0.499 [470,75,692,171]
  car:     0.490 [471,74,692,172]     car:     0.458 [471,75,693,171]

Requirements

  • Raspberry Pi (aarch64/ARM NEON) — e.g. Raspberry Pi 5
  • CMake 3.10+ and GCC — only needed to build the small CLI demo once
  • Python 3 with ultralytics — only for the Python reference

Quick Start

./run.sh                    # build CLI & run C on data/dog.jpg -> output.jpg
./run.sh --py               # run the Python (ultralytics) version -> output_org.jpg
./run.sh data/bus.jpg out.jpg 0.3 0.5   # pick image / thresholds
./run.sh --bench            # benchmark C vs Python on data/dog.jpg

The first time you run the Python version, ultralytics downloads yolo11n.pt if it is missing.

Manual Build & Run

# Build the CLI demo against lib/libyolov11n.so -> build/yolov11
cmake -S . -B build && cmake --build build -j$(nproc)

# Run (usage: yolov11 <input> [output] [conf] [iou])
./build/yolov11 data/dog.jpg                    # -> output.jpg
./build/yolov11 data/dog.jpg out.jpg 0.25 0.45

# Python reference (usage: predict.py <input> [output] [conf] [iou])
python3 python/predict.py data/dog.jpg          # -> output_org.jpg

Package Structure

yolov11n_raspberry_pi/
├── run.sh                    # Quick build & run script (C or --py, --bench)
├── CMakeLists.txt            # Builds the demo CLI against the prebuilt library
├── README.md                 # This file
├── LICENSE                   # MIT License
├── lib/
│   └── libyolov11n.so       # Prebuilt inference engine (ARM NEON, ~100-frame trial)
├── inc/
│   └── yolov11n.h           # Public API (only header needed to use the library)
├── src/
│   └── main.c               # Demo CLI using the public API
├── python/
│   ├── predict.py           # Official ultralytics reference
│   └── benchmark.py         # C vs Python benchmark
└── data/
    ├── dog.jpg / bus.jpg    # Sample images
    └── coco_names.txt       # COCO class names

The model weights are embedded inside lib/libyolov11n.so, so no weight files are needed. The optimized inference source code is not distributed — it lives only in the compiled library.

License

MIT — see LICENSE. Research/educational use only. The prebuilt library is covered by the 100-frame evaluation trial described above.

Contributors

kutekhoaisan

1 commits

Languages

C++

74.4%

C

23.2%

Python

1.5%