PyTorch implementation of a Real-ESRGAN model trained on custom dataset. This model shows better results on faces compared to the original version. It is also easier to integrate this model into your projects.
This is a forked Github Version which also includes inferencing for videos
This is not an official implementation. We partially use code from the original repository
Real-ESRGAN is an upgraded ESRGAN trained with pure synthetic data is capable of enhancing details while removing annoying artifacts for common real-world images.
- Paper (Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data)
- Original implementation
- Pytorch Original implementation
- Huggingface Page Models 🤗
Low quality image:
Real-ESRGAN result:
Low quality image:
Real-ESRGAN result:
Low quality image:
Real-ESRGAN result:
pip install git+https://github.com/Nick088/Real-ESRGAN_Pytorch.git
import torch
from PIL import Image
import numpy as np
from RealESRGAN import RealESRGAN
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = RealESRGAN(device, scale=4)
model.load_weights('weights/RealESRGAN_x4.pth', download=True)
path_to_image = 'inputs/lr_image.png'
image = Image.open(path_to_image).convert('RGB')
sr_image = model.predict(image)
sr_image.save('results/sr_image.png')
- Click Code and Download as Zip.
- Open Run_Inference_UI.bat.
- After it installs the dependencies, let it run and do Ctrl+Click on Local URL.
- Now either for Image Tab or Video Tab, just upload your input, select the Upscale Model (x2, x4, x8) and Submit!
- Download one of the 2 Kaggle Notebooks Files above
- Go on https://kaggle.com, be sure you make an account and are phone verified.
- Click the '+', then 'Create new notebook'.
- Click 'File' and 'Import Notebook'.
- Import the kaggle notebook file.
Kaggle Notebooks files.
Updated & Fixed the no ui version and added a kaggle notebook too, everything is fixed now.
Added web ui precompiled local, kaggle web ui notebook.
- Nick088 (improving and porting)
- forever-ai (making the pytorch implementation model of Real-ESRGAN)
- Xinntao
- Tencent
- Geeve George (no ui inference video code)
- daroche (fixing web ui video inference code)