Weakly Supervised Discovery of Semantic Attributes
AMEENALI @ MAIL .
TAU .
AC .
IL
GALANTI @ MIT
EDU
EVGENIIZH @ CAMPUS .
TECHNION .
AC .
IL
CHAIMBASKIN @
CS .
TECHNION .
AC .
IL
WOLF @ CS .
TAU .
AC .
IL
Editors: Bernhard Schölkopf, Caroline Uhler and Kun Zhang
Abstract
We consider the problem of extracting semantic attributes, using only classification labels for supervision.
For example, when learning to classify images of birds into species, we would like to observe the emergence of features used by zoologists to classify birds.
To tackle this problem, we propose training a neural network with discrete features in the last layer, followed by two heads: a multi-layered perceptron (MLP) and a decision tree.
The decision tree utilizes simple binary decision stumps, thus encouraging features to have semantic meaning.
We present theoretical analysis, as well as a practical method for learning in the intersection of two hypothesis classes.
Compared with various benchmarks, our results show an improved ability to extract a set of features highly correlated with a ground truth set of unseen attributes
1. Introduction
The discovery of meaningful intermediate features in classification problems is at the heart of many scientific domains.
For example, in botany, species are often identified based on dichotomous keys related to the shape of the leaf, the texture of the fruit, etc.
(Project, 2021).
In paleography, manuscripts are dated or attributed to a specific scribe based, among other attributes, on specific characteristics of the morphology of the letters (Stokes, 2009).
Such intermediate features allow experts to discuss a certain classification outcome, for example, in case of an ambiguity or disagreement.
Moreover, the attributes discovered help understand the underlying structure of the problem.
In our paleography example, certain morphological attributes can be traced back to a specific school of scribes, and certain forms evolve over time in specific geographic locations, influenced by nearby writing cultures (James, 2020).
In this work, we define a weakly supervised attribute discovery problem, motivated by the nature of such intermediate level features.
The problem is addressed within a novel theoretical framework, which gives rise to an effective method.
Our focus is on binary attributes that are both evidence-based and distinctive.
By evidence-based we mean that there is a mapping f such that every input x is mapped to a vector f ( x ) of binary values, indicating the presence of each attribute.
Distinctiveness means that there should be simple rules that determine the class label y
( x ) based on the obtained attributes f ( x ) .
Currently, deep neural networks (DNNs) represent the most successful methodology for obtaining attributes from images (Zhang et al., 2014; Xu et al., 2020) and for classification.
However, interpreting DNNs is very challenging (Zhang et al., 2021).
In contrast, decision trees with binary decision stumps provide simple and interpretable decision rules, which are based on attributes (Guidotti et al., 2018).
We propose merging the two approaches by training a DNN to produce quantized representations suitable for classification both by an MLP and by a decision tree.
To perform this hybrid learning task, we provide a theoretical analysis of the problem of learning at the intersection of two hypothesis classes.
We study the optimization dynamics of training two hypotheses from two different classes of functions.
The first one is trained to minimize its distance from the second one, and the second one is trained to minimize its distance from the first one and the target function.
We call this process Intersection Regularization , since it regularizes the second hypothesis to be close to the first hypothesis class.
We discuss the conditions on the loss surface in terms of theory, for which this process converges to an equilibrium point or a local minimum.
We present a method for concurrently training a network and a tree, based on the proposed analysis.
The algorithm learns a quantized representation of the data and two classifiers on top of this representation: a decision tree and an MLP.
The two classifiers are trained for a supervised multiclass classification task using intersection regularization.
Our goal is to recover attributes that match those that humans would provide, without having access to such attributes during training.
Since the human-defined attributes are typically sparse, we also apply L 1 regularization on the quantized vector of activations.
In an extensive set of experiments, we demonstrate that discrete representations, along with decision stumps learned using our algorithm, are highly correlated with a set of unseen human-defined attributes.
At the same time, the overall classification accuracy is only slightly reduced compared to standard cross-entropy training.
The key contributions of this paper are as follows: (i)
We identify a novel learning problem, which we call Weakly Unsupervised Discovery of Semantic Attributes .
In this setting, samples are associated with abstract binary attributes and are labeled by class membership.
The algorithm is provided with class-labeled samples and is assessed based on its ability to recover the binary attributes without any access to them.
We provide concrete measures for testing the success of a given method for this task.
(ii)
We introduce a method for recovering the semantic attributes.
This method is based on a novel regularization process for regularizing a neural network using a decision tree.
We call this regularization method, ‘Intersection Regularization’ , and (iii)
We study the theory of convergence guarantees of the new regularization method to equilibrium points and local minima.
2. Related Work Interpretability
Developing tools and techniques to interpret existing deep learning based approaches and to build explainable machine learning algorithms is a fast-growing field of research.
In computer vision, most contributions are concerned with providing an output relevance map.
These methods include saliency-based methods (Simonyan et al., 2013; Zeiler and Fergus, 2014;
Mahendran and Vedaldi, 2016; Zhou et al., 2016a; Dabkowski and Gal, 2017; Zhou et al., 2018;
Gur et al., 2020), Activation Maximization (Erhan et al., 2009) and Excitation Backprop (Zhang et al., 2018), perturbation-based methods Fong and Vedaldi (2017); Fong et al.
Shapleyvalue-based methods (Lundberg and Lee, 2017) enjoy theoretical justification and the Deep Taylor
Decomposition (Montavon et al., 2017) provides a derivation that is also applicable to Layer-wise
Relevance Propagation (LRP) (Bach et al., 2015) and its variants (Gu et al., 2018; Iwana et al., 2019;
Nam et al., 2019) presented RAP.
Gradient-based methods are based on the gradient with respect to the layer’s input feature map and include Gradient*Input (Shrikumar et al., 2016), Integrated
Gradients (Sundararajan et al., 2017), SmoothGrad (Smilkov et al., 2017), FullGrad (Srinivas and
Fleuret, 2019), and Grad-CAM (Selvaraju et al., 2017).
Methods that provide an output relevance map suffer from several notable disadvantages.
First, many of these methods were shown to suffer from a bias toward image edges and fail sanity checks that link their outcome to the classifiers, as shown by Asano et al.
Furthermore, even though these methods are useful for visualization and downstream tasks, such as weakly supervised segmentation (Li et al., 2018), it is not obvious how to translate the image maps produced by these methods into semantic attributes, i.e., extract meaning from a visual depiction.
An additional disadvantage of this approach is that it does not provide a direct method for evaluating whether a given neural network is interpretable or not, and the evaluation is often done with related tasks, such as segmentation or measuring the classifier’s sensitivity to regions or pixels deemed important to the classification outcome or the absence of this.
In our framework, we suggest objective measures in which one can quantify the degree of interpretability of a given model.
Since linear models are intuitively considered interpretable, Alvarez-Melis and Jaakkola (2018a) developed a framework in which the learned features are monotonic and additive.
The explanation takes the form of presenting each attribute’s contribution, explaining the attributes using prototype samples.
Unlike our framework, no attempt was made to validate that the obtained attributes correspond to a predefined list of semantic attributes.
Local interpretability models, such as LIME (Ribeiro et al., 2016), approximate the decision surface for each specific decision by a linear model and, unlike our method, are not aimed at extracting meaningful attributes.
Besides, such models are known to be sensitive to small perturbations of the input (Alvarez-Melis and Jaakkola, 2018b; Yeh et al., 2019).
Fine-Grained Classification
Fine-grained classification aims at differentiating subordinate classes of a common superior class.
Those subordinate classes are usually defined by domain experts, based on complicated rules, which typically focus on subtle differences in particular regions.
Because of the inherent difficulty of classifying slightly different classes, many contributions in this area often aim at detecting informative regions in the input images that aid their classification (Duan et al., 2012;
Yang et al., 2018; Chen et al., 2019;
Hu et al., 2019; Huang and Li, 2020; Zhuang et al., 2020).
In our work, we would like to recover semantic attributes that are not necessarily associated with specific image regions, e.g., mammal vs. reptile, or omnivore vs. carnivore.
Disentanglement
A disentangled representation (Schmidhuber, 1992; Bengio et al., 2013a; Peters et al., 2017; Lake et al., 2017; Tschannen et al., 2018) is a representation that contains multiple independent parts.
Various methods, such as (Brakel and Bengio, 2017; Feng et al., 2018; Marx et al., 2019; Tsai et al., 2020) have been able to effectively learn disentangled representations from data.
This setting is different from ours in two ways.
First, the attributes we would like to recover are not necessarily independent.
Second, in disentanglement, we are typically interested in recovering any set of features that represent the data in a disentangled manner.
In our case, success is measured subject to a specific set of attributes.
Attributes Discovery
Attributes discovery has been an active research direction in computer vision.
Attributes are typically referred as human-interpretable features that can describe the input image or the class it belongs to.
Gutierrez et al.
(2019) cast the problem of attributes discovery as a supervised learning task.
Lampert et al.
; Farhadi et al.
(2009a);
Yu et al.
; Sattar et al.
(2017) focus on category-level attributes, in which one would like to learn a set of attributes that describe the classes of the different images in the dataset.
In several cases, and especially in fine-grained classification, predicting the class of an image is a more nuanced process, where the values of attributes may vary between images in the same category.
In our paper, we focus on recovering instance-level attributes.
Explainability of Decision Trees
Decision trees are known to be naturally explainable models, as long as the decision rules are easy to interpret.
However, as far as we know, it has not been shown before that learning trees, while optimizing the features, lead to the emergence of attributes that are similar to those that appear in large set of (ground truth) relevant attributes.
In the context of the interpretability of recommendation systems, meta-trees were used for providing per-user decision rules (Shulman and Wolf, 2020).
This method relies on a pre-existing set of features rather than extracting them from the input.
In another line of work, Frosst and Hinton (2017) also employs preexisting features and distills the information within a deep network into a soft decision tree (Irsoy et al., 2012).
Unlike our work, the neural network is not optimized to produce suitable features.
More relevant to our work is the Adaptive Neural Trees method of Tanno et al.
(2019), which also combines decision trees and neural networks.
In this method, trees of dynamic architectures that include network layers are grown so that the underlying network features gradually evolve.
It is shown that the learned tree divides the classes along meaningful axes; however, the emergence of semantic attributes was not shown.
Quantization
Quantization is the conversion of floating-point data to a low-bit discrete representation.
The most common approaches for training a quantized neural network employ two sets of weights (Hubara et al., 2018;
Zhou et al., 2016b).
The forward pass is performed with quantized weights, and updates are performed on full precision ones, i.e., approximating gradients with the straight-through estimator (STE, Bengio et al., 2013b).
In this work, we make use of quantizations in order to learn discrete, interpretable representations of the data within a neural network.
3. Problem Setup
In this section, we formulate a new learning setting, which we call Weakly Unsupervised Discovery of Semantic Attributes .
In this setting, there is an unknown target function y :
X → Y , along with an attributes function f : X → U d we would like to learn.
Here, X ⊂ R n is a set of instances and Y is
N e t w o r k
C l a ss i ﬁ e r
D e c
i s i o n T r ee
Q u a n t i z e r
CE so(cid:262) CE
Indigo Bunting   01 S o f t m a x + a set of labels.
The function f is assumed to be d 0 -sparse, i.e., ∀ x ∈ X : ∥ f ( x ) ∥ 0 ≤ d 0 .
The values of f are taken from a latent space U d , where U =
R , [ − 1 , 1] or {± 1 } , depending on the task.
For example, X can be a set of images of k animal species and Y =
{ e i } ki =1 the set of labels, where e i ∈
R k is the i ’th elementary vector.
In this case, y is a classifier that takes an animal image x and returns the species of the animal.
The function f corresponds to a set of d binary attributes { f i } di =1 (e.g., carnivore/herbivore).
Each attribute f
i takes an image x and returns whether the animal illustrated in x satisfies the i th attribute.
Similarly to the standard learning setting, the set X is endowed with a distribution D , from which samples x are taken.
The learning algorithm is provided with a set S
= { ( x i , y ( x i )) } mi =1 of m i.i.d.
samples.
Typically, the learning algorithm is supposed to fit a hypothesis H :
X → Y from a given hypothesis class H that would minimize the expected risk :
[Equation]
where ℓ : Y 2 → [0 , ∞ ) is a loss function, for example, the ℓ 2 loss function ℓ 2 ( a, b )
=
∥ a − b ∥ 22 for regression or the cross-entropy loss for classification.
Since the algorithm is not provided with full access to D , it minimizes the empirical version of it
[Equation]
or minimizes L S [ H, y ] along with additional regularization terms.
In contrast to the standard learning setting, in our framework we would like to learn a model
H =
G ◦ q ◦ F that minimizes the expected risk, but also recovers the semantic attributes f ( x ) (without any access to these attributes).
Here, F and G are a trainable representation function and a classifier, and q is a pre-defined discretization operator.
Put differently, the labels are given as proxy labels, while the actual goal is to learn a discretevalued representation q ( F ( x )) of the data, which maximizes some measure of feature fidelity d D ( F ) =
d D ( f ; b ◦ q ◦ F ) depending on the distribution D and a binarization function b that translates a vector into a binary vector (see Sec.
5 for details).
3.1. Measures of Feature Fidelity
The goal of training in the proposed setting is to learn a representation of the data q ( F ( x )) that maximizes the fidelity of the extracted features with respect to an unseen set of ground-truth binary attributes f ( x ) .
In this section, we define a generic family of functions d D ( f ; g ) for measuring the fidelity of a multi-variate function g : X → U d with respect to a multi-variate function f : X → U n over a distribution D of samples.
Let r ( q 1 , q 2 ; D ) be a measure of accuracy between two univariate functions q 1 , q 2 : X → U over a distribution D .
In this paper, since we consider imbalanced attributes, r is the F1 score.
Finally, we extend r to be annotation-invariant by using ˆ r ( q 1 , q 2 ; D ) :
= max { r ( q 1 , q 2 ; D ) , r ( q 1 , 1 − q 2 ; D ) } as a measure of accuracy that is invariant to whether positive samples are denoted by 1 or 0 .
Let g : X → { 0 , 1 } d and f : X → { 0 , 1 } n be two multivariate binary functions.
We denote
[Equation]
This quantity measures the average similarity between each feature f i in f to some feature g j in g .
The fidelity of g with respect to f is the harmonic mean d D ( f ; g ) :
= 2 d D ( f ∥ g ) · d D ( g ∥ f ) d D ( f ∥ g )+ d D ( g ∥ f ) , which is a symmetric measure of similarity.
Informally, d D ( f ∥ g ) measures the extent at which the set of attributes in f can be treated as a subset of the set of attributes in g and d D ( f ; g ) as the extent at which the sets of attributes in f and g are equivalent.
We use the harmonic mean as it penalizes low values, in contrast to the arithmetic mean.
When measuring the fidelity over a finite set of test samples S T , the proposed d D ( f ; g ) considers the discrete uniform distribution D
= U [ S T ] .
Finally, in some cases, it is more relevant to measure the distance between f and g instead of their similarity.
We note that our method can be readily extended to this case by taking r to be a distance function and replacing the maximization in Eq.
(3) and the definition of ˆ r by minimization.
For example, for real-valued functions (i.e., U ⊂ R ), it is reasonable to use the distance between the two functions, r ( q 1 , q 2 ; D ) =
E x ∼ D [ | q 1 ( x ) − q 2 ( x ) | ] .
4. Intersection Regularization
A key component of our method in Sec.
5 is the proposed notion of Intersection Regularization .
In this section, we introduce and study the optimization dynamics of the intersection regularization theoretically.
Suppose that we have two hypothesis classes G =
{ G θ | θ ∈ Θ } and T =
{ T ω | ω ∈ Ω } , where Θ and Ω are two sets of parameters.
Intersection regularization involves solving the following problem
[Equation]
where Q ( θ, ω ) :
= L S [ G θ , y ] + L S [ G θ , T ω ] .
In this problem, we are interested in learning a hypothesis G θ ∈ G that is closest to the target function y among all members of G that can be approximated by a hypothesis T ω ∈ T .
We can think of T as prior knowledge we have on the target function y .
Therefore, in some sense, the term L S [ G θ , T ω ] acts as a regularization term that restricts G θ to be close to the class T .
In Sec. 5, we use intersection regularization to train a neural network G over a quantized representation that mimics a decision tree T and minimizes the classification error.
In this case, the class T consists of decision trees of a limited depth ( ω is a vector that allocates an encoding of the tree, including its structure and decision rules) and G is a class of neural networks of a fixed architecture ( θ is a vector of the weights and biases of a given network).
The underlying quantized representation thus obtained is suitable for classification by both a decision tree and a neural network.
The following analysis focuses on two main properties: finding a local minima of Q and arriving at an equilibrium point of Q .
An equilibrium point of Q is a pair ( θ, ω ) , such that, Q (ˆ θ, ˆ ω ) =
min θ Q ( θ, ˆ ω ) =
min ω Q (ˆ θ, ω ) .
The proofs are given in the appendix and are based on Thm. 2.1. by Nesterov (2014) and the analysis by Song et al.
The following proposition shows that under certain conditions it is possible to converge to an equilibrium of Q ( θ, ω ) when iteratively optimizing θ and ω .
To show this, we assume that Q is a convex function with respect to θ for any fixed value of ω .
This is true, for example, when
G θ is the linearization of a wide neural network (Lee et al., 2019), which also serve as universal approximators (Ji et al., 2020).
It has also been proven that the optimization dynamics of wide neural networks match the dynamics of their linearized version (Lee et al., 2019).
In addition, we assume that one is able to compute a global minimizer ω of L S [ G θ , T ω ] for any θ .
This is typically impossible, however, it is reasonable to assume that one is able to approximately minimize L S [ G θ , T ω ] with respect to ω if it is being optimized by a descent optimizer.
Throughout the analysis, we assume that ∪ ω ∈ Ω arg min θ Q ( θ, ω ) is well-defined and bounded and that lim θ : ∥ θ ∥→∞ L S [ G θ , y ] = ∞ .
Proposition 1 Assume that Q ( θ, ω ) is convex and β -smooth w.r.t θ for any fixed value of ω .
Let θ 1 be an initialization and ω 1 ∈ arg min ω Q ( θ 1 , ω ) .
We define θ t to be the weights produced after t iterations of applying Gradient Descent on Q ( θ, ω t − 1 ) over θ with learning rate µ < β − 1 and ω t = arg min ω Q ( θ t − 1 , ω ) .
Then, we have
[Equation]
The following proposition shows that if we apply Block Coordinate Gradient Descent (BCGD) in order to optimize θ and ω minimize Q ( θ, ω ) (starting at ( θ 1 , ω 1 ) ), then they converge to a local minimum that is also an equilibrium point.
The BCGD iteratively updates: θ t +1 =
θ t − µ ∇Q ( θ t , ω t ) and ω t +1 = ω
t − µ ∇Q ( θ t +1 , ω t ) .
Throughout the analysis we assume that the sets ∪ ω ∈ Ω arg min θ Q ( θ, ω ) and ∪ θ ∈ Θ arg min ω Q ( θ, ω ) are well-defined and bounded.
Proposition 2 Assume that Q ( θ, ω ) is a twice continuously differentiable, element-wise convex (i.e., convex w.r.t θ for any fixed value of ω and vice versa), Lipschitz continuous and β -smooth function, whose saddle points are strict.
Let θ t , ω t be the weights produced after t iterations of applying
BCGD on Q ( θ, ω ) with learning rate µ < β − 1 .
( θ t , ω t ) then converges to a local minimum (ˆ θ, ˆ ω ) of
Q that is also an equilibrium point.
5. Method
In this section, we propose our method for dealing with the problem introduced in Sec. 3.
Require:
S = { ( x i , y ( x i )) } mi =1 - dataset; λ 1 , λ 2 , λ 3 - non-negative coefficients; I - number of epochs; s - batch size; A - Tree training algorithm (and splitting criteria); 1: Initialize F, G and T =
None; 2: Partition S into batches Batches ( S ) of size s ; 3: for i = 1 , . .
, I do 4: ¯ λ 2 =
[ i > 1] · λ 2 ; 5:
S ′ = ∅ ; 6: for B ∈ Batches ( S ) do 7:
Update G using GD to minimize λ 1 L B [ G ◦ F q , y ]
+ ¯ λ 2 L B [ G ◦ F q , T ◦ F q ] ; 8:
Update F using GD to minimize λ 1 L B [ G ◦ F q , y ]
+ ¯ λ 2 L B [ G ◦ F q , T ◦ F q ] + λ 3 R B
[ F ] ; 9:
Extend S ′ =
S ′ ∪ { ( F q ( x ) , G ( F q ( x )))
| x ∈ B } ; 10: end for 11:
Initialize decision tree T ; 12:
Train T over S ′ using A ; 13: end for 14: return F, G, T ;
Model
Informally, our algorithm aims to learn a sparse discrete representation F q ( x ) :
= q ( F ( x )) of the data, that is suitable for classification by a decision tree T of small depth.
Intuitively, this leads to a representation that supports classification by relatively simple decision rules.
For this purpose, we consider a model of the following form: H tree =
T ◦ F q , where F : X → R d is a trainable neural network and T : R d → R k is a decision tree from a class T of multivariate regression decision trees of maximal depth d max .
The function G (and T ) is translated into a classifier by taking arg max i ∈
[ k ] G ( F q ( x ))
(and arg max i ∈
[ k ] T ( F q ( x )) ).
In order to learn a neural network G that minimizes the classification error and also approximates a decision tree, we apply intersection regularization between a class of neural networks G and the class of decision trees T .
Our objective function is decomposed into several loss functions.
For each loss, we specify in brackets “[ · ] ′′ the components responsible for minimizing the specified loss functions.
For a full description of our method, see Alg. 1.
For each epoch (line 3), we iteratively update the network to minimize its objective function using GD and train the decision tree from scratch.
To optimize the neural network, we use two loss functions (lines 7-8).
The first one is the cross-entropy loss of H net with respect to the ground-truth labels, and the second one is the soft cross-entropy loss of H net with respect to the probabilities of
H tree ,
[Equation]
where the loss function ℓ : ∆ k × ∆ k
→ [0 , ∞ ) is the cross-entropy loss defined as follows:
ℓ ( u,
[Equation] [Equation]
ki =1 v i · log( u i ) , k is the number of classes and ∆ k is the standard simplex.
The second loss is applied only from the second epoch onwards (line 4).
To learn sparse representations (Tibshirani, 1996; Koh et al., 2007), we also apply L 1 regularization over the quantized representation of the data
[Equation]
Tree Optimization
During each epoch, we accumulate a dataset S ′ of pairs ( F q ( x ) , G ( F q ( x ))) for all of the samples x incurred until the current iteration (line 9 in Alg. 1).
By the end of the epoch, we train a multivariate regression decision tree T from scratch over the dataset S ′ (see line 12 in Alg. 1).
To train the decision tree, we used the CART algorithm of Loh (2011) with the information gain splitting criteria.
Quantization and Binarization
The function F : X → R n is a real-valued multivariate function.
To obtain a discrete representation of the data, we discretize the outputs of F using the uniform quantizer (Sheppard, 1897; Vanhoucke et al., 2011) q , see appendix B for a step-by-step listing of the algorithm.
This quantization employs a finite number of equally sized bins.
Their size is calculated by dividing the input range into 2 r bins, where r specifies the number of bits for encoding each bin.
Since the round function is non-differentiable, the gradients of the uniform quantization are usually approximated (Bengio et al., 2013b; Ramapuram and Webb, 2019;
Yang et al., 2019).
In this paper, we utilize the straight-through estimator (Bengio et al., 2013b), which assumes that the
Jacobian of rounding is simply identity, to estimate gradients of the discretization.
For applying the feature fidelity measure proposed in Sec.
3.1, we first cast the discrete vector q ( F ( x )) into a vector of binary features b ( q ( F ( x ))) and compute d D ( F ) :
= d D ( f ; b ◦ q ◦ F ) , where b is a binarization function.
In this paper, we use the following binarization scheme.
For a given vector v = q ( F ( x ))
we compute u = b ( v ) :
= ( u 1 ∥ u 2 ) as follows: for all i ∈ [ n ] and j ∈ [2 r ] , we have:
[Equation]
j ] and u 2 i,j = 1 [ v i ̸
= j ] , where 1 is the indicator function.
The dimension of u is 2 r +1 · n .
6. Experiments
In this section, we evaluate our method on several datasets with attributes in comparison to various baselines.
Implementation Details
The architecture of the feature extractor F is taken from (Du et al., 2020) with the published hyperparameters and is based on ResNet-50 .
The classifier G is a twolayered, fully connected neural network.
We initialize the ResNet with pre-trained weights trained on ILSVRC2012 (Russakovsky et al., 2015).
Finetuning a pre-trained model, instead of training the model from scratch is the common practice in fine-grained classification, for example Du et al.
; Zhuang et al.
(2020) employ an imagenet trained backbone model and finetune it over the fine-grained classification task.
If one trains any of these models (including ours) on fine-grained classification tasks without pre-training the model, the results for the classification accuracy will be lower, and we can expect the fidelity score to be lower, as well.
When training our method and the baselines we employed the following early stopping criterion: we train the model until the second epoch for which the accuracy rate drops over a validation set, and report the results for the last epoch before the drop.
In order to conduct a fair comparison we matched the original scheduler of Li et al.
Throughout the experiments, we used the following default hyperparameters, except in our ablation studies, where we varied the hyperparameters in order to evaluate their effect.
The coefficients for the loss functions are λ 1 = 2 , λ 2 = 1 , λ 3 = 0 .
Optimization was carried out using SGD.
We used batch size of 64 across all of the expermints, and 0 .
as the learning rate .
For the data augmentations, RandomHorizontalFlip,RandomCrop are used with flipping probability p = 0 .
Datasets
Our experiments employed the following datasets: (i)
The aYahoo dataset (Farhadi et al., 2009b), consisting of 1850 training and 794 test images from 12 classes (e.g., bag, goat, mug).
Each image is labeled with 64 binary attributes.
The images are collected from Yahoo.
(ii) a Pascal dataset (Farhadi et al., 2009b) consisting of 20 classes and 2869 training and 2227 test images.
The images are labeled with the same 64 binary attributes as in the aYahoo dataset.
(iii)
Animals with attributes dataset (AwA2) (Xian et al., 2018) consisting of 26125 training andtest images from 50 animal classes, where each class is labeled with 85 numeric attribute values, (iv)
CUB-200-2011 (Wah et al., 2011) consisting of 200 bird species classes, where each image out of 5993 training and 5794 test images is labeled with 312 binary attribute values.
We used the standard train/evaluation splits of the datasets.
Runtime and Infrastructure
The experiments were run on three GeForce RTX 3090 GPUs.
Our method completes an epoch every 7 minutes on aYahoo, 10 minutes on aPascal, 1 hour on AwA2, and 1 hour on CUB-200-2011.
On average, our method runs for approximately 12 epochs on both aYahoo and aPascal, 2-4 epochs on AwA2, and 35-40 on CUB-200-2011.
The exact time withing this range depends on the representation capacity (e.g., number of bits, dimension).
Baseline methods
We compare our method with various methods that capture a wide variety of approaches: (i) SDT
(Frosst and Hinton, 2017) and ANT (Tanno et al., 2019), train a neural network of a tree architecture with the intention of learning high-level concepts.
(ii) WS-DAN (Hu et al., 2019) is a method that generates attention maps representing the object’s discriminative parts in order to improve the classification.
(iii) DFL-CNN and Nts (Wang et al., 2018; Yang et al., 2018) use a network that captures class-specific discriminative regions.
Region Grouping (Huang and Li, 2020) is a similar method, which also uses a regularization term that enforces the empirical distribution of part occurrence to align a U-shaped prior distribution.
(iv) ProtoPNet (Chen et al., 2019) computes similarity scores of informative patches in the image with learned prototype images.
These similarity scores are then aggregated by an MLP classifier.
All baselines, except ProtoPNet, are provided with labeled samples, without access to ground-truth semantic segmentation of any kind.
ProtoPNet employs cropping-based pre-processing that makes use of the bounding boxes provided with the
CUB-200-2011 dataset.
To measure the baselines’ and our method’s performance on our task, we apply quantization to the penultimate layer of each model.
For each method, we apply configurations with penultimate layer dimension 128 , 256 or 512 and apply uniform quantization with a 1 , 2 , 3 or 4 -bit representation.
We report, for each method, the results of the configuration that provides the highest accuracy rate on the validation set.
Note that this selection is based on accuracy, not on the feature fidelity score.
The fidelity score is computed as follows:
d D ( F ) :
= d D ( f ; b ◦ q ◦ F ) , where F is the penultimate layer of the model and q , b are the uniform quantization and binarization operators.
Quantitative Analysis
In Tab. 1 we report the results of our method and of the various baselines for each dataset.
As can be seen, our method obtains a significantly higher feature fidelity score than the baselines across all datasets.
We note that ProtoPNet (Chen et al., 2019) makes use of cropping-based preprocessing.
In order to compare its results with those of the other methods fairly, we omitted pre-processing on all datasets, except for CUB-200-2011.
As can be seen, our method achieves a fidelity score that is higher than ProtoPNet’s on CUB-200-2011, even though this kind of supervision helps ProtoPNet achieve the most competitive feature fidelity score among the baselines.
[Table]
On the other datasets
[Table]
where no such crops were available
[Table]
and where ProtoPNet is trained on the entire frame
[Table]
the feature fidelity score of ProtoPNet is significantly worse than that of our method.
Ablation Study
We conducted several ablation studies in order to validate the soundness of our method.
Throughout the ablations, we compared our method with three of its variations: (i) a quantized network trained to minimize the cross-entropy loss, (ii) a quantized network trained to minimize the cross-entropy loss and the L 1 regularization loss and (iii) a quantized network with a differentiable soft decision tree (SDT) on top of it, trained to minimize the cross-entropy loss.
In all three cases, the neural network is initialized with weights pre-trained on ILSVRC2012 (Russakovsky et al., 2015).
We used the online learning decision trees of Domingos and Hulten (2000).
The quantized network uses the same architecture as our model and is trained with the same hyperparameters.
As can be seen in Tab. 1, our method significantly improves the discovery of the semantic attributes, at the small expense of a slight decrease in classification accuracy, which is a secondary priority for our task.
To validate that the obtained performance gap in the fidelity score d D ( F ) is consistent across multiple configurations, we report in Fig 2 the results of the quantized neural network baseline method and our complete method.
In Fig 3, we report the obtained classification accuracy per classification.
As can be seen, our method does not harm the models’ accuracy, while it generally improves the feature fidelity score across the various configurations of feature dimensions and the number of bits used in the binarization process.
A qualitative analysis of the attributes that emerge within the learned representations when our full method is applied is presented in Appendix C. A short study of the training dynamics of the
Intersection Regularization loss, CE loss, accuracy and fidelity score is provided in Appendix D.
[Figure]
a t u r
[Figure]
F i d e li t y
[Figure]
, labeled as ( n, k )
[Figure]
7. Limitations
There are a few limitations to both our problem setting and algorithmic approach.
First, the problem of “Weakly Supervised Discovery of Semantic Attributes” discussed in Sec.
3 is ill-posed in the general case.
This is because we do not have access to the ground-truth binary attributes, and potentially the function f ( x ) could be replaced with a different function, even when assuming that y ( x ) is a function of f ( x ) .
For example, in general, if y ( x ) = sign ( (cid:80) i f ( x ) i ) , then, there are typically multiple functions f ( x ) that could implement y ( x ) .
In particular, it is typically unknown what the dimension of F ought to be.
This is no different from other unsupervised learning settings, such as clustering (Shalev-Shwartz and Ben-David, 2014;
Ben-David, 2018), cross-domain mapping (He et al., 2016; Zhu et al., 2017; Kim et al., 2017; Galanti et al., 2018), domain adaptation (Ben-David et al., 2006; Mansour, 2009; Mansour et al., 2009;
Ben-David et al., 2010), causality and disentanglement (Peters et al., 2017; Locatello et al., 2019) and sparse dictionary learning (Hillar and Sommer, 2015; Garfinkle and Hillar, 2019), where ambiguity is an inherent aspect of the learning problem.
This issue makes this problem challenging, especially when the number of ground-truth attributes is large, as in the case of CUB-200-2011, or when there are multiple redundant attributes in the dataset.
To cope with the multiple-admissible-solution issue in unsupervised learning one typically make assumptions on the structure of the target function, which narrows the space of functions captured by the algorithm.
In our case, we assume that y ( x ) can be represented as t ( f ( x )) , where t is a decision tree of small depth.
8. Conclusions
In this paper we introduced the problem of weakly supervised discovery of semantic attributes.
This problem explores the emergence of interpretable features quantitatively, based on a set of semantic features that is unseen during training.
We present evidence that methods which are tailored to extract semantic attributes do not necessarily perform well in this metric and suggest a new approach to solving this problem.
Our method is based on joint learning in the soft intersection of two hypothesis classes: a neural network for obtaining its classification power and a decision tree for learning features that lend themselves to classification by short logical expressions.
We demonstrate that this way of learning is more effective than other methods for the new task and that learning with the new regularization scheme improves the fidelity of the obtained feature map.
Appendix A. Proofs of Props. 1 and
Proposition 1 Assume that Q ( θ, ω ) is convex and β -smooth w.r.t θ for any fixed value of ω .
Let θ 1 be an initialization and ω 1 ∈ arg min ω Q ( θ 1 , ω ) .
We define θ t to be the weights produced after t iterations of applying Gradient Descent on Q ( θ, ω t − 1 ) over θ with learning rate µ < β − 1 and ω t = arg min ω Q ( θ t − 1 , ω ) .
Then, we have
[Equation]
Proof First, we would like to prove that Q ( θ t , ω t ) is monotonically decreasing.
We notice that for each t ∈ N , we have
[Equation]
since ω t is the global minimizer of Q ( θ t , ω ) .
In addition, by the proof of (cf.
Nesterov (2014),
Thm.
2.1.14), we have
[Equation]
θ
[Equation]
ω
[Equation]
where η := µ (1 − 0 .
5 βµ ) > 0 .
Therefore, we conclude that Q ( θ t , ω t ) is indeed monotonically decreasing.
Since Q is non-negative, we conclude that Q ( θ t , ω t ) is a convergent sequence.
In particular, θ t is bounded.
Otherwise, Q ( θ t , ω t ) ≥ L S [ h θ t , y ] → ∞ in contradiction to the fact that
Q ( θ t , ω t ) is a convergent sequence.
Next, by applying the convexity of Q ( θ, ω t − 1 ) (as a function of θ ), we have
[Equation]
where θ ∗ t = arg min θ Q ( θ, ω t ) .
By combining Eqs.
(8) and (9), we have
[Equation]
In particular,
[Equation]
Since the left-hand side tends to zero and the right-hand side is lower bounded by zero, by the sandwich theorem the right-hand side tends to zero as well.
Since both θ t and θ ∗ t are bounded sequences ( { arg min θ Q ( θ, ω )
| ω ∈ Ω } is well-defined and bounded), we conclude that lim t →∞ Q ( θ t , ω t ) =
lim t →∞ min θ Q ( θ, ω t ) .
We also have: Q ( θ t , ω t ) =
min ω Q ( θ t , ω ) by definition, and therefore, lim t →∞ Q ( θ t , ω t ) =
lim t →∞ min ω Q ( θ t , ω ) as well.
Proposition 2 Assume that Q ( θ, ω ) is a twice continuously differentiable, element-wise convex (i.e., convex w.r.t θ for any fixed value of ω and vice versa), Lipschitz continuous and β -smooth function, whose saddle points are strict.
Let θ t , ω t be the weights produced after t iterations of applying
BCGD on Q ( θ, ω ) with learning rate µ < β − 1 .
( θ t , ω t ) then converges to a local minimum (ˆ θ, ˆ ω ) of
Q that is also an equilibrium point.
Proof Firstly, since Q ( θ, ω ) is a twice continuously differentiable, Lipschitz continuous and β -smooth function, by Prop. 3.4 and Cor.
3.1 in (Song et al., 2017), ( θ t , ω t ) converge to a local minimum (ˆ θ, ˆ ω ) of Q .
Therefore, it is left to show that (ˆ θ, ˆ ω ) is also an equilibrium point.
We note that Q ( θ, ω ) is element-wise convex and β -smooth.
By the proof of (cf.
Nesterov (2014), Thm.
2.1.14), we have
[Equation]
where η := µ (1 − 0 .
5 βµ ) > 0 .
By applying the convexity of Q ( θ, ω t ) (as a function of θ ), we have
[Equation]
where θ ∗ t = arg min θ Q ( θ, ω t ) and ω ∗ t = arg min ω Q ( θ t +1 , ω ) .
By combining Eqs.
(12) and (13), we have
[Equation]
and similarly
[Equation]
we have
[Equation]
In particular, we have
[Equation]
Therefore, the sequence Q ( θ t , ω t ) is monotonically decreasing.
Since Q ( θ t , ω t ) is non-negative, it converges to some non-negative constant.
By Eq.
[Equation]
we have
[Equation] [Equation]
Since the left-hand side tends to zero and the right-hand side is lower bounded by zero, by the sandwich theorem the sequences
[Equation]
and
[Equation]
tend to zero.
We note that θ t and ω t are convergent sequences and are, therefore, also bounded.
In addition, we recall that the sets { arg min θ Q ( θ, ω ) | ω ∈ Ω } and { arg min ω Q ( θ, ω ) | θ ∈ Θ } are well-defined and bounded.
Hence, the terms ∥ θ t − θ ∗ t ∥ 22 and ∥ ω t − ω ∗ t ∥ 22 are bounded.
Thus, we conclude that the sequences ( Q ( θ t , ω t ) − min θ Q ( θ, ω t ))
and ( Q ( θ t +1 , ω t ) − min ω Q
( θ t +1 , ω ))tend to zero.
In particular,
[Equation]
Since Q is a Lipschitz continuous function, we have (i) lim
t →∞ Q ( θ t +1 , ω t ) =
lim t →∞ Q ( θ t , ω t ) =
Q (ˆ θ, ˆ ω ) , (ii) lim
t →∞ min θ Q ( θ, ω t ) =
min θ Q ( θ, ˆ ω ) and (iii)
lim
t →∞ min ω Q ( θ t , ω ) =
min ω Q (ˆ θ, ω ) .
Therefore, we finally conclude that (ˆ θ, ˆ ω ) is an equilibrium point of Q .
Appendix B. Uniform Quantization
The uniform quantization method is fully described in Alg.
For a given function p , we denote by ∂p the estimated gradients of p w.r.t x .
In Alg. 2, the estimated gradient of ˜ z is computed as the gradient of min(max( z init , q min ) , q max ) (since ∂ round( x ) = 1 when applying STE Bengio et al.
(2013b)), which is simply 1 [ z init ∈ ( q min , q max )] · ∂z init ∂x , where ∂z init ∂x is the gradient of z init w.r.t x .
∂ ˜ q
i and ∂q are defined similarly, see lines 10-11 in Alg.
Appendix C. Qualitative Analysis
We provide a qualitative analysis of the advantage of our method over a simple neural network with a quantized representation layer.
Each method learns a binarized feature map b ◦ F .
In this experiment, for each learned feature map F and a given ground-truth attribute q i ( x ) , we compute d D ( q i ; b ◦ q ◦ F ) that measures whether it appears in the learned binarized representation layer b ◦ q ◦ F .
In Figs.
4we plot the values of d D ( q i ; b ◦ q ◦ F ) for each attribute in the dataset as a heatmap.
We also report the number of attributes for which our method achieves a higher score (by at least ϵ = 0 . 05 ) and vice versa.
2D Boxy 3D Boxy
Round
Vert Cyl
Horiz Cyl
Tail
Occluded
Beak
[Figure]
Ear
Snout
Nose
Mouth
Hair
Face
Eye Hand
Leg
Foot
Wing
Propeller
Jet engine
Window
Row Wind Door
Headlight
Taillight
Side Mirror
Pedal
Handlebars
Sail
Mast Leaf
Flower
Stem
Wool
Clear
Skin
Metal
Plastic Shiny
Vegetation
Wood
Cloth
Hern
Rein
Exhaust
Trunk Exhaust
Saddle
Shiny
Furn.
Leg
Furn.
Back
Furn.
Seat
Furn.
Arm
Glass
[Figure]
Arm
Torso
Wheel
Label
Leather
Jen Engine
Pot 2D Boxy 3D Boxy
Round
Vert Cyl
Horiz Cyl
Tail
Occluded
[Figure]
Ear
Snout
Nose
Mouth
Hair
Face
[Figure]
Leg
Foot
Wing
Propeller
Jet engine
Window
Row Wind
[Figure]
Headlight
Taillight
Side Mirror
Pedal
Handlebars
Sail
[Figure]
Flower
Stem
Wool
Clear
Skin
Metal
Plastic
[Figure]
Vegetation
Wood
Cloth
Hern
Rein
Exhaust
Trunk Exhaust
Saddle
Shiny
Furn.
Leg
Furn.
Back
Furn.
Seat
Furn.
Arm
[Figure] [Figure]
Metal
Plastic Shiny
Vegetation
Wood
Cloth
Hern
Rein
Exhaust
Trunk Exhaust
Saddle
Shiny
Furn.
Leg
Furn.
Back
Furn.
Seat
Furn.
Arm
[Figure]
Arm
Torso
Wheel
Label
Leather
Jen
[Figure]
Pot 2D Boxy 3D Boxy
Round
Vert Cyl
Horiz Cyl
Tail
Occluded
Beak Head
Ear
Snout
Nose
Mouth
Hair
Face
Eye Hand
Leg
Foot
Wing
Propeller
Jet engine
Window
Row Wind
[Figure]
Headlight
Taillight
Side Mirror
Pedal
Handlebars
Sail
Mast Leaf
Flower
Stem
Wool
Clear
Skin
Metal
Plastic
[Figure]
Vegetation
Wood
Cloth
Hern
Rein
Exhaust
Trunk Exhaust
Saddle
Shiny
Furn.
Leg
Furn.
Back
Furn.
Seat
Furn
[Figure]
Pot
Black
White
Blue
Brown
Gray
Orange
Red
Yellow Patches
Spots
Stripes
Furry
Hairless
Toughskin
Big
Small Bulbous
Lean
Fippers
Hands
Hooves
Pads
Paws
Longleg Tail
Chewteeth
Meatteeth
Buckteeth
Horns
Claws
Tusks
Smelly Flys
Hops
Swims
Tunnels
Walks
Fast
Slow
Strong Weak
Muscle
Bipedal Quadrapedal
Active
Inactive
Nocturnal
Hibernate Agility
Fish
Meat
Plankton
Vegetation
Insects
Forager
Grazer Hunter
Scavenger
Skimmer
Stalker
Newworld
Oldword
Arctic
Coastal Desert
Bush
Plains
Forest
Fields
Jungle
Mountains
Ocean Ground
Water
Tree
Cave
Fierce
Timid
Smart
Group Solitary
Nestspot
Domestic
Wings
Fippers
Black
White
Blue
Brown
Gray
Orange
Red
Yellow Patches
Spots
Stripes
Furry
Hairless
Toughskin
Big
Small Bulbous
Lean
Fippers
Hands
Hooves
Pads
Paws
Longleg Tail
Chewteeth
Meatteeth
Buckteeth
Horns
Claws
Tusks
Smelly Flys
Hops
Swims
Tunnels
Walks
Fast
Slow
Strong Weak
Muscle
Bipedal Quadrapedal
Active
Inactive
Nocturnal
Hibernate Agility
Fish
Meat
Plankton
Vegetation
Insects
Forager
Grazer Hunter
Scavenger
Skimmer
Stalker
Newworld
Oldword
Arctic
Coastal Desert
Bush
Plains
Forest
Fields
Jungle
Mountains
Ocean Ground
Water
Tree
Cave
Fierce
Timid
Smart
Group Solitary
[Figure]
Domestic
Wings
Fippers
Appendix D. Training Dynamics
In the following, we show the training dynamics over aPascal and aYahoo datasets.
As can be seen, as a general tendency, the fidelity score increases in correlation with the intersection regularization loss (IR Loss) decreases.
While during most of the training process both metrics improve together, at later stages they seem to fluctuate in a narrow band in a matter that is not always correlated.
The cross-entropy (CE) loss and the accuracy constantly improve from epoch to epoch.
Therefore, we do not see a clear tradeoff between the IR loss and the CE loss, at least in the first 12 epochs.
=