HRNetv2-W48: Optimized for AMD ROCm
HRNetv2-W48 is a semantic segmentation model that assigns a class label to every pixel while maintaining high-resolution feature representations throughout the network. 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 HRNetv2 found here. This repository contains configurations and scripts optimized for AMD® ROCm™ platforms. You can use the hrnetv2 AMD scripts to reproduce results or export with custom configurations. More details on model performance can be found here.
Task Overview
Task: Semantic segmentation
Dataset: Cityscapes val (500 images) · ADE20k val · LIP val (variant-specific)
Output metrics: mIoU (mean Intersection over Union), pixel accuracy, mean class accuracy
Model variants: Default is Cityscapes at 1024×2048 (paper mIoU 80.9%). Override with
HRNET_VARIANTorHRNET_MODEL(e.g.export HRNET_MODEL=ade20k) or runmake set-variant VARIANT=MODEL_LIPfor a persistent override. Runmake list-variantsfor aliases.
NPU note: NPU float precisions (FP32/FP16/BF16) use per-dtype
config/vitisai_config_*.json; NPU INT8 requiresmake quantize-npu-int8before benchmark/eval.
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, GPU (MIGraphX execution provider), and NPU (VitisAI execution provider).
- No code changes required versus the upstream HRNet implementation — only environment/runtime configuration differs.
- CPU fallback path supported for environments without a ROCm-capable GPU.
| Runtime | Precision | Backend | Hardware | Notes |
|---|---|---|---|---|
| ONNX Runtime | FP32 / FP16 / BF16 / INT8 | CPU Execution Provider | AMD CPU | — |
| ONNX Runtime | FP32 / FP16 / BF16 / INT8 | MIGraphX Execution Provider | AMD Instinct™ / Radeon™ GPU (ROCm) | — |
| ONNX Runtime | FP32 / FP16 / BF16 / INT8 | VitisAI Execution Provider | AMD Ryzen AI NPU | INT8 requires Quark calibration via make quantize-npu-int8 |
Getting Started
For setup instructions, evaluation scripts, and custom configuration options, see the hrnetv2 on GitHub.
Model Details
Model Type: Semantic segmentation, HRNetv2-W48
Base Model: HRNet/HRNet-Semantic-Segmentation (HRNetv2-W48)
Model Stats:
- Model variant: Cityscapes, 1024×2048 input (default) — ADE20k (520×520) and LIP (473×473) also supported
- Precision tested: FP32, FP16, BF16, INT8
Accuracy Pipeline
Higher mIoU means predicted pixel labels agree more closely with ground truth — 100% is perfect overlap, 0% is no agreement.
Metrics Explained
| Metric | Description |
|---|---|
| mIoU | Primary segmentation metric — mean Intersection-over-Union averaged across all classes. Higher means better boundary alignment and class assignment across the validation set. |
| Pixel accuracy | Fraction of correctly labeled pixels — rewards overall coverage but can hide poor performance on rare classes. |
| Mean class accuracy | Average per-class accuracy — exposes imbalance when large classes dominate pixel accuracy. |
Accuracy Results
Full Dataset Evaluation (Cityscapes val) — filled from evaluation_results/; run make metrics to refresh:
| Device | Backend | Precision | Variant | Accuracy (%) |
|---|---|---|---|---|
| CPU | ONNX Runtime | FP32 | Cityscapes | 40.54 |
| CPU | ONNX Runtime | FP16 | Cityscapes | 40.75 |
| CPU | ONNX Runtime | BF16 | Cityscapes | 40.82 |
| CPU | ONNX Runtime | INT8 | Cityscapes | 40.99 |
| GPU | ONNX Runtime | FP32 | Cityscapes | 40.86 |
| GPU | ONNX Runtime | FP16 | Cityscapes | 40.63 |
| GPU | ONNX Runtime | BF16 | Cityscapes | 40.67 |
| GPU | ONNX Runtime | INT8 | Cityscapes | 40.82 |
| NPU | ONNX Runtime | FP32 | Cityscapes | 40.49 |
| NPU | ONNX Runtime | FP16 | Cityscapes | 41.10 |
| NPU | ONNX Runtime | BF16 | Cityscapes | 40.92 |
| NPU | ONNX Runtime | INT8 | Cityscapes | 0.00 |
Dig Deeper
Want to explore the full evaluation scripts, config options, and other AMD-optimized model examples?
📂 View the full project on GitHub
The GitHub repository includes:
- Benchmark, profile, and evaluation Makefile targets for CPU, GPU, and NPU
- Dataset staging for Cityscapes, ADE20k, and LIP variants
- ONNX export scripts and the patched upstream HRNet evaluation tooling
- Additional HRNetv2-W48 variants (Cityscapes, ADE20k, LIP)
