← 开源
ai-forever

Real-ESRGAN

PyTorch implementation of Real-ESRGAN model

ApplicationsContent creationPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
657
Star
223
Fork
+0
本周
3
贡献者
创建于 2021-11-02 · 更新于 2026-10-09 · 今日第 15396 名
主要开发者
boomb0omAlexWortegasneakybeaky18-debug
README

Real-ESRGAN

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

You can try it in google colab

Installation

pip install git+https://github.com/sberbank-ai/Real-ESRGAN.git

Usage


Basic usage:

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')

Examples


Low quality image:

Real-ESRGAN result:


Low quality image:

Real-ESRGAN result:


Low quality image:

Real-ESRGAN result:

排名相邻
同类项目