Semantic Pruning for Single Class Interpretability

1 INTRODUCTION . Convolutional Neural Networks ( CNN ) provides high quality features that are used in various tasks such as object recognition ( Ouyang et al. , 2015 ; Wang et al. , 2015 ; Lin et al. , 2017a ; Hu et al. , 2017 ) , scene classification ( Zhou et al. , 2014 ; Ren & Li , 2015 ) , semantic segmentation Girshick et al . ( 2014 ) ; Husain et al . ( 2017 ) , image captioning ( Anderson et al. , 2017 ; Rennie et al. , 2017 ; Yao et al. , 2017 ; Lu et al. , 2017 ) , raw audio generation ( van den Oord et al. , 2016 ) , data analytics ( Najafabadi et al. , 2015 ) . Unlike engineered features , where one or multiple features have been designed with specific domain knowledge ( SIFT ( Lowe , 1999 ) , SURF ( Bay et al. , 2008 ) , LBP ( Ojala et al. , 1994 ) , Canny ( Canny , 1986 ) , etc . ) , features in CNN are obtained by directly learning representations ( filters ) from the data without explicit domain expertise . While using a large number of learned filters in CNNs creates high-quality features , it also requires significant computational resources . The filter learning and the inference processes need resources such as GPU or TPUs to tackle the computational overhead . Recently , multiple optimization methods were proposed , with the target to reduce the computational overhead of either the learning or the inference processes . For instance , in the learning optimization approach , the following works have been done ( Zhang et al. , 2018 ; Lin et al. , 2017b ) . On the other hand , the number of the current works targeting the optimization of the inference are : reduced precision computation ( Rastegari et al. , 2016 ; Courbariaux et al. , 2016 ; Zhou et al. , 2016 ) , look-up and precomputing ( Abdiyeva et al. , 2018 ; Brendel & Bethge , 2019 ) , pruning ( Anwar et al. , 2015 ; Li et al. , 2016 ; Zhu & Gupta , 2017 ; Raghu et al. , 2017 ; Morcos et al. , 2018 ; Ma et al. , 2019 ) and knowledge distillation ( Hinton et al. , 2015 ) . The work described in this paper continues in the direction of inference optimization by pruning . However , the pruning is only used as a tool for studying the interpretability of CNNs filter . Pruning is the process of removing redundant filters from the network ( Anwar et al. , 2015 ; Li et al. , 2016 ; Zhang et al. , 2017 ; Zylberberg , 2017 ; Zhu & Gupta , 2017 ; Raghu et al. , 2017 ; Morcos et al. , 2018 ; Ma et al. , 2019 ) . In current approaches , the pruning process consists of the following steps : train CNN , remove redundant filters and retrains the network to preserve the original accuracy . The proposed pruning method , however , does not involve retraining of the pruned network . The motivation of this work is the interpretation of CNNs : pruned and unpruned filters are analyzed to evaluate class-wise relations and dependencies . In particular , the pruning applied to AlexNet is used to explore and study whether one can obtain a new single class classifier by dropping the selected filters in the original multi-class classifier instead of an expensive training process of a new classifier . The interpretability of the network resulting from pruning can be seen as a filter-wise and signalwise network dissection : The removal of filters in a controlled manner allows us to determine how different classified objects affects other classes , how the density of the classes in the learned feature space affects the accuracy of a classification and how the structure of the learned multi-class feature space allows to improve the accuracy of a single-class classification . Therefore , the pruning used in this work can also be seen as an approach to CNN understanding ( Bau et al. , 2017 ; Zylberberg , 2017 ; Kindermans et al. , 2017 ; Morcos et al. , 2018 ) . The proposed method , referred to as semantic pruning , is performed as follows : we start from a CNN trained to distinguish q classes . Then we reduce the multi-class CNN to the single class classification problem , by removing unrelated to the selected class labels . To remove filters , we measure each filter ’ s contribution ( activation magnitude ) toward recognition of a target object class . Filters with the highest contributions were preserved , and the remaining filters were dropped from the network . The pruned and unpruned filters are analyzed for correlation , overlap and other measures allowing us to determine class-wise interactions . The contribution of this paper can be summarized as the following : • investigated the sensitivity of object classification to semantic pruning , • study of the interference between class wise filters in CNN , This paper is organized as follows . Section 2 introduces semantic pruning concept . Section 3 describes the experiments and the results and Section 4 concludes the findings . 2 PROPOSED SEMANTIC PRUNING . Let Fi ∈ R M×M×D be a filter in layer j of a convolutional network . Let , Bj ∈ R X×Y×D be an input tensor to the layer j. X and Y are spatial dimensions . To calculate the output tensor Bj+1 of the layer j input tensor Bj is convolved with the set of filters L = { F1 ... , FD′ } of layer j . Lets denote the output of the convolution operation between input tensor Bj and a single filter Fi as Ri : Ri = Fi ⊙ Bj ( 1 ) Then B j+1 ( : , : ,i ) = Ri Definition 1 ( Pruning ) . Let L = { F1 , . . . , FD′ } be a convolutional layer , Fi ∈ R M×M×D be a single filter of the layer with an input tensor Bj ∈ R X×Y×D . Bj+1 = L ⊙ Bj ( eq . 1 ) with Bj+1 ∈ R X′×Y ′×D′ . Pruning layer L denoted as Ω ( L ) is the process of removing one or more Fi from L resulting in a new set of filters Ω ( L ) = L ′ = { F1 , . . . , FD′′ } . Hence , a new output is B ′ j+1 = L ′ ⊙ Bj with B ′ j+1 ∈ R X′×Y ′×D′′ such that D′′ ≤ D′ . In this work , we propose a semantic pruning method that is applied with respect to each selected class separately . We determine the amount of pruned filters for each object class λi ∈ Λ = { λ1 , . . . , λq } where q is the number of classes in the dataset . To determine which filters can be removed , the process of pruning requires a measure of contribution . In this work , we propose to use activation magnitude as filter removal criteria . Definition 2 ( Activation Magnitude r̄ ) . Let R ∈ RX ′ ×Y ′ be a result of convolution between input tensor and a single filter in the layer , then activation magnitude for each filter Fi is computed as follows : r̄i = X′∑ x=1 Y ′∑ y=1 Rx , y , i ( 2 ) with r̄ ∈ R1×1×D ′ . The schema for calculating r̄ is shown in Figure 1b . We propose to perform pruning for each class separately ; hence , we split the dataset into subsets of images belonging to the same class . Let D = { δ1 , . . . , δn } be the dataset containing the n data samples . Let Λ = { λ1 , . . . , λq } be the number of object classes in the dataset . Then , Dλc ⊂ D be a subset of D containing all data samples with class label λc . The number of samples in Dλc is denoted as p , such that p ≤ n. Let r̄i ( δo ) be the activation magnitude of a filter Fi resulting from using input sample δo ∈ Dλc . We want to measure the response of each filter w.r.t . to the individual class . Therefore , we propose to accumulate the activation magnitudes of all samples belonging to the selected class . The resultant value is denoted as Accumulated Response . Definition 3 ( Accumulated Response γ ) . r̄i λc is the Accumulated Response for filter Fi and object class λc and defined as shown in eq . 3 γ = r̄λci = p∑ o=1 r̄i ( δo ) ( 3 ) The process of semantic pruning starts by separating the dataset D into subsets Dλc = { δ1 , . . . , δp } with p being the number of samples in the subset Dλi , for object label λc ∈ Λ = { λ1 , . . . , λq } with q being the number of object classes . Let m be the total number of filters in AlexNet . We calculate the accumulated response r̄λc = { r̄λc1 , . . . , r̄ λc m } for each filter in the network and for selected number of object classes from the dataset . The percentage of pruned filters is represented by the parameter θ ( pruning ratio ) such that θ = [ 0 , . . . , 1 ] . For instance , for θ = 0.1 , the 10 % of filters with lowest accumulated response will be pruned . In this work , let Fσ and Fσ̄ be the set of unpruned and pruned filters for a given γ respectively . The process of filter pruning can be performed using two different approaches : network wise and layer-wise . Network wise pruning ( NWP ) is performed on filters F from all layers of the network . Filters are sorted according to their corresponding accumulated responses , and the filters with the smallest values are removed in correspondence to the pruning ratio θ . On the other hand , Layer wise pruning ( LWP ) separates filters into groups , each containing filters from one layer . The pruning is then applied to each layer separately . However , as a result of removing certain filters , the activation response for the filters in the consecutive layers can get affected , and therefore , higher potential of pruning can be achieved . Therefore , we also provided a comparison between these two cases , referred to as Direct and Residual Pruning . Two settings were used toward varying-parameter θ . These approaches will be referred to as discrete and continuous pruning . For discrete pruning , the values are changes with the fixed step size , while for continues pruning the wider range of values is explored . 3 EXPERIMENTS . To illustrate the effectiveness of the semantic pruning approach , we applied the method on the model trained for an object classification task . In our experiments we used AlexNet ( Krizhevsky et al. , 2012 ) trained on ImageNet ( Russakovsky et al. , 2015 ) dataset . The AlexNet network consists of five convolutional and three fully connected layers . Fully connected layers are referred to as classifier . The convolutional layers are referred to as feature extractor . The ImageNet data set contains 1000 object classes ; however , due to computational constraints , we evaluated our method on randomly chosen 50 classes , to show the further potential of the method . Figure 3 : Comparison of classification accuracy between unpruned AlexNet and pruned using NWP-M , LWP-33 , NWP-66 , LWP-66 . The experimental section is organized as follows : • Sensitivity to pruning • Study of the Filter Interference

Summary: This work proposes to prune filters in CNN model to interpret the correlation among different filters or classes. Though interpreting CNN filter is a well-studied topic, learning the interpretability through pruning is new and interesting. The proposed method is simple, by just using the averaging the value of the output of each filter as the indicator. The author claims that object classes represented in high feature density area usually share similar filters, which is in accordance with the common sense. Also, filters at lower layer are usually important.