Skip to content

Upscale images by a factor of 2 via deep convolutional neural network in Python

Notifications You must be signed in to change notification settings

TheMrKingent/NeuralUpscale

Repository files navigation

Neural Upscale 2x

headline

Upscale images by a factor of 2 via deep convolutional neural network in Python: API and pre-trained models, based on the ESPC architecture by Shi et al. 2016 [1].

Two pre-trained models are included: Luminance and RGB, both of which were trained on approximately 33k various images (~6.5Gb). You can, however, use any Tensorflow model which is compatible with the architecture, or even train your own, in which case UpscalingUtilities package and Training.ipynb notebook may be useful.

Requirements: Tensorflow, PIL. Tested on Python 3.10.


Quick Guide

  1. Import necessary utilities, all dependencies are loaded automatically:
from UpscalingUtilities import *
from Neural_Upscale_2x import *
  1. Load desired model. Pre-trained models are either Luminance_Model or RGB_Model. Say you want to use the first one:
model = load_upscaling_model('../Luminance_Model')
  1. Load desired image using Tensorflow's function, which returns a PIL image instance:
img = load_img('../img.png')
  1. Initialize an upscaler object using the appropriate function. Either luminanceUpscaler() or rgbUpscaler(). In this example:
upscaler = luminanceUpscaler(model)
  1. Upscale! Returns an image upscaled by a factor of 2 in both width and height (4 times as many pixels) as a PIL image instance, which you can save as usual:
img_2x = upscaler.upscale(img)
img_2x.save('../title.png')

LargeMatrix


References

[1] Wenzhe Shi, Jose Caballero, Ferenc Huszár, Johannes Totz, Andrew P Aitken, Rob Bishop, Daniel Rueckert, and Zehan Wang. Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1874–1883, 2016.

About

Upscale images by a factor of 2 via deep convolutional neural network in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published