D ECOUPLING R EPRESENTATION AND C LASSIFIER FOR L ONG -T AILED R ECOGNITION
Anonymous authors
Paper under double-blind review
A BSTRACT
The long-tail distribution of the visual world poses great challenges for deep learning based classiﬁcation models on how to handle the class imbalance problem.
Existing solutions usually involve class-balancing strategies, e.g . by loss re-weighting, data re-sampling, or transfer learning from head- to tail-classes, but most of them adhere to the scheme of jointly learning representations and classiﬁers.
In this work, we decouple the learning procedure into representation learning and classiﬁcation , and systematically explore how different balancing strategies affect them for long-tailed recognition.
The ﬁndings are surprising: (1) data imbalance might not be an issue in learning high-quality representations; (2) with representations learned with the simplest instance-balanced (natural) sampling, it is also possible to achieve strong long-tailed recognition ability at little cost by adjusting only the classiﬁer.
We conduct extensive experiments and set new state-of-the-art performance on common long-tailed benchmarks like ImageNetLT, Places-LT and iNaturalist, showing that it is possible to outperform carefully designed losses, sampling strategies, even complex modules with memory, by using a straightforward approach that decouples representation and classiﬁcation.
I NTRODUCTION
Visual recognition research has made rapid advances during the past years, driven primarily by the use of deep convolutional neural networks (CNNs) and large image datasets, most importantly the ImageNet Challenge (Russakovsky et al., 2015).
Such datasets are usually artiﬁcially balanced with respect to the number of instances for each object/class in the training set.
Visual phenomena, however, follow a long-tailed distribution that many standard approaches fail to properly model, leading to a signiﬁcant drop in accuracy.
Motivated by this, a number of works have recently emerged that try to study long-tailed recognition , i.e ., recognition in a setting where the number of instances in each class highly varies and follows a long-tailed distribution.
When learning with long-tailed data, a common challenge is that instance-rich (or head) classes dominate the training procedure.
The learned classiﬁcation model tends to perform better on these classes, while performance is signiﬁcantly worse for instance-scarce (or tail) classes.
To address this issue and to improve performance across all classes, one can re-sample the data or design speciﬁc loss functions that better facilitate learning with imbalanced data (Chawla et al., 2002;
Cui et al., 2019; Cao et al., 2019).
Another direction is to enhance recognition performance of the tail classes by transferring knowledge from the head classes (Wang et al., 2017; 2018; Zhong et al., 2019;
Liu et al., 2019).
Nevertheless, the common belief behind existing approaches is that designing proper sampling strategies, losses, or even more complex models, is crucial for learning high-quality representations for long-tailed recognition.
Most aforementioned approaches thus learn the classiﬁers used for recognition jointly with the data representations.
However, such a joint learning scheme makes it unclear how the long-tailed recognition ability is achieved—is it from learning a better representation or by handling the data imbalance better via shifting classiﬁer decision boundaries?
To answer this question, we take one step back and decouple long-tail recognition into representation learning and classiﬁcation .
For learning representations, the model is exposed to the training instances and trained through different sampling strategies or losses.
For classiﬁcation, upon the learned representations, the model recognizes the long-tailed classes through various classiﬁers.
We evaluate the performance of various sampling
Speciﬁcally, we ﬁrst train models to learn representations with different sampling strategies, including the standard instance-based sampling, class-balanced sampling and a mixture of them.
Next, we study three different basic approaches to obtain a classiﬁer with balanced decision boundaries, on top of the learned representations.
They are 1) re-training the parametric linear classiﬁer in a class-balancing manner ( i.e ., re-sampling); 2) non-parametric nearest class mean classiﬁer, which classiﬁes the data based on their closest class-speciﬁc mean representations from the training set; and 3) normalizing the classiﬁer weights, which adjusts the weight magnitude directly to be more balanced, adding a temperature to modulate the normalization procedure.
We conduct extensive experiments to compare the aforementioned instantiations of the decoupled learning scheme with the conventional scheme that jointly trains the classiﬁer and the representations.
We also compare to recent, carefully designed and more complex models, including approaches using memory ( e.g ., OLTR (Liu et al., 2019)) as well as more sophisticated losses (Cui et al., 2019).
From our extensive study across three long-tail datasets, ImageNet-LT, Places-LT and iNaturalist, we make the following intriguing observations:
We ﬁnd that decoupling representation learning and classiﬁcation has surprising results that challenge common beliefs for long-tailed recognition: instance-balanced sampling learns the best and most generalizable representations.
• It is essential in long-tailed recognition to re-adjust the decision boundaries speciﬁed by the jointly learned classiﬁer during representation learning: Our experiments show that this can either be achieved by retraining the classiﬁer with class-balanced sampling or by a simple, yet effective, classiﬁer weight normalization which has only a single hyper-parameter controlling the “temperature” and which does not require additional training.
• By applying the decoupled learning scheme to standard networks ( e.g .,
ResNeXt)
, we achieve signiﬁcantly higher accuracy than well established state-of-the-art methods (different sampling strategies, new loss designs and other complex modules) on multiple longtailed recognition benchmark datasets, including ImageNet-LT, Places-LT, and iNaturalist.
R ELATED W ORK
Long-tailed recognition has attracted increasing attention due to the prevalence of imbalanced data in real-world applications (Wang et al., 2017;
Zhou et al., 2017; Mahajan et al., 2018; Zhong et al., 2019; Gupta et al., 2019).
Recent studies have mainly pursued the following three directions:
Data distribution re-balancing.
Along this direction, researchers have proposed to re-sample the dataset to achieve a more balanced data distribution.
These methods include over-sampling (Chawla et al., 2002; Han et al., 2005) for the minority classes (by adding copies of data), undersampling (Drummond et al., 2003) for the majority classes (by removing data), and class-balanced sampling (Shen et al., 2016; Mahajan et al., 2018) based on the number of samples for each class.
Cost-sensitive learning.
Various methods are proposed to assign different cost to different training samples for each class.
The cost can vary at class-level for matching a given data distribution and improving the generalization of tail classes (Cui et al., 2019; Khan et al., 2017; Cao et al., 2019;
Khan et al., 2019; Huang et al., 2019).
A more ﬁne-grained control of cost can also be achieved at sample level, e.g . with Focal loss (Lin et al., 2017),
Meta-Weight-Net (Shu et al., 2019), re-weighted training (Ren et al., 2018), or based on Bayesian uncertainty (Khan et al., 2019).
Recently, Hayat et al.
(2019) proposed to balance the classiﬁcation regions of head and tail classes using an afﬁnity measure to enforce cluster centers of classes to be uniformly spaced and equidistant.
Transfer learning from head- to tail classes.
Transfer-learning based methods address the issue of imbalanced training data by transferring features learned from head classes with abundant training instances to under-represented tail classes.
Recent work includes transferring the intra-class variance (Yin et al., 2019) and transferring semantic deep features (Liu et al., 2019).
However it is usually a non-trivial task to design speciﬁc modules ( e.g . external memory) for feature transfer.
A benchmark for low-shot recognition was proposed by Hariharan & Girshick (2017) and consists of a representation learning phase without access to the low-shot classes and a subsequent low-shot learning phase.
In contrast, the setup for long-tail recognition assumes access to both head and tail classes and a more continuous decrease in in class labels.
Recently, Liu et al.
(2019) and Cao et al.
(2019) adopt re-balancing schedules that learn representation and classiﬁer jointly within a two-stage training scheme.
OLTR (Liu et al., 2019) uses instance-balanced sampling to ﬁrst learn representations that are ﬁne-tuned in a second stage with class-balanced sampling together with a memory module.
LDAM (Cao et al., 2019) introduces a label-distribution-aware margin loss that expands the decision boundaries of few-shot classes.
In Section 5 we exhaustively compare to OLTR and LDAM, since they report state-of-the-art results for the ImageNet-LT, Places-LT and iNaturalist datasets.
In our work, we argue for decoupling representation and classiﬁcation.
We demonstrate that in a long-tailed scenario, this separation allows straightforward approaches to achieve high recognition performance, without the need for designing sampling strategies, balance-aware losses or adding memory modules.
L EARNING REPRESENTATIONS FOR LONG - TAILED RECOGNITION
For long-tailed recognition, the training set follows a long-tailed distribution over the classes.
As we have less data about infrequent classes during training, the models trained using imbalanced datasets tend to exhibit under-ﬁtting on the few-shot classes.
But in practice we are interested in obtaining the model capable of recognizing all classes well.
Various re-sampling strategies (Chawla et al., 2002; Shen et al., 2016; Cao et al., 2019), loss reweighting and margin regularization over few-shot classes are thus proposed. However, it remains unclear how they achieve performance improvement, if any, for long-tailed recognition.
Here we systematically investigate their effectiveness by disentangling representation learning from classiﬁer learning, in order to identify what indeed matters for longtailed recognition.
Notation.
We deﬁne the notation used through the paper.
Let X
= { x i , y i } , i ∈ { 1 , . . . , n } be a training set, where y i is the label for data point x i .
Let n j denote the number of training sample for class j , and let n = (cid:80) Cj =1 n j be the total number of training samples.
Without loss of generality, we assume that the classes are sorted by cardinality in decreasing order, i.e ., if i < j , then n i ≥ n j .
Additionally, since we are in a long-tail setting, n 1 (cid:29) n C .
Finally, we denote with f ( x ; θ ) =
z the representation for x , where f ( x ; θ ) is implemented by a deep CNN model with parameter θ .
The ﬁnal class prediction ˜
y is given by a classiﬁer function g , such that ˜ y = arg max g
( z ) .
For the common case, g is a linear classiﬁer, i.e ., g ( z )
=
W (cid:62) z + b , where W denotes the classiﬁer weight matrix, and b is the bias.
We present other instantiations of g in Section 4.
Sampling strategies.
In this section we present a number of sampling strategies that aim at rebalancing the data distribution for representation and classiﬁer learning.
For most sampling strategies presented below, the probability p j of sampling a data point from class j is given by:
[Equation]
where q ∈ [0 , 1] and C is the number of training classes.
Different sampling strategies arise for different values of q and below we present strategies that correspond to q = 1 , q = 0 , and q = 1 / 2 .
Instance-balanced sampling.
This is the most common way of sampling data, where each training example has equal probability of being selected.
For instance-balanced sampling, the probability p IB j is given by Equation 1 with q = 1 , i.e ., a data point from class j will be sampled proportionally to the cardinality n j of the class in the training set.
Class-balanced sampling.
For imbalanced datasets, instance-balanced sampling has been shown to be sub-optimal (Huang et al., 2016;
Wang et al., 2017) as the model under-ﬁts for few-shot classes leading to lower accuracy, especially for balanced test sets.
Class-balanced sampling has been used to alleviate this discrepancy, as, in this case, each class has an equal probability of being selected.
The probability p CB
j is given by Eq.
(1) with q = 0 , i.e ., p CB
j
= 1 /C .
One can see this as a twostage sampling strategy, where ﬁrst a class is selected uniformly from the set of classes, and then an instance from that class is subsequently uniformly sampled.
Square-root sampling.
A number of variants of the previous sampling strategies have been explored.
A commonly used variant is square-root sampling (Mikolov et al., 2013; Mahajan et al., 2018), where q is set to 1 / 2 in Eq.
(1) above.
Progressively-balanced sampling.
Recent approaches (Cui et al., 2018; Cao et al., 2019) utilized mixed ways of sampling, i.e ., combinations of the sampling strategies presented above.
In practice this involves ﬁrst using instance-balanced sampling for a number of epochs, and then class-balanced sampling for the last epochs.
These mixed sampling approaches require setting the number of epochs before switching the sampling strategy as an explicit hyper-parameter.
Here, we experiment with a softer version, progressively-balanced sampling, that progressively “interpolates” between instancebalanced and class-balanced sampling as learning progresses.
Its sampling probability/weight p j for class
j is now a function of the epoch t ,
[Equation]
where T is the total number of epochs.
Figure 3 in appendix depicts the sampling probabilities.
Loss re-weighting strategies.
Loss re-weighting functions for imbalanced data have been extensively studied, and it is beyond the scope of this paper to examine all related approaches.
What is more, we found that some of the most recent approaches reporting high performance were hard to train and reproduce and in many cases require extensive, dataset-speciﬁc hyper-parameter tuning.
In
Section A of the Appendix we summarize the latest, best performing methods from this area.
In Section 5 we show that, without bells and whistles, baseline methods equipped with a properly balanced classiﬁer can perform equally well, if not better, than the latest loss re-weighting approaches.
CLASSIFICATION FOR LONG - TAILED RECOGNITION
When learning a classiﬁcation model on balanced datasets, the classiﬁer weights W and b are usually trained jointly with the model parameters θ for extracting the representation f
( x i ; θ ) by minimizing the cross-entropy loss between the ground truth y i and prediction W (cid:62) f
( x i ; θ ) + b .
This is also a typical baseline for long-tailed recognition.
Though various approaches of re-sampling, reweighting and transferring representations from head to tail classes have been proposed, the general scheme remains the same: classiﬁers are either learned jointly with the representations either endto-end, or via a two-stage approach where the classiﬁer and the representation are jointly ﬁne-tuned with variants of class-balanced sampling as a second stage (Cui et al., 2018; Cao et al., 2019).
In this section, we consider decoupling the representation from the classiﬁcation in long-tailed recognition.
We present ways of learning classiﬁers aiming at rectifying the decision boundaries on head- and tail-classes via ﬁne-tuning with different sampling strategies or other non-parametric ways such as nearest class mean classiﬁers.
We also consider an approach to rebalance the classiﬁer weights that exhibits a high long-tailed recognition accuracy without any retraining cost.
Classiﬁer Re-training (cRT).
A straightforward approach is to re-train the classiﬁer with classbalanced sampling.
That is, keeping the representations ﬁxed, we randomly re-initialize and optimize the classiﬁer weights W and b for a small number of epochs using class-balanced sampling.
A similar methodology was also recently used in (Zhang et al., 2019) for action recognition on a long-tail video dataset.
Nearest Class Mean classiﬁer (NCM).
Another commonly used approach is to ﬁrst compute the mean feature representation for each class on the training set and then perform nearest neighbor search either using cosine similarity or the Euclidean distance computed on L 2 normalized mean features (Snell et al., 2017; Guerriero et al., 2018; Rebufﬁ et al., 2017).
Despite its simplicity, this is a strong baseline ( cf .
the experimental evaluation in Section 5); the cosine similarity alleviates the weight imbalance problem via its inherent normalization (see also Figure 4).
τ -normalized classiﬁer ( τ -normalized).
We investigate an efﬁcient approach to re-balance the decision boundaries of classiﬁers, inspired by an empirical observation: after joint training with instance-balanced sampling, the norms of the weights (cid:107) w j (cid:107) are correlated with the cardinality of the classes n j , while, after ﬁne-tuning the classiﬁers using class-balanced sampling, the norms of the classiﬁer weights tend to be more similar ( cf .
Figure 2-left).
Inspired by the above observations, we consider rectifying imbalance of decision boundaries by adjusting the classiﬁer weight norms directly through the following τ -normalization procedure.
Formally, let W = { w j } ∈ R d × C , where w j ∈ R d are the classiﬁer weights corresponding to class j .
We scale the weights of W to get (cid:102) W = { (cid:102) w j } by:
[Equation]
(3) where τ is a hyper-parameter controlling the “temperature” of the normalization, and || · || denotes the L 2 norm.
When τ = 1 , it reduces to standard L 2 -normalization.
When τ = 0 , no scaling is imposed.
We empirically choose τ ∈ (0 , 1) such that the weights can be rectiﬁed smoothly.
After τ -normalization, the classiﬁcation logits are given by ˆ y = (cid:102) W (cid:62) f
( x ; θ ) .
Note that we discard the bias term b here due to its negligible effect on the logits and ﬁnal predictions.
E XPERIMENTS 5. E XPERIMENTAL SETUP
Datasets.
We perform extensive experiments on three large-scale long-tailed datasets, including
Places-LT (Liu et al., 2019), ImageNet-LT (Liu et al., 2019), and iNaturalist 2018 (iNatrualist, 2018).
Places-LT and ImageNet-LT are artiﬁcially truncated from their balanced versions (Places2 (Zhou et al., 2017) and ImageNet-
(Deng et al., 2009))
so that the labels of the training set follow a long-tailed distribution.
Places-LT contains images from 365 categories and the number of images per class ranges from 4980 to 5.
ImageNet-LT has 1000 classes and the number of images per class ranges from 1280 to 5 images.
iNaturalist 2018 is a real-world, naturally long-tailed dataset, consisting of samples from 8,142 species.
Evaluation Protocol.
After training on the long-tailed datasets, we evaluate the models on the corresponding balanced test/validation datasets and report the commonly used top-1 accuracy over all classes, denoted as All .
To better examine performance variations across classes with different number of examples seen during training, we follow Liu et al.
and further report accuracy on three splits of the set of classes: and
Accuracy is reported as percentage.
Implementation.
We use the PyTorch (Paszke et al., 2017) framework for all experiments 1 .
For
Places-LT, we choose ResNet-152 as the backbone network and pretrain it on the full ImageNet2012 dataset, following Liu et al.
On ImageNet-LT, we report results with ResNet- { 10,50,101,152 }
(He et al., 2016) and ResNeXt- { 50,101,152 } (32x4d)
(Xie et al., 2017) but mainly use ResNeXt-50 for analysis.
Similarly, ResNet- { 50,101,152 } is also used for iNaturalist 2018.
For all experiements, if not speciﬁed, we use SGD optimizer with momentum 0.9, batch size 512, cosine learning rate schedule (Loshchilov & Hutter, 2016) gradually decaying from 0.2 to 0 and image resolution 224 × 224 .
In the ﬁrst representation learning stage, the backbone network is usually trained for 90 epochs.
In the second stage, i.e ., for retraining a classiﬁer (cRT), we restart the learning rate and train it for 10 epochs while keeping the backbone network ﬁxed.
For τ -normalization, we determine the value of τ by searching in [0.0, 0.1, 0.2, ..., 1.0] to ﬁnd the τ gives highest top-1 accuracy on a separate validation dataset.
Then the selected value is used for testing.
We also explored other ways of determining τ in Appendix.
B.5, especially when there is no validation dataset available.
5. S AMPLING STRATEGIES AND DECOUPLED LEARNING
In Figure 1, we compare different sampling strategies for the conventional joint training scheme to a number of variations of the decoupled learning scheme on the ImageNet-LT dataset.
For the joint training scheme (Joint), the linear classiﬁer and backbone for representation learning are jointly trained for 90 epochs using a standard cross-entropy loss and different sampling strategies, i.e ., Instance-balanced, Class-balanced, Square-root, and Progressively-balanced.
For the decoupled learning schemes, we present results when learning the classiﬁer in all the ways presented in
Section 4, i.e ., re-initialize and re-train (cRT), Nearest Class Mean (NCM) as well as τ -normalized classiﬁer.
Below, we discuss a number of key observations.
Sampling matters when training jointly.
From the Joint results in Figure 1 across sampling methods and splits, we see consistent gains in performance when using better sampling strategies (see also [Figure] NCM cRT -norm A cc u r a c y ( % )
Many
Joint NCM cRT -norm Medium Joint NCM cRT -norm Few
Joint NCM cRT -norm
All
Instance-balanced
Class-balanced
Square-root Progressively-balanced Table 5). The trends are consistent for the overall performance as well as the medium- and fewshot classes, with progressively-balanced sampling giving the best results.
As expected, instancebalanced sampling gives the highest performance for the many-shot classes.
This is well expected since the resulted model is highly skewed to the many-shot classes.
Our results for different sampling strategies on joint training validate related works that try to design better data sampling methods.
[Table]
Joint or decoupled learning?
For most cases presented in Figure 1, performance using decoupled methods is signiﬁcantly better in terms of overall performance, as well as all splits apart from the many-shot case.
Even the nonparametric NCM approach is highly competitive in most cases, while cRT and τ -normalized outperform the jointly trained baseline by a large margin ( i.e . 5% higher than the jointly learned classiﬁer), and even achieving 2% higher overall accuracy than the best jointly trained setup with progressively-balanced sampling.
The gains are even higher for mediumand few-shot classes at 5% and 11%, respectively.
To further justify our claim that it is beneﬁcial to decouple representation and classiﬁer, we experiment with ﬁne-tuning the backbone network (ResNeXt-50) jointly with the linear classiﬁer.
In
Table 1, we present results when ﬁne-tuning the whole network with standard or smaller (0.1 × ) learning rate, ﬁne-tuning only the last block in the backbone, or only retraining the linear classiﬁer and ﬁxing the representation.
Fine-tuning the whole network yields the worst performance (46.3% and 48.8%), while keeping the representation frozen performs best (49.5%).
The trend is even more evident for the medium/few-shot classes.
This result suggests that decoupling representation and classiﬁer is desirable for long-tailed recognition.
Instance-balanced sampling gives the most generalizable representations.
Among all decoupled methods, when it comes to overall performance and all splits apart from the many-shot classes, we see that Instance-balanced sampling gives the best results.
This is particularly interesting, as it implies that data imbalance might not be an issue learning high-quality representations .
5. H OW TO BALANCE YOUR CLASSIFIER ?
Among the ways of balancing the classiﬁer explored in Figure 1, the non-parametric NCM seems to perform slightly worse than cRT and τ -normalization.
Those two methods are consistently better in most cases apart from the few-shot case, where NCM performs comparably.
The biggest drop for the NCM approach comes from the many-shot case. It is yet still somehow surprising that both the NCM and τ -normalized cases give competitive performance even though they are free of additional training and involve no additional sampling procedure.
As discussed in Section 4, their strong performance may stem from their ability to adaptively adjust the decision boundaries for many-, medium- and few-shot classes (see also Figure 4).
[Figure]
Many
Medium
Few
[Figure] visualization
[Figure] cRT -Norm data 0.
[Figure] accuracy
Many
Medium
Few
All In Figure 2 (left) we empirically show the L 2 norms of the weight vectors for all classiﬁers, as well as the training data distribution sorted in a descending manner with respect to the number of instances in the training set. We can observe that the weight norm of the joint classiﬁer (blue line) is positively correlated with the number of training instances of the corresponding class. More-shot classes tend to learn a classiﬁer with larger magnitudes.
As illustrated in Figure 4, this yields a wider classiﬁcation boundary in feature space, allowing the classiﬁer to have much higher accuracy on data-rich classes, but hurting data-scarce classes. τ -normalized classiﬁers (gold line) alleviate this issue to some extent by providing more balanced classiﬁer weight magnitudes. For retraining (green line), the weights are almost balanced except that few-shot classes have slightly larger classiﬁer weight norms. Note that the NCM approach would give a horizontal line in the ﬁgure as the mean vectors are L 2 -normalized nearest neighbor search
In Figure 2 (right), we further investigate how the performance changes as the temperature parameter τ for the τ -normalized classiﬁer varies.
The ﬁgure shows that as τ increases from 0, many-shot accuracy decays dramatically while few-shot accuracy increases dramatically.
5. C OMPARISON
[Table] In this section
[Table]
we compare the performance of the decoupled schemes to other recent works that report state-of-the-art results on on three common long-tailed benchmarks: ImageNet-LT, iNaturalist and Places-LT.
Results are presented in Tables 2, 3 and [Table] respectively [Table]
Rows with † denote results directly copied from Cao et al
We present results when training for 90/200 epochs
[Table] [Table] ImageNet-LT.
Table 2 presents results for ImageNet-LT.
Although related works present results with ResNet-10 (Liu et al., 2019), we found that using bigger backbone architectures increases performance signiﬁcantly on this dataset.
We therefore present results for three backbones: ResNet-10,
ResNeXt-50 and the larger ResNeXt-152.
For the state-of-the-art OLTR method of Liu et al.
we adopt results reported in the paper, as well as results we reproduced using the authors’ opensourced codebase 2 with two training settings: the one suggested in the codebase and the one using our training setting for the representation learning.
From the table we see that the non-parametric decoupled NCM method performs on par with the state-of-the-art for most architectures.
We also see that when re-balancing the classiﬁer properly, either by re-training or τ -normalizing, we get results that, without bells and whistles outperform the current state-of-the-art for all backbone architectures.
We further experimented with adding the memory mechanism of Liu et al.
(2019) on top of our decoupled cRT setup, but the memory mechanism didn’t seem to further boost performance (see Appendix B.4).
iNaturalist 2018.
We further evaluate our decoupled methods on the iNaturalist 2018 dataset.
We present results after 90 and 200 epochs, as we found that 90 epochs were not enough for the representation learning stage to converge; this is different from Cao et al.
(2019) where they train for 90 epochs.
From Table 3 we see that results are consistent with the ImageNet-LT case: re-balancing the classiﬁer gives results that outperform CB-Focal
(Cui et al., 2019).
Our performance, when training only for 90 epochs, is slightly lower than the very recently proposed LDAM+DRW (Cao et al., 2019). However, with 200 training epochs and classiﬁer normalization, we achieve a new state-of-the-art of 69.3 with ResNet-50 that can be further improved to 72.5 for ResNet-152.
It is further worth noting that we cannot reproduce the numbers reported in Cao et al.
We ﬁnd that the τ -normalized classiﬁer performs best and gives a new state-of-the-art for the dataset, while surprisingly achieving similar accuracy (69%/72% for ResNet-50/ResNet-152) across all many-, medium- and few-shot class splits , a highly desired result for long-tailed recognition.
Complete results, i.e ., for all splits and more backbone architectures can be found in Table 8 of the Appendix.
Places-LT.
For Places-LT we follow the protocol of Liu et al.
and start from a ResNetbackbone pre-trained on the full ImageNet dataset.
Similar to Liu et al.
(2019), we then ﬁne-tune the backbone with Instance-balanced sampling for representation learning.
Classiﬁcation follows with ﬁxed representations for our decoupled methods.
As we see in Table 4, all three decoupled methods outperform the state-of-the-art approaches, including Lifted Loss (Oh Song et al., 2016),
Focal Loss (Lin et al., 2017), Range Loss (Zhang et al., 2017), FSLwF (Gidaris & Komodakis, 2018) and OLTR (Liu et al., 2019).
Once again, the τ -normalized classiﬁer give the top performance, with impressive gains for the medium- and few-shot classes.
C ONCLUSIONS
In this work, we explore a number of learning schemes for long-tailed recognition and compare jointly learning the representation and classiﬁer to a number of straightforward decoupled methods.
Through an extensive study we ﬁnd that although sampling strategies matter when jointly learning representation and classiﬁers, instance-balanced sampling gives more generalizable representations that can achieve state-of-the-art performance after properly re-balancing the classiﬁers and without need of carefully designed losses or memory units.
We set new state-of-the-art performance for three long-tailed benchmarks and believe that our ﬁndings not only contribute to a deeper understanding of the long-tailed recognition task, but can offer inspiration for future work
A L OSS R E - WEIGHTING STRATEGIES
Here, we summarize some of the best performing loss re-weighting methods that we compare against in Section 5.
Introduced in the context of object detection where imbalance exists in most common benchmarks, the Focal loss (Lin et al., 2017) aims to balance the sample-wise classiﬁcation loss for model training by down-weighing easy samples.
To this end, given a probability prediction h
i for the sample x i over its true category
y i , it adds a re-weighting factor (1 − h i ) γ with γ > 0 into the standard cross-entropy loss L CE :
[Equation]
For easy samples (which may dominate the training samples) with large predicted probability h i for their true categories, their corresponding cross entropy loss will be down weighted.
Recently, Cui et al.
(2019) presented a class balanced variant of the focal loss and applied it to long-tailed recognition.
They modulated the Focal loss for a sample from class j with a balance-aware coefﬁcient equal to (1 − β ) / (1 − β nj ) .
Very recently, Cao et al.
(2019) proposed a label-distribution-aware margin (LDAM) loss that encourages few-shot classes to have larger margins, and their ﬁnal loss is formulated as a cross-entropy loss with enforced margins:
[Equation]
[Equation]
where ˆ y are the logits and ∆ j is a class-aware margin, inversely proportional to n 1 / 4 j .
B F URTHER A NALYSIS AND R ESULTS B. S AMPLING S TRATEGIES
In Figure 3 we visualize the sampling weights for the four sampling strategies we explore.
In Tablewe present accuracy on ImageNet-LT for “all” classes when training the representation and classiﬁer jointly.
It is clear that better sampling strategies help when jointly training the classiﬁer with the representations/backbone architecture.
[Figure]
B. C LASSIFIER DECISION BOUNDARIES FOR τ - NORMALIZED AND NCM
In Figure 4 we illustrate the classiﬁer decision boundaries before/after normalization with Eq.(3), as well as when using cosine distance.
Balancing the norms also leads to more balanced decision boundaries, allowing the classiﬁers for few-shot classes to occupy more space.
[Table]
[Equation]
Cosine m i m j m k
L
[Equation]
j
[Equation]
i
B. C LASSIFIER LEARNING COMPARISON TABLE
Table 6 presents some comparative analysis for the four different ways of learning the classiﬁer that are presented in Section 4.
B. V ARYING THE BACKBONE ARCHITECTURE SIZE
ImageNet-LT.
In Figure 5 we present accuracy for different backbone architecture sizes for
OLTR (Liu et al., 2019) using the authors’ codebase settings (OLTR*), OLTR using the representation learning stage detailed in Section 5 (OLTR**), and three variants of the decoupled methods:
cRT d)
cRT with
the memory module from Liu et al.
(2019) while training the classiﬁer and τnormalized.
We see that a) the authors’ implementation of OLTR over-ﬁts for larger models, b) overﬁtting can be alleviated with our training setup (different training and LR schedules) c) adding the memory unit when re-training the classiﬁer doesn’t increase performance. Additional results of Table 2 are given in Table 7.
iNaturalist 2018.
In Table 8 we present an extended version of the results of Table 3.
We show results per split as well as results with a ResNet-101 backbone.
As we see from the table and mentioned in Section 5, training only for 90 epochs gives sub-optimal representations, while both large models and longer training result in much higher accuracy on this challenging, large-scale task.
What is even more interesting, we see performance across the many-, medium- and few-shot splits being approximately equal after re-balancing the classiﬁer, with only a small advantage for the many-shot classes. [Table] ResNet ResNet
ResNet
ResNet OLTR* OLTR** cRT+Memory cRT 𝝉 -norm [Table]
B. O N THE EXPLORATION OF DETERMINING τ
The current tau-normalization strategy does require a validation set to choose tau, which could be a disadvantage depending on the practical scenario.
Can we do better?
Finding τ value on training set.
We also attempted to select τ directly on the training dataset.
Surprisingly, ﬁnal performance on testing set is very similar, with τ selected using training set only.
We achieve this goal by simulating a balanced testing distribution from the training set.
We ﬁrst feed the whole training set through the network to get the top-1 accuracy for each of the classes.
Then, we average the class-speciﬁc accuracies and use the averaged accuracy as the metric to determine the tau value.
As shown in Table 9, we compare the τ found on training set and validation set for all three datasets.
We can see that both the vale of τ and the overall performances are very close to each other, which demonstrates the effectiveness of searching for τ on training set.
This strategy offers a practical way to ﬁnd τ even when validation set is not available.
Learning τ value on training set.
We further investigate if we can automatically learn the τ value instead of grid search.
To this end, following cRT, we set τ as a learnable parameter and learn it on the training set with balanced sampling, while keeping all the other parameters ﬁxed (including both the backbone network and classiﬁer).
Also, we compare the learned τ value and the corresponding
[Table]
in the Table 9 (denoted by “learn” =
(cid:51) ).
This further reduces the manual effort of searching best τ values and make the strategy more accessible for practical usage.
[Table]
C OMPARING MLP C LASSFIIER WITH L INEAR C LASSIFIER
We experimented with MLPs with different layers (2 or 3) and different number of hidden neurons (2048 or 512).
We use ReLU as activation function, set the batch size to be
[Table]
and train the MLP using balanced sampling on ﬁxed representation for 10 epochs with a cosine learning rate schedule, which gradually decrease the learning rate to zero.
We conducted experiments on two datasets. On ImageNet-LT, we use ResNeXt50 as the backbone network. The results are summarized in Table 10.
We can see that when the MLP going deeper, the performance are getting worse.
It probably means the backbone network is enough to learn discriminative representation.
[Table]
For iNaturalist, we use the representation from a ResNet50 model trained for 200 epochs.
We only consider a hidden dimension of 2048, as this dataset contains much more classes.
The results are shown in Table 11, and show that performance drop is even more severe when a deeper classiﬁer is used.
[Table]
We tried to replace the linear classiﬁer with a cosine similarity classiﬁer with (denoted by “cos”) and without (denoted by ”cos(noRelu)”) the last ReLU activation function, following Gidaris & Komodakis (2018).
We summarize the results in Table 12, which show that they are comparable to each other
[Table]
[Table]