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: 7 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 (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-06T05:38:06.000Z (over 4 years ago)
- Last Synced: 2025-04-10T22:35:13.468Z (9 days ago)
- Topics: dcgan, gan, generative-model, tensorflow
- Language: JavaScript
- Homepage: http://carpedm20.github.io/faces/
- Size: 76.2 MB
- Stars: 7,161
- Watchers: 244
- 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).

* [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

### celebA
After 6th epoch:

After 10th epoch:

### Asian face dataset



### MNIST
MNIST codes are written by [@PhoenixDai](https://github.com/PhoenixDai).



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


Details of the histogram of true and fake result of discriminator (with custom dataset not celebA).


## 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/)