| --- |
| library_name: onnx |
| license: apache-2.0 |
| tags: |
| - foundation |
| - amd |
| - rocm |
| - image-segmentation |
| pipeline_tag: image-segmentation |
| --- |
| |
|  |
|
|
| # UNet: Optimized for AMD ROCm |
|
|
| UNet-S5-D16 is a convolutional encoder-decoder network for semantic segmentation — it classifies every pixel in an image into one of 19 urban-scene categories (road, sidewalk, building, person, car, etc.). This repository packages inference for semantic segmentation 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 UNet found [here](https://github.com/open-mmlab/mmsegmentation). |
| This repository contains configurations and scripts optimized for **AMD® ROCm™** platforms. You can use the [unet AMD scripts](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/unet) to reproduce results or export with custom configurations. More details on model performance can be found [here](#accuracy-pipeline). |
|
|
| --- |
|
|
| ## Task Overview |
|
|
| **Task:** Cityscapes semantic segmentation (19 classes) |
|
|
| **Dataset:** Cityscapes val split (500 images), downloaded automatically from [HuggingFace](https://huggingface.co/datasets/Antreas/Cityscapes); benchmark inputs from [UrbanSyn](https://huggingface.co/datasets/UrbanSyn/UrbanSyn) |
|
|
| **Output metrics:** mIoU (mean Intersection-over-Union across 19 classes), per-class IoU, pixel accuracy |
|
|
| --- |
|
|
| ## 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 — FP32/FP16/BF16/INT8), and NPU (VitisAI — FP32/FP16/BF16/INT8). |
| - No code changes required versus the upstream UNet-S5-D16 (mmsegmentation) implementation — only environment/runtime configuration differs. |
| - All GPU precisions use a single FP32 ONNX model with runtime quantization via MIGraphX EP options. |
|
|
| | 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) | First run may take 30+ minutes due to graph compilation | |
| | ONNX Runtime | FP32 / FP16 / BF16 / INT8 | VitisAI Execution Provider | AMD Ryzen AI NPU | INT8 requires Quark + Cityscapes calibration quantization step | |
|
|
| --- |
|
|
| ## Getting Started |
|
|
| For setup instructions, evaluation scripts, and custom configuration options, see the [unet on GitHub](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/unet). |
|
|
| --- |
|
|
| ## Model Details |
|
|
| **Model Type:** Semantic segmentation (convolutional encoder-decoder) |
|
|
| **Base Model:** UNet-S5-D16 (mmsegmentation) |
|
|
| **Model Stats:** |
| - Input (`input`): `(1, 3, 512, 1024)` float32 |
| - Output (`output`): `(1, 19, 512, 1024)` float32 |
| - Precision tested: FP32 (CPU); FP32, FP16, BF16, INT8 (GPU) |
|
|
| --- |
|
|
| ## Accuracy Pipeline |
|
|
| Higher mIoU means predicted pixel labels agree more closely with ground truth across all 19 Cityscapes classes — 100% is perfect overlap, 0% is no agreement. Published paper mIoU for UNet-S5-D16 on Cityscapes is 69.10%. |
|
|
| ### Metrics Explained |
|
|
| | Metric | Description | |
| |--------|-------------| |
| | mIoU | Mean Intersection-over-Union averaged across all 19 Cityscapes classes. Higher means better boundary alignment and class assignment. | |
|
|
| ### Accuracy Results |
|
|
| **Cityscapes val mIoU** — UNet-S5-D16 (paper: 69.10%): |
|
|
| <!-- accuracy-table-start --> |
| | Device | Precision | mIoU | |
| |--------|-----------|------| |
| | CPU | FP32 | 69.31% | |
| | GPU | FP32 | 69.31% | |
| | GPU | FP16 | 69.32% | |
| | GPU | BF16 | 69.34% | |
| | GPU | INT8 | 69.31% | |
| <!-- accuracy-table-end --> |
|
|
| --- |
|
|
| ## 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/unet)** |
|
|
| The GitHub repository includes: |
| - Setup and prerequisites for ROCm environments |
| - Cityscapes val and UrbanSyn dataset staging scripts |
| - Full mIoU evaluation pipeline via mmsegmentation Runner |
| - Benchmarking and profiling scripts across CPU, GPU, and NPU |
|
|