The architecture of the discriminator network is similar to the architecture of the discriminator in a PatchGAN network. It is a deep convolutional neural network and contains several convolution blocks. Basically, it takes an image of a shape of (128, 128, 3) and predicts whether the image is real or fake. It contains several ZeroPadding2D layers, the documentation for which is available at the following link: https://keras.io/layers/convolutional/#zeropadding2d. The following table shows the architecture of the discriminator network in detail:
Layer name |
Hyperparameters |
Input shape |
Output shape |
Input layer |
none |
(128, 128, 3) |
(128, 128, 3) |
ZeroPadding2D layer |
padding(1, 1) |
(128, 128, 3) |
(130, 130, 3) |
2D convolution layer |
filters=64, kernel_size=4, strides=2, padding='valid' |
(130, 130, 3) |
(64, 64, 64) |
Activation layer |
activation='leakyrelu', alpha=0.2 |
(64, 64, 64) |
(64, 64, 64) |
ZeroPadding2D layer |
padding(1, 1) |
(64, 64, 64) |
(66, 66, 64) |
2D convolution layer |
filters=128, kernel_size=4, strides=2, padding='valid' |
(66, 66, 64) |
(32, 32, 128) |
Instance normalization layer |
axis=1 |
(32, 32, 128) |
(32, 32, 128) |
Activation layer |
activation='leakyrelu', alpha=0.2 |
(32, 32, 128) |
(32, 32, 128) |
ZeroPadding2D layer |
padding(1, 1) |
(32, 32, 128) |
(34, 34, 128) |
2D convolution layer |
filters=256, kernel_size=4, strides=2, padding='valid' |
(34, 34, 128) |
(16, 16, 256) |
Instance normalization layer |
axis=1 |
(16, 16, 256) |
(16, 16, 256) |
Activation layer |
activation='leakyrelu', alpha=0.2 |
(16, 16, 256) |
(16, 16, 256) |
ZeroPadding2D layer |
padding(1, 1) |
(16, 16, 256) |
(18, 18, 256) |
2D convolution layer |
filters=512, kernel_size=4, strides=2, padding='valid' |
(18, 18, 256) |
(8, 8, 512) |
Instance normalization layer |
axis=1 |
(8, 8, 512) |
(8, 8, 512) |
Activation layer |
activation='leakyrelu', alpha=0.2 |
(8, 8, 512) |
(8, 8, 512) |
ZeroPadding2D layer |
padding(1, 1) |
(8, 8, 512) |
(10, 10, 512) |
2D convolution layer |
filters=1, kernel_size=4, strides=1, padding='valid', activation='sigmoid' |
(10, 10, 512) |
(7, 7, 1) |
The discriminator network returns a tensor with a shape of (7, 7, 1). We have now covered the detailed architecture of both networks. In the next section, we'll take a look at the objective function required to train CycleGANs.