Skip to content

mohammad-ghaderi/YOLO26

Repository files navigation

YOLO26 Inference (ARM64 Assembly + C)

YOLO26 Detection Result YOLO26 Detection Result

YOLO26 object detection inference written from scratch in ARM64 Assembly and C, optimized for the Raspberry Pi 4 (ARM Cortex-A72).

Bachelor's Final Project
Author: Mohammad Ghaderi
Advisor: Prof. Saleh Yousefi


Project Overview

This project implements the inference stage of the YOLO26n object detection model entirely from scratch using C and ARM64 Assembly. The main focus is on understanding and reproducing the low-level optimizations employed by modern ARM inference engines.

Key optimization areas include:

  • ARM NEON SIMD vectorization
  • Cache-aware computation
  • Winograd convolution
  • Optimized GEMM kernels
  • Operator fusion
  • ARM64 micro-kernel design

YOLO26 Architecture

YOLO26 Architecture

The implementation follows the YOLO26 architecture and focuses on efficient execution of convolutional layers on ARM Cortex-A72 processors.


Features

  • ARM64 (AArch64) optimized
  • ARM64 Assembly + C
  • ARM NEON vectorization
  • Float32 inference
  • SiLU/sigmoid/softmax activation (NCNN-inspired implementation - implementing exp)
  • Winograd F(2×3) transform (using NCNN transform matrix values)
  • GEMM convolution
  • Pointwise & Depthwise convolution
  • Cache-aware tiling
  • Custom ARM micro-kernels
  • Operator fusion
  • Multiple kernel and tile-size experiments
  • Attention
  • Components (C3K2, SPPF, Conv, C2PSA, Detect, BottleNeck, PSA)
  • read jpg and save result as png with bounding boxes

Performance

All benchmarks were performed on:

  • Raspberry Pi 4 Model B / ARM Cortex-A72 /ARMv8-A (64-bit) / Linux

Performance Comparison

Example

YOLO26 Detection Result YOLO26 Detection Result YOLO26 Detection Result YOLO26 Detection Result This is the output of the implementation. It surprised me—you can test it too.

Build & Run

Compile the project : ( same for arm or x86 on QEMU emulator)

If ARM64 hardware is not available, the project can be executed through QEMU. The provided Makefile supports both native ARM64 execution and QEMU-based execution using the same commands. Go To Install QEMU emulator

First, clone the repository:

git clone https://github.com/mohammad-ghaderi/YOLO26.git
cd YOLO26

Build

make

Run inference on an image: input image should be 640*640 jpg

make run IMG=path/to/image.jpg

Example:

make run IMG=images/img1.jpg

Install QEMU Emulator

Ubuntu / Debian:

sudo apt update
sudo apt install qemu-user qemu-user-static

Arch Linux:

sudo pacman -S qemu-user

Fedora:

sudo dnf install qemu-user-static

Acknowledgments

  • During development, several experimental implementations were tested. Some of these (e.g., QS8, FP16, etc.) remain in the repository but are not part of the final inference pipeline.
  • The parameters from the official YOLO26n pretrained model were extracted, restructured, and repacked into a custom binary format (param.bin). The ordering and layout were redesigned to match the optimized memory access pattern of this ARM64 inference engine.

About

YOLO26n object detection inference from scratch in ARM64 Assembly and C, optimized for Raspberry Pi 4 with NEON, Winograd, GEMM, and custom ARM micro-kernels.

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors