Models · Image restoration

GFPGAN

GFPGAN v1.4 (Wang et al., Tencent ARC, CVPR 2021): restores a degraded face (an aligned 512 x 512 crop) with a pretrained StyleGAN2 face generator as prior; the classic face restorer of upscaling tools. Apache-2.0 code and weights.

experimental Fork of TencentARC/GFPGAN@7552a77 · backends: portable, kernels

Checkpoint gfpgan-v1.4

Paper 2021 Added in 0.2.0

Kernels, RTX 5060 Ti 16 GB 18.0 ms 512x512, fp16
vs the faster original 1.2× original fp16: 21.9 ms
Peak memory 473 MiB original: 563 MiB
Accuracy vs original fp32 – no test-set run

Use it

pip install fastforks

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

from fastforks import restoration

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

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 fp16.half() on 1 modules, fp16 inputs; upstream GFPGANer.enhance on the aligned face, float32, random noise per callfp16 21.9–563 MiB/670 MiB0.80.03
Portable fp32fp32not measured ––––
Portablefp16 21.21.0×505 MiB/528 MiB1.00.25
Kernelsfp16 18.01.2×473 MiB/530 MiB0.80.07
Portable + torch.compile 12.51.8×360 MiB/428 MiB27 (build)–
TensorRT fp16fp16 15.81.4×400 MiBenginenot comparable115 (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-14Originalfp32172 2,871 MiB process–512x512
Portablefp16138 1,982 MiB processmatches512x512
Portablefp32153 1,954 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
Apache-2.0 LICENSE
Weights
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

GFPGANv1.4.pth 349 MB· hosted on GitHub

fastforks downloads and checks these files on first use (fastforks download gfpgan-v1.4).

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.

Accuracy not measured for gfpgan-v1.4.

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| <= 6.3e-06 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00051 and p99 <= 0.0022 (absolute error of the output image).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.0000063 not recorded
GPU default dtypes, mean |diff|≤ 0.00051 0.00034
GPU default dtypes, p99 |diff|≤ 0.0022 0.00144

Recorded for gfpgan-v1.4 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: cudnn_hacc

Details

GFPGAN v1.4 (Wang et al., CVPR 2021): blind face restoration with a generative facial prior: a U-Net encoder whose features modulate (spatial feature transform) a pretrained StyleGAN2 face generator. Input: an aligned 512 x 512 face crop (FFHQ alignment); detecting, aligning and pasting the face back are not part of the model.

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 >= 512, padded to a multiple of 32; tested up to 512x512 (508 MiB allocated)
Outputs
image
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
fp32, fp16

Limitations

  • No accuracy measurement: blind face restoration is scored on CelebA-Test / LFW / WebPhoto (FID, NIQE, identity distance), which are not part of the evaluation data here; tiers are compared by output parity and speed only.
Full reference, generated from the repository

GFPGAN v1.4 (Wang et al., Tencent ARC, CVPR 2021): restores a degraded face (an aligned 512 x 512 crop) with a pretrained StyleGAN2 face generator as prior; the classic face restorer of upscaling tools. Apache-2.0 code and weights.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
gfpgan-v1.4synthetic (512x512)original
portable
kernels
portable + torch.compile
TensorRT fp16
21.9
21.2
18.0
12.5
15.8
563 / 670
505 / 528
473 / 530
360 / 428
609 / 644
Details

Parity

CPU, float32: max |diff| <= 6.3e-06 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.00051 and p99 <= 0.0022 (absolute error of the output image).

variantkernels error vs original, mean / p99GPU, torchkernels used
gfpgan-v1.40.00034 / 0.00144RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400

Limitations

  • No accuracy measurement: blind face restoration is scored on CelebA-Test / LFW / WebPhoto (FID, NIQE, identity distance), which are not part of the evaluation data here; tiers are compared by output parity and speed only.

Example output

No example rendered for this checkpoint yet.