Implementation of basic and universal DCGAN model using Keras.
These programs can load images from the specified directory, resize these images and train the Keras model. Images generated during training can be recorded. Also, trained models can be loaded and can be generated images.
- Python 3.0 or newer
- Keras 2.0 or newer (Tensorflow backend)
- Pillow
- numpy
- tqdm
- h5py
- Clone this repository:
git clone https://github.com/kcct-fujimotolab/DCGAN.git
cd DCGAN/
- Make a directory for data sets:
mkdir images
- Collect images (more than 2000-3000 works better):
ls images/
data0000.jpg data0001.jpg ... data9999.jpg
- Start training by specifying image size, number of epochs, data set directory, etc.:
python train.py --input images/ --size 64 64 --epoch 1000
- Generate images by specifying output directory, number of batches:
python generate.py --output gen/ --batch 64
--help
-h
: show information
--input
-i
: data sets path (default -i images/
)
--size
-z
: image size during training, 2 values required, must be multiples of 8 (default -z 64 64
)
--epoch
-e
: number of epochs (default -e 3000
)
--batch
-b
: batch size (default -b 64
)
--dim
-d
: input dimension of generator (default -d 100
)
--output
-o
: output directory path (default -o gen/
)
--save
-s
: taking snapshot interval (default -s 100
)
--output
-o
: output directory path (default -o gen/
)
--batch
-b
: number of generated images (default -b 64
)
We extracted 4096 images from the face data provided by Labeled Faces in the Wild, and trained with Keras model.
Fujimoto Lab at Kobe City College of Technology
Undergraduate Student of Electronics Department
@yoidea