Skip to main content

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

Installation

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

Usage


Basic usage:

import torch
from PIL import Image
from py_real_esrgan.model 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:

Metadata

Release files for py-real-esrgan 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for py-real-esrgan 2.0.0
File Interpreter ABI Platform Actions
py_real_esrgan-2.0.0-py3-none-any.whl Python 3 none any Details for py_real_esrgan-2.0.0-py3-none-any.whl

Release files / py_real_esrgan-2.0.0-py3-none-any.whl

Download URL py_real_esrgan-2.0.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5667e58c416761a1f0fa3fc09c2ec2605379d732ef0fe465bf986d2ccc218a78
BLAKE2b-256 checksum
How to use checksums
36cd928f22d14f87e03061785e0929184ba433b1ac6aae958ed67c5d9ab034fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.2

Security for py-real-esrgan 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page