May 2019
Intermediate to advanced
272 pages
7h 19m
English
The Discriminator model consists of a Convolution followed by ResNet blocks and a dense layer that projects the learned features to a single number, as given in the following code block:
from keras.layers import Input, Flattenfrom keras.layers import Dense, Conv2Dfrom keras.models import Modeldef build_resnet_discriminator(input_shape, n_filters, n_residual_blocks, kernel_size=(1, 1), stride=1): input = Input(shape=input_shape) x = Conv2D(filters=n_filters, kernel_size=kernel_size, strides=stride, padding='same')(input) # resnet blocks x = resnet_block(x, n_residual_blocks, n_filters) # Flatten and project to a single dimension x = Flatten()(x) x = Dense(1)(x) # create model graph model = Model(inputs=input, outputs=x, ...
Read now
Unlock full access