This repository introduces the TensorFlow 2 implementation of DCGAN described in UNSUPERVISED REPRESENTATION LEARNING WITH DEEP CONVOLUTIONAL GENERATIVE ADVERSARIAL NETWORKS (Radford et al. 2015)
- Python 3.7 or later
- Tensorflow 2.2.0
- numpy
- opencv
- matplotlib
The model in this repository was trained on CelebA Dataset, which is a large-scale face dataset containing 202.599 celebrity face images. To reproduce the result, the Align&Cropped Images of the CelebA Dataset are required. Please refer to Large-scale CelebFaces Attributes (CelebA) Dataset for more information and downloading.
To train DCGAN model, use the following command:
python run.py --dataset_dir path \
--checkpoint_dir path --progress_dir path \
--latent_dim int --test_size int \
--batch_size int --lr float --epochs int
where:
- --checkpoint_dir: Path to save checkpoint. Default="./model/checkpoint"
- --progress_dir: Path to write training progress image. Default="./data/face_gan"
- --dataset_dir: Path to dataset.
- --latent_dim: Latent space dimension. Default=100
- --test_size: Number of test images during training is equal test_size^2. Default=4
- --batch_size: Number of training steps per epoch. Default=100
- --lr: Learning rate. Default=0.0002
- --epochs: Number of epochs for training. Default=20
This GIF illustrates the generator improvement during the training
Samples from latent space | Faces linear transformation |
---|---|