This is an unofficial repository 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.
You can try it in google colab
- Paper: Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data
- Official github
-
Clone repo
git clone https://github.com/boomb0om/Real-ESRGAN-colab cd Real-ESRGAN-colab
-
Install requirements
pip install -r requirements.txt
-
Download pretrained weights and put them into
weights/
folder
Basic example:
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')
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')