TL;DR
Simonyan, Vedaldi and Zisserman asked what a trained image classifier has learned, and they answered with two gradient-based tools. The first generates an image that a chosen class score likes most. The second computes, for one given image and class, a saliency map that marks the pixels whose small changes would move the class score most, using a single backward pass. On the 2013 ImageNet challenge the saliency maps were good enough to locate objects with no box labels, only image-level labels.
Builds on: convolutional networks, Backpropagation, Taylor expansion · Leads to: Adversarial Examples, Image Segmentation
Why it mattered
The paper gave the field a cheap, general way to look inside a deep vision model. Saliency maps and related gradient methods have since been used as a first check in computer vision: a practitioner who suspects a model is reading a watermark or a background texture, rather than the object, can look at where the gradient lands. The same kind of gradient later underlies adversarial attacks, which change pixels in the direction the score is most sensitive to (Adversarial Examples).
The paper also made a technical point that lasted. Earlier visualisation work by Zeiler and Fergus used a special reconstruction network, the deconvolutional network. Simonyan and colleagues showed that for most layers this reconstruction is just back-propagation of gradients, so one method covers both. The paper presents this as a unified view that links gradient-based explanation to the older reconstruction methods.
The problem
A convolutional network trained on ImageNet has about one thousand class outputs, and each output is a score computed by many layers of Convolution, ReLU and max pooling. Before this paper, people could see what the first layers responded to, but there was no simple way to ask a question about the final decision: what does the network mean by "dog" in general, and which part of this particular photograph makes it say "dog"?
Two questions were open. The first was about the class: can we draw a representative image for a class from the trained weights alone? The second was about one image: can we say which pixels matter for the score, without retraining and without a labelled mask? The paper answers both with the same ingredient, the gradient of the class score with respect to the input image, which the Backpropagation algorithm computes for any network.
How it works
The method has two parts. This walkthrough follows the second, the saliency map, because it is the one that uses an actual image. It takes four steps for an input image and a class .
- Input. A grey-scale image with rows and columns, and a class such as "dog". The network has already been trained, and its weights are fixed.
- Forward pass. Run the image through the network to get the class score , the unnormalised output for class before the Softmax. Check: the score is one number for the class, and a higher number means the network prefers that class.
- Backward pass. Compute the derivative at , one number per pixel, with a single Backpropagation pass. Each number says how much the score changes for a tiny change in that pixel. Check: a large magnitude means a small change to that pixel moves the score a lot.
- Output. Take the absolute value of each derivative and, for colour images, the maximum across the three channels. Arrange the results on the image grid. The result is the saliency map , with one value per pixel. Check: has the same shape as the image, so you can overlay it directly.
A toy version makes the logic concrete. Suppose a 2 by 2 grey image is flattened to four pixels, and the score is a weighted sum with weights . The derivative of the score with respect to each pixel is just its weight, so the saliency values are . Put back on the grid, the pixel with weight is the most important, even though its sign is negative. The method keeps the magnitude and throws away the sign, because a strong negative influence is still an influence.
flowchart LR A[Image I0] --> B[Forward pass to score S_c] B --> C[Backward pass: gradient w of S_c] C --> D[Absolute value and max over channels] D --> E[Saliency map M on the image grid]
The paper also gives a second method, class model visualisation, which builds an image rather than explaining one. It starts from the zero image, plus the mean training image, and runs gradient ascent on the input to maximise the class score, with an penalty on the image size so that the result does not grow without limit. This uses the same backward pass, but the variable being adjusted is the image and not the weights.
The math
Let be the class score for image . The class model is the image that solves
where controls how strongly the image size is penalised. The authors maximise the unnormalised score rather than the softmax posterior , because increasing can be achieved by lowering the other scores; this is why the class model depicts the class, not its competitors.
Step 2 in symbols: a linear stand-in for the network
The score is a complicated function of the image. Near , the first-order Taylor expansion replaces it with a straight line:
Here is the image flattened into a vector, is the vector of derivatives, and makes the line pass through the true score at . For a linear model the weight vector is the saliency itself, which is the motivation the paper gives.
Step 3 in symbols: passing the gradient back through the layers
The derivative is computed by the chain rule, layer by layer. For a convolution with kernel , the paper shows that the backward step convolves with the flipped kernel . For a ReLU, the gradient is passed where the input was positive. For max pooling, the gradient goes only to the position that won the max. A deconvolutional network applies the same kind of rule in its reconstruction; the paper shows that the two agree except at ReLU layers, where the deconvolutional network masks by the sign of its own reconstruction rather than by the layer input.
Step 4 in symbols: from derivatives to a map
For a grey-scale image with pixel at index of , the map is . For a colour image with channels indexed by , the authors take the maximum over channels:
The maximum keeps the strongest response from any channel, so a pixel counts as salient if any of its colour channels matters.
Results
The paper reports four kinds of result, and each has its own limits.
Network accuracy. The single ConvNet used for the visualisations, trained on ILSVRC-2013 with 1.2 million training images and 1000 classes, reached a top-1 error of 39.7% and a top-5 error of 17.7% on the validation set. The authors note that this is slightly better than the 40.7% and 18.2% reported for a single network in the 2012 ImageNet paper by Krizhevsky and colleagues. The network has the layer configuration conv64, conv256, conv256, conv256, conv256, full4096, full4096, full1000, and the authors describe it as less wide than the 2012 network it was modelled on.
Class models. Figure 1 of the paper shows images generated for several classes. The authors judge them qualitatively: different aspects of a class, such as typical colours and parts, appear together in one image. There is no numerical score for this result, so the claim is visual.
Saliency maps and localisation. The saliency maps were averaged over ten crops and reflections of each test image, as the classifier itself does. They highlight the object in the test images shown in Figure 2. To turn the maps into object boxes, the authors ran a GraphCut colour segmentation seeded with a foreground colour model from pixels above the 95% quantile of saliency and a background model from pixels below the 30% quantile. The resulting mask gave a bounding box for each of the top-5 predicted classes. The method reached a 46.4% top-5 localisation error on the ILSVRC-2013 test set. The challenge winner reached 29.9%, but it used full supervision, while this method was weakly supervised, trained on image labels only. The authors' own 2012 localisation entry, which was fully supervised with part-based models and Fisher vectors, had a 50.0% localisation error, so the weakly supervised method beat it.
Limits. The saliency maps are a local statement: they describe how the score changes for tiny changes around one image, through a linear approximation. They are not proof of what the network uses, and a large saliency value is evidence of sensitivity, not of meaning. The localisation result is also a single number on one benchmark with a specific segmentation pipeline, so it says the maps are useful, not that they always find the whole object.
Reading guide
The paper is short, and its sections map onto prerequisites as follows.
- Abstract and Section 1 (Introduction). The three contributions: class models by gradient ascent, saliency maps by one backward pass, and the link to deconvolutional networks. Needs convolutional networks and Gradient Descent, because the visualisation is gradient ascent on the input.
- Section 2 (Class model visualisation). Needs L2 Regularization for the penalty term and Softmax for why the raw score, not the probability, is maximised.
- Section 3 (Saliency). Needs Taylor Series for the linear approximation, partial derivatives and Backpropagation for computing , and Rectified Linear Unit (ReLU) and Max Pooling because the map depends on how they pass gradients.
- Section 3.2 (Localisation). Needs Image Segmentation for the idea of masks. The GraphCut method and Gaussian mixture colour models are used as black boxes; the paper's own description is enough to follow the pipeline.
- Section 4 (Relation to deconvolutional networks). Needs Transposed Convolution (the Zeiler and Fergus deconvolution) and Convolution, to follow the flipped-kernel argument.
- Section 5 (Conclusion). Short, and it names future work on using saliency inside training.
Check yourself
QuestionIn one sentence, what does a class saliency map measure for an image, and how many backward passes does it need?Show answer
It measures how much a small change to each pixel would change the class score, using the derivative of the score with respect to the image. It needs a single backward pass.
QuestionA linear score is with . What saliency values does the method give for the three pixels?Show answer
The derivatives are the weights . Taking absolute values gives saliency . The second pixel is the most salient, even though its weight is negative.
QuestionWhy does the paper maximise the raw class score rather than the softmax probability when generating a class model image?Show answer
Probability can rise by lowering the scores of other classes, so maximising it does not concentrate on the target class. Maximising the raw score focuses the optimisation on class , which is what the class model is meant to depict.
QuestionA colleague says a bright saliency region proves the network 'sees' a dog there. Using the paper's own limits, how would you answer?Show answer
The map shows local sensitivity of the score under a linear approximation, not proof of meaning. It shows the pixels the score is most sensitive to, which is evidence worth checking, but a bright region does not by itself establish what the network uses or why.
Sources
- Simonyan, Vedaldi and Zisserman, "Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps" (2013), https://arxiv.org/abs/1312.6034
- Zeiler and Fergus, "Visualizing and Understanding Convolutional Networks" (2013), https://arxiv.org/abs/1311.2901