Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aitorzip/pytorch-srgan
A modern PyTorch implementation of SRGAN
https://github.com/aitorzip/pytorch-srgan
cnn computer-vision convolutional-neural-networks deep-learning gan generative-adversarial-network pytorch pytorch-gan srgan super-resolution
Last synced: 4 days ago
JSON representation
A modern PyTorch implementation of SRGAN
- Host: GitHub
- URL: https://github.com/aitorzip/pytorch-srgan
- Owner: aitorzip
- License: gpl-3.0
- Created: 2017-07-22T22:45:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T11:22:19.000Z (about 7 years ago)
- Last Synced: 2024-12-24T19:09:24.303Z (11 days ago)
- Topics: cnn, computer-vision, convolutional-neural-networks, deep-learning, gan, generative-adversarial-network, pytorch, pytorch-gan, srgan, super-resolution
- Language: Python
- Homepage: https://arxiv.org/abs/1609.04802
- Size: 146 MB
- Stars: 362
- Watchers: 9
- Forks: 92
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyTorch-SRGAN
A modern PyTorch implementation of SRGANIt is deeply based on __Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network__ paper published by the Twitter team (https://arxiv.org/abs/1609.04802) but I replaced activations by Swish (https://arxiv.org/abs/1710.05941)
You can start training out-of-the-box with the CIFAR-10 or CIFAR-100 datasets, to emulate the paper results however, you will need to download and clean the ImageNet dataset yourself. Results and weights are provided for the ImageNet dataset.
Contributions are welcome!
## Requirements
* PyTorch
* torchvision
* tensorboard_logger (https://github.com/TeamHG-Memex/tensorboard_logger)## Training
```
usage: train [-h] [--dataset DATASET] [--dataroot DATAROOT]
[--workers WORKERS] [--batchSize BATCHSIZE]
[--imageSize IMAGESIZE] [--upSampling UPSAMPLING]
[--nEpochs NEPOCHS] [--generatorLR GENERATORLR]
[--discriminatorLR DISCRIMINATORLR] [--cuda] [--nGPU NGPU]
[--generatorWeights GENERATORWEIGHTS]
[--discriminatorWeights DISCRIMINATORWEIGHTS] [--out OUT]
```Example: ```./train --cuda```
This will start a training session in the GPU. First it will pre-train the generator using MSE error for 2 epochs, then it will train the full GAN (generator + discriminator) for 100 epochs, using content (mse + vgg) and adversarial loss. Although weights are already provided in the repository, this script will also generate them in the checkpoints file.
## Testing
```
usage: test [-h] [--dataset DATASET] [--dataroot DATAROOT] [--workers WORKERS]
[--batchSize BATCHSIZE] [--imageSize IMAGESIZE]
[--upSampling UPSAMPLING] [--cuda] [--nGPU NGPU]
[--generatorWeights GENERATORWEIGHTS]
[--discriminatorWeights DISCRIMINATORWEIGHTS]```
Example: ```./test --cuda```
This will start a testing session in the GPU. It will display mean error values and save the generated images in the output directory, all three versions: low resolution, high resolution (original) and high resolution (generated).
## Results
### Training
The following results have been obtained with the current training setup:* Dataset: 350K randomly selected ImageNet samples
* Input image size: 24x24
* Output image size: 96x96 (16x)Other training parameters are the default of _train_ script
![Tensorboard training graphs](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/training_results.png)
### Testing
Testing has been executed on 128 randomly selected ImageNet samples (disjoint from training set)```[7/8] Discriminator_Loss: 1.4123 Generator_Loss (Content/Advers/Total): 0.0901/0.6152/0.0908```
### Examples
See more under the _output_ directory__High resolution / Low resolution / Recovered High Resolution__
![Original doggy](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_real/41.png)
![Generated doggy](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_fake/41.png)![Original woman](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_real/38.png)
![Generated woman](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_fake/38.png)![Original hair](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_real/127.png)
![Generated hair](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_fake/127.png)![Original sand](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_real/72.png)
![Generated sand](https://raw.githubusercontent.com/ai-tor/PyTorchSRGAN/master/output/high_res_fake/72.png)