May 2020
Beginner to intermediate
430 pages
10h 39m
English
To calculate activation, we calculate the model output from each layer. In this example, there are 16 layers, so we use model.layers[:16] to specify all 16 layers. The code we use to do this is as follows:
layer_outputs = [layer.output for layer in model.layers[:16]]activation_modelfig = Model(inputs=model.input, outputs=layer_outputs)activationsfig = activation_modelfig.predict(img_tensor)
To use activation, we use the Keras Model functional API, which calculates all the layers required for calculating b when given a:
model = Model(inputs=[a1, a2], outputs=[b1, b2, b3])
For our exercise, the input is the image tensor we calculated previously, while the output is the activation layer.
Next, we visualize ...