gfpgan
GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration
What it is and what it does
GFPGAN is a face restoration tool built on PyTorch that uses a generative adversarial network to recover detail and clarity in degraded facial images. It leverages a pretrained StyleGAN2-based facial prior to perform blind restoration—meaning it works on faces of unknown quality without requiring alignment or preprocessing. The package includes multiple model versions (V1, V1.2, V1.3) with different trade-offs between sharpness and naturalness.
The typical workflow is to load a pretrained model, pass an image or folder of images through the restorer, and receive enhanced faces along with optional full-image upscaling via Real-ESRGAN. It depends on basicsr for training and inference infrastructure, facexlib for face detection and helper functions, and standard computer-vision libraries (OpenCV, NumPy, SciPy). The package is designed to run on GPU but includes a clean version that works on CPU.
Use it for:
- Restore old or low-resolution photographs where faces are blurry or degraded
- Enhance security camera footage or surveillance images to improve facial clarity
- Preprocess face images for downstream computer-vision tasks like recognition or analysis
- Batch upscale and denoise portrait collections for archival or publication
- Combine with Real-ESRGAN to restore both faces and background details in a single pass
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
GFPGAN restores and enhances degraded faces in images using a generative adversarial network trained on facial priors, producing clearer face details while optionally upscaling the full image.
Yes, if you need face restoration and can work with a dormant package. The library is stable and well-established (37k+ GitHub stars), has no known vulnerabilities, and low install friction. However, expect no active maintenance or updates—use it for production only if you can tolerate a frozen codebase and are comfortable debugging against a 2022-era PyTorch ecosystem.
Install
gfpgan on PyPI
pip
pip install gfpganuv
uv add gfpganpoetry
poetry add gfpganInstalling gfpgan
Before you install
Low install friction with a pure Python wheel. Requires PyTorch and 12 runtime dependencies including torch, torchvision, and basicsr. The package is dormant (last release 2022-09-16, last commit 2024-07-26), so expect no active maintenance or bug fixes.
License in practice
Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install gfpgan
from gfpgan import GFPGANer
restorer = GFPGANer(model_path='GFPGANv1.3.pth', upscale=2)
restored_img, restored_faces = restorer.enhance(input_img, has_aligned=False, only_center_face=False, suffix='restored')
Requires a pre-trained model file (e.g., GFPGANv1.3.pth) to be downloaded separately; PyTorch must be installed first.
Verify before relying
- Whether the package works reliably on Windows or CPU-only systems despite the description mentioning support
- Current compatibility with modern PyTorch versions beyond what the 2022 release was tested against
- Performance characteristics and memory requirements for typical image sizes
Package facts
| License | Apache License Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 12 — basicsr, facexlib, lmdb, numpy, opencv-python, pyyaml, scipy, tb-nightly, torch, torchvision, tqdm, yapf |
| Maintenance | dormant — 1,428 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 284,085/month — #8,068 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gfpgan-1.3.8-py3-none-any.whl
Keywords: computer vision, pytorch, image restoration, super-resolution, face restoration, gan, gfpgan
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
realesrganReal-ESRGAN upscales images and videos using…
permissive · top 15,000 on PyPI
basicsrBasicSR is a PyTorch-based toolbox for image…
permissive · top 15,000 on PyPI
retina-faceDetects faces in images and extracts facial…
permissive · top 15,000 on PyPI
facenet-pytorchProvides pretrained PyTorch models for face…
permissive · top 15,000 on PyPI
face-alignmentDetects 2D and 3D facial landmarks from images…
permissive · top 15,000 on PyPI
mtcnnDetects faces and facial landmarks (eyes, nose,…
permissive · top 5,000 on PyPI
retinaface-pyDetects and localizes faces in images using a…
permissive · top 15,000 on PyPI
facexlibFacexlib provides a collection of PyTorch-based…
permissive · top 5,000 on PyPI
clean-fidComputes Fréchet Inception Distance (FID) and…
permissive · top 15,000 on PyPI
face_recognition_modelsProvides pre-trained deep learning models for…
permissive · top 15,000 on PyPI