Giter VIP home page Giter VIP logo

srgan-pytorch's Introduction

SRGAN-PyTorch

Paper Link : https://arxiv.org/pdf/1609.04802.pdf

References :

  1. https://github.com/sgrvinod/Deep-Tutorials-for-PyTorch
  2. https://www.kaggle.com/code/balraj98/single-image-super-resolution-gan-srgan-pytorch/notebook
  3. https://www.kaggle.com/code/luizclaudioandrade/srgan-pytorch-lightning
  4. https://pytorch.org/tutorials/beginner/
  5. https://github.com/aladdinpersson/Machine-Learning-Collection/tree/master/ML/Pytorch/GANs
  6. https://www.youtube.com/playlist?list=PLhhyoLH6IjfwIp8bZnzX8QR30TRcHO8Va
  7. https://paperswithcode.com/

Google Colab link for direct use of the notebook : https://tinyurl.com/tbp9tevr

Concepts involved : Residual Connections, Generative Adversarial Networks(GANs), Perceptual Loss

Note : This Model was trained on a small subset of CelebA Dataset(you can get the whole dataset from here: https://www.kaggle.com/datasets/jessicali9530/celeba-dataset) due to computational constraints.

A GAN type model is trained to convert low resolution images into high resolution. The high resolution images are used as taregts to train the Generator and as inputs for the Discriminator of SRGAN Model respectively. Low resolution versions of the high resolution images are produced by bicubic downsampling, and they are input to the Generator of SRGAN Model.

I trained on only 1000 images and you can get that custom dataset here : https://tinyurl.com/2xfe8u6j

Use 'making_lr_img.py' to create your own custom dataset of Low Resolution images. I foud it easy as compared to do it in transforms.Compose() of torchvision, but it's upto you.

Use 'pytorch_prediction.py' to get predicted image from the trained model. Don't forget to add the weights of your trained model in torch.load() and the weights must be of generator only (we don't require discriminator here, it's role is over as it was only required to improve the predictions of generator model so that generator can produce something desirable and not just random noise).

Use 'after_predictions.py' to visualize the predicted/generated image.

Use 'gradio_interface.py' to get a nice UI Interface for the model. After cloning the repo into your local machine or copying the files, run : python3 pytorch_prediction.py to see the nice UI on your local host.

I retrained the model with around 10,000 images of celebA dataset and got quite satisfying results. I've added the outputs in the zip file, left most one is the real hr image, middle one is lr image and rightmost one is generated by our model.

9

GRADIO INTERFACE LOOKS SOMETHING LIKE THIS:

image

srgan-pytorch's People

Contributors

sartq333 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.