This paper addresses the visualisation of image classification models, learnt using deep Convolutional Networks (ConvNets). We consider two visualisation techniques, based on computing the gradient of the class score with respect to the input image. The first one generates an image, which maximises the class score [Erhan et al., 2009], thus visualising the notion of the class, captured by a ConvNet. The second technique computes a class saliency map, specific to a given image and class. We show that such maps can be employed for weakly supervised object segmentation using classification ConvNets. Finally, we establish the connection between the gradient-based ConvNet visualisation methods and deconvolutional networks [Zeiler et al., 2013].READ FULL TEXT VIEW PDF
Existing weakly supervised semantic segmentation (WSSS) methods usually
There is great interest in *saliency methods* (also called *attribution
We propose an end-to-end-trainable attention module for convolutional ne...
Explaining the output of a deep network remains a challenge. In the case...
Gaining insight into how deep convolutional neural network models perfor...
With recent advances in deep learning, neuroimaging studies increasingly...
Convolutional Networks (ConvNets) have recently improved image recogniti...
CNN visualization tool
With the deep Convolutional Networks (ConvNets)  now being the architecture of choice for large-scale image recognition [8, 4], the problem of understanding the aspects of visual appearance, captured inside a deep model, has become particularly relevant and is the subject of this paper.
In previous work, Erhan et al. 
visualised deep models by finding an input image which maximises the neuron activity of interest by carrying out an optimisation using gradient ascent in the image space. The method was used to visualise the hidden feature layers of unsupervised deep architectures, such as the Deep Belief Network (DBN), and it was later employed by Le et al.  to visualise the class models, captured by a deep unsupervised auto-encoder. Recently, the problem of ConvNet visualisation was addressed by Zeiler et al. . For convolutional layer visualisation, they proposed the Deconvolutional Network (DeconvNet) architecture, which aims to approximately reconstruct the input of each layer from its output.
In this paper, we address the visualisation of deep image classification ConvNets, trained on the large-scale ImageNet challenge dataset. To this end, we make the following three contributions. First, we demonstrate that understandable visualisations of ConvNet classification models can be obtained using the numerical optimisation of the input image  (Sect. 2). Note, in our case, unlike , the net is trained in a supervised manner, so we know which neuron in the final fully-connected classification layer should be maximised to visualise the class of interest (in the unsupervised case,  had to use a separate annotated image set to find out the neuron responsible for a particular class). To the best of our knowledge, we are the first to apply the method of  to the visualisation of ImageNet classification ConvNets . Second, we propose a method for computing the spatial support of a given class in a given image (image-specific class saliency map) using a single back-propagation pass through a classification ConvNet (Sect. 3). As discussed in Sect. 3.2, such saliency maps can be used for weakly supervised object localisation. Finally, we show in Sect. 4 that the gradient-based visualisation methods generalise the deconvolutional network reconstruction procedure .
Our visualisation experiments were carried out using a single deep ConvNet, trained on the ILSVRC-2013 dataset , which includes 1.2M training images, labelled into 1000 classes.
Our ConvNet is similar to that of  and is implemented using their
cuda-convnet toolbox111http://code.google.com/p/cuda-convnet/, although our net is less wide,
and we used additional image jittering, based on zeroing-out random parts of an image.
Our weight layer configuration is: conv64-conv256-conv256-conv256-conv256-full4096-full4096-full1000,
where convN denotes a convolutional layer with N filters, fullM – a fully-connected layer with M outputs.
On ILSVRC-2013 validation set, the network achieves the top-1/top-5 classification error of , which is slightly better than
/, reported in  for a single ConvNet.
In this section we describe a technique for visualising the class models, learnt by the image classification ConvNets. Given a learnt classification ConvNet and a class of interest, the visualisation method consists in numerically generating an image , which is representative of the class in terms of the ConvNet class scoring model.
More formally, let be the score of the class , computed by the classification layer of the ConvNet for an image . We would like to find an -regularised image, such that the score is high:
where is the regularisation parameter. A locally-optimal can be found by the back-propagation method. The procedure is related to the ConvNet training procedure, where the back-propagation is used to optimise the layer weights. The difference is that in our case the optimisation is performed with respect to the input image, while the weights are fixed to those found during the training stage. We initialised the optimisation with the zero image (in our case, the ConvNet was trained on the zero-centred image data), and then added the training set mean image to the result. The class model visualisations for several classes are shown in Fig. 1.
It should be noted that we used the (unnormalised) class scores , rather than the class posteriors, returned by the soft-max layer: . The reason is that the maximisation of the class posterior can be achieved by minimising the scores of other classes. Therefore, we optimise to ensure that the optimisation concentrates only on the class in question . We also experimented with optimising the posterior , but the results were not visually prominent, thus confirming our intuition.
In this section we describe how a classification ConvNet can be queried about the spatial support of a particular class in a given image. Given an image , a class , and a classification ConvNet with the class score function , we would like to rank the pixels of based on their influence on the score .
We start with a motivational example. Consider the linear score model for the class :
where the image is represented in the vectorised (one-dimensional) form, and and
are respectively the weight vector and the bias of the model. In this case, it is easy to see that the magnitude of elements ofdefines the importance of the corresponding pixels of for the class .
In the case of deep ConvNets, the class score is a highly non-linear function of , so the reasoning of the previous paragraph can not be immediately applied. However, given an image , we can approximate with a linear function in the neighbourhood of by computing the first-order Taylor expansion:
where is the derivative of with respect to the image at the point (image) :
Another interpretation of computing the image-specific class saliency using the class score derivative (4) is that the magnitude of the derivative indicates which pixels need to be changed the least to affect the class score the most. One can expect that such pixels correspond to the object location in the image. We note that a similar technique has been previously applied by  in the context of Bayesian classification.
Given an image (with rows and columns) and a class , the class saliency map is computed as follows. First, the derivative (4) is found by back-propagation. After that, the saliency map is obtained by rearranging the elements of the vector . In the case of a grey-scale image, the number of elements in is equal to the number of pixels in , so the map can be computed as , where is the index of the element of , corresponding to the image pixel in the -th row and -th column. In the case of the multi-channel (e.g. RGB) image, let us assume that the colour channel of the pixel of image corresponds to the element of with the index . To derive a single class saliency value for each pixel , we took the maximum magnitude of across all colour channels: .
It is important to note that the saliency maps are extracted using a classification ConvNet trained on the image labels, so no additional annotation is required (such as object bounding boxes or segmentation masks). The computation of the image-specific saliency map for a single class is extremely quick, since it only requires a single back-propagation pass.
We visualise the saliency maps for the highest-scoring class (top-1 class prediction) on randomly selected ILSVRC-2013 test set images in Fig. 2. Similarly to the ConvNet classification procedure , where the class predictions are computed on 10 cropped and reflected sub-images, we computed 10 saliency maps on the 10 sub-images, and then averaged them.
The weakly supervised class saliency maps (Sect. 3.1) encode the location of the object of the given class in the given image, and thus can be used for object localisation (in spite of being trained on image labels only). Here we briefly describe a simple object localisation procedure, which we used for the localisation task of the ILSVRC-2013 challenge .
Given an image and the corresponding class saliency map, we compute the object segmentation mask using the GraphCut colour segmentation 
. The use of the colour segmentation is motivated by the fact that the saliency map might capture only the most discriminative part of an object, so saliency thresholding might not be able to highlight the whole object. Therefore, it is important to be able to propagate the thresholded map to other parts of the object, which we aim to achieve here using the colour continuity cues. Foreground and background colour models were set to be the Gaussian Mixture Models. The foreground model was estimated from the pixels with the saliency higher than a threshold, set to thequantile of the saliency distribution in the image; the background model was estimated from the pixels with the saliency smaller than the quantile (Fig. 3, right-middle). The GraphCut segmentation  was then performed using the publicly available implementation222http://www.robots.ox.ac.uk/~vgg/software/iseg/. Once the image pixel labelling into foreground and background is computed, the object segmentation mask is set to the largest connected component of the foreground pixels (Fig. 3, right).
We entered our object localisation method into the ILSVRC-2013 localisation challenge. Considering that the challenge requires the object bounding boxes to be reported, we computed them as the bounding boxes of the object segmentation masks. The procedure was repeated for each of the top-5 predicted classes. The method achieved top-5 error on the test set of ILSVRC-2013. It should be noted that the method is weakly supervised (unlike the challenge winner with error), and the object localisation task was not taken into account during training. In spite of its simplicity, the method still outperformed our submission to ILSVRC-2012 challenge (which used the same dataset), which achieved localisation error using a fully-supervised algorithm based on the part-based models  and Fisher vector feature encoding .
In this section we establish the connection between the gradient-based visualisation and the DeconvNet architecture of . As we show below, DeconvNet-based reconstruction of the -th layer input is either equivalent or similar to computing the gradient of the visualised neuron activity with respect to , so DeconvNet effectively corresponds to the gradient back-propagation through a ConvNet.
For the convolutional layer , the gradient is computed as , where and are the convolution kernel and its flipped version, respectively. The convolution with the flipped kernel exactly corresponds to computing the -th layer reconstruction in a DeconvNet: .
For the RELU rectification layer, the sub-gradient takes the form: , where is the element-wise indicator function. This is slightly different from the DeconvNet RELU reconstruction: , where the sign indicator is computed on the output reconstruction instead of the layer input .
Finally, consider a max-pooling layer, where the element of the output feature map is computed by pooling over the corresponding spatial neighbourhood of the input. The sub-gradient is computed as . Here, corresponds to the max-pooling “switch” in a DeconvNet.
We can conclude that apart from the RELU layer, computing the approximate feature map reconstruction using a DeconvNet is equivalent to computing the derivative using back-propagation, which is a part of our visualisation algorithms. Thus, gradient-based visualisation can be seen as the generalisation of that of , since the gradient-based techniques can be applied to the visualisation of activities in any layer, not just a convolutional one. In particular, in this paper we visualised the class score neurons in the final fully-connected layer.
It should be noted that our class model visualisation (Sect. 2) depicts the notion of a class, memorised by a ConvNet, and is not specific to any particular image. At the same time, the class saliency visualisation (Sect. 3) is image-specific, and in this sense is related to the image-specific convolutional layer visualisation of  (the main difference being that we visualise a neuron in a fully connected layer rather than a convolutional layer).
In this paper, we presented two visualisation techniques for deep classification ConvNets. The first generates an artificial image, which is representative of a class of interest. The second computes an image-specific class saliency map, highlighting the areas of the given image, discriminative with respect to the given class. We showed that such saliency map can be used to initialise GraphCut-based object segmentation without the need to train dedicated segmentation or detection models. Finally, we demonstrated that gradient-based visualisation techniques generalise the DeconvNet reconstruction procedure . In our future research, we are planning to incorporate the image-specific saliency maps into learning formulations in a more principled manner.
This work was supported by ERC grant VisRec no. 228180. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Tesla K40 GPU used for this research.
Multi-column deep neural networks for image classification.In Proc. CVPR, pages 3642–3649, 2012.
ImageNet classification with deep convolutional neural networks.In NIPS, pages 1106–1114, 2012.
Building high-level features using large scale unsupervised learning.In Proc. ICML, 2012.