sunsmarterjie/yolov12
sunsmarterjie/yolov12 has 2,969 GitHub stars and 436 forks. GitHot measured 0 stars in 24 hours and +4 in 7 days. Last checked 2026-11-11 08:09 UTC. Last push 2026-10-25.
[NeurIPS 2025] YOLOv12: Attention-Centric Real-Time Object Detectors
Measured star growth
- in 24h
- 0
- in 7 days
- +4
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalYOLOv12
YOLOv12: Attention-Centric Real-Time Object Detectors
Yunjie Tian1, Qixiang Ye2, David Doermann1
1 University at Buffalo, SUNY, 2 University of Chinese Academy of Sciences.
Comparison with popular methods in terms of latency-accuracy (left) and FLOPs-accuracy (right) trade-offs
Updates
2025/06/17: Use this repo for YOLOv12 instead of ultralytics. Their implementation is inefficient, requires more memory, and has unstable training, which are fixed here!
2025/07/01: YOLOv12's classification models are released, see code.
2025/06/04: YOLOv12's instance segmentation models are released, see code.
2025/04/15: Pretrain a YOLOv12 model with LightlyTrain, a novel framework that lets you pretrain any computer vision model on your unlabeled data, with YOLOv12 support. Here is also a Colab tutorial!
2025/03/18: Some guys are interested in the heatmap. See this issue.
2025/03/09: YOLOv12-turbo is released: a faster YOLOv12 version.
2025/02/24: Blogs: ultralytics, LearnOpenCV. Thanks to them!
2025/02/22: YOLOv12 TensorRT CPP Inference Repo + Google Colab Notebook.
2025/02/22: Android deploy / TensorRT-YOLO accelerates yolo12. Thanks to them!
2025/02/20: Any computer or edge device? / ONNX CPP Version. Thanks to them!
2025/02/20: Train a yolov12 model on a custom dataset: Blog and Youtube. / Step-by-step instruction. Thanks to them!
2025/02/19: arXiv version is public. Demo is available (try Demo2 Demo3 if busy).
Abstract
Enhancing the network architecture of the YOLO framework has been crucial for a long time but has focused on CNN-based improvements despite the proven superiority of attention mechanisms in modeling capabilities. This is because attention-based models cannot match the speed of CNN-based models. This paper proposes an attention-centric YOLO framework, namely YOLOv12, that matches the speed of previous CNN-based ones while harnessing the performance benefits of attention mechanisms.YOLOv12 surpasses all popular real-time object detectors in accuracy with competitive speed. For example, YOLOv12-N achieves 40.6% mAP with an inference latency of 1.64 ms on a T4 GPU, outperforming advanced YOLOv10-N / YOLOv11-N by 2.1%/1.2% mAP with a comparable speed. This advantage extends to other model scales. YOLOv12 also surpasses end-to-end real-time detectors that improve DETR, such as RT-DETR / RT-DETRv2: YOLOv12-S beats RT-DETR-R18 / RT-DETRv2-R18 while running 42% faster, using only 36% of the computation and 45% of the parameters.
Main Results
Turbo (default):
| Model (det) | size (pixels) |
mAPval 50-95 |
Speed (ms) T4 TensorRT10 |
params (M) |
FLOPs (G) |
|---|---|---|---|---|---|
| YOLO12n | 640 | 40.4 | 1.60 | 2.5 | 6.0 |
| YOLO12s | 640 | 47.6 | 2.42 | 9.1 | 19.4 |
| YOLO12m | 640 | 52.5 | 4.27 | 19.6 | 59.8 |
| YOLO12l | 640 | 53.8 | 5.83 | 26.5 | 82.4 |
| YOLO12x | 640 | 55.4 | 10.38 | 59.3 | 184.6 |
v1.0:
| Model (det) | size (pixels) |
mAPval 50-95 |
Speed (ms) T4 TensorRT10 |
params (M) |
FLOPs (G) |
|---|---|---|---|---|---|
| YOLO12n | 640 | 40.6 | 1.64 | 2.6 | 6.5 |
| YOLO12s | 640 | 48.0 | 2.61 | 9.3 | 21.4 |
| YOLO12m | 640 | 52.5 | 4.86 | 20.2 | 67.5 |
| YOLO12l | 640 | 53.7 | 6.77 | 26.4 | 88.9 |
| YOLO12x | 640 | 55.2 | 11.79 | 59.1 | 199.0 |
| Model (seg) | size (pixels) |
mAPbox 50-95 |
mAPmask 50-95 |
Speed (ms) T4 TensorRT10 |
params (M) |
FLOPs (G) |
|---|---|---|---|---|---|---|
| YOLOv12n-seg | 640 | 39.9 | 32.8 | 1.84 | 2.8 | 9.9 |
| YOLOv12s-seg | 640 | 47.5 | 38.6 | 2.84 | 9.8 | 33.4 |
| YOLOv12m-seg | 640 | 52.4 | 42.3 | 6.27 | 21.9 | 115.1 |
| YOLOv12l-seg | 640 | 54.0 | 43.2 | 7.61 | 28.8 | 137.7 |
| YOLOv12x-seg | 640 | 55.2 | 44.2 | 15.43 | 64.5 | 308.7 |
| Model (cls) | size (pixels) |
Acc. top-1 |
Acc. top-5 |
Speed (ms) T4 TensorRT10 |
params (M) |
FLOPs (G) |
|---|---|---|---|---|---|---|
| YOLOv12n-cls | 224 | 71.7 | 90.5 | 1.27 | 2.9 | 0.5 |
| YOLOv12s-cls | 224 | 76.4 | 93.3 | 1.52 | 7.2 | 1.5 |
| YOLOv12m-cls | 224 | 78.8 | 94.4 | 2.03 | 12.7 | 4.5 |
| YOLOv12l-cls | 224 | 79.5 | 94.5 | 2.73 | 16.8 | 6.2 |
| YOLOv12x-cls | 224 | 80.1 | 95.3 | 3.64 | 35.5 | 13.7 |
Installation
conda create -n yolov12 python=3.11 supervision flash-attn
conda activate yolov12
git clone https://github.com/sunsmarterjie/yolov12 && cd yolov12
pip install -r requirements.txt
pip install -e .
Validation
yolov12n
yolov12s
yolov12m
yolov12l
yolov12x
from ultralytics import YOLO
model = YOLO('yolov12{n/s/m/l/x}.pt')
model.val(data='coco.yaml', save_json=True)
Training
from ultralytics import YOLO
model = YOLO('yolov12n.yaml')
# Train the model
results = model.train(
data='coco.yaml',
epochs=600,
batch=256,
imgsz=640,
scale=0.5, # S:0.9; M:0.9; L:0.9; X:0.9
mosaic=1.0,
mixup=0.0, # S:0.05; M:0.15; L:0.15; X:0.2
copy_paste=0.1, # S:0.15; M:0.4; L:0.5; X:0.6
device="0,1,2,3",
)
# Evaluate model performance on the validation set
metrics = model.val()
# Perform object detection on an image
results = model("path/to/image.jpg")
results[0].show()
Prediction
from ultralytics import YOLO
model = YOLO('yolov12{n/s/m/l/x}.pt')
model.predict()
Export
from ultralytics import YOLO
model = YOLO('yolov12{n/s/m/l/x}.pt')
model.export(format="engine", half=True) # or format="onnx"
Demo
python app.py
# Please visit http://127.0.0.1:7860
Acknowledgement
The code is based on ultralytics. Thanks for their excellent work!
Citation
@article{tian2026yolov12,
title={Yolov12: Attention-centric real-time object detectors},
author={Tian, Yunjie and Ye, Qixiang and Doermann, David},
journal={Advances in neural information processing systems},
volume={38},
pages={78433--78457},
year={2026}
}
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
562,012 starspublic-apis/public-apis
A collective list of free APIs
498,404 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
454,085 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,400 stars