|
| 1 | +# YOLO26 - Semantic Segmentation |
| 2 | + |
| 3 | +YOLO26 is the latest addition to the Ultralytics YOLO model series. The semantic segmentation variant assigns a class label to every pixel in an image, producing dense scene-level masks rather than per-object instances. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +YOLO26 for semantic segmentation pairs the efficient YOLO26 backbone with a dense per-pixel prediction head. Key features include: |
| 8 | + |
| 9 | +- **Per-pixel classification** - Every pixel is assigned a single class label. |
| 10 | +- **Efficient YOLO26 backbone** - Shares the NMS-free, DFL-free YOLO26 architecture for fast inference and broad edge compatibility. |
| 11 | +- **Cityscapes pre-trained checkpoints** - Public weights trained on the 19-class Cityscapes dataset, available across all model sizes. |
| 12 | +- **Binary and multi-class** - Supports a single foreground class (binary head) or many foreground classes, alongside an implicit background. |
| 13 | +- **Multiple model sizes** - From nano to extra-large variants. |
| 14 | + |
| 15 | +## License |
| 16 | + |
| 17 | +**AGPL-3.0** |
| 18 | + |
| 19 | +!!! info "Commercial Licensing" |
| 20 | + - **AGPL-3.0**: Free for open-source projects. Requires derivative works to be open-sourced. |
| 21 | + - **Paid Roboflow customers**: Automatically get access to use any YOLO26 models trained on or uploaded to the Roboflow platform for commercial use. |
| 22 | + - **Free Roboflow customers**: Can use YOLO26 via the serverless hosted API, or commercially self-hosted with a paid plan. |
| 23 | + |
| 24 | + Learn more: [Roboflow Licensing](https://roboflow.com/licensing) | [YOLO26 License Details](https://roboflow.com/model-licenses/yolo26) |
| 25 | + |
| 26 | +## Pre-trained Model IDs |
| 27 | + |
| 28 | +Public YOLO26 semantic segmentation checkpoints are trained on the **Cityscapes** dataset (19 classes) at 1024×1024 and are **open access** (no API key required). |
| 29 | + |
| 30 | +| Model Size | 1024×1024 | |
| 31 | +|------------|-----------| |
| 32 | +| Nano | `yolo26n-sem-1024` | |
| 33 | +| Small | `yolo26s-sem-1024` | |
| 34 | +| Medium | `yolo26m-sem-1024` | |
| 35 | +| Large | `yolo26l-sem-1024` | |
| 36 | +| Extra-Large | `yolo26x-sem-1024` | |
| 37 | + |
| 38 | +**Custom model ID format:** `project-url/version` (e.g., `my-project-abc123/2`) |
| 39 | + |
| 40 | +## Supported Backends |
| 41 | + |
| 42 | +| Backend | Extras Required | |
| 43 | +|---------|----------------| |
| 44 | +| `onnx` | `onnx-cpu`, `onnx-cu12`, `onnx-cu118`, `onnx-jp6-cu126` | |
| 45 | +| `torch-script` | `torch-cpu`, `torch-cu118`, `torch-cu124`, `torch-cu126`, `torch-cu128`, `torch-jp6-cu126` | |
| 46 | +| `trt` | `trt10` | |
| 47 | + |
| 48 | +## Roboflow Platform Compatibility |
| 49 | + |
| 50 | +| Feature | Supported | |
| 51 | +|---------|-----------| |
| 52 | +| **Training** | ✅ Train custom models on Roboflow | |
| 53 | +| **Upload Weights** | ✅ Upload pre-trained weights | |
| 54 | +| **Serverless API (v2)** | ✅ [Deploy via hosted API](https://docs.roboflow.com/deploy/serverless-hosted-api-v2) | |
| 55 | +| **Edge Deployment (Jetson)** | ✅ Deploy on NVIDIA Jetson devices | |
| 56 | +| **Self-Hosting** | ✅ Deploy with `inference-models` | |
| 57 | + |
| 58 | +## Usage Example |
| 59 | + |
| 60 | +```python |
| 61 | +import cv2 |
| 62 | +import numpy as np |
| 63 | +from inference_models import AutoModel |
| 64 | + |
| 65 | +# Load a public Cityscapes checkpoint (open access, no API key required) |
| 66 | +model = AutoModel.from_pretrained("yolo26n-sem-1024") |
| 67 | +image = cv2.imread("path/to/image.jpg") |
| 68 | + |
| 69 | +# Run inference |
| 70 | +results = model(image) |
| 71 | + |
| 72 | +# Per-pixel class IDs and confidence |
| 73 | +seg_map = results[0].segmentation_map # (H x W) class id per pixel |
| 74 | +confidence = results[0].confidence # (H x W) per-pixel confidence |
| 75 | + |
| 76 | +# Colour the mask and overlay on the original image |
| 77 | +colors = np.random.randint(0, 255, size=(len(model.class_names), 3), dtype=np.uint8) |
| 78 | +colored_mask = colors[seg_map.cpu().numpy()] |
| 79 | +overlay = cv2.addWeighted(image, 0.5, colored_mask, 0.5, 0) |
| 80 | +cv2.imwrite("segmentation_result.jpg", overlay) |
| 81 | +``` |
| 82 | + |
| 83 | +To run a custom-trained model, pass your `project-url/version` and a Roboflow API key: |
| 84 | + |
| 85 | +```python |
| 86 | +model = AutoModel.from_pretrained( |
| 87 | + "my-project-abc123/2", |
| 88 | + api_key="your_roboflow_api_key", |
| 89 | +) |
| 90 | +``` |
| 91 | + |
| 92 | +## Output Format |
| 93 | + |
| 94 | +The model returns a list of `SemanticSegmentationResult` objects with: |
| 95 | + |
| 96 | +| Field | Type | Description | |
| 97 | +|-------|------|-------------| |
| 98 | +| `segmentation_map` | `torch.Tensor` | Class ID for each pixel (H x W) | |
| 99 | +| `confidence` | `torch.Tensor` | Confidence score for each pixel (H x W) | |
| 100 | +| `image_metadata` | `dict` | Optional metadata about the image | |
| 101 | + |
| 102 | +!!! note "Semantic vs Instance Segmentation" |
| 103 | + Semantic segmentation labels every pixel with a class but does not separate individual objects (all cars share the "car" label). For per-object masks, counting, or tracking, use an instance segmentation model such as [YOLO26 - Instance Segmentation](yolo26-instance-segmentation.md). |
0 commit comments