Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/david-gpu/srez
Image super-resolution through deep learning
https://github.com/david-gpu/srez
Last synced: 3 months ago
JSON representation
Image super-resolution through deep learning
- Host: GitHub
- URL: https://github.com/david-gpu/srez
- Owner: david-gpu
- License: mit
- Archived: true
- Created: 2016-08-26T22:22:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T10:48:45.000Z (over 7 years ago)
- Last Synced: 2024-09-21T17:02:42.696Z (3 months ago)
- Language: Python
- Size: 202 KB
- Stars: 5,297
- Watchers: 191
- Forks: 667
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-gans-and-deepfakes - [github
- awesome-data-science-viz - srez - resolution through deep learning (Images / Frameworks)
- awesome - david-gpu/srez - Image super-resolution through deep learning (Python)
- gans-awesome-applications - [github
- starred-awesome - srez - Image super-resolution through deep learning (Python)
- awesome-starred - david-gpu/srez - Image super-resolution through deep learning (others)
README
# srez
Image super-resolution through deep learning. This project uses deep learning to upscale 16x16 images by a 4x factor. The resulting 64x64 images display sharp features that are plausible based on the dataset that was used to train the neural net.
Here's an random, non cherry-picked, example of what this network can do. From left to right, the first column is the 16x16 input image, the second one is what you would get from a standard bicubic interpolation, the third is the output generated by the neural net, and on the right is the ground truth.
![Example output](srez_sample_output.png)
As you can see, the network is able to produce a very plausible reconstruction of the original face. As the dataset is mainly composed of well-illuminated faces looking straight ahead, the reconstruction is poorer when the face is at an angle, poorly illuminated, or partially occluded by eyeglasses or hands.
This particular example was produced after training the network for 3 hours on a GTX 1080 GPU, equivalent to 130,000 batches or about 10 epochs.
# How it works
In essence the architecture is a DCGAN where the input to the generator network is the 16x16 image rather than a multinomial gaussian distribution.
In addition to that the loss function of the generator has a term that measures the L1 difference between the 16x16 input and downscaled version of the image produced by the generator.
The adversarial term of the loss function ensures the generator produces plausible faces, while the L1 term ensures that those faces resemble the low-res input data. We have found that this L1 term greatly accelerates the convergence of the network during the first batches and also appears to prevent the generator from getting stuck in a poor local solution.
Finally, the generator network relies on ResNet modules as we've found them to train substantially faster than more old-fashioned architectures. The adversarial network is much simpler as the use of ResNet modules did not provide an advantage during our experimentation.
# Requirements
You will need Python 3 with Tensorflow, numpy, scipy and [moviepy](http://zulko.github.io/moviepy/). See `requirements.txt` for details.
## Dataset
After you have the required software above you will also need the `Large-scale CelebFaces Attributes (CelebA) Dataset`. The model expects the `Align&Cropped Images` version. Extract all images to a subfolder named `dataset`. I.e. `srez/dataset/lotsoffiles.jpg`.
# Training the model
Training with default settings: `python3 srez_main.py --run train`. The script will periodically output an example batch in PNG format onto the `srez/train` folder, and checkpoint data will be stored in the `srez/checkpoint` folder.
After the network has trained you can also produce an animation showing the evolution of the output by running `python3 srez_main.py --run demo`.
# About the author
[LinkedIn profile of David Garcia](https://ca.linkedin.com/in/david-garcia-70913311).