This repository provides an end-to-end workflow for Quantization Aware Training (QAT), Export, and Deployment of YOLOv26n (NMS-Free) on the ESP32-P4 SoC using the ESP-DL library.
By leveraging a custom dual-head architecture and direct regression (RegMax=1), this implementation achieves high-performance inference without the overhead of Distribution Focal Loss (DFL) or complex post-processing.
Tip
Accuracy Parity & Speed Leadership: This implementation achieves a 36.5% mAP matching the official ESP-DL YOLOv11nbut runs 30% faster thanks to hardware-specific SIMD kernels.
| Architecture | Resolution | mAP (Accuracy) | Latency | Speedup |
|---|---|---|---|---|
| ESP-DL YOLOv11n | 640px | 36.0% | 2.4s | 1.0x |
| YOLO26n (Ours) | 512px | 36.5% | 1.7s | 1.3x (π +30%) |
Want to see how I achieved 1.7s latency on ESP32-P4?
β±οΈ 5 Minute Read β’ π§ Deep Tech Analysis
Note
I am considering porting YOLO26n-Seg (Instance Segmentation) to the ESP32-P4 to enable pixel-level masks on the edge.
Support the Project: If you find this repository helpful, please consider giving it a Star β.
Your support is my main motivation! If this project gains enough traction, I will prioritize building and open-sourcing the Segmentation pipeline next.
---
This project requires the ESP-DL library to be located in the project root.
git clone https://github.com/boumedinebillal/yolo26n_esp.git
cd yolo26n_espThe project relies on esp-dl for neural network kernels. Clone it into the root directory:
git clone https://github.com/espressif/esp-dl.git
cd esp-dl
git submodule update --init --recursiveTroubleshooting / Version Lock: While the latest version is recommended, if you encounter build errors, revert to the validated commit:
git checkout 7089b94a76206825bddba57a6385d46cc08c0a6b git submodule update --init --recursive
Return to the project root:
cd ..Ensure you have Python >3.9 installed.
pip install -r requirements.txtBenchmark conducted on ESP32-P4 Engineering Sample.
| Model Architecture | Configuration | Resolution | mAP (COCO) | Latency | Status |
|---|---|---|---|---|---|
| YOLO26n (Optimized) | Int8 QAT | 512x512 | 36.5% | 1.77s | Target |
| YOLO26n (High-Res) | Int8 QAT | 640x640 | 38.5% | 3.00s | |
| YOLOv11n (Baseline) | Official ESP-DL | 640x640 | 36.0% | 2.75s |
- NMS-Free Architecture: Utilizes a One-to-One prediction head for direct inference, eliminating the need for Non-Maximum Suppression.
- Int8 Quantization: Full Quantization Aware Training (QAT) pipeline using
esp-ppqfor maximum efficiency on the P4 accelerator. - Dynamic Resolution: Pre-configured support for both 512x512 and 640x640 resolutions in firmware.
- Optimized Firmware: C++ Inference engine (
Yolo26Processor) optimized for ESP-DL's static graph execution.
The entire QAT and Export workflow is orchestrated by YOLOv26_QAT_Workflow.ipynb.
- Open the Notebook:
jupyter notebook YOLOv26_QAT_Workflow.ipynb
- Configure: Set your desired
IMG_SZ(512 or 640) in the configuration cell. - Run Pipeline: Execute all cells to:
- Export the PyTorch model to ONNX (with custom patches).
- Quantize and Calibrate using
esp-ppq. - Fine-tune (QAT) for optimal accuracy.
- Export the final
.espdlmodel artifacts.
- Artifacts: The resulting models will be saved in
output/size_512/oroutput/size_640/.
The ESP-IDF firmware project is located in yolo26n_esp32p4/.
- ESP-IDF v5.5+ installed and sourced.
After running the QAT pipeline:
- Copy the generated
.espdlfile fromoutput/toyolo26n_esp32p4/main/models/. - Review
yolo26n_esp32p4/README.mdfor specific build switches (e.g., selecting 512 vs 640 model).
cd yolo26n_esp32p4
idf.py set-target esp32p4
idf.py build
idf.py flash monitor.
βββ yolo26n_esp32p4/ # ESP-IDF C++ Firmware Project
βββ pipeline_source/ # Python Source (Trainer, Exporter, Config)
βββ output/ # Generated Models & Checkpoints
βββ YOLOv26_QAT_Workflow.ipynb # Main QAT Orchestrator
βββ requirements.txt # Python Dependencies
βββ README.md # Project Documentation
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 Billal Boumedine (https://github.com/boumedinebillal/yolo26n_esp)
If you use this work in your research or project, please cite:
@software{yolo26n_esp32p4,
author = {Boumedine, Billal},
title = {YOLO26n QAT & Deployment for ESP32-P4},
year = {2026},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/boumedinebillal/yolo26n_esp}}
}www.linkedin.com/in/boumedine-billal-a9a850239
Open an issue for bug reports or feature requests.
Pull requests are welcome!
