ilguyi / dcgan.tensorflow

14 stars 4 forks source link

Deep Convolutional Generative Adversarial Networks with TensorFlow with tf.train.Supervisor

implementation based on http://arxiv.org/abs/1511.06434

"Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks", Alec Radford, Luke Metz and Soumith Chintala

Network architecture

generator

Requirements

Training

dataset download (celebA_tfrecords.zip)

editing dcgan_train.sh

dcgan_train.sh

# Working directory
WORKING_DIR=$HOME/projects

# Where the training (fine-tuned) checkpoint and logs will be saved to.
TRAIN_DIR=$WORKING_DIR/dcgan.tensorflow/exp1

# Where the dataset is saved to.
DATASET_DIR=$WORKING_DIR/datasets/celebA/tfrecords

CUDA_VISIBLE_DEVICES=0 \
python train.py \
    --train_dir=${TRAIN_DIR} \
    --dataset_dir=${DATASET_DIR} \
    --initial_learning_rate=0.0002 \
    --num_epochs_per_decay=5 \
    --learning_rate_decay_factor=0.9 \
    --batch_size=128 \
    --num_examples=202599 \
    --max_steps=30000 \
    --save_steps=2000 \
    --adam_beta1=0.5 \

run dcgan_train.sh

$ ./dcgan_train.sh

Generating images

generate.sh

# Working directory
WORKING_DIR=$HOME/projects

# Where the training (fine-tuned) checkpoint and logs will be saved to.
TRAIN_DIR=$WORKING_DIR/dcgan.tensorflow/exp1

batch=$1

#CUDA_VISIBLE_DEVICES=0 \
python generate.py \
    --checkpoint_dir=${TRAIN_DIR} \
    --checkpoint_step=-1 \
    --batch_size=$batch \
    --seed=12345 \
    --make_gif=True \
    --save_step=2000 \

convert -delay 30 -loop 0 *.jpg generated_images.gif

run generate.sh

$ ./generate.sh batch_size (the number of images you want)

Results

celebA datasets

result

Author

Il Gu Yi