HWEnc-onnx-models

August 4, 2026 · View on GitHub

日本語版はこちら / Japanese

Build tools for ONNX models used by --vpp-onnx and --vpp-rife-ov in QSVEnc / NVEnc / VCEEnc. QSVEnc's ONNX deinterlacer uses --vpp-onnx-deint with onnx_deint_models.json; NVEnc and VCEEnc retain the active --vpp-stdeint interface with stdeint_ov_models.json.

Generates 255 --vpp-onnx models (243 FP32 + 12 INT8) across 28 families, 10 RIFE models, two ST-DeInt models, and the MIT-licensed DDD model with a single command: download → convert or extract → INT8 quantize → manifests. DDD is downloaded from a fixed upstream commit and converted from its pinned checkpoint with export_ddd.py.

Quick Start

Linux

# 1. Set up venv (first time only)
bash setup_env.sh

# 2. Full build (download + convert + INT8 quantization + manifests)
.venv_onnx/bin/python run_all.py --output /path/to/output

# 3. Dry run (print plan without executing)
.venv_onnx/bin/python run_all.py --output /path/to/output --dry-run

Windows

REM 1. Set up venv (first time only)
setup_env.bat

REM 2. Full build
.venv_onnx\Scripts\python run_all.py --output C:\path\to\output

REM 3. Dry run
.venv_onnx\Scripts\python run_all.py --output C:\path\to\output --dry-run

run_all.py Options

OptionDescription
--output PATHOutput root directory (required)
--skip-downloadSkip venv setup and downloads
--skip-convertSkip FP32 ONNX conversion
--skip-int8Skip INT8 quantization
--jobs NParallel conversion workers (default: 1)
--dry-runPrint plan without executing

Output Directory Structure

output/
├── _work/              # Intermediate data (can be deleted after build)
│   ├── repos/          #   Cloned source repositories
│   ├── realesrgan/     #   Real-ESRGAN .pth weights
│   └── realcugan_weights/ # Real-CUGAN .pth weights
├── acnet/              # Converted ONNX models (one dir per family)
├── anime3d/
├── anime4k_gan/
├── anime4k_restore/
├── anime4k_upscale/
├── arnet/
├── artcnn/
├── bsrgan/
├── dncnn/
├── dpsr/
├── drunet/
├── edvr/               # QSVEnc/NVEnc --vpp-onnx frames=5
├── edsr/
├── esrgan/
├── fdncnn/
├── ffdnet/
├── fsrcnnx/
├── hdrtvnetpp/
├── nnedi3/
├── ravu/
├── realcugan/
├── realesrgan/
├── rife/               # --vpp-rife-ov models; excluded from models.json
├── stdeint/            # ST-DeInt models; excluded from models.json
├── ddd/                # generated DDD.onnx and LICENSE.txt
├── srmd/
├── waifu2x/
├── websr/
├── models.json              # --vpp-onnx model manifest
├── rife_ov_models.json      # --vpp-rife-ov model manifest
├── stdeint_ov_models.json   # NVEnc/VCEEnc --vpp-stdeint manifest
└── onnx_deint_models.json   # QSVEnc --vpp-onnx-deint manifest

architecture in onnx_deint_models.json is an internal tensor contract (stdeint or ddd), not a public command-line switch. model= is the manifest registration name; direct ONNX paths are not accepted. DDD is distributed in the dedicated onnx_models_<version>_deint_ddd.zip archive with its MIT license and a DDD-only onnx_deint_models.json. ST-DeInt remains excluded from release archives because its upstream license is still Unknown.

Deinterlacer manifests by backend

BackendOptionManifestRegistered names
QSVEnc--vpp-onnx-deint model=<name>onnx_deint_models.jsonstdeint, stdeint_fast, DDD
NVEnc / VCEEnc--vpp-stdeint model=<name>stdeint_ov_models.jsonstdeint, stdeint_fast

The two manifests are kept separate because each backend consumes a different registry. They are generated together by run_all.py; only the QSVEnc manifest records architecture metadata.

Model Families

FamilySource TypeFP32INT8Total
acnetGLSL12-12
anime3dGLSL2-2
anime4k_ganGLSL6-6
anime4k_restoreGLSL6-6
anime4k_upscaleGLSL10-10
arnetGLSL16-16
artcnnONNX (upstream)18624
bsrganPyTorch .pth3-3
dncnnPyTorch .pth6-6
dpsrPyTorch .pth415
dddPyTorch .pt1-1
drunetPyTorch .pth415
edvrPyTorch .pth2-2
edsrPyTorch .pth3-3
esrganPyTorch .pth5-5
fdncnnPyTorch .pth4-4
ffdnetPyTorch .pth4-4
fbcnnPyTorch .pth4-4
fsrcnnxC++ header4-4
hdrtvnetppPyTorch .pth2-2
nnedi3Python weights10-10
nafnetPyTorch .pth4-4
ravuPython weights21-21
realcuganPyTorch .pth12214
realesrganPyTorch .pth8210
rifeupstream ONNX archive10-10
stdeintPyTorch .pt2-2
srmdPyTorch .pth6-6
superimagePyTorch .pth24-24
waifu2xJSON weights34-34
websrJSON weights9-9
--vpp-onnx Total24312255

DDD is a dedicated deinterlacer model and is not included in the generic --vpp-onnx total above. Its dynamic-H/W ONNX contract is (1,9,H,W) -> (1,3,H,W); it returns the missing field and QSVEnc performs field weaving after inference.

Conversion Source Types

GLSL Shader Parsing

Extracts weights from Anime4K, ACNet, ARNet, and FSRCNNX shaders and builds ONNX graphs.

Python Weights (RAVU, NNEDI3)

Converts trained weights from bjin/mpv-prescalers via torch.onnx.export.

PyTorch .pth Weights

Converts pretrained models from KAIR, EDSR, Real-ESRGAN, Real-CUGAN, BSRGAN, etc. via torch.onnx.export. HDRTVNet++ SDR-to-HDR models are converted from the official pretrained weights. ST-DeInt is converted from the official pretrained weights into a dynamic H/W model using an equivalent GridSample implementation and half-height, 6-channel restoration output. Weaving is performed by QSVEnc after inference. stdeint_fast.onnx is generated with --no-deform; it removes deform alignment and GridSample for fast fp16 inference with a small quality tradeoff.

DDD is converted from the fixed MIT upstream checkpoint into a dynamic-H/W (1,9,H,W) -> (1,3,H,W) missing-field model. QSVEnc performs field weaving after inference; the model is distributed in the dedicated DDD archive.

EDVR-M is converted from the MMagic REDS checkpoint to the identical BasicSR architecture and exported as fixed-resolution, 15-channel models containing five RGB frames. QSVEnc/NVEnc apply frames=5 from the registry automatically. The deformable-convolution decomposition depends on the spatial shape, so the release contains 128x128 and 160x88 inputs. Additional multiples-of-four can be generated with export_edvr.py --size WIDTHxHEIGHT.

JSON Weights

Builds ONNX graphs from waifu2x and websr JSON weight files.

Upstream ONNX

ArtCNN models are pre-built ONNX files published by the author.

INT8 Quantization

Generates INT8 ONNX from FP32 ONNX using nncf (Neural Network Compression Framework) Post-Training Quantization.

Requirements

  • Python 3.10+
  • PyTorch (CPU)
  • ONNX
  • onnxscript
  • NumPy
  • SciPy
  • nncf
  • onnxruntime
  • deform-conv2d-onnx-exporter

setup_env.sh (Linux) or setup_env.bat (Windows) creates the venv and installs all dependencies.

File Structure

FileDescription
run_all.pyIntegrated runner (download → convert → INT8 → manifests)
setup_env.shPython venv setup (Linux)
setup_env.batPython venv setup (Windows)
quantize_int8.pyINT8 quantization via nncf
export_*.pyPer-family FP32 ONNX conversion scripts
export_stdeint.pyConverts the official ST-DeInt weights to full and --no-deform fast, half-height 6-channel restoration-output ONNX models
export_ddd.pyConverts the fixed MIT DDD checkpoint to dynamic-H/W (1,9,H,W) -> (1,3,H,W) missing-field ONNX
export_edvr.pyConverts EDVR-M REDS x4 to fixed-resolution, five-frame 15-channel ONNX models
extract_rife.pyExtracts RIFE ONNX from the official archive and verifies SHA-256 and I/O shapes
convert_edsr.pyEDSR conversion script
convert_ravu_*.pyRAVU conversion scripts (4 files, called by export_ravu.py)
extract_anime4k_upscale_gan_glsl.pyAnime4K GAN GLSL parsing helper
package_archives.pyCreates main, fbcnn/nafnet, and dedicated DDD deinterlacer archives; ST-DeInt remains separate
requirements.txtPython dependencies

License

Each model's license follows its upstream repository. A LICENSE.txt is placed in each <family>/ directory with full provenance details.

FamilyLicenseAuthor / Copyright
ACNet, ARNetMITTianZerL (ACNetGLSL)
Anime4K (anime3d, anime4k_gan, anime4k_restore, anime4k_upscale)MITbloc97
ArtCNNMITJoao Chrisostomo
BSRGANMIT (KAIR) / Apache-2.0 (BSRGAN repo)Kai Zhang
DnCNN, DPSR, DRUNet, ESRGAN, FDnCNN, FFDNet, SRMDMITKai Zhang (KAIR)
EDSRMITSanghyun Son
EDVRApache-2.0BasicSR Authors / OpenMMLab
FSRCNNXGPL-3.0 (igv's trained weights)igv, nessotrin, TianZerL
HDRTVNet++MITHoven Li
FBCNNApache-2.0Jiaxi Jiang, Kai Zhang, Radu Timofte
NAFNetMITmegvii-model
NNEDI3LGPL-3.0 (trained weights)bjin
RAVULGPL-3.0 (trained weights)bjin
Real-CUGANMITbilibili
Real-ESRGANBSD-3-ClauseXintao Wang
RIFE v4.xMITMegvii, hzwer
ST-DeIntUnknownYuqing Liu et al.
DDDMITVincent van de Schaft (fixed upstream commit)
super-image (PAN, CARN, A2N, AWSRN, MSRN)Apache-2.0Eugene Siow et al.
waifu2xMITnagadomi, nihui (ncnn topology)
websrMITsb2702, bloc97

Note on FSRCNNX: The weights originate from igv/FSRCNN-TensorFlow (GPL-3.0), not from the MIT-licensed Anime4KCPP code that bundles them. See licenses/fsrcnnx.txt for details.

The conversion scripts in this repository are licensed under the MIT License.

Generated result counts

With the default pipeline, the output contains 255 generic --vpp-onnx models (243 FP32 + 12 INT8), 10 RIFE models, 2 ST-DeInt models, and DDD, plus manifests for the generic, RIFE, ST-DeInt, and QSVEnc deinterlacer registries. Release packaging produces a third dedicated DDD archive; ST-DeInt is intentionally not included in release archives.