Visualizing a CNN
What does the convolution layer used in a CNN "see"? Here, we will visualize a convolution layer to explore what happens in a CNN.
Visualizing the Weight of the First Layer
Earlier, we conducted simple CNN training for the MNIST dataset. The shape of the weight of the first (convolution) layer was (30, 1, 5, 5). It was 5x5 in size, had 1 channel, and 30 filters. When the filter is 5x5 in size and has 1 channel, it can be visualized as a one-channel gray image. Now, let's show the filters of the convolution layer (the first layer) as images. Here, we will compare the weights before and after training. Figure 7.24 shows the results (the source code is located at ch07/visualize_filter.py
):