As mentioned in the previous section, the generator network is a deep convolution neural network. The generator network contains the following blocks:
- The pre-residual block
- The residual block
- The post-residual block
- The upsampling block
- The final convolution layer
Let's explore these blocks one by one:
- The pre-residual block: The pre-residual block contains a single 2D convolution layer and relu as the activation function. The configuration of the block is as follows:
Layer name |
Hyperparameters |
Input shape |
Output shape |
2D convolution layer |
Filters=64, kernel_size=3, strides=1, padding='same', activation='relu' |
(64, 64, 3) |
(64, 64, 64) |
- The residual block: The residual block contains two 2D convolution layers. Both layers are followed by a batch normalization layer with a value of momentum equal to 0.8. The configuration of each residual block is as follows:
Layer name |
Hyperparameters |
Input shape |
Output shape |
2D convolution layer |
Filters=64, kernel_size=3, strides=1, padding='same', activation='relu' |
(64, 64, 64) |
(64, 64, 64) |
Batch normalization layer |
Momentum=0.8 |
(64, 64, 64) |
(64, 64, 64) |
2D convolution layer |
Filters=64, kernel_size=3, strides=1, padding='same' |
(64, 64, 64) |
(64, 64, 64) |
Batch normalization layer |
Momentum=0.8 |
(64, 64, 64) |
(64, 64, 64) |
Addition layer |
None |
(64, 64, 64) |
(64, 64, 64) |
The addition layer calculates the sum of the input tensor to the block and the output of the last batch normalization layer. The generator network contains 16 residual blocks with the preceding configuration.
- The post-residual block: The post-residual block also contains a single 2D convolution layer and relu as the activation function. The convolution layer is followed by a batch normalization layer with the value of momentum equal to 0.8. The configuration of the post-residual block is as follows:
Layer name |
Hyperparameters |
Input Shape |
Output Shape |
2D convolution layer |
Filters=64, kernel_size=3, strides=1, padding='same' |
(64, 64, 64) |
(64, 64, 64) |
Batch normalization layer |
Momentum=0.8 |
(64, 64, 64) |
(64, 64, 64) |
- The upsampling block: The upsampling block contains one upsampling layer and one 2D convolution layer and uses relu as the activation function. There are two upsampling blocks in the generator network. The configuration of the first upsampling block is as follows:
Layer name |
Hyperparameters |
Input shape |
Output shape |
2D upsampling layer |
Size=(2, 2) |
(64, 64, 64) |
(128, 128, 64) |
2D convolution layer |
Filters=256, kernel_size=3, strides=1, padding='same', activation='relu' |
(128, 128, 256) |
(128, 128, 256) |
The configuration of the second upsampling block is as follows:
Layer name |
Hyperparameters |
Input shape |
Output shape |
2D upsampling layer |
Size=(2, 2) |
(128, 128, 256) |
(256, 256, 256) |
2D convolution layer |
Filters=256, kernel_size=3, strides=1, padding='same', activation='relu' |
(256, 256, 256) |
(256, 256, 256) |
- The last convolution layer: The last layer is a 2D convolution layer that uses tanh as the activation function. It generates an image of a shape of (256, 256, 3). The configuration of the last layer is as follows:
Layer name |
Hyperparameters |
Input shape |
Output shape |
2D convolution layer |
Filters=3, kernel_size=9, strides=1, padding='same', activation='tanh' |
(256, 256, 256) |
(256, 256, 3) |