Ultralytics YOLO27: Join the waitlist.
Get Started

YOLO12: Attention-Centric Object Detection

Overview#

YOLO12, released in early 2025, introduces an attention-centric architecture that departs from the traditional CNN-based approaches used in previous YOLO models, yet retains the real-time inference speed essential for many applications. It achieves high object detection accuracy through changes to its attention mechanisms and overall network architecture. Despite those advantages, YOLO12 remains a community-driven release that may exhibit training instability, elevated memory consumption, and slower CPU throughput due to its heavy attention blocks, so Ultralytics recommends YOLO11 or YOLO26 for most production workloads.

Community Model

YOLO12 is maintained primarily for benchmarking and research. If you need stable training, predictable memory usage, and optimized CPU inference, choose YOLO11 or YOLO26 for deployment.



Watch: How to Use YOLO12 for Object Detection with the Ultralytics Package | Is YOLO12 Fast or Slow?

Key Features#

  • Area Attention Mechanism: A new self-attention approach that processes large receptive fields efficiently. It divides feature maps into l equal-sized regions (defaulting to 4), either horizontally or vertically, avoiding complex operations and maintaining a large effective receptive field. This significantly reduces computational cost compared to standard self-attention.
  • Residual Efficient Layer Aggregation Networks (R-ELAN): An improved feature aggregation module based on ELAN, designed to address optimization challenges, especially in larger-scale attention-centric models. R-ELAN introduces:
    • Block-level residual connections with scaling (similar to layer scaling).
    • A redesigned feature aggregation method creating a bottleneck-like structure.
  • Optimized Attention Architecture: YOLO12 streamlines the standard attention mechanism for greater efficiency and compatibility with the YOLO framework. This includes:
    • Using FlashAttention to minimize memory access overhead.
    • Removing positional encoding for a cleaner and faster model.
    • Adjusting the MLP ratio (from the typical 4 to 1.2 or 2) to better balance computation between attention and feed-forward layers.
    • Reducing the depth of stacked blocks for improved optimization.
    • Using convolution operations (where appropriate) for their computational efficiency.
    • Adding a 7x7 separable convolution (the "position perceiver") to the attention mechanism to implicitly encode positional information.
  • Comprehensive Task Support: YOLO12 supports a range of core computer vision tasks: object detection, instance segmentation, image classification, pose estimation, and oriented object detection (OBB).
  • Enhanced Efficiency: Achieves higher accuracy with fewer parameters compared to many prior models, demonstrating an improved balance between speed and accuracy.
  • Flexible Deployment: Designed for deployment across diverse platforms, from edge devices to cloud infrastructure.

YOLO12 latency-accuracy and FLOPs-accuracy comparison with other real-time detectors

Supported Tasks and Modes#

YOLO12 supports a variety of computer vision tasks. The table below shows task support and the operational modes (Training, Validation, Inference, and Export) enabled for each:

Pretrained weights availability

Only detection weights (yolo12n.pt, yolo12s.pt, yolo12m.pt, yolo12l.pt, yolo12x.pt) are released on ultralytics/assets. Segmentation, classification, pose, and OBB architectures are defined in ultralytics/cfg/models/12/, so those variants support training from scratch from the .yaml config, but no pretrained .pt files are currently available for them. For pretrained segmentation, pose, classification, or OBB checkpoints, Ultralytics recommends YOLO11 or YOLO26.

Model TypeTaskPretrained WeightsTrainingValidationInferenceExport
YOLO12Detection✅✅✅✅✅
YOLO12-segSegmentation❌✅✅✅✅
YOLO12-clsClassification❌✅✅✅✅
YOLO12-posePose❌✅✅✅✅
YOLO12-obbOBB❌✅✅✅✅

All YOLO12 architectures support every mode once a trained checkpoint is available. The Pretrained Weights column indicates only whether Ultralytics publishes an official pretrained .pt on ultralytics/assets: for segmentation, pose, classification, and OBB, you must train your own checkpoint from the corresponding .yaml before running inference, validation, or export.

Performance Metrics#

YOLO12 improves accuracy at all model scales, with some trade-offs in speed compared to the fastest prior YOLO models. Below are quantitative results for object detection on the COCO validation dataset:

Detection Performance (COCO val2017)#

Performance
Modelsize
(pixels)
mAPval50-95Speed
CPU ONNX
(ms)
Speed
T4 TensorRT
(ms)
params
(M)
FLOPs
(B)
Comparison
(mAP/Speed)
YOLO12n64040.6-1.642.67.5+2.1%/-9% (vs. YOLOv10n)
YOLO12s64048.0-2.619.323.3+0.1%/+42% (vs. RT-DETRv2)
YOLO12m64052.5-4.8620.270.7+1.0%/-3% (vs. YOLO11m)
YOLO12l64053.7-6.7726.495.4+0.4%/-8% (vs. YOLO11l)
YOLO12x64055.2-11.7959.1208.9+0.6%/-4% (vs. YOLO11x)
  • Inference speed measured on an NVIDIA T4 GPU with TensorRT FP16 precision.
  • Comparisons show the relative improvement in mAP and the percentage change in speed (positive indicates faster; negative indicates slower). Comparisons are made against published results for YOLOv10, YOLO11, and RT-DETR where available.

Usage Examples#

This section provides examples for training and inference with YOLO12.

The examples below focus on YOLO12 Detect models (for object detection). For other supported tasks (segmentation, classification, pose estimation, and oriented object detection), refer to the respective task-specific documentation: Segment, Classify, Pose, and OBB.

Example

Pretrained *.pt models (using PyTorch) and configuration *.yaml files can be passed to the YOLO() class to create a model instance in Python:

from ultralytics import YOLO

# Load a COCO-pretrained YOLO12n model
model = YOLO("yolo12n.pt")

# Train the model on the COCO8 example dataset for 100 epochs
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)

# Run inference with the YOLO12n model on the 'bus.jpg' image
results = model("path/to/bus.jpg")

Key Improvements#

  1. Enhanced Feature Extraction:

    • Area Attention: Efficiently handles large receptive fields, reducing computational cost.
    • Optimized Balance: Improved balance between attention and feed-forward network computations.
    • R-ELAN: Enhances feature aggregation using the R-ELAN architecture.
  2. Optimization Innovations:

    • Residual Connections: Introduces residual connections with scaling to stabilize training, especially in larger models.
    • Refined Feature Integration: Implements an improved method for feature integration within R-ELAN.
    • FlashAttention: Incorporates FlashAttention to reduce memory access overhead.
  3. Architectural Efficiency:

    • Reduced Parameters: Achieves a lower parameter count while maintaining or improving accuracy compared to many previous models.
    • Streamlined Attention: Uses a simplified attention implementation, avoiding positional encoding.
    • Optimized MLP Ratios: Adjusts MLP ratios to more effectively allocate computational resources.

Requirements#

The Ultralytics YOLO12 implementation, by default, does not require FlashAttention. However, FlashAttention can be optionally compiled and used with YOLO12. To compile FlashAttention, one of the following NVIDIA GPUs is needed:

Citations and Acknowledgments#

If you use YOLO12 in your research, please cite the original work by University at Buffalo and the University of Chinese Academy of Sciences:

Citation
@inproceedings{tian2025yolov12,
  title={YOLOv12: Attention-Centric Real-Time Object Detectors},
  author={Tian, Yunjie and Ye, Qixiang and Doermann, David},
  booktitle={Advances in Neural Information Processing Systems},
  volume={38},
  pages={78433--78457},
  year={2025},
  url={https://proceedings.neurips.cc/paper_files/paper/2025/file/7103444259031cc58051f8c9a4868533-Paper-Conference.pdf}
}

@software{yolo12,
  author = {Tian, Yunjie and Ye, Qixiang and Doermann, David},
  title = {YOLO12: Attention-Centric Real-Time Object Detectors},
  year = {2025},
  url = {https://github.com/sunsmarterjie/yolov12},
  license = {AGPL-3.0}
}

The YOLO12 paper was published in the NeurIPS 2025 proceedings, with a preprint on arXiv.

FAQ#

  • YOLO12 incorporates several key innovations to balance speed and accuracy. The Area Attention mechanism efficiently processes large receptive fields, reducing computational cost compared to standard self-attention. The Residual Efficient Layer Aggregation Networks (R-ELAN) improve feature aggregation, addressing optimization challenges in larger attention-centric models. Optimized Attention Architecture, including the use of FlashAttention and removal of positional encoding, further enhances efficiency. These features allow YOLO12 to achieve high accuracy while maintaining the real-time inference speed many applications need.

  • YOLO12 supports a wide range of core computer vision tasks: object detection, instance segmentation, image classification, pose estimation, and oriented object detection (OBB). This makes YOLO12 applicable to diverse fields, from robotics and autonomous driving to medical imaging and industrial inspection. Note that pretrained .pt weights are currently published for detection only; the segmentation, pose, classification, and OBB architectures are provided as .yaml configs for training from scratch.

  • YOLO12 improves accuracy at all model scales compared to prior YOLO models like YOLOv10 and YOLO11, with some trade-offs in speed compared to the fastest prior models. For example, YOLO12n achieves a +2.1% mAP improvement over YOLOv10n and +1.2% over YOLO11n on the COCO val2017 dataset. Compared to models like RT-DETR, YOLO12s offers a +1.5% mAP improvement and a +42% speed increase. These metrics highlight YOLO12's strong balance between accuracy and efficiency.

  • By default, the Ultralytics YOLO12 implementation does not require FlashAttention. However, FlashAttention can be optionally compiled and used with YOLO12 to minimize memory access overhead. To compile FlashAttention, one of the following NVIDIA GPUs is needed: Turing GPUs (e.g., T4, Quadro RTX series), Ampere GPUs (e.g., RTX30 series, A30/40/100), Ada Lovelace GPUs (e.g., RTX40 series), or Hopper GPUs (e.g., H100/H200). This lets users benefit from FlashAttention when their hardware supports it.

  • This page provides basic usage examples for training and inference. YOLO12 uses the same Train, Val, Predict, and Export modes and Segment, Classify, Pose, and OBB task interfaces as other Ultralytics models.

Comments69

Ask a question, share your results, or help someone else.

  1. Zixuan-HeZixuan-HeGitHub

    I try use the YOLO12-seg, but with update to lastest version (> pip install -U ultralytics) it is still showing (No such file or directory: 'YOLO12n-seg.pt) with code (yolo segment train data=data.yaml model=YOLO12n-seg.pt epochs=200 batch=16 imgsz=640 patience=25 ). theYOLO12n.pt for obj is good. Is the code changed or need other input?

    1
    1. Glenn JocherGlenn JocherUltralytics

      @Zixuan-He Answer:
      The YOLO12-seg model requires using its specific configuration file. Try model=yolo12-seg.yaml instead of the .pt file to initialize training. The segmentation weights are not yet released as pretrained .pt files, but you can train from scratch using the YAML configuration. For details, see the YOLO12-seg documentation.

      2
    2. LucasGenoudLucasGenoudGitHub

      Hello, thank you for your answer ! Do you have any date estimation of when the pretrained segmentation models for YOLO12 will be available ? Thanks

    3. Glenn JocherGlenn JocherUltralytics

      We don't have an official release date for YOLO12-seg pretrained weights yet, but you can train segmentation models from scratch using the YOLO12-seg.yaml configuration. For updates, please monitor the YOLO12 documentation.

    4. Glenn JocherGlenn JocherUltralytics

      Thank you for your kind words! We don't have a specific release date for YOLO12-seg pretrained weights yet, but you can monitor the YOLO12 documentation for updates. The team typically announces new model releases there first. For now, training from scratch using the YOLO12-seg.yaml configuration remains the recommended approach.

  2. dolokbutarbutar24dolokbutarbutar24GitHub

    Here are some sample images for the healthy class. I also attached some "results" images, hopefully can give more information so you guys can help me with the project.

    Pada Sen, 30 Mar 2026 pukul 15.58 Glenn Jocher @.***> menulis:

    Thanks for dropping this question here so the Ultralytics team can see it; for leaf-disease datasets, mAP50-95 usually improves more from cleaner labels, balanced class counts, harder negative samples, and reviewing per-class PR/confusion outputs than from pushing loss weights alone, so I’d next tune weight_decay, momentum, warmup_epochs, lrf, translate, shear, perspective, fliplr, and close_mosaic using the hyperparameter tuning guide https://docs.ultralytics.com/guides/hyperparameter-tuning/ and performance metrics guide https://docs.ultralytics.com/guides/yolo-performance-metrics/. If you can share a few sample images, labels, and training curves here, we can suggest a tighter search space, and it’s also worth benchmarking the same split with YOLO26 https://docs.ultralytics.com/models/yolo26/ since YOLO12 is mainly maintained as a community research model.

    — Reply to this email directly, view it on GitHub https://github.com/orgs/ultralytics/discussions/19360?email_source=notifications&email_token=A23CVICPPIXOD6F3LMBB52T4TIZKDA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRTG44DGNRZUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-16378369, or unsubscribe https://github.com/notifications/unsubscribe-auth/A23CVIG2PM2BD5335IFZQXT4TIZKDAVCNFSM6AAAAABXS26SR6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMMZXHAZTMOI . You are receiving this because you commented.Message ID: @.*** com>

    1. Glenn JocherGlenn JocherUltralytics

      Thanks, that helps; from those samples I’d next verify that the healthy labels are fully consistent and that the class counts are not skewed, then please attach a few matching image/label .txt pairs plus results.csv and confusion_matrix_normalized.png so we can check whether this is a data issue rather than a YOLO12 training issue, and if you recently fixed labels please delete any labels/*.cache files before retraining.

  3. dolokbutarbutar24dolokbutarbutar24GitHub

    I am currently working on a project to detect cassava leaf diseases using YOLOv12. The focus of this research is to perform hyperparameter tuning and also determine the most suitable augmentation configuration to improve model performance. So far, the trained model is still hovering around the 0.5 range for the mAP@50-95 evaluation metric. Here are the hyperparameters I have used for tuning so far: epochs=100, patience=20, imgsz=1024, batch=8, optimizer='auto', lr0=0.00511, box=6.32971, cls=2.87957, dfl=2.12658, mosaic=0.25, scale=0.15, mixup=0.0, copy_paste=0.0, degrees=10.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4.

    What other strategies can I do to improve my model's performance, especially on the mAP@50-95 evaluation metric? Do you have any suggestions for other hyperparameters that need to be added to this project for tuning? I'm sure your experience and skills can answer that and help me hahaha.

    1. Glenn JocherGlenn JocherUltralytics

      Thanks for dropping this question here so the Ultralytics team can see it; for leaf-disease datasets, mAP50-95 usually improves more from cleaner labels, balanced class counts, harder negative samples, and reviewing per-class PR/confusion outputs than from pushing loss weights alone, so I’d next tune weight_decay, momentum, warmup_epochs, lrf, translate, shear, perspective, fliplr, and close_mosaic using the hyperparameter tuning guide and performance metrics guide. If you can share a few sample images, labels, and training curves here, we can suggest a tighter search space, and it’s also worth benchmarking the same split with YOLO26 since YOLO12 is mainly maintained as a community research model.

  4. ClousyClousy

    在5090 32G上使用yolo12l训练模型的时候,数据量大概7万左右,batch_size=24 内存占用在24G左右,为啥速度只有2-3it/s 是哪里设置有问题?下面是训练参数: rain_args = dict( data="data.yaml", epochs=500, imgsz=640, batch=24, device=device, workers=16,

        cache=False,      
        amp=True, 
        
        # --- 减少 CPU 负担 ---
        mosaic=0.0,        # 暂时关掉 Mosaic 看看速度是否飙升
        mixup=0.0,         # 同上
    )
    1. Glenn JocherGlenn JocherUltralytics

      yolo12l 本身是重注意力结构,吞吐会比同尺度的 CNN 系列低不少,所以你看到的 2–3 it/s 在 batch=24 下未必异常(折算大约是 48–72 img/s);如果你目标是更高训练/CPU 端速度,建议直接换到更稳更快的 Ultralytics YOLO26(YOLO12 更偏研究/基准用途,见 YOLO12 文档)。想确认是不是环境/数据读取瓶颈的话,请把 yolo checks 输出和完整文本训练日志(含第一轮的进度条行、CUDA:/显卡名、DataLoader 相关信息)贴在这里;另外你现在 cache=False 可能会被磁盘 IO 卡住、workers=16 在部分系统上也会造成额外调度开销,建议先用下面这组参数做一次对照测试(同一数据/同一 imgsz),看 it/s 是否明显变化:

      yolo checks
      yolo train model=yolo12l.pt data=data.yaml epochs=2 imgsz=640 batch=24 device=0 workers=8 cache=True mosaic=0.0 mixup=0.0
  5. dolokbutarbutar24dolokbutarbutar24GitHub

    is there any video (tutorial) about how to classify plant disease? i'm confused about how to do it because i need guidance to do classify task

    1. Glenn JocherGlenn JocherUltralytics(edited)

      Yes—plant disease is just a standard image classification workflow; please follow the Ultralytics YOLO classification guide (and drop any follow-up questions here in this discussion so the Ultralytics team can see them), then try:

      from ultralytics import YOLO
      
      # ImageNet-pretrained classifier backbone (recommended starting point)
      model = YOLO("yolo26n-cls.pt")
      
      # Your dataset folder should contain train/ and val/ with one subfolder per class
      model.train(data="path/to/plant_disease_dataset", epochs=50, imgsz=224)

      If you share your dataset folder layout (just the directory tree) and what’s confusing you, I can point you to the exact next step.

  6. asad121101asad121101GitHub

    Hello , this new yolo12 is using what architecture in neck ? pan or fpn ? or some thing else ?

  7. Sourabh0052Sourabh0052GitHub

    while working on classification model using YOLO12-cls and i do not make any .yaml file, just simply provide the data source path then will it work same or not

  8. radadiavasuradadiavasuGitHub

    I faced a problem that recently I put my model on training with yolo12x but at 98/100 epoch it stopped due to units are over on colab pro but when I start again and expect to start from 98 but it start from 1/100 instead of 98 even in results.csv I couldn't get anything. Why this problem occurs?

  9. deldanrdeldanrGitHub

    When resuming a training session started with Yolov12, after the AMP check, the training session downloads a Yolov11 model to continue, which I assume is an error.

    Attached is part of the log: YOLOv12l summary: 488 layers, 26,389,875 parameters, 26,389,859 gradients, 89.4 GFLOPs

    Transferred 1245/1245 items from pretrained weights Freezing layer 'model.21.dfl.conv.weight' AMP: Running Automatic Mixed Precision (AMP) checks... Downloading https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt to 'yolo11n.pt'... <-- Here's the error

  10. pvurdapvurdaGitHub

    Has anyone found a low-cost, low-latency way to generate a short semantic scene caption (e.g., “two people loading a van”) on top of YOLO12 detections in real time?