- Python >= 3.7 (Recommend to use Anaconda or Miniconda)
- PyTorch >= 1.7
-
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 use X4 model for arbitrary output size with the argument
outscale
. The program will further perform cheap resize operation after the Real-ESRGAN output.
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
-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: fp16 (half precision).
--ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto
Download pre-trained models: RealESRGAN_x4plus.pth
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P weights
Inference
python inference_realesrgan.py -n RealESRGAN_x4plus -i <path to image> --face_enhance 1
Results are in the results
folder
Download pre-trained models: RealESRGAN_x4plus.pth
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P weights
Inference
python dataset_inference.py --dir <dataset_folder_name>
COLMAP Dense Reconstruction
python colmap_runner.py --path <name of folder containing images> --project_name <name of associaed colmap project>
python visualize_mesh_and_pointcloud.py --path <name of associaed colmap project>
Case | Ref Image | Pretrained ESRGAN Predictions |
---|---|---|
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 |
Case | Ref Dataset | Pretrained ESRGAN Predictions |
---|---|---|
1 | Synthetic Motion Blurred |
Prediction |
2 | Synthetic Resolution Blurred |
Prediction |