March 2020
Intermediate to advanced
366 pages
9h 8m
English
As we are going to use the features as they are, let's first freeze the weights of the network layers so that they don't update during the training process:
for layer in base_model.layers: layer.trainable = False
In general, each location of an activation map specifies whether there is a feature of the corresponding type in that location. As we work on the last layers of the network, we can suppose that different locations on the activation map contain similar information and reduce the dimensionality of our features by averaging the activation maps:
x = K.layers.GlobalAveragePooling2D()(base_model.output)
The operation is called AveragePooling2D—we pool the average of the tensor in two dimensions ...