Skip to content
 
 

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-ESRGAN

WARNING: This is an unmaintained fork

The repository DougHaber/Real-ESRGAN is a fork of ai-forever/Real-ESRGAN which is a fork of xinntao/Real-ESRGAN.

The ai-forever / sberbank-ai version added in an improved Python interface that I wanted to use. It hadn't been updated in a couple of years, and all usage was triggering a couple Torch warnings. The changes in this repository fix those warnings.

These changes have been made available as a pull request to the upstream as well.

As this is unmaintained, usage is not recommended, but if you feel the need, the correct URL is:

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

In the event that the PR is accepted, this fork will likely be deleted.

All content below this section is unmodified from the upstream repository.

Update 2024-12-07: I made another change to fix a warning with newer versions of huggingface.

Overview

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 Open In 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:

About

PyTorch implementation of Real-ESRGAN model (UNMAINTAINED FORK)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages