Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carpedm20/dcgan-tensorflow
A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
https://github.com/carpedm20/dcgan-tensorflow
dcgan gan generative-model tensorflow
Last synced: 3 days ago
JSON representation
A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
- Host: GitHub
- URL: https://github.com/carpedm20/dcgan-tensorflow
- Owner: carpedm20
- License: mit
- Created: 2015-12-11T02:06:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-06T05:38:06.000Z (almost 4 years ago)
- Last Synced: 2024-12-18T20:06:17.431Z (3 days ago)
- Topics: dcgan, gan, generative-model, tensorflow
- Language: JavaScript
- Homepage: http://carpedm20.github.io/faces/
- Size: 76.2 MB
- Stars: 7,158
- Watchers: 245
- Forks: 2,625
- Open Issues: 188
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DCGAN in Tensorflow
Tensorflow implementation of [Deep Convolutional Generative Adversarial Networks](http://arxiv.org/abs/1511.06434) which is a stabilize Generative Adversarial Networks. The referenced torch code can be found [here](https://github.com/soumith/dcgan.torch).
![alt tag](DCGAN.png)
* [Brandon Amos](http://bamos.github.io/) wrote an excellent [blog post](http://bamos.github.io/2016/08/09/deep-completion/) and [image completion code](https://github.com/bamos/dcgan-completion.tensorflow) based on this repo.
* *To avoid the fast convergence of D (discriminator) network, G (generator) network is updated twice for each D network update, which differs from original paper.*## Online Demo
[](http://carpedm20.github.io/faces/)
[link](http://carpedm20.github.io/faces/)
## Prerequisites
- Python 2.7 or Python 3.3+
- [Tensorflow 0.12.1](https://github.com/tensorflow/tensorflow/tree/r0.12)
- [SciPy](http://www.scipy.org/install.html)
- [pillow](https://github.com/python-pillow/Pillow)
- [tqdm](https://pypi.org/project/tqdm/)
- (Optional) [moviepy](https://github.com/Zulko/moviepy) (for visualization)
- (Optional) [Align&Cropped Images.zip](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html) : Large-scale CelebFaces Dataset## Usage
First, download dataset with:
$ python download.py mnist celebA
To train a model with downloaded dataset:
$ python main.py --dataset mnist --input_height=28 --output_height=28 --train
$ python main.py --dataset celebA --input_height=108 --train --cropTo test with an existing model:
$ python main.py --dataset mnist --input_height=28 --output_height=28
$ python main.py --dataset celebA --input_height=108 --cropOr, you can use your own dataset (without central crop) by:
$ mkdir data/DATASET_NAME
... add images to data/DATASET_NAME ...
$ python main.py --dataset DATASET_NAME --train
$ python main.py --dataset DATASET_NAME
$ # example
$ python main.py --dataset=eyes --input_fname_pattern="*_cropped.png" --trainIf your dataset is located in a different root directory:
$ python main.py --dataset DATASET_NAME --data_dir DATASET_ROOT_DIR --train
$ python main.py --dataset DATASET_NAME --data_dir DATASET_ROOT_DIR
$ # example
$ python main.py --dataset=eyes --data_dir ../datasets/ --input_fname_pattern="*_cropped.png" --train
## Results
![result](assets/training.gif)
### celebA
After 6th epoch:
![result3](assets/result_16_01_04_.png)
After 10th epoch:
![result4](assets/test_2016-01-27%2015:08:54.png)
### Asian face dataset
![custom_result1](web/img/change5.png)
![custom_result1](web/img/change2.png)
![custom_result2](web/img/change4.png)
### MNIST
MNIST codes are written by [@PhoenixDai](https://github.com/PhoenixDai).
![mnist_result1](assets/mnist1.png)
![mnist_result2](assets/mnist2.png)
![mnist_result3](assets/mnist3.png)
More results can be found [here](./assets/) and [here](./web/img/).
## Training details
Details of the loss of Discriminator and Generator (with custom dataset not celebA).
![d_loss](assets/d_loss.png)
![g_loss](assets/g_loss.png)
Details of the histogram of true and fake result of discriminator (with custom dataset not celebA).
![d_hist](assets/d_hist.png)
![d__hist](assets/d__hist.png)
## Related works
- [BEGAN-tensorflow](https://github.com/carpedm20/BEGAN-tensorflow)
- [DiscoGAN-pytorch](https://github.com/carpedm20/DiscoGAN-pytorch)
- [simulated-unsupervised-tensorflow](https://github.com/carpedm20/simulated-unsupervised-tensorflow)## Author
Taehoon Kim / [@carpedm20](http://carpedm20.github.io/)