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-OMRON dataset.
  • 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}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including amd/ryzenai-hrnet-bg-seg