--- library_name: onnx license: apache-2.0 tags: - foundation - amd - rocm - image-to-image pipeline_tag: image-to-image --- ![](https://huggingface.co/AMD-PAVS-AI/esrgan/resolve/main/esrgan.png) # ESRGAN: Optimized for AMD ROCm ESRGAN (Enhanced Super-Resolution Generative Adversarial Network) reconstructs a high-resolution image from a low-resolution input, upscaling 4× (250×250 → 1000×1000). This repository packages inference for image super-resolution 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 ESRGAN found [here](https://arxiv.org/abs/1809.00219). This repository contains configurations and scripts optimized for **AMD® ROCm™** platforms. You can use the [esrgan AMD scripts](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/esrgan) to reproduce results or export with custom configurations. More details on model performance can be found [here](#accuracy-pipeline). --- ## Task Overview **Task:** Image super-resolution (4× upscaling) **Dataset:** DIV2K validation set (100 HR images; 20 center-cropped 1000×1000 HR / 250×250 LR pairs prepared by default) **Output metrics:** PSNR (dB), SSIM, latency/throughput > **Backend note:** The shipped model is an INT8 QDQ-quantized ONNX model with static NHWC shapes for cross-device compatibility; benchmark/profile precision flags select the execution/quantization path applied at run time. --- ## 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/INT8), GPU (MIGraphX execution provider — FP32/FP16/INT8), and NPU (VitisAI execution provider, auto-quantized internally). - No code changes required versus the upstream ESRGAN implementation — only environment/runtime configuration differs. - GPU and NPU both degrade output quality relative to CPU on this particular model — see Accuracy Pipeline for measured results. | Runtime | Precision | Backend | Hardware | Notes | |---|---|---|---|---| | ONNX Runtime | FP32 / INT8 | CPU Execution Provider | AMD CPU | Reference quality path | | ONNX Runtime | FP32 / FP16 / INT8 | MIGraphX Execution Provider | AMD Instinct™ / Radeon™ GPU (ROCm) | Quality degrades vs. CPU on this model | | ONNX Runtime | Auto | VitisAI Execution Provider | AMD Ryzen AI NPU | Auto-quantized internally; quality degrades further | --- ## Getting Started For setup instructions, evaluation scripts, and custom configuration options, see the [esrgan on GitHub](https://github.com/AMD-PAVS/physical_ai_sdk/blob/main/models/esrgan). --- ## Model Details **Model Type:** Generative adversarial network for image super-resolution **Base Model:** ESRGAN (INT8 QDQ-quantized ONNX export) **Model Stats:** - Input: `(1, 250, 250, 3)` float32, NHWC, normalized to [0, 1] - Output: `(1, 1000, 1000, 3)` float32, NHWC (4× upscaled) - Precision tested: FP32, FP16, INT8 (shipped model is INT8-QDQ) --- ## Accuracy Pipeline Higher is better for both metrics — they measure how closely the upscaled image matches the ground truth. PSNR has no fixed ceiling (an exact match is infinite dB; typical super-resolution scores fall in the ~20–35 dB range), while SSIM is bounded in [0, 1] where 1.0 is a perfect structural match. ### Metrics Explained | Metric | Description | |--------|-------------| | PSNR (dB) | Peak Signal-to-Noise Ratio — a pixel-level fidelity measure derived from mean squared error. Higher means less per-pixel distortion, but can rate a blurry-but-aligned image well even when fine texture is lost — which is why it is paired with SSIM. | | SSIM | Structural Similarity Index — compares local luminance, contrast, and structure rather than raw pixel error. Higher means the output preserves edges and texture the way a human viewer perceives structure. | ### Accuracy Results **Full Dataset Evaluation (DIV2K validation, 20 image pairs, INT8-QDQ model)** — filled from `evaluation_results/eval_results__int8.json`; run `make metrics` to refresh: | Device | Precision | PSNR (dB) | SSIM | Images | |--------|-----------|-----------|------|--------| | CPU | INT8 | 22.68 | 0.7152 | 20 | | GPU | INT8 | 11.29 | 0.1701 | 20 | | NPU | INT8 | 5.06 | 0.1775 | 20 | --- ## 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/esrgan)** The GitHub repository includes: - Benchmark, profile, and evaluation Makefile targets for CPU, GPU, and NPU - DIV2K dataset staging and PSNR/SSIM evaluation pipeline - INT8-QDQ ONNX export used across all device targets - Benchmarking and reproduction instructions