Member-only story
Visualizing intermediate activation in Convolutional Neural Networks with Keras
In this article we’re going to train a simple Convolutional Neural Network using Keras with Python for a classification task. For that we will use a very small and simple set of images consisting of 100 pictures of circle drawings, 100 pictures of squares and 100 pictures of triangles which I found here in Kaggle. These will be split into training and testing sets (folders in working directory) and fed to the network.
Most importantly, we are going to replicate some of the work of François Chollet in his book Deep Learning with Python in order to learn how our layer structure processes the data in terms of visualization of each intermediate activation, which consists of displaying the feature maps that are output by the convolution and pooling layers in the network.
What this means is that we are going to visualize the result of each activation layer.
We’ll go super fast since we are not focusing here on doing a detailed explanation of CNNs with Keras.
Let’s first import all our required libraries:
%matplotlib inlineimport glob
import matplotlib
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import imageio as im
from keras import models
from…