amd/ryzenai-hrnet-bg-seg
By amd · ↓ 0 · ♥ 0 · Updated 2026-01-21
What's in this repo
This page lists the files in amd/ryzenai-hrnet-bg-seg, including seg_hrnet_nchw_fp32.onnx, seg_hrnet_nchw_u8s8.onnx.
- 2 ONNX models (.onnx files)
- 11 files, including 4 .py, 2 .txt, 2 .onnx, 1 .md
- Last updated 2026-01-21
ONNX files
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
HRNet for background segmentation
The model operating at 512x512 resolution for semantic background segmentation on images.
It was introduced in the paper Object-Contextual Representations for Semantic Segmentation by Yuhui Yuan et al.
We have developed a modified version optimized for AMD Ryzen AI.
Model description
HRNet is an advanced deep learning architecture designed for image segmentation tasks. It maintains high-resolution representations throughout the network, enabling precise semantic segmentation with accurate spatial details.
Intended uses & limitations
You can use this model for background segmentation tasks. See the model hub for all available hrnet-bg-seg models.
How to use
Installation
# inference only
pip install -r requirements-infer.txt
# inference & evaluation
pip install -r requirements-eval.txt
Data Preparation (optional: for evaluation)
Run python download_dut_omron.py to automatically download and extract the DUT-OMRON dataset into the datasets directory.
Alternatively, you can manually download DUT-OMRON Dataset Images and Pixel-wise Ground Truth from the DUT-OMRON page, then extract both archives into datasets.
Your datasets folder should look like this:
datasets
├── DUT-OMRON-image
│ ├── im005.jpg
│ ├── ...
└── pixelwiseGT-new-PNG
├── im005.png
├── ...
Test & Evaluation
- Run inference on images
python onnx_inference.py --onnx seg_hrnet_nchw_u8s8.onnx --input /Path/To/Your/Image --out-dir outputs
Arguments:
--input: Accepts either a single image file path or a directory path. If it's a file, the script will process that image only. If it's a directory, the script will recursively scan for .png, .jpg, and .jpeg files and process all of them.
--out-dir: Output directory where the restored images will be saved.
- Evaluate the quantized model
python onnx_eval.py \
--onnx seg_hrnet_nchw_u8s8.onnx \
--img-dir datasets/DUT-OMRON-image \
--gt-mask-dir datasets/pixelwiseGT-new-PNG \
--out-dir outputs/
Performance
| Model | MAE(⬇) | s-measure(⬆) | max f-measure(⬆) | weighted f-measure(⬆) |
|---|---|---|---|---|
| HRNet (fp32) | 0.0803 | 0.7586 | 0.6867 | 0.6570 |
| HRNet (u8s8) | 0.0789 | 0.7611 | 0.6892 | 0.6600 |
Note:
- Metrics are calculated on the
DUT-OMRONdataset. - Evaluation uses PySODMetrics v1.6.0 as the evaluation tool.
@article{YuanCW19,
title={Object-Contextual Representations for Semantic Segmentation},
author={Yuhui Yuan and Xilin Chen and Jingdong Wang},
booktitle={ECCV},
year={2020}
}
Model info
Created: 2026-01-21
Updated: 2026-01-21
View on Hugging Face