Real-ESRGAN Compact (fastforks)

Real-ESRGAN Compact (SRVGGNetCompact, Wang et al.): a small VGG-style blind super-resolution network: 3 x 3 convs with PReLU at the input size, one pixel-shuffle to the output size, plus the nearest-upsampled input. realesr-general-x4v3 is Real-ESRGAN's general x4 model (32 convs, 64 channels, about 1.2 M parameters), trained like Real-ESRGAN on synthetic real-world degradations. load(path) reads other Compact checkpoints (any scale, channels and depth).

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/xinntao/Real-ESRGAN at a4abfb2979a7.

Task: restoration. Tier: experimental. Outputs: image. Backends: portable, kernels.

Input: one RGB image. Output: the restored (upscaled) image, model.scale x the input size, RGB in [0, 1]. tile= runs large images in overlapping tiles (as ComfyUI).

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
realesr-general-x4v3@1 realesr-general-x4v3.pth 8dc7edb9ac80 BSD-3-Clause yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: BSD-3-Clause. Licence files: LICENSE.

Training data: DIV2K (NTIRE 2017 super-resolution, 1000 2K images), Flickr2K (2650 2K Flickr images, EDSR), OutdoorSceneTraining (OST, SFTGAN) (docs/Training.md: DF2K (DIV2K + Flickr2K) + OST HR images with Real-ESRGAN's synthetic degradations; the general v3 model's data is not named further.).

Licence evidence: https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/LICENSE ; https://github.com/xinntao/Real-ESRGAN/releases/tag/v0.2.5.0

Input size

any H x W >= 1, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): realesr-general-x4v3 512x512 (0.1 GiB peak allocated, 0.2 reserved)

Speed and memory

Restoration, synthetic, 512x512

model time (ms): original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
realesr-general-x4v3 42.1 30.1 24.0 1.8x 1.3x 157 / 206 125 / 164 125 / 164

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
realesr-general-x4v3 0.16 0.40 0.31 0.20 0.29 0.05

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
realesr-general-x4v3 512x512 30.1 ms 22.6 ms 11.9 ms 24.0 ms 3.89 s 15.3 s 125 / 164 125 / 144 125 / 164 220 / 228

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

DIV2K validation HR images and the official bicubic LR images (x4 or x2, the model's scale), one pass without tiles; PSNR and SSIM (Gaussian 11 x 11, sigma 1.5) on the Y channel (BT.601) of the output rounded to uint8, scale px border cropped, averaged over the images. Real-ESRGAN is trained for real-world degradations, not bicubic, so its PSNR is low: the numbers compare our modes with the original, not with PSNR-oriented upscalers. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
realesr-general-x4v3 DIV2K validation (every 2nd: 50 images), bicubic x4 LR -> HR, PSNR / SSIM (Y) 26.70 / 0.7701 26.70 / 0.7701 26.70 / 0.7701 26.70 / 0.7701

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 60534e1d, 2026-11-14.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 1e-06 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00093 and p99 <= 0.004 (absolute error of the output image).

Usage

from fastforks import restoration

model = restoration.load("realesr-general-x4v3")  # mode="auto": the preferred backend from recorded measurements
result = model("photo.png")  # tile=512 for large images
result.image  # [3, sH, sW] float32 RGB in [0, 1], s = model.scale
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: realesr-general-x4v3.

Kernels backend

restoration.load("realesr-general-x4v3", mode="kernels") runs our CUDA kernels (cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

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 fastforks/compact