[Paper] [YouTube Video] [PPT slides]
-
Clone repo
git clone https://github.com/xinntao/Real-ESRGAN.git cd Real-ESRGAN
-
Install dependent packages
# Install basicsr - https://github.com/xinntao/BasicSR # We use BasicSR for both training and inference pip install basicsr # facexlib and gfpgan are for face enhancement pip install facexlib pip install gfpgan pip install -r requirements.txt python setup.py develop
- You can try in our website: ARC Demo (RealESRGAN_x4plus_anime_6B)
- Online Replicate demo:
- Online Colab demo for Real-ESRGAN:
- Online Colab demo for for Real-ESRGAN (anime videos):
Usage: python inference_realesrgan.py -n RealESRGAN_x4plus -i infile -o outfile [options]...
A common command: python inference_realesrgan.py -n RealESRGAN_x4plus -i infile --outscale 3.5 --face_enhance
-h show this help
-i --input Input image or folder. Default: 'inputs'
-o --output Output folder. Default: 'results'
-n --model_name Model name. Default: 'RealESRGAN_x4plus'
(Model names: RealESRGAN_x4plus | RealESRNet_x4plus | RealESRGAN_x4plus_anime_6B | RealESRGAN_x2plus | realesr-animevideov3 | realesr-general-x4v3)
-s, --outscale The final upsampling scale of the image. Default: 4
--suffix Suffix of the restored image. Default: out
-t, --tile Tile size, 0 for no tile during testing. Default: 0
--face_enhance Whether to use GFPGAN to enhance face. Default: False
--fp32 Use fp32 precision during inference. Default: '--fp32'
--ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto
-dn, --denoise_strength Denoise strength. 0 for weak denoise (keep noise), 1 for strong denoise ability, 'Only used for the realesr-general-x4v3 model'
--alpha_upsampler The upsampler for the alpha channels. Options: realesrgan | bicubic . Default: 'realesrgan'
-g, --gpu-id gpu device to use. Default=None. can be 0,1,2 for multi-gpu
Inference!
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --face_enhance
The most straightforward way of improving model performance is to fine-tune on some specific datasets.
- Add the realesr-general-x4v3 model - a tiny small model for general scenes. It also supports the -dn option to balance the noise (avoiding over-smooth results). -dn is short for denoising strength.
- The inference code supports: 1) tile options; 2) images with alpha channel; 3) gray images; 4) 16-bit images.
- The training codes have been released. A detailed guide can be found in Training.md.