Overview
Real-ESRGAN integrates with GFPGAN (Generative Facial Prior GAN) to provide enhanced face restoration. This combination uses Real-ESRGAN for overall image super-resolution and GFPGAN to specifically enhance facial details.How It Works
When face enhancement is enabled:- Detection: GFPGAN detects faces in the image
- Enhancement: Each detected face is enhanced using GFPGANv1.3
- Background: Real-ESRGAN upscales the background
- Composition: Enhanced faces are pasted back into the upscaled background
Quick Start
Usage Examples
Basic Face Enhancement
Advanced Usage
Compatible Models
- Recommended
- Alternative Models
- Not Compatible
RealESRGAN_x4plus (Best)
GFPGAN Integration Details
Model Information
GFPGAN version 1.3 is automatically downloaded and used for face enhancement.Download URL:
Uses the ‘clean’ architecture variant of GFPGAN.
Set to 2 for optimal quality.
Real-ESRGAN is used as the background upsampler, ensuring consistent quality across the entire image.
Face Detection Parameters
- has_aligned: Set to
Falseas input faces are not pre-aligned - only_center_face: Set to
Falseto enhance all detected faces - paste_back: Set to
Trueto composite faces back into the upscaled image
Use Cases
Portrait Photography
Old Family Photos
Group Photos
Low-Resolution Photos
Video Frames with Faces
Performance Considerations
Processing Time
Face enhancement adds overhead:- Without face enhancement: ~0.1-0.5s per image (depends on size and GPU)
- With face enhancement: ~0.5-2s per image (depends on number of faces)
Memory Usage
GPU Selection
For multi-GPU systems:Comparison Examples
- Without: Good overall upscaling, but faces may lack fine details
- With: Sharper facial features, better skin texture, enhanced eye details
Tips for Best Results
Troubleshooting
GFPGAN not installed error
GFPGAN not installed error
Install the required dependencies:If you still encounter issues:
Face enhancement not working
Face enhancement not working
Check if you’re using a compatible model:Compatible:
RealESRGAN_x4plus✓RealESRNet_x4plus✓RealESRGAN_x2plus✓realesr-general-x4v3✓
RealESRGAN_x4plus_anime_6B✗ (automatically disabled)realesr-animevideov3✗ (automatically disabled)
Faces look unnatural or over-processed
Faces look unnatural or over-processed
This can happen with heavily compressed or very low-quality inputs. Try:
- Use a higher quality source image
- Try without face enhancement if the result is too aggressive
- Use RealESRNet_x4plus for smoother results:
Some faces not detected
Some faces not detected
GFPGAN may miss faces that are:
- Too small (< 64x64 pixels)
- At extreme angles
- Partially occluded
- Very dark or blurry
- Pre-crop and process faces individually
- Manually adjust brightness/contrast before processing
- Try upscaling first without face enhancement, then apply face enhancement
CUDA out of memory
CUDA out of memory
Face enhancement requires additional memory. Solutions:
-
Use tiling:
-
Use smaller model:
- Process images individually instead of batch processing
Standalone GFPGAN
For more control over face enhancement, you can use GFPGAN directly:Related Resources
GFPGAN Project
Official GFPGAN repository
General Images
Learn about models for real-world photos
Basic Inference
Complete reference for inference options