Model architecture

Building the internal model function allows us to build and compile the discriminator neural network. To build it, take the following steps:

  1. Within the Discriminator class, define the model and create an input layer based on the shape of the image, as follows:
    def model(self):
input_layer = Input(shape=self.SHAPE)
  1. Start with the following two convolutional layers:
x = Convolution2D(96,3,3, subsample=(2,2),  
border_mode='same',activation='relu')(input_layer)
x = Convolution2D(64,3,3, subsample=(2,2),
border_mode='same',activation='relu')(x)
  1. Add a max pooling layer, as suggested by the authors, as follows:
x = MaxPooling2D(pool_size=(3,3),border_mode='same')(x)
  1. Finish the network with the final convolutional layers, as follows:
        x = Convolution2D(32,3,3, subsample=(1,1), border_mode='same',activation='relu')(x)
x = Convolution2D(32,1,1, subsample=(1,1), border_mode='same',activation='relu')(x)
x = Convolution2D(2,1,1, subsample=(1,1), border_mode='same',activation='relu')(x)
  1. Construct the output layer for the network and return the model with the following code:
output_layer = Reshape((-1,2))(x)
return Model(input_layer,output_layer)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.33.235