PyTorch implemetatio of a Real-ESRGAN model traied o custom dataset. This model shows better results o faces compared to the origial versio. It is also easier to itegrate this model ito your projects. Real-ESRGAN is a upgraded ESRGAN traied with pure sythetic data is capable of ehacig details while removig aoyig artifacts for commo real-world images. Code for usig model you ca obtai i our repo.Real-ESRGAN
Usage
import torch
from PIL import Image
import umpy as p
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', dowload=True)
path_to_image = 'iputs/lr_image.pg'
image = Image.ope(path_to_image).covert('RGB')
sr_image = model.predict(image)
sr_image.save('results/sr_image.pg')
点击空白处退出提示
评论