Skip to content

superdianuj/ESRGAN

🔧 Dependencies and Installation

Installation

  1. Clone repo

    git clone https://github.com/xinntao/Real-ESRGAN.git
    cd Real-ESRGAN
  2. 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

Inference

Python script

Usage of python script

  1. 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

Inference on Single Image

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

Inference on Dataset

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 Results

Case Ref Image Pretrained ESRGAN Predictions
1 Case 1 Ref Case 1 Output
2 Case 2 Ref Case 2 Output
3 Case 3 Ref Case 3 Output
4 Case 4 Ref Case 4 Output
5 Case 5 Ref Case 5 Output
6 Case 6 Ref Case 6 Output
Case Ref Dataset Pretrained ESRGAN Predictions
1 GIF 1
Synthetic Motion Blurred
GIF 2
Prediction
2 GIF 3
Synthetic Resolution Blurred
GIF 4
Prediction

Ref Dataset COLMAP Reconstruction

colmap_dataset_motion_blurred_video.mp4

Pretrained ESRGAN Predictions COLMAP Reconstruction

colmap_dataset_motion_blurred_out_video.mp4

Ref Dataset COLMAP Reconstruction

colmap_dataset_resolution_blurred_video.mp4

Pretrained ESRGAN Predictions COLMAP Reconstruction

colmap_dataset_resolution_blurred_out_video.mp4

Reference

https://github.com/xinntao/Real-ESRGAN

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages