Code Monkey home page Code Monkey logo

image-super-resolution's Introduction

Image Super-Resolution using SRResNet and SRGAN

A TensorFlow 2 implementation of the paper Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network

Examples

Input Image input image

SRResNet srresnet

SRGAN srgan

Quick Start

Usage

To run the models an different images, follow the code in: run_model.ipynb.

Open In Colab

Add images to the input directory.

Select between SRResNet or SRGAN

model_name = "srresnet"
model_name = "srgan"

Output images will appear in either output/srresnet_bicubic_x4 or output/srgan_bicubic_x4, depending on the selected model.

Training

Follow the code in: train_SRRestNet_and_SRGAN.ipynb.

Open In Colab

If training on colab, be sure to use a GPU (runtime > Change runtime type > GPU)

The models train using the div2k dataset using the parameters specified in the paper Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network. I have added a slight adaptation to handle noise from jpeg images when upscaling.

To train without jpeg noise adaptation, change from

train_mappings = [
    lambda lr, hr: random_crop(lr, hr, hr_crop_size=hr_crop_size, scale=dataset_parameters.scale), 
    random_flip, 
    random_rotate, 
    random_lr_jpeg_noise]

to

train_mappings = [
    lambda lr, hr: random_crop(lr, hr, hr_crop_size=hr_crop_size, scale=dataset_parameters.scale), 
    random_flip, 
    random_rotate]

You can select from the different div2k datasets by changing the key:

dataset_key = "bicubic_x4" # by default

Available keys: bicubic_x2, unknown_x2, bicubic_x3, unknown_x3, bicubic_x4, unknown_x4, realistic_mild_x4, realistic_difficult_x4, realistic_wild_x4, bicubic_x8

Data will automatically be downloaded and the super resolution scale will be set based on the key.

Acknowledgements

Example images 000002x4.png, 000003x4.png, 000004x4.png come from Flickr2K_LR_bicubic X4

Example image 187_0019.jpg comes from Caltech 256

Much of the code in this repository has been refactored from https://github.com/krasserm/super-resolution

image-super-resolution's People

Contributors

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