realesr-animevideov3 — ONNX (fp32 for DirectML, bf16 for the AMD Ryzen AI NPU)
Fixed-shape ONNX exports of realesr-animevideov3 (Real-ESRGAN, SRVGGNetCompact, 4x, anime video) by Xintao Wang, from the weights published in xinntao/Real-ESRGAN.
*_fp32.onnxruns on any ONNX Runtime execution provider. It is used with DirectML on an AMD iGPU.*_bf16cast.onnxis for the ONNX Runtime VitisAI execution provider of Ryzen AI Software 1.8.0 on an XDNA2 NPU.
Input is RGB in [0, 1], float32, NCHW, 3 channels. Output is 4x the input height and width.
Files
| File | Input → output | Precision | Target | SHA-256 |
|---|---|---|---|---|
animevideov3_nchw_256x256_fp32.onnx | 1x3x256x256 → 1x3x1024x1024 | fp32 | DirectML / CPU | 139f166bd2b955c7d4cd31ca2616eb97dacc4365c1c315d880735ce72a0663d9 |
animevideov3_nchw_512x512_fp32.onnx | 1x3x512x512 → 1x3x2048x2048 | fp32 | DirectML / CPU | 8490f877bc3461ad0d8d7f256549ab1560e25ccb72ed8500ec6396c41935d691 |
animevideov3dp_nchw_512x512_bf16cast.onnx | 1x3x512x512 → 1x3x2048x2048 | bf16 (cast) | VitisAI EP, whole model | 3360e2c051d4ee7ee80452066d8a1a64fa3cba030f464df7926eaf1d746dac4a |
animevideov3dp_body_nchw_512x512_bf16cast.onnx | 1x3x512x512 → 1x48x512x512 | bf16 (cast) | VitisAI EP, body only | 9debfe8a17eeb8b4c3e8ee72fd6cb3b29ea6f0f49338136267f68d5e95fb11cd |
animevideov3dp_body_nchw_512x512.tail.json | manifest for the body | — | CPU post-processing | aeb0d93ffd4bc066a60bf787612aad6a299a27f0ec4637bafbf283706ee2b2d9 |
dp in a file name means the PReLU activations are decomposed into two ReLU branches
(PReLU(x) = ReLU(x) - a * ReLU(-x)), which the VAIML compiler of Ryzen AI 1.8.0 maps onto the NPU as a
single subgraph.
The body file is the same bf16 model with the final DepthToSpace(blocksize=4, CRD) and the
nearest-neighbour skip connection (Resize + Add) cut off. The manifest describes that tail; the host
runs it on the CPU with a few lines of NumPy. This moves a memory-bound operation off the NPU and
produces output bit-identical to the whole model
(tail-cut.md).
How the files were made
- Weights
realesr-animevideov3.pth→ fixed-shape fp32 ONNX withscripts/npu/export_animevideov3.py(SRVGGNetCompact reimplementation, opset 17, no dynamic axes, onnxsim). Thedpvariant is the same export with PReLU decomposed. - fp32 → bf16:
python -m quark.onnx.tools.convert_fp32_to_bf16 --input <dp fp32> --output <dp bf16cast> --format with_cast(AMD Quark, from the Ryzen AI 1.8.0 environment; no calibration data). - Tail cut:
scripts/npu/split_tail.py, which also verifiesbody + NumPy tail == whole modelon the CPU EP (max abs diff < 1e-5).
Running on the NPU
The VitisAI EP compiles the bf16 model with VAIML when the first session is created. On a Ryzen AI 7 PRO 350
this takes about 15 minutes and up to 1.9 GB of RAM; the result is cached (cache_dir / cache_key session
options) and later sessions start in seconds. The cache is tied to the Ryzen AI Software and NPU driver
versions, so it is not published here; compile it on the target machine.
Measured on a Ryzen AI 7 PRO 350 (XDNA2 NPU, Radeon 860M, 32 GB LPDDR5-8000, Ryzen AI SW 1.8.0, NPU driver 32.0.203.329), one 854x480 frame → 4x, including tiling and merge, steady state:
| Execution | Time per frame | PSNR vs fp32 output |
|---|---|---|
| iGPU, DirectML, fp32 (256–512 tiles) | 0.46 s | — |
| NPU, VitisAI EP, bf16, power mode Default (512 tiles) | 0.47 s | 49.4 dB |
| NPU, VitisAI EP, bf16, power mode Turbo | 0.35 s | 49.4 dB |
Details of the measurement, the compiler workarounds and the tail cut are in tomhda/ryzen-ai-npu-super-resolution-notes.
License and attribution
The model weights are by Xintao Wang and contributors, released under the
BSD 3-Clause License (xinntao/Real-ESRGAN). The ONNX files
here are format conversions of those weights and carry the same license; the original notice is in
LICENSE-BSD-3-Clause-Real-ESRGAN.txt.
This is an independent, personal conversion. It is not affiliated with or endorsed by AMD or the Real-ESRGAN authors. AMD, Ryzen and Ryzen AI are trademarks of Advanced Micro Devices, Inc.
These files are also the model kit of TOGU SCALER, a Windows upscaler that runs them on DirectML and on the Ryzen AI NPU.