This application claims priority from EP 20194915.3, filed on Sep. 7, 2020, the contents of which are incorporated by reference herein in its entirety.
Embodiments relate to a method of training a deep neural network (DNN) to classify data.
State-of-the-art deep learning classification models contain millions and sometimes billions of parameters, which results in very complex decision boundaries. The decision boundaries of deep learning models form high dimensional manifolds, which are impossible to visualize. Moreover, by having many parameters there is an increased risk of overfitting. Overfitting is normally detected by inspection at train-test error/accuracy, but looking just at the accuracy for model selection is not always appropriate: in some cases it is essential for a machine learning model to be a faithful approximator of human-like reasoning, even if it is less accurate than the state-of-art model trained for the same task.
It is therefore desirable that DNNs are trained so as to achieve a desired degree of sparsity in activations. Sparsity in activations is associated with faster learning and reduced memory requirements. For example, it allows unimportant neurons to be pruned, making deep neural networks easier to embed into mobile devices.
It has also been hypothesized that sparsity of neuron activations is a desirable property for a self-explainable model, since it may result in more interpretable representations. It is well known that, in convolutional neural networks, sparsity constraints on filters force them to mimic the mammalian visual cortex area V1 and V2. Additionally, sparsity may enhance the performance and interpretability of rule extraction logic programs because sparsity induces fewer rules without sacrificing the accuracy. It may be argued that a smaller number of rules is easier to interpret by a human, and therefore they explain better and in a more compact manner the decisions made by a neural network.
Interpretable machine learning models are desirable in many real-life scenarios, including critical areas like healthcare, autonomous driving and finance, where models should explain their decision-making process, otherwise they are not trusted. For example, explaining the decision-making process of a neural network may assist doctors in making a better judgement of patient condition and mitigate human errors.
In classic convolutional neural networks (CNNs), a filter may fire in response to multiple object parts of the input image and also in many cases the importance region of activation is quite large. This makes it hard to assess the cause of activation of a filter and also hinders interpretability. Furthermore, in classic CNNs it is often the case that an image is related with high activations for many filters and this absence of sparsity in activations makes it even more difficult to explain the decision-making process of a CNN based on its filter activities. Therefore, linking neurons (or clusters of neurons) to specific object parts may be considered to be a desirable step towards explaining the decisions made by a neural network based on its neuron activities.
One way to train more interpretable models is to enforce some kind of clustering in the filter/neuron space. The main idea is to encourage filters/neurons to form groups that fire in response to common object parts or patterns present in a specific class or shared between classes. Each neuron/filter may then be associated with a specific object part or topic after a labelling process which could be manual or automated. Neurons with regions of high activation are more important in describing the decisions made by the model, and these activations may be utilized by rule extraction programs to explain a particular decision made by the complex model, enhancing the interpretability of the learned representations while maintaining fidelity.
Many supervised approaches that associate filters to specific object parts by utilizing object part annotations have been proposed. However, such detailed data is too expensive to acquire because it needs a lot of labelling work, and the vast majority of data does not come with such annotations. Therefore, it would be very useful to train models in an unsupervised fashion (without object part annotations) and teach their filters to be interpretable by representing specific object parts.
One previous proposal associates filters to specific object parts by introducing an additional penalty called ‘filter loss’ in the objective function that assigns each filter f to the category c whose images activate filter f the most. Their loss is expressed in terms of mutual information between feature maps and some templates, and forces each filter f to represent a specific object of category c and keep silent on other categories, i.e. each filter will be associated with one class. This means, for example, that there might be different filters firing for ‘tail of dog’, ‘tail of cat’ or ‘tail of bird’, leading to redundant representations, instead of having a unified filter to represent ‘tail’ that may activate on multiple classes at the same time. It is evident that, while this method succeeds in disentangling representations and linking filters to objects of specific classes, it does not encourage parsimonious representations (sparsity) which is something that may help reduce the redundancy in representations.
Some regularization approaches have been proposed to realize sparse activations, but none of them achieves at the same time clustering of the filter space (e.g. filters representing object parts or topics) and sparse representations.
An embodiment of a first aspect is a computer-implemented method of training a deep neural network—DNN—to classify data, which may for example be in image or tabular form, the method comprising: for a batch of N training data Xi, where i=1 to N and ci is the class of training data Xi, carrying out during training of the DNN a clustering-based regularization process at at least one layer l of the DNN having neurons j, in which process a regularization activity penalty is added to a loss function for the batch of training data which is to be optimized during training, whereby the regularization activity penalty comprises components associated with respective neurons in the layer which are dependent on the respective classes of the training data.
The clustering-based regularization process may comprise, before adding the regularization activity penalty, obtaining a prior probability distribution over neuron activations for each class. The regularization activity penalty may be structured to induce activations of neurons to converge to the prior probability distribution.
The prior probability distribution may be a sparse distribution in which only a low proportion of neurons in the layer are activated for the class.
The prior probability distributions of at least some classes may intersect.
Embodiments provide presents clustering-based regularization techniques to train more interpretable filters in a convolutional neural network (CNN), or more interpretable neurons in a Feed Forward Neural Network (FFNN) in general, while achieving a desired degree of sparsity in activations at the same time. It is therefore possible for the DNN to learn more quickly. Furthermore, it allows unimportant neurons to be pruned, thereby reducing memory requirements for the DNN.
The proposed methods encourage each filter of a convolutional layer to represent an object part or concept, without the need for object part annotations. This is accomplished by imposing penalties on filter activations using the ground truth labels of each image/sample as a supervisory signal. After training with the proposed methods, the activation region of filters is small and compact, hence after a labelling process (which could be manual or automated) each filter/neuron may be associated with a specific object part or concept. This results in more interpretable filter/neuron activities, which is a significant step towards explainability in Artificial Intelligence.
The proposed methods may also be used for transfer learning, where a machine learning model is trained on one domain and then may be applied to another domain with little or no additional training. By utilizing the learned interpretable representations, less data are required to train the model, therefore lowering the cost for a business to obtain big data.
In one embodiment, the clustering-based regularization process may comprise calculating, for each neuron, the component of the regularization activity penalty associated with the neuron, the amount of the component being determined by the probabilities of the neuron activating according to the prior probability distributions pjci. The component of the regularization activity penalty may be calculated using the formula:
Σi=1N(1−pjc
where Aij(l) is the activation of neuron j in layer l for training data Xi.
The regularization activity penalty R(W1:l) may be calculated using the formula:
where W1:l denotes the set of weights from layer 1 up to 1.
In another embodiment, the clustering-based regularization process may comprise, before adding the regularization activity penalty, determining the prior probability distribution for each class at each iteration of the process.
Determining the prior probability distribution for each class may comprise using neuron activations for the class from previous iterations to define the probability distribution.
The clustering-based regularization process may further comprise using the determined prior probability distribution to identify a group of neurons for which the number of activations of the neuron for the class meets a predefined criterion.
The predefined criterion may be at least one of: whether, when the neurons are ranked according to the number of activations of the neuron for the class from the prior probability distribution, the neuron is ranked within the top K neurons, where K is an integer; and whether the number of activations of the neuron for the class from the prior probability distribution exceeds a predefined activation threshold.
The regularization activity penalty may comprise penalty components calculated for each neuron outside the group but no penalty component for the neurons within the group.
Alternatively, the regularization activity penalty may comprise penalty components calculated for each neuron in the layer, the amount of the penalty component for neurons outside the group being greater than for neurons within the group. In the clustering-based regularization process the neurons may be ranked according to the number of activations of the neuron for the class from the prior probability distribution. The penalty component for each neuron may be inversely proportional to the ranking of the neuron.
Embodiments of the method may further comprise determining the saliency of the neurons in the layer and discarding at least one neuron in the layer which is less salient than others in the layer. That is, as mentioned above, unimportant neurons may be pruned.
Embodiments of the method may further comprise applying a weight regularization technique to the layer after carrying out the clustering-based regularization process.
A rule extraction technique may be applied to the DNN after training is complete to obtain rules explaining the activity of the neurons. That is, the proposed method may be combined with a post-hoc rule extraction program (for example, but not limited to, that proposed in EP3291146) to achieve better and more interpretable rules. Sparsity in activations may improve the interpretability, because fewer filters/neurons will fire on a specific image/sample. Using sparse activations, rule extraction programs may produce fewer rules which are more interpretable, while maintaining high fidelity.
As mentioned above, a manual or automated neuron labelling process may be applied to the DNN after training is complete to associate neurons with a specific object part or concept.
In a particular implementation, a method according to an embodiment may be used to train a DNN for use in controlling a semi-autonomous vehicle. For example, in an instance of transfer learning, a CNN trained using a method according to an embodiment to recognize traffic signs using a dataset comprising images of traffic signs from one country may be more readily trained to recognize traffic signs from another country than CNNs trained using a different method.
Embodiments of a second aspect provide a computer program or a computer program product comprising instructions which, when executed by a computer, cause the computer to carry out any of the methods/method steps described herein, or a non-transitory computer-readable medium comprising instructions which, when executed by a computer, cause the computer to carry out any of the methods/method steps described herein.
Embodiments of a third aspect provide apparatus to train a deep neural network—DNN—to classify data, which may for example be in image or tabular form, the apparatus comprising at least one processor, and at least one memory to store the DNN, the data to be classified, and instructions to cause the processor to: for a batch of N training data Xi, where i=1 to N and ci is the class of training data Xi, carry out a clustering-based regularization process at at least one layer l of the DNN having neurons j, in which process a regularization activity penalty is added to a loss function for the batch of training data which is to be optimized during training, whereby the regularization activity penalty comprises components associated with respective neurons in the layer which are dependent on the respective classes of the training data.
Reference will now be made, by way of example, to the accompanying drawings, in which:
This proposal aims to tackle the aforementioned inefficiencies in a unified approach. The goal is to train more interpretable filters/neurons and encourage them to cluster and fire in response to small and semantically meaningful regions by introducing sparsity in activations so that these regions may be associated with specific object parts in a separate labelling process after the fact. This clustering is accomplished without the use of specific object part annotations, using instead only the ground truth label of each sample as the supervisory signal, making the method broadly applicable.
As described earlier, a previous proposal associates filters to specific object parts by an appropriate ‘filter loss’. However, the proposed loss may cause redundancy in representations, training different filters for each class for the same concept (e.g. instead of learning general concept of ‘tail’ they learn ‘tail of cat’, ‘tail of dog’, etc.), especially if the model has high capacity for the problem to be solved. The method proposed in this application aims to tackle this inefficiency by introducing sparsity in representations. By encouraging parsimonious representations, the filters will be induced to capture the most discriminative information and hopefully avoid the redundancy problem.
For example, at the forward pass penalties Rm(W1:m) are computed for each layer according to an algorithm to be used for the layer (as explained later). After reaching the classification head, the loss to minimize is
L
CE+ΣmλmRm(W1:m).
Gradients are computed and then the parameters are updated at backward pass. This process can be repeated many times (num_batch)×(num_epochs). The general idea is captured by
In the present application, in a first algorithm, hereafter “algorithm 1” or “Elite-BackProp with prior distribution”, for each class a prior distribution over filter activations is imposed that leads to a semantically meaningful clustering of the filter space. By allowing the prior distributions of different classes to intersect, concepts shared between the classes may be modelled (e.g. intuitively learn only one filter for the concept of head instead of one filter per class). Moreover, by imposing sparse prior distributions, such as that shown in
The “Elite-BackProp with prior distribution” algorithm is supervised, in the sense that it is necessary to manually define for each class a prior distribution over filter activations. Although simple prior distributions like uniform or Gaussian are easy to construct, defining more complex prior distributions may be more difficult, because as the number of classes increases the possibilities increase combinatorially. Questions like “how many filters should be highly active for different classes” may be difficult to answer a priori. Moreover, a ‘wrong’ prior distribution may still cause redundancy in filter activations. For example, if the model has high capacity for the problem at hand, then a sparse prior distribution would be appropriate, but if a dense prior distribution is defined, such as that shown in
To tackle the aforementioned issues a second algorithm, hereafter “algorithm II” or “Elite-BackProp topK”, is proposed, in which the topK activations for each class, called the ‘Elite’, are rewarded and all other filters outside the ‘Elite’ of the class are penalized. For each class the ‘Elite’ is defined during training in a completely unsupervised way from the history of activations. Essentially the filters are ranked according to their activations, and any filter outside the ‘Elite’ will be penalized according to its ranking: a lower rank results in bigger penalty. The proposed method is not limited to defining an ‘Elite’ for each class, but different approaches using thresholding (instead of ranking) may be utilized. Furthermore, it is also possible to penalize every filter with a penalty inversely proportional to its ranking (i.e. penalize the ‘Elite’ also by a small amount). Therefore, each class is associated with a distribution of penalties for each filter, which may be regarded as equivalent to imposing a prior distribution over filter activations. The “Elite-BackProp topK” algorithm tackles the redundancy problem by encouraging parsimonious representations in a completely unsupervised manner without the need to manually define a prior distribution.
After training with the proposed regularization methods, the filters/neurons will be more interpretable because they will have high activation regions on meaningful parts/objects of the input image and sparse activity. An optional step may be to discard unimportant neurons (low magnitude) by pruning them, for speed and memory benefits. Later on, a labelling process may follow (which may be either manual or automated) in order to associate every filter with a particular word describing its activation. This is done by visualizing the receptive field of high activations of filters across different images or in an unsupervised fashion using few-shot learning techniques.
Additionally, a rule extraction logic program (such as, but not limited to, that proposed in EP3291146A) may be used after training with the proposed regularization, to distil the knowledge of the interpretable neural model and explain its decisions. Any other existing or future method which maps filters/neurons to literals and generates classification rules over those literals may also be used. Most rule extraction programs take as input the activations of filters from a subset of layers and measure the association with the target output. After associating filters with literals, rules are created to explain a particular decision, boosting the interpretability of the underlying representations. This may be very beneficial in some domains, such as healthcare where doctors need to know the decision-making process of the model and not only the output classification. For example, in detecting tumours or other diseases from images, it will be beneficial to have access to a neural network whose filters ‘fire’ on semantically meaningful regions of the image that help diagnose if a disease is present.
In summary, this proposal aims to train networks in such a way that filters/neurons represent semantically meaningful object parts or concepts, not necessarily associated with one specific class, by introducing sparsity in activations through two clustering-based regularization methods that use the ground truth labels of each sample as a supervisory signal. The proposed methods encourage parsimonious representations and make the activation region of each filter small and compact, making it easier to associate its activation with an object part in a separate labelling process. Last but not least, the sparsity inducing nature of the proposed methods may be combined with pruning for speed and memory benefits, making it easier to embed deep neural networks in mobile devices.
The methods described in the present application are implemented in Tensorflow™, but any other deep learning framework, such as Pytorch™ or Caffe™, may be used.
This proposal presents two regularization methods to realize clustering and sparsity in activation. The proposed methods are described for convolutional neural networks, such as that illustrated in
Before explaining the proposed methods, some necessary preliminaries are discussed and the notation for the rest of this proposal is set out (the ‘Glossary’ at the end of the description should also be referred to).
The proposed clustering-based regularization method is to be applied at a layer l of a CNN that consists of J filters {f1(l), . . . , fj(l)}. Let C denote the total number of classes for the classification problem at hand and let ci denote the ground truth label/class for an image Xi in the dataset. Furthermore, let B denote the total number of batches of images and let each batch contain N images.
Given a batch (X1, . . . , XN) of images, let Fi(l)=(Fi1(l), Fi2(l), . . . , Fij(l)) stand for the feature map (also known as activations) output of the l-th layer for the i-th image in the batch. Each Fij(i) for j=1, . . . , M,j=1, . . . , J is a 2D matrix of activations that is defined as the convolution of the feature map of layer l−1 with the j-th filter for i-th image in the batch, i.e.,
F
ij
(l)
=F
i
(l-1)
*f
j
(l)
where * stands for the convolution operator followed by ReLu (and in some cases by maxpooling also, depending on the architecture) and Fi(0)=Xi is the input image.
For each filter fj(l) we define a Bernoulli distribution Bern(pjc) where pjc denotes the probability of filter fj(l) being ‘active’ for the class c∈{1, 2, . . . , C}. A filter fj(l) is said to be ‘active’ for an image Xi if the activation Aij(l)>t, where t is a specified threshold. For now, threshold t may be considered as the average of filter activations per class; how to find such a threshold will be described later.
1. Algorithm I: “Elite-BackProp with Prior Distribution Activations”
In this algorithm a prior distribution over filter activations in a layer is specified separately for each class. Then, a penalty is introduced in the loss function to encourage filters' activities to converge to the specified prior distribution. The intention is that a set of filters will ‘fire’ only for a specific class, discriminating this class from the others, and another set of filters may ‘fire’ for multiple classes, representing object parts shared between the classes. Moreover, by specifying a sparse prior distribution over filter activations, one may control the redundancy in representations. The filters/neurons are induced to localize meaningful objects for each class and this results in small and compact activation regions, boosting the interpretability of each filter/neuron and consequently making the model more interpretable.
The proposed method to accomplish this consists of penalizing filter activations that have lower probability of being active for a certain class, where low probability is measured in terms of the prior distribution that is chosen. For example, if filter fj has probability pjc=1.0 of being active for class c, then Penalty component=0. If on the other hand a filter fj(l) has probability pjc=0.0 of being active for class c, then Penalty component=|Aij(l)|. Since the activations are taken after a ReLu non-linearity, the absolute value is omitted. In case of other non-linearities that take negative values, like Leaky ReLu, tanh or sigmoid, the absolute value is necessary.
Generally, if an image Xi is of class ci∈{1, . . . , C}, and pjc
Penalty=(1−pjc)Aij(l). (1)
Therefore, the total penalty for activation of filter fj(l) in the batch of N images will be
Σi=1N(1−pjc
and the total regularization penalty R(W1:l), taking into account all activations, is
R(W1:l)=Σi=1NΣj=1C
where W1:l denotes the set of weights from layer 1 up to l and Cl is the number of output channels of layer l.
Notice that the activations Aij(l) are a function of all weights W1:l. Therefore the proposed method implicitly regularizes all weights up to layer l and encourages filters to cluster and have the incentive to represent specific object parts as specified by the prior distribution pjc
The loss function that we optimize during training takes the form
L
W(y,ŷ)=LWCE(y,ŷ)+λR(W1:l)
where LWCE(y,ŷ) stands for the cross-entropy loss between the true and predicted label (any other loss may be used in place of cross-entropy, like hinge loss or Kullback-Leibler; for regression, the L1,L2 losses are common choices, but the present method is not restricted to using only those) and controls the penalty (λ is a small positive constant which is preset at initialization λ based on expert knowledge or determined empirically, for example using cross-validation)L1, L2. The term R(W1:l) acts as a regularization term, but one may use additional regularizers like the Ridge or Lasso. The purpose of R(W1:l) is to encourage filters to form clusters, according to the specified prior distribution.
In this section a toy example is presented to depict the proposed idea of algorithm I in a clearer manner. Suppose that there is a three-class classification problem and the distribution shown in
It is possible to specify any desired prior distribution, and during training the filters are encouraged to have activations that resemble the prior distribution. The intuition is, as previously mentioned, to encourage filters into representing specific object parts by clustering according to the prior distribution. Therefore they cluster in order to either discriminate categories or to represent common topics shared between them.
How to ‘teach’ the filters to have activations according to the prior distribution will now be discussed, starting by looking at the distribution of filter activations for the 1st class. During training, if an image of class 1 has high activation for filters 25 or 37 at layer l, then a big penalty should be imposed. This is because filters 25, 37 should not be active for that class, according to the prior distribution. On the contrary, no penalty is imposed on the activation of filter 12, since according to the prior distribution filter 12 has very high probability of being active for class 1. Filter 16 should be penalized a little because the probability of being active for class 1 is not 1.0. Therefore, filter activations get penalties that are inversely proportional to the prior distribution of filter activations that has been specified.
There is no restriction as to what prior distribution may be specified. For example, uniform prior distribution of filter activations may be specified, as shown in
It is desirable to apply weight regularization (e.g. Ridge) on the layer following application of the Elite-BackProp algorithm, in order to keep weights constrained in a small Euclidean ball. The reason is that the proposed method penalizes activations according to a prior distribution (or an ‘Elite’ in algorithm II as described later). If no constraints are imposed then the model is free to learn arbitrary large weights in order to negate the regularization effect. This problem is depicted in
In summary, activity penalization Aij(l-1)→0 by imposing the prior distribution could be potentially negated by the model if it learns Wjc(l)→∞, where i indexes input images, j indexes neurons-filters in layer l and c indexes output classes. However, if a constraint is imposed on the domain of W(l) in order to lie on a compact set, then it cannot get arbitrarily large to cancel the effect of the regularization penalty. Therefore an L2 regularization penalty is imposed on the weights on the layer that follow Elite-BackProp. The L2 constrains the W(l) to lie inside a Euclidean ball, where the radius of the ball is controlled by the regularization value: a bigger regularization value results in a smaller Euclidean ball.
In a post-processing step pruning techniques may be applied to remove unimportant filters. The ‘importance’ (aka saliency) of each filter/weight in a CNN/FFNN may be determined in terms of a metric (e.g. Lp, LpqLp, Lp,q norms and group sparsity ones) and the filters may be sorted according to that metric. Afterwards, the least important filters/weights may be discarded by zeroing their effect, and the pruned network may be finetuned (re-trained) in order to converge to a simpler function with minimum loss in accuracy. This process may be performed many times in an iterative fashion.
As mentioned earlier, it may be quite difficult to define a good prior distribution over filter activations for each class. In particular, defining the appropriate number of filters that should be active for different classes results in a separate combinatorial problem that might be too time-consuming to solve. Furthermore, a bad choice in prior distribution may still cause redundancy in representations, especially if the model has high capacity for the problem at hand.
To tackle these inefficiencies, an unsupervised method is proposed below to naturally define a ‘prior distribution’ and achieve parsimonious representations as well as clustering of filters towards semantically meaningful concepts.
This section describes an unsupervised method to tackle the limitations of “Elite-BackProp with prior distribution activations” as described earlier. The main idea is to define for each iteration of the algorithm a natural ‘prior distribution’ over filters activations for each class. This prior distribution is not constant during training, but is updated by looking at the history of filter activations from all previous iterations. Filters that had high activations in the past for a class get rewarded whereas filters that had low activations get penalized. Consequently, this procedure constructs for each class at each iteration, a histogram of activations which may be regarded as a prior distribution on that iteration. One may choose to reward a subset of activations per class by a topK approach (i.e. rank the filters and reward the K highest activations, or equivalently penalize the least J-K) or by defining a threshold, but the proposed method is not limited to these approaches. The aim is to encourage parsimonious representations by rewarding a subset of filters (called ‘Elite’) in an unsupervised manner, in order to reduce redundancy and give them the incentive to focus on the most discriminative information.
The proposed second algorithm achieves activity sparsity as well as clustering in filter space using the ground truth label of each class as the supervisory signal. In this algorithm a prior distribution over filter activations for each class is not specified, but instead only a number K, that is used to pick an ‘Elite’ of filters that have high activations for that particular class during the training process without any supervision, is specified. This algorithm is described using a topK approach, but the proposed method is not limited to this.
The ‘Elite’ for each class is constructed as follows: at each forward pass, the top-K filter activations for each class are found and their activations are dynamically accumulated (for each filter and each class). All filters that do not belong to the ‘Elite’ of the corresponding class will get penalized at backward pass. This way, only the ‘Elite’ of filters-neurons will be active for each class after training, and this induces a desirable degree of sparsity that is controlled by K (higher K means less sparse) as well as clustering in the filter-neuron space. After training, some filters may belong to the ‘Elite’ of many classes, a situation that naturally occurs if the topic that is represented by the filter is shared between those classes.
The aim of this method is to induce sparsity by relying only on the ‘Elite’ of filters-neurons for each class to guide the classification. In this way, the ‘Elite’ filters have the incentive to represent only the top K most important objects/topics for each class in order to achieve good classification performance and are free to represent common objects shared between the classes or objects that discriminate the classes. Finally, filters that do not belong to any of the ‘Elite’ may later on be pruned for speed and memory benefits as a post-processing step and the remaining network may be finetuned.
Pruning techniques aim to first find the ‘importance’ (aka saliency) of each filter/weight in CNN/FFNN in terms of a metric (e.g. Lp, Lp,q norms and group sparsity ones) and sort them according to that metric. Afterwards, they discard the least important filters/weights by zeroing their effect. Finally, finetuning (re-training) of the pruned network is conducted in order to converge to a simpler function with minimum loss in accuracy. This process may be performed many times in an iterative fashion.
2.1. Method Description in Detail
The Elite-BackProp topK method works as follows: at each forward pass and for each image Xi in a batch, the activations from a layer l are found where the regularization layer is applied. Let ci denote the ground truth class of image Xi and let D be a dictionary with the target classes as keys and for each value a vector storing the activation of filters in an accumulative manner. The dictionary D is initialized as Cl-dimensional vector of zeroes for each class, where Cl is the number of filters in layer l. At each iteration, after layer l is reached during the forward pass, the activations Aij(l) of filters fj(l) are computed and the memory is dynamically updated:
D[ci]←D[ci]+(Ai1(l), . . . ,AiC
Each activation Aij(l) is a real number and (Ai1(l), . . . , AiC
After updating the dictionary D the filters are ranked according to their activations and the ‘Elite’ of filters E(ci) is defined, i.e. the top-K filters with highest activations for class ci. The activations of the ‘Elite’ will not get penalized, but any filter that does not belong to the class ‘Elite’ will get penalized at the backward pass, and that penalty is inversely proportional to the rank of the filter: lower rank→higher penalty.
It should be noted that in the proposed algorithm the Elite are not penalized, only all other neurons outside the Elite. However, the algorithm may be modified to penalize the Elite also by ranking the activations
Ac1>Ac2> . . . AcK−1>AcK>AcK+1> . . . AcC
for every filter (Elite included). Note that the denominator is the maximum Ac1 activation this time. Therefore, the proposed method is not limited to using an Elite, one could penalize all filters according to their activations of that class or define a threshold on which filters are to be penalized.
Just as for Algorithm I, “Elite-BackProp top-K activations” layer regularization should desirably be followed by an L2 regularizer on the weights (see section 1.3)
Experiments using the proposed regularization approach and uniform prior distribution or topK were conducted on two datasets, Road Dataset obtained from Places365 (Zhou, B.; Lapedriza, A.; Khosla, A.; Oliva, A.; Torralba, A. Places: A 10 million image database for scene recognition, IEEE Trans. Pattern Anal. Mach. Intell. 2018, 40, 1452-1464) and the CUB200-2011 bird dataset (C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie: The caltech-ucsd birds-200-2011 dataset, 2011), as referred to in
A. Road Dataset
This dataset contains 3 categories (‘forest road’, ‘highway’, ‘street’) from the Places365 dataset and the goal is to classify road scenes. Scenes may be described through sub-objects and the topics present within them and that is why this toy dataset was chosen for testing the proposed method. The train-validation-test split chosen is 10,445-1,500 3,055 with 500 images per class for validation and roughly 1018 images per class for testing.
To standardize the data, for each item the per channel mean was subtracted and it was divided by the per channel standard deviation of images in Road dataset. Moreover, to augment the data, the following transformations were performed for each image: 50% chance of horizontal flip, 30% chance to change brightness, 20% chance for Gaussian blur, 35% chance to smooth, 20% chance to convert image to black and white and 30% chance to add salt and pepper noise.
The toy architecture for training on the ROAD dataset is described in
A.1 Results after Training Using Elite-BackProp with Activity Prior Distribution
In this section quantitative and qualitative results on sparsity of activations and visualize activations regions of filters after training with Elite-BackProp with uniform and sparse prior distribution are reported.
A.1.1. Training from Scratch with Uniform Prior Distribution
The architecture shown in
The mean filter activation per class was computed as follows: for each class in the test dataset, all images belonging to that class are passed through the CNN and the spatial mean of each filter after the last convolutional layer where the regularization was applied is recorded, i.e.
where ΣcNc=N, the total number of images in the test dataset.
Note the deviation of filter activations of a specific class (dashed lines) from the mean activation of a filter across all classes. This clearly shows that filters 1-50 highly activate for class 1, filters 51-100 for class 2 and filters 101-150 for class 3.
A simple global threshold t=0.3 for a filter to be active may be manually specified, by visual inspection of activations in
Filters with high activation have the most effect on the classification score because of the linear layer followed by softmax after the GAP layer.
Qualitative Analysis on Training from Scratch with Uniform Prior Distribution
The goal of this qualitative analysis is to assess if filters are clustered (according to the specified prior distribution) after training with Elite-BackProp to fire in response to semantically meaningful and interpretable regions of the input image.
The top 10 activation regions of a filter are computed as follows:
A.1.2. Finetuning with Sparse Prior Distribution
As already mentioned, in “Elite-BackProp with prior distribution” any prior distribution over filter activations that is desired may be used. For example, a sparse prior distribution may be specified, where some filters do not activate at all for all classes and therefore could be pruned after training.
The proposed algorithm Elite-BackProp, with a sparse prior distribution, may also be used for finetuning a pre-trained model, to impose more sparse activations. In this case, Elite-Backprop with sparse prior distribution would define an ‘Elite’ of filters for each class, where the Elite is computed from the activations of the pre-trained model. The ‘Elite’ of each class stands for the most activated filters for that class and during training all filters outside the ‘Elite’ will be penalized.
Elite-BackProp with sparse prior distribution may be regarded as a combination of the techniques in “Elite-BackProp with prior distribution” (algorithm I) and “Elite-BackProp topK” (algorithm II), and may be utilized for effectively finetuning existing models while inducing sparsity at the same time.
Finetuning with Elite-BackProp
As mentioned previously, elements from algorithms I and II may be combined to finetune an existing model using Elite-BackProp with sparse prior distribution. This may be accomplished as follows:
Quantitative Analysis after Finetuning with Sparse Prior Distribution
In this section we present quantitative results after training with Elite-BackProp and sparse prior distribution. The tables in
To construct the sparse prior distribution the steps outlined in the previous section are followed: for each class in the Road dataset, loop through all images of that class and find the top 20 filter activations on average. Afterwards a sparse prior distribution is constructed that assigns to the top 20 filters of each class probability 1.0, and 0.0 probability on all others as described previously.
After finetuning with Elite-BackProp and the constructed sparse prior distribution, the same process as described above in the section “Training from scratch with Uniform prior distribution” section is performed to assess the sparsity in activations: For each class (‘forest road’, ‘highway’, ‘street’), all images belonging to that class are looped through and all filter activations out of the last convolutional layer are computed. Similarly, for each image a vector of 150 filter activations is obtained.
A filter is considered active if its activation is above the threshold for that filter (as discussed above, it may for example be a global threshold, or μj, (μj+σj) or (μj+2σj), or something between intra and inter class mean). In the present example the threshold μj+σj is used; thus, any filter with activation below that threshold is considered inactive. For each image, the number of filters having activations above that threshold is computed. For example, for image 1 in class 1 there may be 32 active filters, for image 2 in class 1 there may be 28 active, etc. When all the computations have been done, the mean number of the active filters for all images per class is taken; this is the number reported in the table of
Therefore, for an image in the class ‘forest road’, on average 30.674 filters are active before applying the Elite-BackProp algorithm, and on average 4.52 filters are active after training with ‘Elite-BackProp’. This means that only a few filters are highly activated for each image, making it much easier to explain the classification decision.
In the table of
A.1.3. Quantitative Analysis of Rule Extraction
The rule extraction framework proposed in EP3291146A was used to distil the knowledge out of the trained CNN and the number of rules, as well as the classification accuracy of the extracted rules, was measured. The results are depicted in the tables shown in
For the architecture shown in
For the architecture described in
From the previous results it seems that for the ROAD dataset global average pooling helps rule extraction when used in conjunction with our regularization. Even without the use of the GAP layer however the proposed regularization results in less unique literals, which equates to simpler representation with very little sacrifice in accuracy.
B. CUB200-2011 Dataset
The CUB200-2011 dataset contains 11.8K images of 200 bird species. Each category contains from 12 up to 33 images (22.4 images on average per category). Since this dataset is very small, extensive augmentation was applied, as described earlier in relation to the Road dataset. The train-validation-test split that was followed was 5696, 1600 and 4493. To standardize the data, for each item the per channel mean was subtracted and it was divided by the per channel standard deviation of images in CUB200.
The architecture shown in
B.1. Results after Training Using Elite-BackProp topK Activations
In this section we report quantitative and qualitative results on sparsity of activations and visualize activations regions of filters after training with Elite-BackProp topK activations with K=20 for 100 epochs. The mean test and validation accuracies on the 88th epoch for the architecture of
Quantitative Analysis
The average filter activations for all images of a given category were measured (as described previously: loop through all images of a specific class, get their activations and then take their average) and their values were plotted as shown in
It may be seen that Elite-BackProp topK introduces big spikes for the filters that are highly active on average for images of class 1. The filters with high activation spikes may be associated with objects of class 1 after visualizing their high activation receptive field in images.
For class 31 big activation spikes on some filters that form the ‘Elite’ of this class are also clearly seen. Notice that some filters overlap with class 1.
Qualitative Analysis on Training from Scratch with Elite-BackProp topK
Experiments were performed using two different visualization approaches. The first visualization approach is described in the previous section “Qualitative Analysis on training from scratch with uniform prior distribution” for the Road dataset with threshold μj+σj. The second visualization approach is that proposed in D. Bau, B. Zhou, A. Khosla, A. Oliva, and A. Torralba. Network dissection: Quantifying interpretability of deep visual representations. In CVPR, 2017. Both approaches produce similar results in terms of visualizing the important regions of activations.
For completeness, the second visualisation approach of Bau et. al. is described below: For each filter fj, feature maps Fij after ReLu operations (and maxpool if present in the architecture) are computed on different input images Xi on the l-th layer where the proposed regularization is applied. Then, the distribution of activation scores in all positions of all feature maps is computed. Later on, an activation threshold tf
p((Fij)rs>tf)=0.005
in order to keep the top activations from all the spatial locations (r, s) of all feature maps Fij. Finally, after thresholding the feature map to obtain a binary mask, it is scaled up to match the resolution of input image, the input image is masked and then it is visualized.
Visualization of high activations in some filters in the CUB200-2011 dataset is shown in
In summary, the proposed method is a clustering-based regularization process with the following properties:
Embodiments may be applied to any area where self-explainable models with interpretable neurons-filters is needed or sparsity in representations is desirable.
After achieving a desired level of sparsity, unnecessary filters/neurons may be pruned to boost speed and reduce memory requirements. This would result in a more compact and lighter DNN model, making it easier to embed it into resource limited portable devices (e.g. mobile devices).
After training with the proposed regularization methods, the filters/neurons will be more interpretable and fire (i.e. have high activation regions) towards meaningful parts/objects of the input image. Afterwards, a labelling process may follow for each filter (which may be either manual or automated) in order to associate every filter with a particular word describing its activation. Essentially, by visualizing the receptive field of high activations of filters across different images one may associate each filter with a word describing its activation. Moreover, a rule extraction logic program may be used after training with the proposed regularization, to distil the knowledge of the interpretable neural model and explain its decisions. Such rule extraction programs take as input the activations of filters from a subset of layers and measure the association with the target output. After thresholding the activation of each filter/neuron, each one of them may be either active or in-active and by creating a decision tree or graph for example, rules are created to explain a particular decision, boosting the interpretability of the underlying representations. This could be very beneficial in domains such as:
Transferable Traffic Sign Recognition—Use Case
The computing device comprises a processor 993 and memory 994, which may for example be configured to perform the tasks of a deep neural network. Optionally, the computing device also includes a network interface 997 for communication with other such computing devices, for example with other computing devices of invention embodiments.
For example, an embodiment may be composed of a network of such computing devices. Optionally, the computing device also includes one or more input mechanisms such as keyboard and mouse 996, and a display unit such as one or more monitors 995. The components are connectable to one another via a bus 992.
The memory 994 may include a computer readable medium, which term may refer to a single medium or multiple media (e.g., a centralized or distributed database and/or associated caches and servers) configured to carry computer-executable instructions or have data structures stored thereon, such as the Road and Cub datasets. Computer-executable instructions may include, for example, instructions and data accessible by and causing a general purpose computer, special purpose computer, or special purpose processing device (e.g., one or more processors) to perform one or more functions or operations. For example, the computer-executable instructions may include those instructions for implementing all the tasks or functions to be performed by each or all of
The processor 993 is configured to control the computing device and execute processing operations, for example executing computer program code stored in the memory 994 to implement the methods described with reference to
The display unit 995 may display a representation of data stored by the computing device and may also display a cursor and dialog boxes and screens enabling interaction between a user and the programs and data stored on the computing device. The input mechanisms 996 may enable a user to input data and instructions to the computing device.
The network interface (network I/F) 997 may be connected to a network, such as the Internet, and is connectable to other such computing devices via the network. The network I/F 997 may control data input/output from/to other apparatus via the network. Other peripheral devices such as microphone, speakers, printer, power supply unit, fan, case, scanner, trackerball etc may be included in the computing device.
Methods embodying the present invention may be carried out on a computing device such as that illustrated in
A method embodying the present invention may be carried out by a plurality of computing devices operating in cooperation with one another. One or more of the plurality of computing devices may be a data storage server storing at least a portion of the data.
The above-described embodiments of the present invention may advantageously be used independently of any other of the embodiments or in any feasible combination with one or more others of the embodiments.
A
i
(l)=σ(W(l)A(l-1)+B(l),
where (⋅)rs stands for the (r, s) spatial coordinates (the definition of activation of a feature map is defined as the average of activations, but may be naturally extended to any metric. For example, someone may define the activation in terms of the Lp or Lp,q norm of each feature map).
Number | Date | Country | Kind |
---|---|---|---|
20194915.3 | Sep 2020 | EP | regional |