The simple dcgan model implemented in Keras with Tensorflow as backend.
The input and output image size of this model is 32 * 32, and in channel-first format, which means the input shape is ( , 3, 32, 32).
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv2d_1 (Conv2D) (None, 128, 16, 16) 1664
_________________________________________________________________
leaky_re_lu_1 (LeakyReLU) (None, 128, 16, 16) 0
_________________________________________________________________
dropout_1 (Dropout) (None, 128, 16, 16) 0
_________________________________________________________________
conv2d_2 (Conv2D) (None, 256, 8, 8) 131328
_________________________________________________________________
leaky_re_lu_2 (LeakyReLU) (None, 256, 8, 8) 0
_________________________________________________________________
dropout_2 (Dropout) (None, 256, 8, 8) 0
_________________________________________________________________
conv2d_3 (Conv2D) (None, 512, 4, 4) 524800
_________________________________________________________________
leaky_re_lu_3 (LeakyReLU) (None, 512, 4, 4) 0
_________________________________________________________________
dropout_3 (Dropout) (None, 512, 4, 4) 0
_________________________________________________________________
conv2d_4 (Conv2D) (None, 1024, 4, 4) 2098176
_________________________________________________________________
leaky_re_lu_4 (LeakyReLU) (None, 1024, 4, 4) 0
_________________________________________________________________
dropout_4 (Dropout) (None, 1024, 4, 4) 0
_________________________________________________________________
flatten_1 (Flatten) (None, 16384) 0
_________________________________________________________________
dense_1 (Dense) (None, 1) 16385
=================================================================
Total params: 2,772,353
Trainable params: 2,772,353
Non-trainable params: 0
_________________________________________________________________
_________________________________________________________________
[INFO] Init generator...
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense_2 (Dense) (None, 16384) 1654784
_________________________________________________________________
batch_normalization_1 (Batch (None, 16384) 65536
_________________________________________________________________
activation_1 (Activation) (None, 16384) 0
_________________________________________________________________
reshape_1 (Reshape) (None, 256, 8, 8) 0
_________________________________________________________________
up_sampling2d_1 (UpSampling2 (None, 256, 16, 16) 0
_________________________________________________________________
conv2d_transpose_1 (Conv2DTr (None, 128, 16, 16) 819328
_________________________________________________________________
batch_normalization_2 (Batch (None, 128, 16, 16) 64
_________________________________________________________________
activation_2 (Activation) (None, 128, 16, 16) 0
_________________________________________________________________
up_sampling2d_2 (UpSampling2 (None, 128, 32, 32) 0
_________________________________________________________________
conv2d_transpose_2 (Conv2DTr (None, 64, 32, 32) 204864
_________________________________________________________________
batch_normalization_3 (Batch (None, 64, 32, 32) 128
_________________________________________________________________
activation_3 (Activation) (None, 64, 32, 32) 0
_________________________________________________________________
conv2d_transpose_3 (Conv2DTr (None, 32, 32, 32) 51232
_________________________________________________________________
batch_normalization_4 (Batch (None, 32, 32, 32) 128
_________________________________________________________________
activation_4 (Activation) (None, 32, 32, 32) 0
_________________________________________________________________
conv2d_transpose_4 (Conv2DTr (None, 16, 32, 32) 12816
_________________________________________________________________
batch_normalization_5 (Batch (None, 16, 32, 32) 128
_________________________________________________________________
activation_5 (Activation) (None, 16, 32, 32) 0
_________________________________________________________________
conv2d_transpose_5 (Conv2DTr (None, 3, 32, 32) 1203
_________________________________________________________________
activation_6 (Activation) (None, 3, 32, 32) 0
=================================================================
Total params: 2,810,211
Trainable params: 2,777,219
Non-trainable params: 32,992
_________________________________________________________________
To use the model, import the module dcgan.
The constructor of dcgan take your train images as input, and its member function train will do the training work.
And the relative post on my personal blog: Linro