Models · Image restoration

Real-ESRGAN Compact

Real-ESRGAN Compact (Wang et al., Tencent ARC): a small, fast VGG-style x4 upscaler for real-world photos (`realesr-general-x4v3`); also loads other Compact checkpoints. BSD-3-Clause code and weights.

experimental Fork of xinntao/Real-ESRGAN@a4abfb2 · backends: portable, kernels

Checkpoint realesr-general-x4v3

Paper 2021 Added in 0.2.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 24.0 ms 512x512, fp16
vs the faster original 1.8× original fp16: 42.1 ms
Peak memory 125 MiB original: 157 MiB
Accuracy vs original fp32 ±0.00 kernels psnr, DIV2K validation (every 2nd: 50 images) (26.70 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import restoration

model = restoration.load("realesr-general-x4v3")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.image
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench realesr-general-x4v3

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

Input: synthetic, 512x512 (the task’s standard size)

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32not measured ––––
Original fp16the authors' mixed-precision option (float16); upstream RealESRGANer pre_pad 0, no tile, -dn 1, on the float image, half (the default)fp16 42.1–157 MiB/206 MiB0.00.04
Portable fp32fp32not measured ––––
Portablefp16 30.11.4×125 MiB/164 MiB0.40.29
Kernelsfp16 24.01.8×125 MiB/164 MiB0.30.05
Portable + torch.compile 22.61.9×125 MiB/144 MiB4 (build)–
TensorRT fp16fp16 11.93.5×164 MiBenginenot comparable15 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp32176 1,302 MiB process–512x512
Portablefp16132 1,289 MiB processmatches512x512
Portablefp32178 1,288 MiB processmatches512x512
Kernelsfp16not implemented–512x512

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
BSD-3-Clause LICENSE
Weights
BSD-3-Clause source
Training data

Our reading of the licences, not legal advice.

Weights

realesr-general-x4v3.pth 4.9 MB· hosted on GitHub

fastforks downloads and checks these files on first use (fastforks download realesr-general-x4v3).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

DIV2K validation (every 2nd: 50 images)

bicubic x4 LR -> HR, PSNR / SSIM (Y)

Rundtypepsnr ↑ssim ↑Δ psnr vs fp32 originalimagesms / image
Original fp32fp3226.700.7701 reference 50 –
Original fp16fp1626.700.7701 ±0.00 50 –
Portable fp32fp3226.700.7701 ±0.00 50 –
Portablefp1626.700.7701 ±0.00 50 –
Kernelsfp1626.700.7701 ±0.00 50 –

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 authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 60534e1d, 2026-11-14.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.000001 not recorded
GPU default dtypes, mean |diff|≤ 0.00093 0.00062
GPU default dtypes, p99 |diff|≤ 0.004 0.00262

Recorded for realesr-general-x4v3 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: cudnn_hacc

Details

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).

Input / output
Input: one RGB image. Output: the restored (upscaled) image, model.scale x the input size, RGB in [0, 1].
What the numbers mean, and which models need the camera focal length

tile= runs large images in overlapping tiles (as ComfyUI).

Input size
any H x W >= 1, resized or padded inside the model; tested up to 512x512 (125 MiB allocated)
Outputs
image
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

Real-ESRGAN Compact (Wang et al., Tencent ARC): a small, fast VGG-style x4 upscaler for real-world photos (realesr-general-x4v3); also loads other Compact checkpoints. BSD-3-Clause code and weights.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
realesr-general-x4v3synthetic (512x512)original
portable
kernels
portable + torch.compile
TensorRT fp16
42.1
30.1
24.0
22.6
11.9
157 / 206
125 / 164
125 / 164
125 / 144
220 / 228
Details
  • Original code: https://github.com/xinntao/Real-ESRGAN at a4abfb2979a7
  • Code licence: BSD-3-Clause (permissive); files: LICENSE
  • Weights licence: BSD-3-Clause
  • Licence evidence: https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/LICENSE ; https://github.com/xinntao/Real-ESRGAN/releases/tag/v0.2.5.0
  • 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.)
  • Kernel libraries: cudnn_hacc
  • Variants: realesr-general-x4v3
  • Outputs: image
  • 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)
  • realesr-general-x4v3 512x512, first call: portable + torch.compile 4 s (cold Inductor cache), TensorRT fp16 15 s (ONNX + engine).
  • realesr-general-x4v3 original 512x512: the authors' mixed-precision option (float16); upstream RealESRGANer pre_pad 0, no tile, -dn 1, on the float image, half (the default)
  • realesr-general-x4v3 load / first call: original 0.16 s / 0.201 s, portable 0.4 s / 0.29 s, kernels 0.31 s / 0.049 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

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.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
realesr-general-x4v3DIV2K validation (every 2nd: 50 images), bicubic x4 LR -> HR, PSNR / SSIM (Y)26.70 / 0.770126.70 / 0.770126.70 / 0.770126.70 / 0.770126.70 / 0.7701

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

Parity

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).

variantkernels error vs original, mean / p99GPU, torchkernels used
realesr-general-x4v30.00062 / 0.00262RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400

Example output

No example rendered for this checkpoint yet.