Implementation of DCGAN with TensorFlow slim. Base codes and models are from DCGAN in Tensorflow made by Taehoon Kim. At this time, this code only support Flower dataset, but maybe with some tweaks you can train/evaluate in other dataset.
I know there are lots of code of DCGAN, especially made by Taehoon Kim. However, this code implement DCGAN with the bleeding edges features of TensorFlow such as TF-Slim, tf.train.Supervisor
and TFRecords
etc.
- TensorFlow 1.0
- SciPy
- NumPy
- wget (Python library)
- Only tested in Python 3.4
Before train model, we have to convert dataset into TFRecords
file format. To do that, first download Flower dataset and then convert (also you can use other dataset such as MNIST or CIFAR-10).
$ cd dataset
# for flower dataset
$ python download_and_convert.py flowers
# for celebA dataset
$ python download_and_convert.py celebA
# if you want to use other dataset, you might change provided code.
Above instructions will make flowers.tfrecords
or celeba.tfrecords
file in dataset
directory.
To train model,
$ python3 dcgan/train.py
See dcgan/train.py
and dcgan/config.py
to modify arguments like logdir
or batch_size
etc (Someday I will provide argument parse codes).
Test (or sample) with trained model using below code.
$ python3 dcgan/sample.py
Note that checkpoint files must be located in logdir
directory. See dcgan/train.py
and dcgan/config.py
. By default, logdir
is set to log/
directory.
Below examples are randomly selected from model with trained around 60k steps.
Some flowers looks fine, but most of images are bad. I believe that this is because Flower dataset has lots of noises, however on the other side, DCGAN's capacity doesn't enough to handle noisy images.
Oops.. I accidentally deleted TensorBoard log file. :(
- Provide pre-trained model
- Apply
argparse
intrain.py
andsample.py
- TODOs