Navigate:
GFPGAN
~$GFPGA0.0%

GFPGAN: Face restoration using generative priors

PyTorch framework for blind face restoration using StyleGAN2 priors.

LIVE RANKINGS • 12:32 PM • STEADY
OVERALL
#435
69
AI & ML
#110
10
30 DAY RANKING TREND
ovr#435
·AI#110
STARS
37.4K
FORKS
6.3K
7D STARS
+1
7D FORKS
0
Tags:
See Repo:
Share:

Learn more about GFPGAN

GFPGAN is a PyTorch-based face restoration framework that applies generative priors from pretrained StyleGAN2 models to restore degraded facial images. The approach uses a two-stage pipeline incorporating face detection, alignment, and GAN-based restoration with local and global feature extraction. It handles blind restoration scenarios where the degradation type and severity are unknown, working with images ranging from very low to high quality. The tool is deployed as a Python package with optional CUDA support and integrates with complementary restoration models for background enhancement.

GFPGAN

1

Blind Degradation Restoration

Leverages pretrained StyleGAN2 facial priors to restore images without knowing degradation type or parameters. Handles mixed artifacts including compression, noise, blur, and low resolution in a single pass.

2

Modular Two-Stage Pipeline

Separates face restoration from background enhancement through Real-ESRGAN integration. Multiple model versions (V1.3, V1.4) provide configurable trade-offs between photorealism and detail preservation.

3

Optional CUDA Dependencies

Pure PyTorch implementation runs on CPU without mandatory CUDA extensions for cross-platform deployment. Accessible through multiple interfaces including Python package, Colab notebooks, and hosted APIs.


from gfpgan import GFPGANer

restorer = GFPGANer(
    model_path='experiments/pretrained_models/GFPGANv1.3.pth',
    upscale=2,
    arch='clean',
    channel_multiplier=2
)

input_img = cv2.imread('degraded_face.jpg', cv2.IMREAD_COLOR)
cropped_faces, restored_faces, restored_img = restorer.enhance(
    input_img, has_aligned=False, only_center_face=False, paste_back=True
)

cv2.imwrite('restored_face.jpg', restored_img)

vv1.3.8

Removed CodeFormer dependency to streamline the codebase.

  • Removed CodeFormer integration from the project
vv1.3.7

Added inference code support for RestoreFormer and CodeFormer models.

  • Added RestoreFormer inference code implementation
  • Added CodeFormer inference code implementation
  • Updated Cog predict functionality
vv1.3.4

Fixed import issues and added multi-GPU support with improved face segmentation.

  • Fixed BasicSR losses import error
  • Updated facelib library and improved face pasting using segmentation
  • Added device parameter to GFPGANer class for multi-GPU support

See how people are using GFPGAN

Loading tweets...


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers