--- library_name: onnx license: agpl-3.0 tags: - foundation - amd - rocm - object-detection pipeline_tag: object-detection --- ![](https://huggingface.co/AMD-PAVS-AI/yolov12/resolve/main/yolo12.png) # YOLO12: Optimized for AMD ROCm YOLO12 is a real-time object detection model that detects and localizes objects across 80 COCO categories in a single forward pass. This repository packages inference for object detection using **ONNX Runtime**, exported and validated for **AMD ROCm** so it runs efficiently on AMD GPUs, CPUs, and NPUs. This is based on the implementation of YOLO12 found [here](https://github.com/ultralytics/ultralytics). This repository contains configurations and scripts optimized for **AMD® ROCm™** platforms. You can use the [yolov12 AMD scripts](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/yolov12) to reproduce results or export with custom configurations. More details on model performance can be found [here](#accuracy-pipeline). --- ## Task Overview **Task:** Object detection **Dataset:** COCO val2017 (5,000 images, 80 categories) **Output metrics:** mAP@0.5:0.95, mAP@0.5, mAP@0.75, Precision, Recall (AR@100), per-size mAP (small/medium/large) > **Model variants:** Default is **m**. Override with `MODEL_SIZE=s/m/l/x`. --- ## AMD ROCm Optimization This model export has been adapted and validated for **AMD Instinct™ / Radeon™ GPUs** running **ROCm**, as well as AMD CPUs and AMD Ryzen AI NPUs. Key points: - Validated backends: **ONNX Runtime** across CPU (FP32), GPU (MIGraphX Execution Provider — FP32/FP16/BF16/INT8), and NPU (VitisAI Execution Provider, auto-quantized internally). - No code changes required versus the upstream Ultralytics YOLO12 implementation — only environment/runtime configuration differs. - First NPU run takes 5–10 minutes for model compilation; subsequent runs use the cached compiled model. | Runtime | Precision | Backend | Hardware | Notes | |---|---|---|---|---| | ONNX Runtime | FP32 | CPU Execution Provider | AMD CPU | — | | ONNX Runtime | FP32 / FP16 / BF16 / INT8 | MIGraphX Execution Provider | AMD Instinct™ / Radeon™ GPU (ROCm) | — | | ONNX Runtime | Auto | VitisAI Execution Provider | AMD Ryzen AI NPU | Auto-quantized internally; first run compiles in 5–10 minutes | --- ## Getting Started For setup instructions, evaluation scripts, and custom configuration options, see the [yolov12 on GitHub](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/yolov12). --- ## Model Details **Model Type:** Object detection (single-pass CNN detector) **Base Model:** YOLO12 (Ultralytics), size `m` default **Model Stats:** - Input: `(1, 3, 640, 640)` float32 - Output: `(1, 84, 8400)` float32 - Precision tested: FP32 (CPU); FP32, FP16, BF16, INT8 (GPU); auto-quantized (NPU) --- ## Accuracy Pipeline COCO quality evaluation is fully implemented — `make eval-fulldataset-` runs inference across all 5,000 COCO val2017 images and computes official COCO metrics via `pycocotools`. Higher mAP means the model's predicted boxes and classes agree more closely with ground truth across the dataset — 1.0 would be perfect detection, 0.0 means no correct detections. In practice, values above ~0.5 for mAP@0.5:0.95 are considered strong for COCO-scale object detection. ### Metrics Explained | Metric | Description | |--------|-------------| | mAP@0.5:0.95 | Primary COCO metric — mean AP averaged across IoU thresholds 0.5–0.95. The strictest, most holistic accuracy number; higher means boxes are both correctly classified and tightly localized across a range of overlap thresholds. | | mAP@0.5 | AP at a single, looser IoU threshold of 0.5 (VOC-style) — a prediction only needs to overlap the ground-truth box by 50% to count as correct, so this is typically higher than mAP@0.5:0.95 and reflects "did it find the object" more than "how precisely." | | mAP@0.75 | AP at a stricter IoU threshold of 0.75 — the predicted box must overlap ground truth by 75%, rewarding precise localization, not just correct detection. | | Precision | Of all boxes the model predicted, what fraction were correct — high precision means few false positives. | | Recall (AR@100) | Of all ground-truth objects, what fraction did the model find within its top 100 detections per image — high recall means few missed objects. | | mAP-small/medium/large | mAP@0.5:0.95 broken down by object size — small objects are typically the hardest, exposing size-specific weaknesses a single aggregate score would hide. | ### Accuracy Results **Full Dataset Evaluation (COCO val2017)** — `MODEL_SIZE=m`: | Device | Precision | mAP@0.5:0.95 | mAP@0.5 | mAP@0.75 | Precision | Recall | |--------|-----------|--------------|---------|----------|-----------|--------| | CPU | FP32 | 0.5141 | 0.6855 | 0.5568 | 0.4615 | 0.5623 | | GPU | FP16 | 0.5137 | 0.6855 | 0.5555 | 0.4611 | 0.5616 | | NPU | FP32 | 0.3164 | 0.4701 | 0.3458 | 0.2854 | 0.3582 | **Note:** NPU quality may differ from CPU/GPU due to VitisAI's internal BF16 quantization. First NPU run takes 5–10 minutes for model compilation; subsequent runs use the cached compiled model. --- ## Dig Deeper Want to explore the full evaluation scripts, config options, and other AMD-optimized model examples? 📂 **[View the full project on GitHub](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/yolov12)** The GitHub repository includes: - Setup and prerequisites for ROCm environments - Full COCO val2017 evaluation pipeline via `pycocotools` - Per-operator latency profiling scripts (including NPU AI Analyzer integration) - Benchmarking and reproduction instructions across CPU, GPU, and NPU