November 2018
Intermediate to advanced
492 pages
12h 19m
English
Now let's visualize the image feature maps (64 features with 64 filters) that are learned with the convolutional layer for a couple of images using the following code block:
from keras.models import Modelimport matplotlib.pylab as pylabimport numpy as npintermediate_layer_model = Model(inputs=model.input, outputs=model.get_layer('conv2d_1').output)intermediate_output = intermediate_layer_model.predict(X_train)print(model.input.shape, intermediate_output.shape)fig = pylab.figure(figsize=(15,15))fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wspace=0.05) pylab.gray()i = 1 for c in range(64): pylab.subplot(8, 8, c+1), pylab.imshow(intermediate_output[i,:,:,c]), pylab.axis('off')pylab.show() ...Read now
Unlock full access