Keras-based implementation of a Deep Convolutional Generative Adversarial Network, based on code from Robbie Barrat, Soumith Chintala, and Felix Mohr.
kerasGANv8.py supports command line arguments.
usage: kerasGANv8.py [-h] --batchSize BATCHSIZE [--noiseSize NOISESIZE]
[--yDim YDIM] [--xDim XDIM] [--outputDir OUTPUTDIR]
[--trainingDir TRAININGDIR]
optional arguments:
-h, --help show this help message and exit
required arguments:
--batchSize BATCHSIZE
batch size
--noiseSize NOISESIZE
size of noise input
--yDim YDIM input y dimension
--xDim XDIM input x dimension
--outputDir OUTPUTDIR
where to save generated imgs
--trainingDir TRAININGDIR
training imgs directory
If training on a CPU, I've found the following options productive:
python3 kerasGANv8.py --xDim=64 --yDim=64 --batchSize=4 --noiseSize=4 --outputDir=[your/desired/output/directory] --trainingDir=[directory/with/training/imgs]
tensorflow
keras
numpy
matplotlib
scipy
Use install_dependencies.sh to prepare.
./install_dependencies.sh
python3 kerasGANv8.py
-
Change the options for x_dim, y_dim, trainingDir, and outputDir to match your training images and desired output location.
-
Adjust the batch size and noise size to the speed at which you want to your model to learn. This is very dependent on how powerful your computer is.
-
These files are intended for CPU training only.
- For images with dimensions 256x256, having ngf=100 and ndf=15 has been optimal.
- For images with dimensions 128x128 or 64x64, having ngf=160 and ndf=20 to 40 has been optimal.
MNIST Training
128x128px Paintings Training
256x256px Impressionist Training
512x512px Paintings Training
256x256px Chuck Close Artwork Training
kerasGANv1 Training
Output from emulating work by Robbie Barrat and Soumith Chintala
More output from my adaptation of main.lua
My homemade revision of the neural network sequential structure that Soumith Chintala developed failed to produce high-quality images. I was able to get interesting results, but I would not classify the images my code generated as "artwork".
The slightly modified version of Barrat's code did produce cool results. The 64x64px generated landscapes came out cool. The 256x256px generated portraits also came out cool.
I am hoping to continue work on this, and eventually produce realistic artwork with my own revisions of Robbie Barrat's and Soumith Chintala's code.
- adapt for GPU calculations
- Lucas Lyon - lalyon
Shoutout to the following people, whose code was invaluable while developing these neural networks.