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
- Paper Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data ICCVW 2021 · first released 22 Jul 2021
Checkpoint realesr-general-x4v3
Paper 2021 Added in 0.2.0 Evaluated with 0.2.0
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)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not 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 MiB | 0.0 | 0.04 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 30.1 | 1.4× | 125 MiB/164 MiB | 0.4 | 0.29 |
| Kernels | fp16 | 24.0 | 1.8× | 125 MiB/164 MiB | 0.3 | 0.05 |
| Portable + torch.compile | 22.6 | 1.9× | 125 MiB/144 MiB | 4 (build) | – | |
| TensorRT fp16 | fp16 | 11.9 | 3.5× | 164 MiBenginenot comparable | 15 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 176 | 1,302 MiB process | – | 512x512 |
| Portable | fp16 | 132 | 1,289 MiB process | matches | 512x512 | |
| Portable | fp32 | 178 | 1,288 MiB process | matches | 512x512 | |
| Kernels | fp16 | not 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
-
- DIV2K (NTIRE 2017 super-resolution, 1000 2K images) research-only, non-commercial
- Flickr2K (2650 2K Flickr images, EDSR) not stated
- OutdoorSceneTraining (OST, SFTGAN) not stated
Our reading of the licences, not legal advice.
Weights
realesr-general-x4v3.pth 4.9 MB· hosted on GitHubfastforks 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)
| Run | dtype | psnr ↑ | ssim ↑ | Δ psnr vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 26.70 | 0.7701 | reference | 50 | – |
| Original fp16 | fp16 | 26.70 | 0.7701 | ±0.00 | 50 | – |
| Portable fp32 | fp32 | 26.70 | 0.7701 | ±0.00 | 50 | – |
| Portable | fp16 | 26.70 | 0.7701 | ±0.00 | 50 | – |
| Kernels | fp16 | 26.70 | 0.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).
| Check | Tolerance | Measured |
|---|---|---|
| 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.scalex 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.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
realesr-general-x4v3 | synthetic (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-x4v3512x512 (0.1 GiB peak allocated, 0.2 reserved) realesr-general-x4v3512x512, first call: portable + torch.compile 4 s (cold Inductor cache), TensorRT fp16 15 s (ONNX + engine).realesr-general-x4v3original 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-x4v3load / 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.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | 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 | 26.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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
realesr-general-x4v3 | 0.00062 / 0.00262 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
Example output
No example rendered for this checkpoint yet.