PyTorch implementation of a Real-ESRGAN model trained on custom dataset

Overview

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.

You can try it in google colab

Installation


  1. Clone repo

    git clone https://https://github.com/sberbank-ai/Real-ESRGAN
    cd Real-ESRGAN
  2. Install requirements

    pip install -r requirements.txt
  3. Download pretrained weights and put them into weights/ folder

Usage


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')
You might also like...
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

torchsummaryDynamic: support real FLOPs calculation of dynamic network or user-custom PyTorch ops

torchsummaryDynamic Improved tool of torchsummaryX. torchsummaryDynamic support real FLOPs calculation of dynamic network or user-custom PyTorch ops.

A custom-designed Spider Robot trained to walk using Deep RL in a PyBullet Simulation
A custom-designed Spider Robot trained to walk using Deep RL in a PyBullet Simulation

SpiderBot_DeepRL Title: Implementation of Single and Multi-Agent Deep Reinforcement Learning Algorithms for a Walking Spider Robot Authors(s): Arijit

🐥A PyTorch implementation of OpenAI's finetuned transformer language model with a script to import the weights pre-trained by OpenAI
🐥A PyTorch implementation of OpenAI's finetuned transformer language model with a script to import the weights pre-trained by OpenAI

PyTorch implementation of OpenAI's Finetuned Transformer Language Model This is a PyTorch implementation of the TensorFlow code provided with OpenAI's

Implementation of CVAE. Trained CVAE on faces from  UTKFace Dataset to produce synthetic faces with a given degree of happiness/smileyness.
Implementation of CVAE. Trained CVAE on faces from UTKFace Dataset to produce synthetic faces with a given degree of happiness/smileyness.

Conditional Smiles! (SmileCVAE) About Implementation of AE, VAE and CVAE. Trained CVAE on faces from UTKFace Dataset. Using an encoding of the Smile-s

Example-custom-ml-block-keras - Custom Keras ML block example for Edge Impulse

Custom Keras ML block example for Edge Impulse This repository is an example on

Demonstrates how to divide a DL model into multiple IR model files (division) and introduce a simplest way to implement a custom layer works with OpenVINO IR models.
Demonstrates how to divide a DL model into multiple IR model files (division) and introduce a simplest way to implement a custom layer works with OpenVINO IR models.

Demonstration of OpenVINO techniques - Model-division and a simplest-way to support custom layers Description: Model Optimizer in Intel(r) OpenVINO(tm

Trained on Simulated Data, Tested in the Real World
Trained on Simulated Data, Tested in the Real World

Trained on Simulated Data, Tested in the Real World

PyTorch implementation of
PyTorch implementation of "A Full-Band and Sub-Band Fusion Model for Real-Time Single-Channel Speech Enhancement."

FullSubNet This Git repository for the official PyTorch implementation of "A Full-Band and Sub-Band Fusion Model for Real-Time Single-Channel Speech E

Comments
  • RealESRGAN_x8.pth creating issue

    RealESRGAN_x8.pth creating issue

    I tried to test RealESRGAN_x8.pth model via your colab notebook. Got an error-

    RuntimeError Traceback (most recent call last) in () 9 10 model = RealESRGAN(device, scale=4) ---> 11 model.load_weights('weights/RealESRGAN_x8.pth')

    1 frames /usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict) 1496 if len(error_msgs) > 0: 1497 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( -> 1498 self.class.name, "\n\t".join(error_msgs))) 1499 return _IncompatibleKeys(missing_keys, unexpected_keys) 1500

    RuntimeError: Error(s) in loading state_dict for RRDBNet: Unexpected key(s) in state_dict: "conv_up3.weight", "conv_up3.bias".

    opened by air55555 2
  • For Video?

    For Video?

    I am pleased with your work; the level of completeness is really professional! What should I do if I want to upscale a video on colab? I tried to place sequentially numbered images created using ffmpeg in the inputs directory, but an error occurred. This is the traceback.


    FileNotFoundError Traceback (most recent call last) in () 2 result_image_path = 'results/sr_img%4d.jpg' 3 ----> 4 image = Image.open(path_to_image).convert('RGB') 5 sr_image = model.predict(np.array(image)) 6

    /usr/local/lib/python3.7/dist-packages/PIL/Image.py in open(fp, mode) 2841 2842 if filename: -> 2843 fp = builtins.open(filename, "rb") 2844 exclusive_fp = True 2845

    FileNotFoundError: [Errno 2] No such file or directory: 'inputs/img%4d.jpg'

    opened by osushilover 1
  • LOSS FUNCTION TO TRAIN

    LOSS FUNCTION TO TRAIN

    Hi ! Thanks alot for this repo.. I wish to train realSRGAN on custom data using Pytorch Lightning. And for that I require the LOSS function and optimizer details. Would request you to provide that.

    Thank You Varun

    opened by cvarun94 0
Owner
Sber AI
Sber AI
Real-ESRGAN aims at developing Practical Algorithms for General Image Restoration.

Real-ESRGAN Colab Demo for Real-ESRGAN . Portable Windows executable file. You can find more information here. Real-ESRGAN aims at developing Practica

Xintao 17.2k Jan 2, 2023
My usage of Real-ESRGAN to upscale anime, some test and results in the test_img folder

anime upscaler My usage of Real-ESRGAN to upscale anime, I hope to use this on a proper GPU cuz doing this on CPU is completely shit ?? , I even tried

Shangar Muhunthan 29 Jan 7, 2023
PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization using Augmented-Self Reference and Dense Semantic Correspondence) and pre-trained model on ImageNet dataset

Reference-Based-Sketch-Image-Colorization-ImageNet This is a PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization usin

Yuzhi ZHAO 11 Jul 28, 2022
LIAO Shuiying 6 Dec 1, 2022
Annotate datasets with a semi-trained or fully trained YOLOv5 model

YOLOv5 Auto Annotator Annotate datasets with a semi-trained or fully trained YOLOv5 model Prerequisites Ubuntu >=20.04 Python >=3.7 System dependencie

Akash James 3 May 14, 2022
A custom DeepStack model that has been trained detecting ONLY the USPS logo

This repository provides a custom DeepStack model that has been trained detecting ONLY the USPS logo. This was created after I discovered that the Deepstack OpenLogo custom model I was using did not contain USPS.

Stephen Stratoti 9 Dec 27, 2022
LSTM model trained on a small dataset of 3000 names written in PyTorch

LSTM model trained on a small dataset of 3000 names. Model generates names from model by selecting one out of top 3 letters suggested by model at a time until an EOS (End Of Sentence) character is not encountered.

Sahil Lamba 1 Dec 20, 2021
Repository to run object detection on a model trained on an autonomous driving dataset.

Autonomous Driving Object Detection on the Raspberry Pi 4 Description of Repository This repository contains code and instructions to configure the ne

Ethan 51 Nov 17, 2022
A collection of pre-trained StyleGAN2 models trained on different datasets at different resolution.

Awesome Pretrained StyleGAN2 A collection of pre-trained StyleGAN2 models trained on different datasets at different resolution. Note the readme is a

Justin 1.1k Dec 24, 2022