Model interpretability in PyTorch
In this section, we will dissect a trained handwritten digits classification model using PyTorch in the form of an exercise. More precisely, we will be looking at the details of the convolutional layers of the trained handwritten digits classification model to understand what visual features the model is learning from the handwritten digit images. We will look at the convolutional filters/kernels along with the feature maps produced by those filters.
Such details will help us to understand how the model is processing input images and, therefore, making predictions. The full code for the exercise can be found in our github repository [13.1] .
Training the handwritten digits classifier – a recap
We will quickly revisit the steps involved in training the handwritten digits classification model, as follows:
- First, we import the relevant libraries, and then set the random seeds to be able to reproduce the results of this exercise:
import torch
np...