--- library_name: ultralytics license: agpl-3.0 tags: - foundation - amd - rocm - image-segmentation pipeline_tag: image-segmentation --- ![](https://huggingface.co/AMD-PAVS-AI/yolo26_segment/resolve/main/yolo26_segment.png) # YOLO26-seg: Optimized for AMD ROCm YOLO26 is a real-time instance segmentation model that detects objects and produces pixel-level masks across 80 COCO categories in a single forward pass. This repository packages inference for instance segmentation using **ONNX Runtime** (CPU, NPU) and **PyTorch** (GPU), exported and validated for **AMD ROCm** so it runs efficiently on AMD GPUs, CPUs, and NPUs. This is based on the implementation of YOLO26 found [here](https://github.com/ultralytics/ultralytics). This repository contains configurations and scripts optimized for **AMD® ROCm™** platforms. You can use the [yolo26_segment AMD scripts](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/yolo26_segment) to reproduce results or export with custom configurations. More details on model performance can be found [here](#accuracy-pipeline). --- ## Task Overview **Task:** Instance segmentation **Dataset:** COCO val2017 (5,000 images, 80 categories) **Output metrics:** Mask mAP@0.5:0.95, Mask mAP@0.5, Mask mAP@0.75, Bbox mAP, Mask Precision, Mask Recall, Mask F1, per-size Mask mAP (small/medium/large) > **Model variants:** Default is **n**. Override with `MODEL_SIZE=n/s/m/l/x`. > **GPU note:** GPU quality uses PyTorch `.pt` models directly — MIGraphX does not support YOLO segment ONNX ops, so GPU runs FP32 only via PyTorch rather than MIGraphX. --- ## 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** on CPU (FP32) and NPU (VitisAI — auto-quantized internally, BF16), and **PyTorch/ROCm** on GPU (FP32 only). - No code changes required versus the upstream Ultralytics YOLO26-seg 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 | — | | PyTorch | FP32 | ROCm (HIP) | AMD Instinct™ / Radeon™ GPU | MIGraphX does not support segment ONNX ops | | ONNX Runtime | BF16 | 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 [yolo26_segment on GitHub](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/yolo26_segment). --- ## Model Details **Model Type:** Instance segmentation (single-pass CNN detector with mask-proto head) **Base Model:** YOLO26-seg (Ultralytics), size `n` default **Model Stats:** - Input: `(1, 3, 640, 640)` float32 - Output (detections): `(1, 300, 38)` float32 - Output (mask protos): `(1, 32, 160, 160)` float32 - Precision tested: FP32 (CPU, GPU); BF16 (NPU) --- ## Accuracy Pipeline COCO instance segmentation 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 mask mAP means the model's predicted segmentation masks agree more closely with ground-truth masks — 1.0 would be perfect pixel-level segmentation, 0.0 means no correct predictions. In practice, values above ~0.35 for mask mAP@0.5:0.95 are considered strong for COCO-scale instance segmentation. ### Metrics Explained | Metric | Description | |--------|-------------| | Mask mAP@0.5:0.95 | Primary COCO mask metric — mean AP averaged across IoU thresholds 0.5–0.95. The strictest, most holistic segmentation accuracy number; higher means masks are both correctly classified and tightly overlap ground-truth at a range of overlap thresholds. | | Mask mAP@0.5 | Mask AP at a single, looser IoU threshold of 0.5 — a prediction only needs 50% pixel overlap with the ground-truth mask 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 precise is the mask boundary." | | Mask mAP@0.75 | Mask AP at a stricter IoU threshold of 0.75 — the predicted mask must overlap ground truth by 75%, rewarding precise boundary delineation, not just correct detection. | | Bbox mAP | Bounding-box mAP@0.5:0.95 — measures detection quality (box localization) independently of mask quality, useful for isolating whether errors come from detection or segmentation. | | Mask Precision | Of all mask predictions the model produced, what fraction were correct — high precision means few false positive masks. | | Mask Recall | Of all ground-truth objects, what fraction did the model find within its top 100 detections per image — high recall means few missed objects. | | Mask F1 | Harmonic mean of mask precision and recall — balances the tradeoff between finding all objects and avoiding false detections. | | Mask mAP-small/medium/large | Mask mAP@0.5:0.95 broken down by object size — small objects are typically the hardest to segment, exposing size-specific weaknesses a single aggregate score would hide. | ### Accuracy Results **Full Dataset Evaluation (COCO val2017)** — `MODEL_SIZE=n`: | Device | Precision | Mask mAP@0.5:0.95 | Mask mAP@0.5 | Mask mAP@0.75 | Bbox mAP | Mask Precision | Mask Recall | |--------|-----------|-------------------|--------------|---------------|----------|----------------|-------------| | CPU | FP32 | 0.3340 | 0.5258 | 0.3528 | 0.3962 | 0.3031 | 0.4244 | | GPU | FP32 | 0.2757 | 0.4774 | 0.2777 | 0.3954 | 0.2534 | 0.3617 | | NPU | BF16 | 0.0008 | 0.0022 | 0.0005 | 0.0041 | 0.0007 | 0.0020 | **Note:** GPU quality uses PyTorch `.pt` models directly (MIGraphX does not support segment ONNX ops). CPU mask mAP is higher than GPU because the ONNX post-NMS postprocessing applies tighter bbox-cropped masks. NPU quality is severely degraded by VitisAI's internal BF16 quantization — the model produces very few detections (bbox mAP drops from ~0.40 to 0.004), making NPU unsuitable for accuracy-critical workloads with this 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/yolo26_segment)** 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