{'fraction_non_alphanumeric': 0.023627677207579058, 'fraction_numerical': 0.006695050212876597, 'mean_word_length': 4.996881699473787, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Understanding of Kernels in CNN Models by Suppressing Irrelevant Visual Features in Images

Deep learning models have shown their superior performance in various vision tasks. However, the lack of precisely interpreting kernels in convolutional neural networks (CNNs) is becoming one main obstacle to wide applications of deep learning models in real scenarios. Although existing interpretation methods may find certain visual patterns which are associated with the activation of a specific kernel, those visual patterns may not be specific or comprehensive enough for interpretation of a specific activation of kernel of interest. In this paper, a simple yet effective optimization method is proposed to interpret the activation of any kernel of interest in CNN models. The basic idea is to simultaneously preserve the activation of the specific kernel and suppress the activation of all other kernels at the same layer. In this way, only visual information relevant to the activation of the specific kernel is remained in the input. Consistent visual information from multiple modified inputs would help users understand what kind of features are specifically associated with specific kernel. Comprehensive evaluation shows that the proposed method can help better interpret activation of specific kernels than widely used methods, even when two kernels have very similar activation regions from the same input image.


Introduction
Convolutional Neural Networks (CNNs) have shown human-level performance in various computer vision tasks and have started to be applied in real scenarios, such as surveillance [32], face identification [18], autonomous driving [14], and medical image analysis [16,26]. However, CNN models are still lack of interpretation, in the sense that CNN interpretation has started to be investigated mainly in the task of classification, where a CNN classifier is trained in advance based on a multi-class dataset. In order to interpret model decisions, several approaches have been recently proposed mainly by estimating the contribution of input image regions or pixels to a specific (often maximum) output value of the CNN model. Ideas include perturbing certain image regions and checking the change of the CNN output [22,23,34,37], finding the relevant activated regions based on the output (feature maps) of the last convolutional layer [6,25,36], directly establishing a simple approximate linear model to estimate the linear relationship between local image regions and the CNN output [23], or back-propagating the CNN output layer-bylayer to the input image space either based on gradient in-formation (or its modified versions) at each layer or based on the relevance between input elements and output at each layer [1,19]. Besides the above ideas, directly maximizing the (pre-softmax) output of a specific neuron at the final output layer with respect to the changeable input image can also give users the general impression of what the neuron represents [17,21,27] based on the observation of the optimized input image. The back-propagation ideas and the maximization idea can also be applied to interpretation of any internal neuron (convolutional kernel at a convolutional layer or output element at a fully connected layer) of the CNN model, where the obtained visual patterns in the image space can be considered as representation or interpretation of the neuron. In addition, the consistency between manually segmented regions of certain concept (or class) and the activated regions in the output of a convolutional kernel can help people interpret the kernel by the semantic concept [3,4]. All the approaches to interpretation of internal or output neurons focus on finding specific visual patterns/concepts or image regions relevant to the neurons. However, there could exist many more (if not unlimited number of) visual patterns activating a specific neuron, and maybe just part of features in a region is relevant to the activation of the neuron for a specific input image. Therefore, the existing approaches may not comprehensively and precisely interpret neurons.
In this study, we propose a simple yet effective method to interpret particularly convolutional kernels by trying to preserve the visual features in the image space which contributes to the activation of a specific kernel, and to suppress the other visual features which is irrelevant to the activation of the specific kernel, where some irrelevant features may come from the same image region as that of the relevant features. Different from existing approaches which aim to reduce or maximize activation of a specific kernel, our method aims to keep the activation. Also different from approaches which aim to find visual patterns often partly contributing to the specific activation of a kernel given any input image, our method aims to find the visual features in the original image which contribute to the exact activation of the kernel (Figure 1).

Related Work
Interpretation of deep learning models has been recently explored mainly with the objective of understanding output prediction and internal neurons of CNN models. Interpretation of model predictions only: Multiple approaches have been proposed only for understanding of model's prediction output, including the perturbation approach [22,34,35], the activation map approach [6,25,36], the local approximation approach [10,35], and the prototype-based approach [12,29]. The perturbation approach perturbs local image regions somehow and checks the change of a specific CNN output. If certain perturbed local region(s) causes large drop in the output, the visual information in the local region in the original input image is crucial and therefore used to explain the original prediction output. Perturbation can be in the form of simply masking a local region by a constant pixel intensity [34], by neighboring image patches [38], or by fusing the original region information with constant or blurring [5,13,22]. A mask could be small and only cover an image patch each time [22]. It also could be of the image size and the degree of masking at each pixel is automatically estimated [23], often with the constraints that the to-be-masked area is small and continuous, and the masking should be smooth [9,29]. The perturbation approach can often find the approximate local image regions relevant to the specific model prediction output, but it is not clear whether all the visual information in the local region equally contributes to the prediction or not.
Different from the perturbation approach exploring regions in the input image, the activation map approach tries to find relevant region(s) in the output feature maps often from the last convolutional layer [6,25,30,36]. By estimating the weight of each feature map either directly from the model parameters (in the following fully connected layer) [36] or from the gradient of the specific model output with respect to the feature map [25], a class-specific (or output-specific) activation map can be obtained with the weighted sum of all feature maps at the convolutional layer. Stronger activation region in the activation map indicates that the corresponding region in the input image is responsible for the specific model output. Since the size of the activation map is often much smaller than that of the input image, the interpolation of the activation map up to the size of the input image would often cause very approximate localization of the image region(s) contributing to the model output prediction.
Similar to the perturbation approach without requiring knowing model parameters, the local approximation approach provides another way to estimate the contribution of each meaning image region (e.g., object parts, similar background region) [1,5]. It assumes that the model decision surface is locally linear in the feature space, where each feature component could correspond to an image region. By approximating the original model with a linear model in the feature space, the contribution of each meaningful image region to the model output can be directly obtained from the weight parameters in the linear model. This approach needs an optimization process to find a unique linear model for each input image. Together with the activation map approach, this approach shares the same issue as that of the perturbation approach, i.e., considering all visual information in certain region relevant to the model prediction.
Different from all the above three approaches, the prototype-based approach simulates human's behavior when trying to interpret a decision, i.e., based on the similarity between the feature of new data and typical features of each class [29]. The prototypes (typical feature representations and associated representative image patches) for each class and the integral similarity measurement between a new image and prototypes can be automatically learned based on a unified deep convolutional model [12]. One issue of this approach is about the determination of appropriate number of prototypes for each class.
Interpretation of both internal and output neurons: The back-propagation approach has been widely used to interpret both internal and output neurons of CNN models [2,5,15,27,34]. Given an input image and the output of a specific neuron, the simplest back-propagation method is to calculate the gradient of the neuron output with respect to each input pixel, and then the quantity of the gradient at each pixel is considered as the importance of the pixel for the activation of the neuron output [2,27]. Each gradient element could be conditionally propagated backward particularly around the commonly used ReLU activation function, e.g., only if the propagated gradient element is positive or if both the gradient and the forward signal are positive [28,34], resulting in different levels of sparsity in the final gradient-based visual pattern in the input image space. However, considering that the original gradient element at each CNN layer is from the model weight parameters which are not correlated with the input information, the overall gradient of a neuron output with respect to the input image may not correctly represent the importance of input image pixels to the specific neuron output [2,27,34]. In this case, gradient at each layer could be replaced by input-relevant signals during back-propagation from the neuron output to the input image space [15]. The importance of each input image pixel could also be estimated not based on gradient but based on the layer-by-layer relevance back-propagation, where the relevance between the output and each input element at one layer can be easily calculated based on the percent contribution of the input element to the output [5]. The resulting visual patterns from the image pixel importance based on each of the back-propagation methods can help users understand the representation of a specific neuron, but the visual patterns may only represent part of the visual signals relevant to the neuron output and do not tell users what exact visual information in the input image contributes to the specific activation of the neuron. The same issue exists in an earlier maximization approach which can obtain rough input visual patterns by maximizing the output of a specific neuron [17,18,21].

Methodology
The purpose of this study is to understand each convolutional kernel (filter) in a pre-trained CNN classifier, in par-ticular what visual features in the image space are associated with or would activate a specific kernel. Given an input image to the CNN classifier and a specific kernel at certain layer, suppose the output (i.e., the feature map) of the kernel is locally activated, it is easy to locate the image region(s) associated with the activated region(s) in the feature map simply by resizing the feature map to the scale of the input image. However, it would be not rigorous if one claims that the visual features in the activated image region cause the specific activation in the kernel's feature map. This is because there often exist multiple features (e.g., color, texture, shape, etc.) in one local image region, and it could be just one type of feature that cause the activation in the feature map, while the other features in the same region could be associated with the activation in the feature maps of some other kernels. Therefore, in order to precisely understand what exact feature(s) in the image activates the specific kernel, it is necessary to disentangle the contributions of these features in the same region to activation of multiple possible kernels. Here we propose a simple but effective method to find the visual features in the image space which is associated with any specific kernel, by suppressing the visual features which is irrelevant to the activation of the specific kernel but may be relevant to the activation of other kernels, and through our method, we can get multiple results that cause the same activation on the selected kernel.
Formally, suppose there are totally N kernels (and therefore correspondingly N feature maps) at the convolutions layer of interest, and the i-th kernel k i of this layer is the specific one to be understood. Given an input image X, denote the output of the kernel by the feature map F i whose size is H × W . In general, some local regions in F i would be activated with values in F i clearly larger than zero, while the other regions would be inactivated with corresponding values close to or being zero in F i . To understand what possible visual features in the input image X cause the activation in F i , we would like to find a modified input im-ageX which is expected to contain only the visual features contributing to the activation in F i . Denote byF i the feature map output of the kernel k i when usingX as input to the CNN model. Then, we expect the difference between the new feature mapF i and the original feature map F i as small as possible, i.e., minimizing the preservation loss L p (X, X), The L 2 norm is used to measure the difference because it is more sensitive to large difference than L 1 norm. The F i 2 in the denominator is to reduce the sensitivity of certain hyper-parameters (e.g., learning rate during optimization) to varying activation levels at different convolutional layers. Meanwhile, in order to effectively remove all irrelevant fea-tures to the activation of the specific kernel k i , we assume that every kind of irrelevant feature is associated with one or more other kernels in the same convolutional layer. Base on such an assumption, removing the irrelevant features could be achieved by finding the modified inputX such that the activation of all the other kernels in the layer is suppressed as much as possible when usingX as input to the CNN model, i.e., minimizing the suppression loss L s (X, X), (2) The L 1 norm is used here to allow large values existing sparsely in some feature mapsF j 's particular when the visual features associated with the specific kernelF i are also contributing to the activation of some other kernels. The N j=1,j =i F j 1 in the denominator again is to reduce the sensitivity of certain hyper-parameters to varying activation levels at different convolutional layers.
In addition, considering that various noise signals could be well filtered away through multiple layers of convolutions, it becomes difficult to find a reasonably good solution X without noise signals because many other similar solutions with small noise signals included could lead to similar feature map activation at the convolutional layer of interest.
To effectively remove such noise signals in the final solution, as used in related work [7,8,10,33], the regularization loss L r (X) can be employed, where W 0 and H 0 are the width and height of the inputX. L 1 norm is used because certain non-zero visual features are expected inX for the specific activation of kernel k i . Overall, given the pre-trained CNN model and the input image X, the modified input imageX which contains only the necessary visual features for the specific activation F i of the kernel k i could be found by minimizing the combined loss L(X, X), where α and β are the weight coefficients to trade off the three terms. Once theX is obtained, the visual features in the original input image X contributing to the specific activation of the kernel k i could be directly observed from X. By observing multiple solutionsX's based on multiple original input images X's, any consistent visual features in theseX's would help users understand what kind of features are associated with the kernel k i .

Experimental setup
The well-known 16-layer VGG [27] classifier pre-trained on the ImageNet dataset [24] was used to evaluate our proposed method in kernel interpretation. Totally six classes of test images were used as inputs for interpretation of kernels in the CNN classifier. Each image was resized to 224 × 224 pixels. For each input image, given the selected specific kernel k i at certain convolutional layer and the fixed model parameters, gradient descent method was used to optimize the input, with initial learning rate 10 and decayed by 0.5 after training loss stops falling for about 50 iterations. Each optimization was observed convergent within 10,000 iterations. The coefficients β = 1.0 and γ = 1.0 during optimization. The results were evaluated both qualitatively and quantitatively. The qualitative evaluation is based on the direct observation of the optimized inputX's and the visualization of the feature maps F i 's andF i 's. Quantitatively, to measure the similarity between the feature mapF i of the kernel k i for the optimized input imageX and the original feature map F i , the structural similarity index (SSIM) [31] is adopted. Mean square error (MSE) between all other kernels' feature mapsF j 's and the expected suppression result (i.e., a zero-value feature map) was introduced to evaluate the degree of suppression for all the other kernels' feature maps at the same convolutional layer, with smaller MSE corresponding to better suppression.

Effect of suppression
We first check whether the proposed method works as expected or not, i.e., given any original input image, whether the method can find an optimized input such that the activation of a selected specific kernel can be preserved while the activation of all the kernels at the same convolutional layer is suppressed. Some existing methods can also interpret the activation of specific kernels, including the backpropagation-based Deconvolution (Deconv) [34], the guided-backpropagation (GBP) [28], and the layer-wise relevance propagation (LRP) [5,11]. Therefore, these methods were used as baselines for comparison with ours. From the demonstrative example in Figure 2, it is clear that our method can find a modified input (first row, second image) which cause almost the same activation of the selected kernel (second row, second feature map) as the original activation (second row, first feature map) and meanwhile well suppress the activation of other kernels (second column, bottom two feature maps). In comparison, the estimated inputs from the baseline methods can neither keep the activation of the specific kernel nor well suppress the activation of other kernels (last three columns). This suggests that the estimated inputs from the baselines actually may not precisely interpret the activation of the specific kernel, while our method probably can find a modified input for the specific interpretation of the selected kernel. Consistent results were obtained with comprehensive and quantitative comparisons. As Table 1 shows, for any convolutional block, our method can get much larger SSIM on selected kernels and smaller MSE (except in Block 1) on the other kernels, which means that our method can well find visual information which contributes to the activation of specific kernels but not of others. Interestingly, the MSE is much smaller (only 0.07) at the last two blocks, while it is relatively large at the mid-level blocks (i.e., 0.55 and 0.34 for Blocks 2 and 3 respectively). This indicates that different kernels at higher layers probably correspond to different visual information such that the method can find a modified input to suppress activation of the other kernels without affecting the activation of the selected kernel. It also indicates that kernels at middle layers are more likely interrelated such that it is difficult to completely suppress the activation of some other kernels when trying to preserve the activation of the selected kernel. Such finding is consistent with existing study [3,20] To get a more intuitive perception on the difference between our method and others, a joint distribution plot was drawn as shown in Figure 3, with x-axis representing the MSE on the activation of the selected kernel and y-axis the MSE on other kernels. Note that for the selected kernel, the MSE is the difference between the response of the kernel to the optimized input and that to the original input. Each point in the plot corresponds to the paired MSE's for one test image from one method. On the top and the right side of the joint plot, two marginal distributions of MSE's from each method were plotted respectively. As we can see, our method can get more concentrated and close-to-origin MSE's on both the selected kernels and all other kernels, while other baseline methods result in more spread distributions, again supporting that our method can find optimized inputs which contribute more specifically to the activation of selected kernels.

Interpretation of kernel activations
Considering that there is no ground truth for what a specific kernel represents or responds to, one way to evaluate interpretation methods is to visualize and check the consistency in the interpretation results with multiple input instances. As demonstrated in Figure 4 (first three rows), for the same kernel, our method and the baseline Deconv consistently found that the orange color causes the specific activation of the kernel, but LRP found inconsistent and more color information and GBP found a completely different color (purple) for the activation. Since the specific kernel is probably responding to color information, one synthetic color image (last row, first) containing all color information was additionally used as input. The activation of the kernel (last row, second) for the synthetic color image tells us that the kernel responds to image regions from red, orange, to yellow colors. Again, both our method and Deconv found the orange information within the activated region is probably causing the specific activation, but LRP and GBP did not. Considering that the orange color is the shared underlying visual information across the activated region, and our method together with Deconv consistently found the orange color in all the real and the synthetic images, it might suggest that the specific kernel does specifically respond to the orange color information and both our method and Deconv correctly interpret the activation of the kernel. Figure 5 lists the optimized inputs and corresponding feature map activation of specific kernels at different convo- Table 1. Quantitative comparison between our method and baselines. For each block in the VGG16 classifier, four kernels were randomly selected from the last convolutional layer in the block, and 180 images were randomly selected from the ImageNet training set for each selected specific kernel. Mean and standard deviation of the SSIM and MSE was calculated over the kernels and input images for the last layer of each block. Note that SSIM was for selected kernels (S.) and MSE for all the other kernels (R.  lutional layers. Compared to kernels at lower layers, interpretation of kernels at higher layer become more challenging. But one consistent observation is that the regions in the optimized inputs by all the methods are largely overlapped, indicating that all the methods are working in localizing the relevant regions for activation of specific kernels. However, only the optimized inputs from our method lead to the very similar feature map activation compared to that of the original inputs (second and last rows), and meanwhile better suppress the activation of other kernels at the same layer (not shown for simplicity). This again suggests that the visual information found by the baselines just partly contributes to the activation of specific kernels, while our method may find more complete and specific visual information for the activation of specific kernels. Also probably due to simultaneous preservation of a specific kernel and suppression of other kernels, our method can more easily discriminate two kernels particularly when the two kernels respond to the same region of an image. Figure 6 demonstrates an example of two kernels ('a' and 'b') having almost the same feature activation (second row, first two) for the input image (first row, first). The optimized inputs (first row) for each of the two kernels were obtained respectively by our method and the baselines. Our method found two complete different visual information respectively for the activation of the two kernels, while the baselines found more or less similar visual information for the two kernels. In addition, from the corresponding feature map activation (second row), it can be seen that the optimized inputs by our method result in very similar activation to the original ones, while the estimated inputs by other methods contribute to only part of the original activation for one or both kernels. To further check whether the two types of visual information found by our method are really associated with the two kernels, multiple different original input images with various visual content were provided and analysed by our method (Figure 7). It shows that the optimized inputs for each of the two kernels by our method Figure 5. Optimized inputs (first and third row) and corresponding feature map activation (second and fourth row) of specific kernels at different convolutional layers. Our method can better preserve the activation of specific kernels at various layers.  contain consistent visual information inside (Figure 7, last two rows). In particular, the optimized inputs for the synthetic color image (Figure 7, last column) contain the color information which is consistent not only with the optimized inputs from other images but also with the color information in the original input. All these consistencies suggest that the two kernels are probably responding specifically to the two different color information which is found only by our method.
Although our method can help better interpret the ac- tivation of specific kernels than the baseline methods, the interpretation is probably still not comprehensive. In particular, by varying the coefficients (e.g., β) in the proposed loss function (Formula 4), multiple optimized inputs can be obtained for the same original input and one specific kernel. As shown in Figure 8, the multiple optimized inputs result in almost the same feature map activation as the original one ( Figure 8, last two rows for each group). While the multiple optimized inputs for each specific kernel contain similar information, the clear visual differences between them indicate that multiple input solutions exist for the same feature activation. Such differences between the solutions suggest that a specific activation of one kernel may be robust to certain variations in the input image. While the robustness is a desirable property for the classifier model to recognize objects which may appear more or less different in different images, it also causes the challenge of specific interpretation of the kernel activation (e.g., 'Is it the whole or part of the specific visual information in the input that contributes to the specific activation of the kernel?'). We leave this challenge as an open question for future study. Figure 8. Multiple optimized inputs for the activation of each specific kernel obtained by varying the coefficient β of the third loss term in our method. For the top two groups (except for the original input on the top left), first row: optimized inputs; second row: the original feature map and feature maps corresponding to the optimized inputs; third row: the difference between the original feature map and the feature map of each optimized input. For bottom two groups, one additional row (second row) was generated by linearly contrasting pixel values from the first row for clearer visualization. Each group is for one specific kernel at a different convolutional layer.

Ablation study
In addition, to further explore the effect of the suppression loss L s and the regularization loss L r , ablation study was performed by removing one of them during input optimization. As table 2 shows, the removal of the regularization loss L r (first row) causes relatively lower SSIM and higher MSE, suggesting that the responses to original inputs were not very well preserved for kernels of interest and suppressed for the other kernels. When removing the suppression loss L s only (second row), it is reasonable that the responses to original inputs were more likely preserved for kernels of interest (as demonstrated by higher SSIM) because there is less force to modify the original input. However in this case, the MSE becomes much higher due to the lack of force to suppress the responses of other kernels. In comparison, the combination of these three loss terms (third row) can achieve the best balance on suppressing irrelevant information for other kernels (lowest MSE) while preserving the information for the selected kernel (relatively high SSIM).

Conclusion
In this study, a simple yet effective optimization method is proposed to interpret the activation of any kernel of interest in a CNN model. By preserving the activation of the specific kernel and suppressing the activation of other kernels at the same layer, the proposed method can find visual information in the input image which is more specific to the activation of the kernel of interest. With consistent observation of the same type of visual information from the optimized inputs for the activation of the same kernel with multiple images, we could interpret that the kernel is specifically responding to such visual information. Quantitative and qualitative evaluation supports that the proposed method may better interpret kernels in the CNN model than existing methods. Future work includes more comprehensive interpretation of kernels for various model structures and applications to real scenarios like intelligent disease diagnosis.