VisualBackProp: efficient visualization of CNNs

11/16/2016 ∙ by Mariusz Bojarski, et al. ∙ Google NYU college Nvidia 0

This paper proposes a new method, that we call VisualBackProp, for visualizing which sets of pixels of the input image contribute most to the predictions made by the convolutional neural network (CNN). The method heavily hinges on exploring the intuition that the feature maps contain less and less irrelevant information to the prediction decision when moving deeper into the network. The technique we propose was developed as a debugging tool for CNN-based systems for steering self-driving cars and is therefore required to run in real-time, i.e. it was designed to require less computations than a forward propagation. This makes the presented visualization method a valuable debugging tool which can be easily used during both training and inference. We furthermore justify our approach with theoretical arguments and theoretically confirm that the proposed method identifies sets of input pixels, rather than individual pixels, that collaboratively contribute to the prediction. Our theoretical findings stand in agreement with the experimental results. The empirical evaluation shows the plausibility of the proposed approach on the road video data as well as in other applications and reveals that it compares favorably to the layer-wise relevance propagation approach, i.e. it obtains similar visualization results and simultaneously achieves order of magnitude speed-ups.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 7

page 8

page 14

page 15

page 16

page 17

page 18

page 19

Code Repositories

VisualBackProp

VisualBackProp - visualization method for convolutional neural networks


view repo

VisualBackProp-PyTorch

Implementation of VisualBackProp using Pytorch.


view repo
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

A plethora of important real-life problems are currently addressed with CNNs [1], including image recognition [2], speech recognition [3]

, and natural language processing 

[4]. More recently they were successfully used in the complex intelligent autonomous systems such as self-driving cars [5, 6]

. One of the fundamental question that arises when considering CNNs as well as other deep learning models is:

what made the trained neural network model arrive at a particular response? This question is of particular importance to the end-to-end systems, where the interpretability of the system is limited. Visualization tools aim at addressing this question by identifying parts of the input image that had the highest influence on forming the final prediction by the network. It is also straightforward to think about visualization methods as a debugging tool that helps to understand if the network detects “reasonable” cues from the image to arrive at a particular decision.

The visualization method for CNNs proposed in this paper was originally developed for CNN-based systems for steering autonomous cars, though it is highly general and can be used in other applications as well. The method relies on the intuition that when moving deeper into the network, the feature maps contain less and less information which are irrelevant to the output. Thus, the feature maps of the last convolutional layer should contain the most relevant information to determine the output. At the same time, feature maps of deeper layers have lower resolution. The underlying idea of the approach is to combine feature maps containing only relevant information (deep ones) with the ones with higher resolution (shallow ones). In order to do so, starting from the feature maps of the last convolutional layer, we “backpropagate” the information about the regions of relevance while simultaneously increasing the resolution, where the backpropagation procedure is not gradient-based (as is the case for example in sensitivity-based approaches 

[7, 8, 9]), but instead is value-based. We call this approach VisualBackProp (an exemplary results are demonstrated in Figure 1).

Figure 1:

Visualization masks obtained by VisualBackProp on ImageNet for ResNet-

 [10].

Our method provides a general tool for verifying that the predictions generated by the neural network111In the case of our end-to-end system for steering an autonomous car, a prediction is the steering wheel angle., are based on reasonable optical cues in the input image. In case of autonomous driving these can be lane markings, other cars, or edges of the road. Our visualization tool runs in real time and requires less computations than forward propagation. We empirically demonstrate that it is order of magnitude faster than the state-of-the-art visualization method, layer-wise relevance propagation (LRP) [11], while at the same time it leads to very similar visualization results.

In the theoretical part of this paper we first provide a rigorous mathematical analysis of the contribution of input neurons to the activations in the last layer that relies on network flows. We propose a quantitative measure of that contribution. We then show that our algorithm finds for each neuron the approximated value of that measure. To the best of our knowledge, the majority of the existing visualization techniques for deep learning, which we discuss in the Related Work section, lack theoretical guarantees, which instead we provide for our approach. This is yet another important contribution of this work.

The paper is organized as follows: Section 2 discusses related work, Section 3 describes our approach and Section 4 provides its theoretical analysis, Section 5 presents empirical results, and Section 6 contains final remarks.

2 Related work

A notable approach [11]

addressing the problem of understanding classification decisions by pixel-wise decomposition of non-linear classifiers proposes a methodology called layer-wise relevance propagation, where the prediction is back-propagated without using gradients such that the relevance of each neuron is redistributed to its predecessors through a particular message-passing scheme relying on the conservation principle. The stability of the method and the sensitivity to different settings of the conservation parameters was studied in the context of several deep learning models 

[12]

. The LRP technique was extended to Fisher Vector classifiers 

[13] and also used to explain predictions of CNNs in NLP applications [14]. An extensive comparison of LRP with other techniques, like the deconvolution method [15] and the sensitivity-based approach [8], which we also discuss next in this section, using an evaluation based on region perturbation can be found in [16]. This study reveals that LRP provides better explanation of the DNN classification decisions than considered competitors222We thus chose LRP as a competitive technique to our method in the experimental section..

Another approach [15]

for understanding CNNs with max-pooling and rectified linear units (ReLUs) through visualization uses deconvolutional neural network 

[17] attached to the convolutional network of interest. This approach maps the feature activity in intermediate layers of a previously trained CNN back to the input pixel space using deconvolutional network, which performs successively repeated operations of i) unpooling, ii) rectification, and iii) filtering. Since this method identifies structures within each patch that stimulate a particular feature map, it differs from previous approaches [18] which instead identify patches within a data set that stimulate strong activations at higher layers in the model. The method can also be interpreted as providing an approximation to partial derivatives with respect to pixels in the input image [8]. One of the shortcomings of the method is that it enables the visualization of only a single activation in a layer (all other activations are set to zero). There also exist other techniques for inverting a modern large convolutional network with another network, e.g. a method based on up-convolutional architecture [19], where as opposed to the previously described deconvolutional neural network, the up-convolutional network is trained. This method inverts deep image representations and obtains reconstructions of an input image from each layer.

The fundamental difference between the LRP approach and the deconvolution method lies in how the responses are projected towards the inputs. The latter approach solves the optimization problems to reconstruct the image input while the former one aims to reconstruct the classifier decision (the details are well-explained in [11]).

Guided backpropagation [20] extends the deconvolution approach by combining it with a simple technique visualizing the part of the image that most activates a given neuron using a backward pass of the activation of a single neuron after a forward pass through the network. Finally, the recently published method [21] based on the prediction difference analysis [22] is a probabilistic approach that extends the idea in [15]

of visualizing the probability of the correct class using the occlusion of the parts of the image. The approach highlights the regions of the input image of a CNN which provide evidence for or against a certain class.

Understanding CNNs can also be done by visualizing output units as distributions in the input space via output unit sampling [23]. However, computing relevant statistics of the obtained distribution is often difficult. This technique cannot be applied to deep architectures based on auto-encoders as opposed to the subsequent work [24, 25], where the authors visualize what is activated by the unit in an arbitrary layer of a CNN in the input space (of images) via an activation maximization procedure that looks for input patterns of a bounded norm that maximize the activation of a given hidden unit using gradient ascent. This method extends previous approaches [26]. The gradient-based visualization method [25] can also be viewed as a generalization of the deconvolutional network reconstruction procedure [15] as shown in subsequent work [8]. The requirement of careful initialization limits the method [15]

. The approach was applied to Stacked Denoising Auto-Encoders, Deep Belief Networks and later on to CNNs 

[8]. Finally, sensitivity-based methods [8, 7, 9]) aim to understand how the classifier works in different parts of the input domain by computing scores based on partial derivatives at the given sample.

Some more recent gradient-based visualization techniques for CNN-based models not mentioned before include Grad-CAM [27], which is an extension of the Class Activation Mapping (CAM) method [28]. The approach heavily relies on the construction of weighted sum of the feature maps, where the weights are global-average-pooled gradients obtained through back-propagation. The approach lacks the ability to show fine-grained importance like pixel-space gradient visualization methods [20, 15] and thus in practice has to be fused with these techniques to create high-resolution class-discriminative visualizations.

Finally, complementary bibliography related to analyzing neural networks is briefly discussed in the Supplement (Section 7).

3 Visualization method

As mentioned before, our method combines feature maps from deep convolutional layers that contain mostly relevant information, but are low-resolution, with the feature maps of the shallow layers that have higher resolution but also contain more irrelevant information. This is done by “back-propagating” the information about the regions of relevance while simultaneously increasing the resolution. The back-propagation is value-based. We call this approach VisualBackProp to emphasize that we “back-propagate” values (images) instead of gradients. We explain the method in details below.

a)     b)

Figure 2: a)

Block diagram of the VisualBackProp method. The feature maps after each ReLU layer are averaged. The averaged feature map of the last convolutional layer is scaled-up via deconvolution and multiplied by the averaged feature map from the previous layer. The resulting intermediate mask is again scaled-up and multiplied. This process is repeated until we reach the input.

b) Left: Averaged feature maps of all convolutional layers from the input (top) to the output (bottom). Right: Corresponding intermediate masks. The top one is the final result.

The block diagram of the proposed visualization method is shown in Figure 2

a. The method utilizes the forward propagation pass, which is already done to obtain a prediction, i.e. we do not add extra forward passes. The method then uses the feature maps obtained after each ReLU layer (thus these feature maps are already thresholded). In the first step, the feature maps from each layer are averaged, resulting in a single feature map per layer. Next, the averaged feature map of the deepest convolutional layer is scaled up to the size of the feature map of the previous layer. This is done using deconvolution with filter size and stride that are the same as the ones used in the deepest convolutional layer (for deconvolution we always use the same filter size and stride as in the convolutional layer which outputs the feature map that we are scaling up with the deconvolution). In deconvolution, all weights are set to

and biases to . The obtained scaled-up averaged feature map is then point-wise multiplied by the averaged feature map from the previous layer. The resulting image is again scaled via deconvolution and multiplied by the averaged feature map of the previous layer exactly as described above. This process continues all the way to the network’s input as shown in Figure 2a. In the end, we obtain a mask of the size of the input image, which we normalize to the range .

The process of creating the mask is illustrated in Figure 2b. On the left side the figure shows the averaged feature maps of all the convolutional layers from the input (top) to the output (bottom). On the right side it shows the corresponding intermediate masks. Thus on the right side we show step by step how the mask is being created when moving from the network’s output to the input. Comparing the two top images clearly reveals that many details were removed in order to obtain the final mask.

4 Theoretical analysis

Figure 3: Left: General CNN with biases. Right: Corresponding multipartite graph. Dead nodes, i.e. nodes that do not transmit any flow (corresponding to neurons with zero activation), are crossed.

We now present theoretical guarantees for the algorithm (all proofs are deferred to the Supplement). Our theoretical analysis does not rely on computing the sensitivity of any particular cost function with respect to the changes of values of particular input neurons. So we will not focus on computing the gradients. The reason for that is that even if the gradients are large, the actual contribution of the neuron might be small. Instead our proposed method is measuring the actual contribution that takes into account the “collaborative properties” of particular neurons. This is measured by the ability of particular neurons to substantially participate in these weighted inputs to neurons in consecutive layers that themselves have higher impact on the form of the ultimate feature maps than others.

Let’s consider a convolutional neural network with convolutional layers that we index from to and ReLU nonlinear mapping with biases , where stands for a neuron of the network. We assume that no pooling mechanism is used and the strides are equal to one (the entire analysis can be repeated for arbitrary stride values). We denote by the number of feature maps of the layer, by the shape of the kernel applied in the convolutional layer.

For a CNN with learned weights and biases we think about the inference phase as a network flow problem on the sparse multipartite graph with parts ( is the input image), where different parts simply correspond to different convolutional layers, source nodes are the pixels of the input image () and sinks are the nodes of the last convolutional layer. Figure 3 explains the creation of the multipartite graph from the CNN: every vertex of the graph corresponds to a neuron and the number of parts of the graph corresponds to the number of network layers. A vertex v in each part is connected with the vertex in a subsequent part if i) there is an edge between them in the corresponding CNN and ii) this vertex (neuron) v has non-zero activation. Furthermore, we denote as the incoming flow to node . From now on we will often implicitly transition from the neural network description to the graph theory and vice versa using this mapping.

Let us now define an important notation we will use throughout the paper:

  • Let be the value of the total input flow to neuron (or in other words the weighted input to neuron ), be the value of the activation of , and be the bias of .

  • Let be an edge from some neuron to . Then will denote the input flow to along edge , will denote the activation of (i.e. ), and be the bias of (i.e. ).

We will use either of the two notations depending on convenience.

Note that the flow is (dis-)amplified when it travels along edges and furthermore some fraction of the flow is lost in certain nodes of the network (due to biases). This is captured in the Lemma 1.

Lemma 1

The inference phase in the convolutional neural network above is equivalent to the network flow model on a multipartite graph with parts , where each edge has a weight defining the amplification factor for the flow traveling along this edge. Consider node in the part . It has neighbors in part . The flow of value is lost in .

The flow-formulation of the problem is convenient since it will enable us to quantitatively measure the contribution of pixels from the input image to the activations of neurons in the last convolutional layer. Before we propose a definition of that measure, let us consider a simple scenario, where no nonlinear mapping is applied. That neural network model would correspond to the network flow for multipartite graphs described above, but with no loss of the flow in the nodes of the network. In that case different input neurons act independently. For each node in (i.e. corresponds to a pixel in the input image), the total flow value received by is obtained by summing over all paths from to the expressions of the form , where stands for the weight of an edge and is the value of pixel or in other words the value of the input flow to X. This is illustrated in Figure 4a. This observation motivates the following definition:

Definition 1 (-function for CNNs with no biases)

Consider the neural network architecture, similar to the one described above, but with no biases. Lets call it . Then the contribution of the input pixel to the last layer of feature maps is given as:

(1)

where is the value of pixel and is a family of paths from to in the corresponding multipartite graph.

a) b)

Figure 4: a) Convolutional architecture with no biases. The contribution of the input pixel to the last layer of feature maps can be computed by summing the contribution along different paths originating at and ending in the last layer. The contribution from each path is proportional to the product of the weights of edges belonging to this path. b) The contribution of any given input pixel along a particular path in the general CNN is equal to the product , where s are the activations on the path and s are the corresponding biases.

Definition 1 however does not take into consideration network biases. In order to generalize it to arbitrary networks, we construct a transformation of a CNN with biases to the one without biases as given in Lemma 2

Lemma 2

The bias-free image of the network can be obtained from by removing the biases and multiplying each weight of an edge by , where an edge goes from neuron to . Note that .

The in-depth discussion of this transformation can be found in the Supplement.

Since we know how to calculate the contribution of each input neuron to the convolutional network in the setting without biases and we know how to translate any general convolutional neural network to the equivalent one without biases, we are ready to give a definition of the contribution of each input neuron in the general network .

Definition 2 (-function for general CNNs)

Consider the general neural network architecture described above. Then the contribution of the input pixel to the last layer of feature maps is given as:

(2)

where is the bias-free image of network .

Definition 2 relates the contribution of the neuron in from the parameters of , rather than explicitly in terms of the parameters of . This is fixed in the lemma below (Lemma 3).

Lemma 3

For an input neuron function is defined as:

(3)

where is the value of pixel and is a family of paths from to in the corresponding multipartite graph.

Figure 4b illustrates the lemma. Note that in the network with no biases one can set and obtain the results introduced before the formula involving sums of weights’ products.

We prove the following results (borrowing the notation introduced before) by connecting our previous theoretical analysis with the algorithm.

Theorem 1

For a fixed CNN considered in this paper there exists a universal constant such that the values of the input neurons computed by VisualBackProp are of the form:

(4)

The statement above shows that the values computed for pixels by the VisualBackProp algorithm are related to the flow contribution from that pixels in the corresponding graphical model and thus, according to our analysis, measure their importance. The formula on is similar to the one on , but gives rise to a much more efficient algorithm and leads to tractable theoretical analysis. Note that the latter one can be obtained from the former one by multiplying each term of the inner products by and then rescaling by a multiplicative factor of . Rescaling does not have any impact on quality since it is conducted in exactly the same way for all the input neurons. Finally, the following observation holds.

Remark 1

Note that for small kernels the number of paths considered in the formula on is small (since the degrees of the corresponding multipartite graph are small) thus in practice the difference between formula on and the formula on coming from the re-weighting factor is also small. Therefore for small kernels the VisualBackProp algorithm computes good approximations of input neurons’ contributions to the activations in the last layer.

In the next section we show empirically that works very well as a measure of contribution333 thus might be a near-monotonic function of . We leave studying this to future works..

5 Experiments

In the main body of the paper we first demonstrate the performance of VisualBackProp on the task of end-to-end autonomous driving, which requires real-time operation. The codes of VisualBackProp are already publicly released. The experiments were performed on the Udacity self-driving car data set (Udacity Self Driving Car Dataset 3-1: El Camino). We qualitatively compare our method with LRP implementation as given in Equation 6 from [16] (similarly to the authors, we use ) and we also compare their running times444Note that it is hard to quantitatively measure the performance of the visualization methods and none such standardized measures exist.. We then show experimental results on the task of the classification of traffic signs on the German Traffic Sign Detection Benchmark data set (http://benchmark.ini.rub.de/?section=gtsdb&subsection=dataset) and ImageNet data set (http://image-net.org/challenges/LSVRC/2016/). Supplement contains additional experimental results on all three data sets.

We train two networks, that we call NetSVF and NetHVF, which vary in the input size. In particular, NetHVF input image has approximately two times higher vertical field of view, but then is scaled down by that factor. The details of both architectures are described in Table 1

in the Supplement. The networks are trained with stochastic gradient descent (SGD) and the mean squared error (MSE) cost function for

epochs.

Figure 5: Visualizing the training of the network NetSVF with the VisualBackProp method: (starting from the second image in the first row) the mask after 0.1, 0.5, 1, 4, 16, and 32 epochs (similar figure for NetHVF is shown in the Supplement). Over time the network learns to detect more relevant cues for the task from the training data. The first image of the first row is an input image and the last image of the second row is the input image with the mask overlaid in red.

The Udacity self-driving car data set that we use contains images from three front-facing cameras (left, center, and right) and measurements such as speed and steering wheel angle, recorded from the vehicle driving on the road. The measurements and images are recorded with different sampling rates and are independent, thus they require synchronization before they can be used for training neural networks. For the purpose of this paper, we pre-process the data with the following operations: i) synchronizing images with measurements from the vehicle, ii) selecting only center camera images, iii) selecting images where the car speed is above  m/s, iv) converting images to gray scale, and v) cropping and scaling the lower part of the images to a size for network NetSVF and size for network NetHVF. As a result, we obtain a data set with  K images with corresponding steering wheel angles (speed is not used), where the first  K examples are used for training and the remaining  K examples are used for testing. We train the CNN to predict steering wheel angles based on the input images.

Figure 6: Top: NetSVF, bottom: NetHVF. Input test images with the corresponding masks overlaid in red. The errors are (from the left): and degrees of SWA for NetSVF and and for NetHVF degrees of SWA.
Figure 7: Network NetSVF. Two consecutive frames with the corresponding masks overlaid in red. The errors are (from left): and degrees of SWA.
Figure 8: Network NetHVF. Input test image with the mask overlaid in red. The errors are (from left): and degrees of SWA.
Figure 9: Network NetSVF. Input test image with the mask overlaid in red. The errors are (from the top): and degrees of SWA.

We first apply VisualBackProp method during training to illustrate the development of visual cues that the network focuses on. The obtained masks for an exemplary image are shown in Figure 5. The figure captures how the CNN gradually learns to recognize visual cues relevant for steering the car (lane markings) as the training proceeds.

We next evaluate VisualBackProp and LRP on the test data. We show the obtained masks on various exemplary test input images in Figures 69 and Figures 1519 (Supplement), where on each figure the left column corresponds to our method and the right column corresponds to LRP. For each image we also report the test error defined as a difference between the actual and predicted steering wheel angle (SWA) in degrees. Figures 6 illustrates that the CNN learned to recognize lane markings, the most relevant visual cues for steering a car. It also shows that the field of view affects the visualization results significantly. Figures 18 and 19 capture how the CNN responds to shadows on the image. One can see that the network still detects lane markings but only between the shadows, where they are visible. Each of the Figures 7 and 15 shows two consecutive frames. On the second frame in Figure 7, the lane marking on the left side of the road disappears, which causes the CNN to change the visual cue it focuses on from the lane marking on the left to the one on the right. Figures 16 and 8 correspond to the sharp turns. The images in the top row of Figure 8 demonstrate the correlation between the high prediction error of the network and the low-quality visual cue it focuses on. Finally, in Figure 9 we demonstrate that the CNN has learned to ignore horizontal lane markings as they are not relevant for steering a car, even though it was trained only with the images and the steering wheel angles as the training signal. The network was therefore able to learn which visual cues are relevant for the task of steering the car from the steering wheel angle alone. Figure 17 similarly shows that the CNN learned to ignore the horizontal lines, however, as the visualization shows, it does not identify lane markings as the relevant visual cues but other cars instead.

Figure 10: German Traffic Sign Detection Benchmark data set. Sets of input images with visualization masks arranged in four columns. Each set consist of an input image (left), a visualization mask generated by VisualBackProp (center), and a visualization mask generated by LRP (right).
Figure 11: ImageNet. Sets of input images with visualization masks arranged in four columns. Each set consist of an input image (left), and a visualization mask generated by VisualBackProp (right).

We implemented VisualBackProp and LRP in Torch7 to compare the computational time. Both methods used the cunn library to utilize GPU for calculations and have similar levels of optimization. All experiments were performed on GeForce GTX 970M. The average time of computing a mask for VisualBackProp was equal to , whereas in case of the LRP method it was . The VisualBackProp is therefore on average times faster than LRP. At the same time, as demonstrated in Figures 69 and Figures 1519 (Supplement), VisualBackProp generates visualization masks that are very similar to those obtained by LRP.

We next (Figure 20) demonstrate the performance of VisualBackProp and LRP on German Traffic Sign Detection Benchmark data set. The network is described in Table 2 in the Supplement.

Finally, we show the performance of VisualBackProp on ImageNet data set. The network here is a ResNet- [10].

6 Conclusions

In this paper we propose a new method for visualizing the regions of the input image that have the highest influence on the output of a CNN. The presented approach is computationally efficient which makes it a feasible method for real-time applications as well as for the analysis of large data sets. We provide theoretical justification for the proposed method and empirically show on the task of autonomous driving that it is a valuable diagnostic tool for CNNs.

References

  • [1] Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Comput., 1(4):541–551, 1989.
  • [2] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS. 2012.
  • [3] O. Abdel-Hamid, A.-r. Mohamed, H. Jiang, and G. Penn. Applying convolutional neural networks concepts to hybrid NN-HMM model for speech recognition. In ICASSP, 2012.
  • [4] J. Weston, S. Chopra, and K. Adams. #tagspace: Semantic embeddings from hashtags. In EMNLP, 2014.
  • [5] M. Bojarski, D. Del Testa, D. Dworakowski, B. Firner, B. Flepp, P. Goyal, L. D. Jackel, M. Monfort, U. Muller, J. Zhang, X. Zhang, J. Zhao, and K. Zieba. End to end learning for self-driving cars. CoRR, abs/1604.07316, 2016.
  • [6] C. Chen, A. Seff, A. L. Kornhauser, and J. Xiao. Deepdriving: Learning affordance for direct perception in autonomous driving. In ICCV, 2015.
  • [7] D. Baehrens, T. Schroeter, S. Harmeling, M.i Kawanabe, K. Hansen, and K.-R. Müller. How to explain individual classification decisions. J. Mach. Learn. Res., 11:1803–1831, 2010.
  • [8] K. Simonyan, A. Vedaldi, and A. Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In Workshop Proc. ICLR, 2014.
  • [9] P. M. Rasmussen, T. Schmah, K. H. Madsen, T. E. Lund, S. C. Strother, and L. K. Hansen. Visualization of nonlinear classification models in neuroimaging - signed sensitivity maps. BIOSIGNALS, pages 254–263, 2012.
  • [10] K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In ECCV, 2016.
  • [11] S. Bach, A. Binder, G. Montavon, F. Klauschen, K.-R. Müller, and W Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PLOS ONE, 10(7):e0130140, 2015.
  • [12] A. Binder, S. Bach, G. Montavon, K.-R. Müller, and W. Samek. Layer-wise relevance propagation for deep neural network architectures. pages 913–922, 2016.
  • [13] S. Bach, A. Binder, G. Montavon, K.-R. Müller, and W. Samek. Analyzing classifiers: Fisher vectors and deep neural networks. In CVPR, 2016.
  • [14] L. Arras, F. Horn, G. Montavon, K.-R. Müller, and W. Samek. Explaining predictions of non-linear classifiers in NLP. In ACL Workshop on Representation Learning for NLP, 2016.
  • [15] M. D. Zeiler and R. Fergus. Visualizing and understanding convolutional networks. In ECCV, 2014.
  • [16] W. Samek, A. Binder, G. Montavon, S. Bach, and K.-R. Müller. Evaluating the visualization of what a deep neural network has learned. IEEE Transactions on Neural Networks and Learning Systems, 2016.
  • [17] M. D. Zeiler, G. W. Taylor, and R. Fergus. Adaptive deconvolutional networks for mid and high level feature learning. In ICCV, 2011.
  • [18] R. Girshick, J. Donahue, T. Darrell, and J. Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, 2014.
  • [19] A. Dosovitskiy and T.Brox. Inverting visual representations with convolutional networks. In CVPR, 2016.
  • [20] J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. In ICLR 2015 Workshop Track, 2015.
  • [21] L. M. Zintgraf, T. S. Cohen, T. Adel, and M. Welling. Visualizing deep neural network decisions: Prediction difference analysis. In ICLR, 2017.
  • [22] M. Robnik-Sikonja and I. Kononenko. Explaining classifications for individual instances. IEEE Trans. Knowl. Data Eng., 20(5):589–600, 2008.
  • [23] G. E. Hinton, S. Osindero, and Y.-W. Teh. A fast learning algorithm for deep belief nets. Neural Comput., 18(7):1527–1554, 2006.
  • [24] D. Erhan, A. Courville, and Y. Bengio. Understanding representations learned in deep architectures. Technical Report 1355, University of Montreal, 2010.
  • [25] D. Erhan, Y. Bengio, A. Courville, and P. Vincent. Visualizing higher-layer features of a deep network. Technical Report 1341, University of Montreal, 2009.
  • [26] P. Berkes and L. Wiskott. On the analysis and interpretation of inhomogeneous quadratic forms as receptive fields. Neural Computation, 18(8):1868–1895, 2006.
  • [27] R. R. Selvaraju, A. Das, R. Vedantam, M. Cogswell, D. Parikh, and D. Batra. Grad-cam: Why did you say that? visual explanations from deep networks via gradient-based localization. CoRR, abs/1610.02391, 2016.
  • [28] B. Zhou, A. Khosla, A. Lapedriza, A. Oliva, and A. Torralba.

    Learning deep features for discriminative localization.

    In CVPR, 2016.

7 Complementary bibliography

Other approaches for analyzing neural networks not mentioned in the main body of the paper include quantifying variable importance in neural networks [29, 30], extracting the rules learned by the decision tree model that is fitted to the function learned by the neural network [31], applying kernel analysis to understand the layer-wise evolution of the representation in a deep network [32], analyzing the visual information in deep image representations by looking at the inverse representations [33], applying contribution propagation technique to provide per-instance explanations of predictions [34] (the method relies on the technique of [35], or visualizing particular neurons or neuron layers [2, 36]. Finally, there also exist more generic tools for explaining individual classification decisions of any classification method for single data instances, like for example 

[7].

Complementary references:

  • [29] M. Gevrey, I. Dimopoulos, and S. Lek. Review and comparison of methods to study the contribution of variables in artificial neural network models. Ecological Modelling, 160(3):249 – 264, 2003.

  • [30] J. D. Olden, M. K. Joy, and R. G. Death. An accurate comparison of methods for quantifying variable importance in artificial neural networks using simulated data. Ecological Modelling, 178(3–4):389 – 397, 2004.

  • [31] R. Setiono and H. Liu. Understanding neural networks via rule extraction. In IJCAI, 1995.

  • [32] G. Montavon, M. L. Braun, and K.-R. Müller. Kernel analysis of deep networks. J. Mach. Learn. Res., 12:2563–2581, 2011.

  • [33] A. Mahendran and A. Vedaldi. Understanding deep image representations by inverting them. In CVPR, 2015.

  • [34] W. Landecker, M.l D. Thomure, L. M. A. Bettencourt, M. Mitchell, G. T. Kenyon, and S. P. Brumby. Interpreting individual classifications of hierarchical networks. In CIDM, 2013.

  • [35] B. Poulin, R. Eisner, D. Szafron, P. Lu, R. Greiner, D. S. Wishart, A. Fyshe, B. Pearcy, C. Macdonell, and J. Anvik. Visual explanation of evidence with additive classifiers. In IAAI, 2006.

  • [36] J. Yosinski, J. Clune, A. M. Nguyen, T. Fuchs, and H. Lipson. Understanding neural networks through deep visualization. CoRR, abs/1506.06579, 2015.

8 Proof of Lemma 1

Proof:


Figure 12: Input pixel is covered by patches corresponding to selected neurons in the consecutive layer. In the corresponding multipartite graph node is adjacent to selected vertices in the next part and transports the flow to them. The same is true if instead of an input pixel we consider any neuron in the network.

As we have explained in the main body of the paper, we will identify the source-nodes for the flow problem with input pixels and the sink-nodes with the neurons of the last convolutional layer. Parts ,…, are the sets of nodes in the corresponding convolutional layers (observe that indeed there are no edges between nodes in s since there are no edges between neurons in feature maps associated with the fixed convolutional layer). Part represents the input image. Each source-node sends units of flow along edges connecting it with nodes in part . This is exactly the amount of the input flow to the node with flow of value deducted (due to the ReLU nonlinear mapping). The activations of neurons in the last convolutional layer can be represented in that model as the output flows of the nodes from . Note that for a fixed neuron in the convolutional layer and fixed feature map in the consecutive convolutional layer (here the layer is the input image) the kernel of size can be patched in different ways (see: Figure 12) to cover neuron

(this is true for all but the “borderline neurons” which we can neglect without loss of generality; if one applies padding mechanism the “borderline neurons” do not exist at all). Thus the total number of connections of

to the neurons in the next layer is . A similar analysis can be conducted if is a pixel from the input image. That completes the proof.

9 Proof of Lemma 2

Proof:

Assume that is an edge from node to . Note that the flow of value is transmitted by . Furthermore , where is the original value of flow before amplification obtained by passing that flow through an edge . Thus the flow output by is multiplied by and output by . Thus one can set: . That completes the proof.

10 Discussion of transformation from Lemma 2

Remark 2

The network after transformation is equivalent to the original one, i.e. it produces the same activations for all its neurons as the original one.

Remark 3 (Intuition behind the transformation:)

Let be an edge from neuron to . The transformation replaces the weight of an edge , or the input flow along , by , where is the some of the input flows to along all the edges going to and is an activation of in the original network. This is done to make the weight of equal to the relative contribution of to the activation of . The relative contribution needs to be on the one hand proportional to the activation of , i.e. , and on the other hand proportional to the input flow along . Finally, the sum of all relative contributions of all the neurons connected with neuron needs to be equal to the activation .

Remark 4

The property that the contribution of the given input flow to to the activation of is proportional to the value of the flow is a desirable property since the applied nonlinear mapping is a ReLU function. It also captures the observation that if the flow is large, but the activation is small, the contribution might be also small since even though the flow contributes substantially, it contributes to an irrelevant feature.

11 Proof of Lemma 3

Proof:

Straightforward from the formula on and derived formula on transforming weights of to obtain .

12 Proof of Theorem 1


Figure 13: The family of paths from the input pixel to output neurons and in the last set of feature maps . Crossed nodes correspond to neurons with zero activation. Paths containing these nodes do not contribute to .

Proof:

Note that averaging over different feature maps in the fixed convolutional layer with feature maps that is conducted by VisualBackProp is equivalent to summing over paths with edges in different feature maps of that layer (up to a multiplicative constant .) Furthermore, adding contributions from different patches covering a fixed pixel is equivalent to summing over all paths that go through . Thus computed expression is proportional to the union of products of activations (since in the algorithm after resizing the masks are point-wise multiplied) along paths from the given pixel in the input image to all the neurons in the last set of feature maps. That leads to the proposed formula. Note that the formula automatically gets rid of all the paths that lead to a neuron with null activation since these paths do not contribute to activations in the last set of feature maps (see: Figure 13).

13 Additional experiments

NetSVF NetHVF
Layer Layer Layer Filter Stride
output size output size size size
conv
conv
conv
conv
conv
conv
conv
conv
conv
conv
FC 1024 1024 - -
FC 512 512 - -
FC 1 1 - -
Table 1: Architectures of NetSVF and NetHVF

. Each layer except for the last fully-connected layer is followed by a ReLU. Each convolution layer is preceded by a batch normalization layer. Let

be the number of feature maps, be the height and be the width. For convolutional layers, layer output size is . Filter size and stride are given as .
Figure 14: Visualizing the training of the network NetHVF with the VisualBackProp method: the mask after 0.1, 0.5, 1, 4, 16, and 32 epochs. Over time the network learns to detect more relevant cues for the task from the training data. The last picture in each set shows the input image with the mask overlaid in red.
Figure 15: Network NetHVF. Left: VisualBackProp, right: LRP. Top and bottom of each column: two consecutive frames with the corresponding masks overlaid in red. The errors are (from the top): and degrees of SWA.
Figure 16: Network NetSVF. Left: VisualBackProp, right: LRP. Input test image with the mask overlaid in red. The errors are (from the top): and degrees of SWA.
Figure 17: Network NetHVF. Left: VisualBackProp, right: LRP. Input test image with the mask overlaid in red. The errors are (from the top): , , and degrees of SWA.
Figure 18: Network NetSVF. Left: VisualBackProp, right: LRP. Input test images with the corresponding masks overlaid in red. The error is 0.69 degrees of SWA.
Figure 19: Network NetHVF. Left: VisualBackProp, right: LRP. Input test images with the corresponding masks overlaid in red. The error is -0.99 degrees of SWA.

Next we demonstrate the performance of VisualBackProp on the task of the classification of traffic signs. The experiments here were performed on the German Traffic Sign Detection Benchmark data set (http://benchmark.ini.rub.de/?section=gtsdb&subsection=dataset). We compare our method with LRP implementation as given in Equation 6 from [16] (similarly to the authors, we use ).

We train the neural network to classify the input image containing a traffic sign into one of 43 categories. The details of the architecture are described in Table 2. The network is trained with stochastic gradient descent (SGD) and the negative log likelihood (NLL) cost function for epochs.

The German Traffic Sign Detection Benchmark data set that we use contains images of traffic signs of various sizes, where each image belongs to one out of 43 different categories. For the purpose of this paper, we scale all images to the size of .

We apply VisualBackProp and LRP algorithm on trained network. The results are shown in Figure 20.

Layer Layer Filter Stride
output size size size
conv
conv
conv
conv
conv
conv
conv
conv
FC 64 - -
FC 43 - -
Table 2: Architecture of the network used for sign classification. Each layer except for the last fully-connected layer is followed by a ReLU. The last fully-connected layer is followed by a LogSoftMax. Each convolution layer is preceded by a batch normalization layer.
Figure 20: Experiment on German Traffic Sign Detection Benchmark data set. Sets of input images with visualization masks arranged in four columns. Each set consist of an input image (left), a visualization mask generated by VisualBackProp (center), and a visualization mask generated by LRP (right).
Figure 21: Experiment on ImageNet data set. Sets of input images with visualization masks arranged in two columns. Each set consist of an input image (left), and a visualization mask generated by VisualBackProp (right).
Figure 22: Experiment on ImageNet data set. Sets of input images with visualization masks arranged in two columns. Each set consist of an input image (left), and a visualization mask generated by VisualBackProp (right).