GFPGAN - AI Image Models Tool

Overview

GFPGAN (Generative Facial Prior GAN) is an open-source, research-grade face-restoration model developed by Tencent ARC that focuses on blind face restoration: recovering high-fidelity facial details (eyes, teeth, hair) and color from heavily degraded inputs in a single forward pass. The method leverages a pretrained face GAN (StyleGAN2) as a generative facial prior and integrates it with a U-Net degradation-removal module via Channel-Split Spatial Feature Transform (CS-SFT) layers to balance realism and fidelity, plus identity-preserving and component losses to keep faces recognizable. ([arxiv.org](https://arxiv.org/pdf/2101.04061.pdf)) The project provides pre-trained model checkpoints (multiple model variants: v1, v1.2 / “clean”, v1.3, v1.4 and a RestoreFormer variant), a Python API (GFPGANer), example inference scripts, and integration recipes (Real-ESRGAN background upsampling, Gradio/Hugging Face Spaces demo). GFPGAN is released under Apache 2.0 and is commonly run locally (Docker or native PyTorch) or via hosted endpoints (e.g., Replicate). Community use cases include restoring old photographs, improving AI-generated faces, and post-processing outputs from image-generation pipelines. ([github.com](https://github.com/TencentARC/GFPGAN?utm_source=openai))

Key Features

  • Blind face restoration that works without knowing the degradation type.
  • Generative facial prior (StyleGAN2) integration via CS-SFT layers for realistic textures.
  • Multiple pre-trained variants: v1, v1.2 (clean), v1.3, v1.4 and RestoreFormer.
  • Programmatic GFPGANer API that returns cropped faces, restored faces, and a pasted-back image.
  • Optional Real-ESRGAN background upsampling for non-face regions.
  • Self-hostable: Docker images and CLI scripts provided for local deployment.
  • Apache 2.0 license—permissive open-source use for research and commercial projects.

Example Usage

Example (python):

from gfpgan import GFPGANer
import cv2

# Initialize a GFPGANer (can use a release checkpoint URL or local path)
restorer = GFPGANer(
    model_path='https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth',
    upscale=2,
    arch='clean',            # options: 'clean', 'bilinear', 'original', 'RestoreFormer'
    channel_multiplier=2)

# Read input image (BGR as OpenCV default)
img = cv2.imread('inputs/low_quality_face.jpg', cv2.IMREAD_UNCHANGED)

# Run enhancement: returns (cropped_faces, restored_faces, restored_img)
cropped_faces, restored_faces, restored_img = restorer.enhance(
    img, has_aligned=False, only_center_face=False, paste_back=True, weight=0.5)

# Save the full-image result (restored_img may be None if not pasted back)
if restored_img is not None:
    cv2.imwrite('results/restored_full.png', restored_img)

# Save the first restored face crop as a separate file
if restored_faces:
    cv2.imwrite('results/restored_face_0.png', restored_faces[0])

print('Done — outputs saved to results/ folder')

# Notes: the GFPGANer API, return values and typical parameters are defined in gfpgan/utils.py in the repo.

Pricing

GFPGAN itself is open-source (Apache 2.0) and free to self-host. Hosted endpoints charge per-run: the Replicate hosted demo lists ~ $0.0028 per run and ≈3s prediction time; other providers (e.g., Synexa) report different per-image rates (examples: $0.0008/image on Synexa). Self-hosting costs depend on GPU/cloud infrastructure used. ([github.com](https://github.com/TencentARC/GFPGAN?utm_source=openai))

Benchmarks

LPIPS (CelebA-Test, blind restoration): 0.3646 (Source: https://arxiv.org/pdf/2101.04061.pdf)

FID (CelebA-Test, blind restoration): 42.62 (Source: https://arxiv.org/pdf/2101.04061.pdf)

PSNR (CelebA-Test, blind restoration): 25.08 dB (Source: https://arxiv.org/pdf/2101.04061.pdf)

SSIM (CelebA-Test, blind restoration): 0.6777 (Source: https://arxiv.org/pdf/2101.04061.pdf)

Replicate runtime: Predictions typically complete within ~3 seconds (Source: https://replicate.com/tencentarc/gfpgan)

Replicate cost per run (hosted): ≈ $0.0028 per run (varies by provider and input) (Source: https://replicate.com/tencentarc/gfpgan)

GitHub popularity: ≈ 37.3k stars (repository) (Source: https://github.com/TencentARC/GFPGAN)

Last Refreshed: 2026-01-09

Key Information

  • Category: Image Models
  • Type: AI Image Models Tool