layer_outputs = [layer.output for layer in model.layers[:16]] image = X_train[0] image = image.reshape(1, 150, 150, 3) activation_model = models.Model(inputs=model.input, outputs=layer_outputs) activations = activation_model.predict(image) first_layer_activation = activations[0] plt.matshow(first_layer_activation[0, :, :, 2], cmap='viridis') plt.matshow(first_layer_activation[0, :, :, 3], cmap='viridis')