I N PL: P SEUDO - LABELING THE I NLIERS F IRST FOR I MBALANCED S EMI - SUPERVISED L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Recent state-of-the-art methods in imbalanced semi-supervised learning (SSL) rely on confidence-based pseudo-labeling with consistency regularization.
To obtain high-quality pseudo-labels, a high confidence threshold is typically adopted.
However, it has been shown that softmax-based confidence scores in deep networks can be arbitrarily high for samples far from the training data, and thus, the pseudo-labels for even high-confidence unlabeled samples may still be unreliable.
In this work, we present a new perspective of pseudo-labeling for imbalanced SSL.
Without relying on model confidence, we propose to measure whether an unlabeled sample is likely to be “in-distribution”; i.e., close to the current training data.
To decide whether an unlabeled sample is “in-distribution” or “out-of-distribution”, we adopt the energy score from out-of-distribution detection literature.
As training progresses and more unlabeled samples become in-distribution and contribute to training, the combined labeled and pseudo-labeled data can better approximate the true class distribution to improve the model.
Experiments demonstrate that our energy-based pseudo-labeling method, InPL , albeit conceptually simple, significantly outperforms confidence-based methods on imbalanced SSL benchmarks.
For example, it produces a 4-6% absolute accuracy improvement on CIFAR10-LT when the imbalance ratio is higher than 50.
When combined with state-of-the-art long-tailed SSL methods, further improvements are attained.
In particular, in one of the most challenging scenarios, InPL achieves a 6.9% accuracy improvement over the best competitor.
I NTRODUCTION
In recent years, the frontier of semi-supervised learning (SSL) has seen significant advances through pseudo-labeling (Rosenberg et al., 2005;
Lee et al., 2013) combined with consistency regularization (Laine & Aila, 2017; Tarvainen & Valpola, 2017; Berthelot et al., 2020; Sohn et al., 2020; Xie et al., 2020a).
Pseudo-labeling, a type of self-training (Scudder, 1965; McLachlan, 1975) technique, converts model predictions on unlabeled samples into soft or hard labels as optimization targets, while consistency regularization (Laine & Aila, 2017; Tarvainen & Valpola, 2017; Berthelot et al., 2019; 2020; Sohn et al., 2020; Xie et al., 2020a) trains a model to produce the same outputs for two different views (e.g, strong and weak augmentations) of an unlabeled sample.
However, most methods are designed for the balanced SSL setting where each class has a similar number of training samples, whereas most real-world data are naturally imbalanced , often following a long-tailed distribution.
To better facilitate real-world scenarios, imbalanced SSL has recently received increasing attention.
State-of-the-art imbalanced SSL methods (Kim et al., 2020; Wei et al., 2021; Lee et al., 2021) are build upon the pseudo-labeling and consistency regularization frameworks (Sohn et al., 2020; Xie et al., 2020a) by augmenting them with additional modules that tackle specific imbalanced issues (e.g., using per-class balanced sampling (Lee et al., 2021; Wei et al., 2021)).
Critically, these methods still rely on confidence -based thresholding (Lee et al., 2013; Sohn et al., 2020; Xie et al., 2020a; Zhang et al., 2021) for pseudo-labeling, in which only the unlabeled samples whose predicted class confidence surpasses a very high threshold (e.g., 0.95) are pseudo-labeled for training.
Confidence-based pseudo-labeling, despite its success in balanced SSL, faces two major drawbacks in the imbalanced, long-tailed setting.
First, applying a high confidence threshold yields significantly lower recall of pseudo-labels for minority classes (Wei et al., 2021), resulting in an exacerbation
[Figure]
of class imbalance. Lowering the threshold can improve the recall for tail classes but at the cost of reduced precision for other classes (see analysis in Section 4.4). Second, prior studies (Szegedy et al., 2014; Nguyen et al., 2015; Hein et al., 2019) show that softmax-based confidence scores in deep networks can be arbitrarily high on even out-of-distribution samples.
Thus, under long-tailed scenarios where the model is generally biased towards the majority classes, the model can predict high confidence scores for the head classes even if the instances are actually from the tail classes, resulting in low precision for head classes.
Given the drawbacks of using the confidence score as the pseudo-label criterion, we seek to design a better approach to determine if an unlabeled sample should be pseudo-labeled.
In this work, we present a novel approach for pseudo-labeling that addresses the drawbacks of confidence-based pseudo-labeling in imbalanced SSL.
Instead of relying on a model’s prediction confidence to decide whether to pseudo-label an unlabeled instance or not, we propose to view the pseudo-labeling decision as an evolving in-distribution vs. out-of-distribution classification problem 1 .
Initially, only the ground-truth human-labeled samples are considered “in-distribution” because they are the only training examples.
In each ensuing training iteration, the unlabeled samples that are close to the current “in-distribution” samples are pseudo-labeled and contribute to training, which in turn gradually expands the “in-distribution”.
Thus, any “out-of-distribution” unlabeled samples from previous iterations may become “in-distribution” in later iterations, as the distribution of the pseudo-labeled training data is continuously updated and expanded.
An illustrative example of this process can be found in Figure 1.
To identify the “inliers”, we leverage the energy score (LeCun et al., 2006) for its simplicity and good empirical performance.
The energy score is a non-probabilistic scalar that is derived from a model’s logits and theoretically aligned with the probability density of a data sample—lower/higher energy reflects data with higher/lower likelihood of occurrence following the training distribution, and has been shown to be useful for conventional out-of-distribution (OOD) detection (Liu et al., 2020).
In our imbalanced SSL setting, at each training iteration, we compute the energy score for each unlabeled sample.
If an unlabeled sample’s energy is below a certain threshold, we pseudo-label it with the predicted class made by the model.
To the best of the authors’ knowledge, our work is the first to consider pseudo-labeling in imbalanced SSL from an in-distribution vs. out-distribution perspective and is also the first work that performs pseudo-labeling without using softmax scores.
We refer to our method as In lier P seudo-
L abeling ( InPL ) in the rest of this paper.
To evaluate the proposed InPL, we integrate it into the classic FixMatch (Sohn et al., 2020) framework and the recent state-of-the-art imbalanced SSL framework ABC (Lee et al., 2021) by replacing their vanilla confidence-based pseudo-labeling with our energy-based pseudo-labeling.
InPL significantly outperforms the confidence-based
For example, InPL produces 4-6% absolute accuracy improvement on CIFAR10-LT over vanilla
FixMatch when the imbalance ratio is higher than 50.
With the ABC framework, our approach achieves a 6.9% accuracy improvement in one of the most challenging evaluation scenarios.
Our analysis further shows that pseudo-labels produced using InPL achieve higher overall precision, and a significant improvement in recall for the tail classes without hurting their precision much.
This result demonstrates that the pseudo-labeling process becomes more reliable with InPL in long-tailed scenarios.
InPL also achieves favourable improvement on large-scaled datasets, shows a high level of robustness against the presence of real OOD examples in unlabeled data, and attains competitive performance on standard SSL benchmarks, which are (roughly) balanced.
R ELATED W ORK
Class-Imbalanced Semi-Supervised Learning.
While SSL research (Scudder, 1965; McLachlan, 1975) has been extensively studied in the balanced setting in which all categories have (roughly) the same number of instances, class-imbalanced SSL is much less explored.
A key challenge is to avoid overfitting to the majority classes while capturing the minority classes.
State-of-the-art imbalanced
SSL methods build upon recent advances in balanced SSL that combine pseudo-labeling (Lee et al., 2013) with consistency regularization (Laine & Aila, 2017; Tarvainen & Valpola, 2017; Berthelot et al., 2019; 2020;
Xie et al., 2020b; Sohn et al., 2020; Xie et al., 2020a; Zhang et al., 2021;
Xu et al., 2021), leveraging standard frameworks such as FixMatch (Sohn et al., 2020) to predict pseudo-labels on weakly-augmented views of unlabeled images and train the model to predict those pseudo labels on strongly-augmented views.
DARP (Kim et al., 2020) refines the pseudo-labels through convex optimization targeted specifically for the imbalanced scenario.
CReST (Wei et al., 2021) achieves class-rebalancing by pseudo-labeling unlabeled samples with frequency that is inversely proportional to the class frequency.
Adsh (Guo & Li, 2022) extends the idea of adaptive thresholding (Zhang et al., 2021;
Xu et al., 2021) to the long-tailed scenario.
ABC (Lee et al., 2021) introduces an auxiliary classifier that is trained with class-balanced sampling whereas DASO
(Oh et al., 2022) uses a similarity-based classifier to complement pseudo-labeling.
Our method is in parallel to these developments – it can be easily integrated into these prior approaches by replacing their confidencebased thresholding with our energy-based one; for example, when plugged into ABC, InPL achieves significant performance gains.
Importantly, ours is the first to view the pseudo-labeling process for imbalanced SSL from an “in-distribution vs. out-of-distribution” perspective.
Out-of-Distribution Detection.
OOD detection aims to detect outliers that are substantially different from the training data, and is important when deploying ML models to ensure safety and reliability in real-world settings.
The softmax score was used as a baseline for OOD detection in (Hendrycks & Gimpel, 2017) but has since been proven to be an unreliable measure by subsequent work (Hein et al., 2019; Liu et al., 2020).
Improvements have been made in OOD detection through temperatured softmax (Liang et al., 2018) and the energy score (Liu et al., 2020).
Robust SSL methods Chen et al. Saito et al. ; Guo et al.
Yu et al. (2020) aim to improve the model’s performance when OOD examples are present in the unlabeled and/or test data under SSL scenarios. For example, D3SL Guo et al. (2020) optimizes a meta network to selectively use unlabeled data;
OpenMatch Saito et al. (2021) trains an outlier detector with soft consistency regularization. These robust SSL methods are used as additional baselines for evaluation on imbalanced SSL in Section 4.1.
Exploring new methods in OOD detection is not the focus of our work. Instead, we show that leveraging the concept of OOD detection, and in particular, the energy score (LeCun et al., 2006; Liu et al., 2020) for pseudo-labeling, provides a new perspective in imbalanced SSL that results in significant improvement under imbalanced settings.
A PPROACH
Our goal is to devise a more reliable way of pseudo-labeling in imbalanced SSL, which accounts for whether an unlabeled data sample can be considered “in-distribution” or “out-of-distribution” based on the existing set of (pseudo-)labeled samples.
To help explain our approach, Inlier Pseudo-Labeling (InPL), we first overview the consistency regularization with confidence-based pseudo-labeling framework (Sohn et al., 2020; Zhang et al., 2021;
Xie et al., 2020a) that state-of-the-art imbalanced
SSL methods build upon, as our method simply replaces one step — the pseudo-labeling criterion.
We then provide a detailed explanation of InPL.
[Figure]
3. B ACKGROUND : C ONSISTENCY R EGULARIZATION WITH C ONFIDENCE - BASED P SEUDO -L ABELING
The training of pseudo-labeling SSL methods for image classification involves two loss terms: the supervised loss L s computed on human-labeled data and the unsupervised loss L u computed on unlabeled data.
The supervised loss is typically the standard multi-class cross-entropy loss computed on weakly-augmented views (e.g., flip and crop) of labeled images.
Let X = { ( x b , y b ) }
B s b
=1 be the labeled set where x and y denote the data sample and its corresponding one-hot label, respectively.
Denote p ( y | ω ( x b ))
=
f ( ω ( x b )) as the predicted class distribution on input x b , where ω is a weaklyaugmenting transformation and f is a classifier often realized as a deep network.
Then at each iteration, the supervised loss for a batch B s of labeled data is given by
[Equation]
where H is the cross-entropy loss.
Mainstream research in SSL focuses on how to construct the unsupervised loss.
One dominating approach is consistency regularization (Laine & Aila, 2017; Tarvainen & Valpola, 2017; Berthelot et al., 2019; 2020), which regularizes the network to be less sensitive to input or model perturbations by enforcing consistent predictions across different views (augmentations) of the same training input, through an MSE or KL-divergence loss.
Self-training (Lee et al., 2013; Rosenberg et al., 2005; Rizve et al., 2021; Xie et al., 2020b) converts model predictions to optimization targets for unlabeled images.
In particular, pseudo-labeling (Lee et al., 2013) converts model predictions into hard pseudo-labels.
To ensure high quality of pseudo-labels, a high confidence threshold is often used.
The recently introduced weak-strong data augmentation paradigm (Sohn et al., 2020; Xie et al., 2020a) can be viewed as the combination of these two directions.
When combined with confidencebased pseudo-labeling (Sohn et al., 2020; Zhang et al., 2021), at each iteration, the process can be summarized as follows:
For each unlabeled data point x , the model makes prediction p ( y
|
ω
( x ))
=
f ( ω ( x b )) on its weakly-augmented view ω ( x ) .
Confidence thresholding is applied and a pseudo-label is only produced when the maximum predicted probability max i
p ( y i | ω ( x )) of x is above a threshold τ c (typically, τ c = 0 .
The model is then trained with its strongly-augmented view Ω( x ) (e
g., RandAugment (Cubuk et al., 2020) and CutOut (DeVries & Taylor, 2017)) along with its one-hot thresholded pseudo-label ˆ p ( y | ω ( x )) obtained on the weakly-augmented view.
With batch size B u for unlabeled data, the unsupervised loss is formulated as follows:
[Equation]
where 1 [ · ] is the indicator function.
The final loss at each training iteration is computed by L
=
L s + λ L u with λ as a hyperparameter to balance the loss terms.
The model parameters are updated with this loss after each iteration.
[Figure]
3. C ONSISTENCY R EGULARIZATION WITH I NLIER P SEUDO -L ABELING
Confidence-based thresholding (step 2 in the above process) typically produces pseudo-labels with high precision in the balanced SSL setting, yet often leads to low precision for head classes and low recall for tail classes in the long-tailed scenario (Wei et al., 2021).
Moreover, softmax-based confidence scores in deep networks are oftentimes overconfident (Guo et al., 2017), and can be arbitrarily high for samples that are far from the training data (Nguyen et al., 2015; Hein et al., 2019).
The implication in the imbalanced SSL setting is that the pseudo-label for even high-confidence unlabeled samples may not be trustworthy if those samples are far from the labeled data.
To address these issues, our method tackles the imbalanced SSL pseudo-labeling process from a different perspective: instead of generating pseudo-labels for high-confidence samples, we produce pseudo-labels only for unlabeled samples that are close to the current training distribution — we call these “in-distribution” samples.
The rest are “out-of-distribution” samples, for which the model’s confidences are deemed unreliable.
The idea is that, as training progresses and more unlabeled samples become in-distribution and contribute to training, the training distribution will better approximate the true distribution to improve the model, and in turn, improve the overall reliability of the pseudo-labels (see Figure 1).
To determine whether an unlabeled sample is in-distribution or out-of-distribution, we use the energy score (LeCun et al., 2006) derived from the classifier f .
The energy score is defined as:
[Equation]
where x is the input data and f i ( x ) indicates the corresponding logit value of the i -th class.
K is the total number of classes and T is a tunable temperature.
When used for conventional OOD detection, smaller/higher energy scores indicate that the input is likely to be in-distribution/out-of-distribution.
Indeed, a discriminative classifier implicitly defines a free energy function (Grathwohl et al., 2020) that can be used to characterize the data distribution (LeCun et al., 2006; Liu et al., 2020).
This is because the training of the classifier, when using the negative log-likelihood loss, seeks to minimize the energy of in-distribution data points.
Since deriving and analyzing the energy function is not the focus of our paper, we refer the reader to (Liu et al., 2020) for a detailed connection between the energy function and OOD detection.
In our Inlier Pseudo-Labeling framework, we compute the energy score for each unlabeled sample and only generate a pseudo-label when the corresponding energy score is less than a pre-defined threshold τ e , which indicates that the unlabeled sample is close to the current training distribution.
The actual pseudo-label is obtained by converting the model prediction on the weakly-augmented view of ω ( x b ) to a one-hot pseudo-label.
Formally, the unsupervised loss is defined as:
[Equation]
e ] H (ˆ p ( y
[Equation]
ω ( x b )) , p ( y | Ω( x b ))) .
We illustrate the key difference between confidence-based pseudo-labeling and energy-based pseudolabeling in Figure 2.
It is worth noting that the energy score is not the only possible metric to implement our InPL approach and it is possible to use other OOD detection metrics for the objective.
[Table]
, 2016) for CIFAR 10-LT and WRN-28-8 for CIFAR 100-LT.
All methods are trained with the default FixMatch training schedule (Sohn et al., 2020).
Results are reported with the mean and standard deviation over 3 different runs.
We choose the energy score for its simplicity and easy integration to existing SSL frameworks such as FixMatch and ABC, which does not incur additional model parameters or significant computation cost (apart from the computation of the energy score).
To further tackle the model bias in long-tail scenarios, we can also optionally replace the vanilla cross-entropy loss ( H ( · ) ) in the unsupervised loss computation with a margin-aware loss (Li et al., 2019; Khan et al., 2019;
Cao et al., 2019; Wang et al., 2022).
We adopt the adaptive margin loss (Wang et al., 2022) with the margin determined through the moving average of the model’s prediction:
[Equation]
where f i (Ω( x b )) represents the corresponding logits of class i on strongly-augmented input Ω( x b ) .
The margin is computed by ∆ i = λ log
( 1˜ p i ) , where ˜ p is the averaged model prediction updated at each iteration through an exponential moving average.
We shall see in the experiments that InPL outperforms the vanilla confidence-based counterparts regardless of whether we use the vanilla cross-entropy loss or the adaptive margin loss.
E XPERIMENTS
In this section, we first compare our energy-based pseudo-labeling approach to confidence-based pseudo-labeling approaches that build upon FixMatch (Sohn et al., 2020) and ABC (Lee et al., 2021) framework and compare to state-of-the-art imbalanced SSL approaches. We evaluate our method on both standard imbalanced SSL benchmarks and the large-scale ImageNet dataset.
Next, we provide analyses on why InPL works well in the imbalanced setting, and then evaluate InPL’s robustness to real OOD samples in the unlabeled data.
All experiments are conducted with multiple runs using different random seeds and we report the mean and standard deviation of the final accuracy.
Following prior suggestion (Oliver et al., 2018) on SSL, we implement our method and baseline methods in the same codebase.
Unless otherwise specified, results for each method are generated with the same codebase, same random seeds, same data splits, and same network architecture for the best possible fair comparison.
Implementation details of all experiments can be found in Appendix A.2.
4. E NERGY - BASED PSEUDO - LABELING VS . CONFIDENCE - BASED PSEUDO LABELING
We first evaluate the effectiveness of InPL’s energy-based pseudo labeling over standard confidencebased pseudo labeling.
For this, we integrate InPL into the FixMatch framework (Sohn et al., 2020) (denoted as FixMatch-InPL), and compare it with the following FixMatch variants, which all use confidence-based pseudo-labeling: UDA (Xie et al., 2020a),
FixMatch-Debiased (Wang et al., 2022), and UPS (Rizve et al., 2021).
UDA uses soft pseudo-labels with temperature sharpening; FixMatchDebiased (Wang et al., 2022) adds a debiasing module before computing the confidence score in
[Table]
pseudo-labeling; UPS (Rizve et al., 2021) uses an uncertainty estimation with MC-Dropout (Gal &
Ghahramani, 2016) as an extra criteria in pseudo-labeling.
We also compare with recent robust SSL methods, OpenMatch (Saito et al., 2021) and D3SL (Guo et al., 2020), as they connect SSL to OOD detection.
Since UPS and D3SL do not use strong augmentations, for fair comparison, we integrate them into the FixMatch framework, denoted by FixMatch-UPS and FixMatch-D3SL.
We evaluate on CIFAR10-LT and CIFAR100-LT (Krizhevsky & Hinton, 2009), which are long-tailed variants of the original CIFAR datasets.
We follow prior work in long-tail SSL (Wei et al., 2021; Lee et al., 2021), and use an exponential imbalance function (Cui et al., 2019) to create the long-tailed version of CIFAR10 and CIFAR100.
Details of constructing these datasets are in Appendix A.1.
InPL outperforms confidence-based pseudo-labeling approaches for imbalanced SSL .
Our
FixMatch-InPL shows a significant improvement over FixMatch variants with confidence-based pseudo-labeling by a large margin (e.g., 4-6% absolute percentage over FixMatch when imbalance ratio γ > 50 for CIFAR10-LT); see Table 1.
For CIFAR100-LT, InPL reaches 48.03% and 42.53% average accuracy when γ = 50 and γ = 100 respectively, outperforming other methods.
UPS is the closest competitor as it tries to measure the uncertainty in the pseudo-labels.
Using UPS in
FixMatch improves the performance over vanilla FixMatch, yet it still cannot match the performance of InPL on CIFAR10-LT.
Moreover, UPS requires forwarding the unlabeled data 10 times to compute its uncertainty measurement, which is extremely expensive in modern SSL frameworks such as
FixMatch.
In comparison to FixMatch-UPS, our InPL provides strong empirical results on long-tailed data and remains highly efficient.
Comparing InPL and FixMatch-debiased (both use AML), our approach again shows consistent improvement on CIFAR10-LT.
We also outperform the robust SSL methods, OpenMatch and D3SL.
Overall, these results show the efficacy of InPL over standard confidence-based pseudo-labeling for imbalanced SSL.
4. C OMPARISON TO STATE - OF - THE - ART IMBALANCED SSL APPROACHES
Next, we compare InPL to state-of-the-art imbalanced SSL approaches.
We integrate InPL into
ABC (Lee et al., 2021), a recent framework designed for imbalanced SSL (denoted as ABC-InPL), by replacing its confidence-based pseudo-labeling with our energy-based pseudo-labeling.
We compare our ABC-InPL with vanilla ABC as well as other state-of-the-art imbalanced SSL methods,
DARP (Kim et al., 2020), CREST (Wei et al., 2021), Adsh (Guo & Li, 2022) and DASO (Oh et al., 2022).
The results are shown in Tables 2 and 3, which correspond to different ways of constructing the imbalanced SSL datasets.
See implementations details in Appendix A.1 and A.2.
InPL improves the state-of-the-art for imbalanced SSL .
Table 2 shows that ABC-InPL consistently outperforms the confidence-based counterparts on CIFAR10-LT and CIFAR100-LT under the ABC framework.
For FixMatch base, when the imbalance ratio γ = 150 and γ = 200 on CIFAR10-LT,
InPL shows a 2.6% and 2.5% improvement, respectively (FixMatch w/ ABC vs. FixMatch w/
ABC-InPL).
Further, we demonstrate the flexibility of InPL by incorporating it into RemixMatch, a consistency-based SSL method that uses Mixup (Zhang et al., 2018).
With RemixMatch, InPL again consistently outperforms confidence-based methods.
Importantly, ABC-InPL achieves significantly higher accuracy for minority classes across all experiment protocols (numbers reported after the “/”
[Table]
in Table
Table 3 shows more results under different combinations of labeled instances and imbalance ratios.
Across almost all settings, InPL consistently outperforms the baselines, sometimes by a very large margin.
For example, in the most challenging scenario ( γ = 150 and N 1 = 500 ), ABC-InPL achieves 77.5% absolute accuracy, which outperforms the state-of-the-art ABC-DASO baseline by 6.9% absolute accuracy.
These results demonstrate that InPL achieves strong performance on imbalanced data across different frameworks and evaluation settings
4. R ESULTS ON I MAGE N ET
[Table]
We evaluate InPL on ImageNet-127 (Huh et al., 2016), a large-scale dataset where the 1000 ImageNet classes are grouped into 127 classes based on the WordNet hierarchy.
This introduces a class imbalance with ratio 286. Due to limited computation, we are unable to use large batch sizes as in FixMatch (Sohn et al., 2020) (1024 for labeled data and 5120 for unlabeled data).
Instead, we use a batch size of 128 for both labeled and unlabeled data following, a recent SSL benchmark (Zhang et al., 2021). As shown in Table 4, InPL outperforms the vanilla FixMatch with confidence-based pseudo-labeling by a large margin, which further demonstrates the efficacy of our approach on large-scaled datasets. While designed to overcome the limitations of confidence-based pseudo-labeling on imbalanced data, InPL does not make any explicit assumptions about the class distribution.
Thus, a natural question is: how does InPL perform on standard SSL benchmarks?
To answer this, we further evaluate InPL on
ImageNet with standard SSL settings in Table 4 (results on other standard SSL datasets can be found in Appendix A.8) and InPL still shows favourable improvement.
This shows that the energy-based pseudo-labeling also has potential to become a general solution to SSL problems.
4. W HY DOES I N PL WORK WELL ON IMBALANCED DATA ?
To help explain the strong performance of InPL on imbalanced data, we provide a detailed pseudolabel precision and recall analysis on CIFAR10-LT.
Here, we refer to the three most frequent classes as head classes, the three least frequent classes as tail classes, and the rest as body classes.
Figure 4 shows the precision and recall of our model’s predicted pseudo-labels over all classes (a,c) and also for the tail classes (b,d).
The analysis for the head and body classes can be found in Appendix A.4.
Compared with FixMatch, InPL achieves higher precision for overall, head, and body pseudo-labels.
Importantly, it doubles FixMatch’s recall of tail pseudo-labels without hurting [Figure] the precision much.
This shows that InPL predicts more true positives for the tail classes and also becomes less biased to the head classes.
Trivially lowering the confidence threshold for FixMatch can also improve the recall for tail pseudo-labels.
However, doing so significantly hurts its precision and does not improve overall accuracy.
For example, as shown in Figure 4 (a) and (d) [Figure] although FixMatch with a lower threshold of 0.6 achieves higher recall for tail pseudo-labels, the overall precision is significantly hurt [Figure]
which results in minimal improvement or degradation in overall accuracy.
We further investigate various lower confidence thresholds for FixMatch and find that none of them leads to improvement in accuracy to match the performance level of InPL (see Appendix A.5) [Figure]
4. A DDITIONAL A NALYSES
InPL is robust against OOD examples .
In real-world scenarios, unlabeled data may not share the same set of classes as labeled data.
To simulate this, we evaluate our method with out-of-distribution data presenting in the unlabeled data.
Here, we consider the scenario where unlabeled data contain examples from different datasets.
We sample 4 labeled examples per class from CIFAR10 and use the rest of CIFAR10 and SVHN as the unlabeled data.
Another OOD robustness experiment under the scenario of class mismatch in unlabeled data (Oliver et al., 2018) can be found in Appendix A.6.
[Table]
Although motivated by imbalanced SSL, InPL also achieves strong performance under the aforementioned realistic conditions where unlabeled instances from different data domains are present in the unlabeled set.
We compare
InPL with the confidence-based methods UDA (Xie et al., 2020a) and FixMatch (Sohn et al., 2020).
When a large amount of OOD examples are in the unlabeled set, the overall performance of both methods decreases, but InPL demonstrates a significant advantage.
Specifically, InPL outperforms UDA and FixMatch by 4.21% and 4.42% absolute accuracy, respectively.
Moreover, InPL consistently includes less OOD examples in training (see Appendix A.6 for details).
This experiment shows the robustness of InPL to true outliers.
Other ablation studies.
Additional ablation studies can be found in the Appendix including the choice of thresholds and temperatures, impact of adaptive margin loss, and more analysis.
D ISCUSSION AND C ONCLUSION
In this work, we presented a novel “in-distribution vs. out-distribution” perspective for pseudo-labeling in imbalanced SSL, in tandem with our energy-based pseudo-labeling method (InPL).
Importantly, our method selects unlabeled samples for pseudo-labeling based on their energy scores derived from the model’s output.
We showed that our method can be easily integrated into state-of-the-art imbalanced SSL approaches, and achieve strong results.
We further demonstrated that our method renders robustness against out-of-distribution samples, and remains competitive on balanced SSL benchmarks.
One limitation is the lack of interpretability of the energy scores; the energy score has a different scale and is harder to interpret.
Devising ways to better understand it would be interesting future work.
Overall, we believe our work has shown the promise of energy-based approaches for imbalanced SSL, and hope that it will spur further research in this direction.
A A PPENDIX
This document complements the main paper by describing: (1) the construction of long-tailed datasets for semi-supervised learning (Appendix A.1); (2) training details of each experiment in the main paper (Appendix A.2); (3) ablation studies on choices of hyper-parameters (Appendix A.3); (4) more precision and recall analysis for pseudo-labels (Appendix A.4); (5) top-1 accuracy of FixMatch with different thresholds (Appendix A.5); (6) more results on realistic evaluations where real OOD examples are presented in the unlabeled sets (Appendix A.6); (7) contribution of adaptive margin loss in InPL (Appendix A.7); (8) additional results on standard SSL benchmarks (Appendix A.8). [Figure] Temperature [Figure]
r acy 76.
[Figure] [Figure] [Figure] For sections, figures, tables, and equations, we use numbers (e.g., Table 1) to refer to the main paper and capital letters (e.g., Table A) to refer to this supplement.
A. C ONSTRUCTION OF L ONG - TAILED CIFAR
In this section, we describe the construction of the long-tailed version of CIFAR10/100 for semisupervised learning.
For experiments in Table 3, we follow prior work (Kim et al., 2020;
Oh et al., 2022) and first set N 1 and M 1 to be the number of instances for the most frequent class in labeled sets and unlabeled sets, respectively.
Next, with imbalance ratio γ , the number of instances for class k in labeled sets is computed as N k = N 1 · γ − ( k − 1) /
( K − 1) , where K is the total number of classes and N 1 is the number of labels for the most frequent class.
Likewise, the number of instances in unlabeled sets is computed as M k = M 1 · γ − ( k − 1) /
( K − 1) .
For experiments in Table 2, we follow the construction strategy in ABC (Lee et al., 2021), which is similar to the aforementioned strategy except that M 1 =
D − N 1 where D is the total number of instances of each class.
For CIFAR10-LT and CIFAR100-LT, D is 5000 and 500 , respectively.
For the experiments in Table 2, 20% labeled data for CIFAR10-LT corresponds to N 1 = 1000 and
M 1 = 4000 .
40% labeled data for CIFAR100-LT corresponds to N 1 = 200 and M 1 = 300 .
A. T RAINING D ETAILS OF L ONG - TAIL E XPERIMENTS
For results in Table 1, we follow the default training settings of FixMatch (Sohn et al., 2020), yet reduce the number of iterations to 6 × 2 16 following CREST (Wei et al., 2021).
This is because models already converge within the reduced schedule.
All other settings are exactly the same as
FixMatch.
Please refer to the original paper for more details.
For results in Table 2, we follow the training settings of ABC (Lee et al., 2021).
Specifically, for all the results, we use Adam (Kingma & Ba, 2014) as the optimizer with a constant learning rate 0.002 and train models with 25000 iterations.
Exponential moving average of momentum 0.999 is used to maintain an ensemble network for evaluation.
The strong augmentation transforms include
RandAugment and CutOut, which is consistent with the standard practice in SSL.
Batch size of both labeled set and unlabeled set is set to 64 and two strongly-augmented views of each unlabeled sample are included in training.
Following ABC, WideResNet-28-2 is used for both CIFAR10-LT and CIFAR100-LT for results in Table 2.
Results are reported as the mean of five runs with different random seeds and the best accuracy of each run is recorded.
For results in Table 3, we follow the training settings of DASO (Oh et al., 2022).
Most of the settings are the same as ABC (Lee et al., 2021) except that SGD is used as the optimizer.
The base learning rate is set to 0.03 and evaluation is conducted every 500 iterations with total number of training iterations being 250000.
The median value in last 20 evaluations of each single run is recorded and the results are reported as the mean of recorded values over three different runs.
For all of our experiments, we simply set the weight of unsupervised loss to 1.0 without further hyper-parameter tuning. [Figure]
A. A BLATION S TUDIES ON H YPERPARAMETERS
We conduct ablation studies to better understand our approach InPL, where we integrate it into the framework of FixMatch (Sohn et al., 2020) and ABC (Lee et al., 2021).
Unless otherwise noted, experiments are conducted on CIFAR10-LT with imbalance ratio 100.
For FixMatch framework, we use 10% of labeled data and for ABC framework, we use 20% of labeled data.
Effect of energy threshold.
The most important hyperparameter of our method is the energy threshold.
Unlike confidence scores that range from 0 to 1, energy scores are unbounded with their scale proportional to the number of classes.
Our thresholds in the experiments are chosen via cross-validation with a separate sampling seed.
We further experiment with different thresholds.
As shown in Figure A (a), within the FixMatch Framework, we observe a steady increase in the performance when the threshold goes from -7.5 to -9.5 and starts to decrease with even lower thresholds.
This is because, with very low thresholds, the model becomes very conservative and only produces pseudo-labels for unlabeled samples that are very close to the training distribution; i.e., the recall in pseudo-labels takes a significant hit.
As for the ABC framework (Figure A (b)), our method is not very sensitive to the energy threshold.
Most threshold values result in good performance but a slightly higher threshold of -5.5 achieves the best accuracy.
Since ABC already performs balanced sampling, using a higher energy threshold helps improve its recall of pseudo-labels without making the model more biased.
Effect of temperature for the energy score.
Recall that the energy function (LeCun et al., 2006) has a tunable temperature T (Equation 3).
Here, we empirically evaluate the impact of this parameter.
As shown in Figure A (c), the simplest setting of T = 1 gives the best performance.
We also experiment with a much larger temperature T = 10 , which leads to major drop in performance to 72.72% accuracy (not shown in the plot).
As noted by prior work (Liu et al., 2020), larger T results in a smoother distribution of energy scores, which makes it harder to distinguish samples.
We find that T < 1 also results in slightly worse performance.
Therefore, we simply set T = 1 and omit the temperature parameter to reduce the effort of hyperparameter tuning for our method.
A. P RECISION AND R ECALL FOR H EAD AND B ODY P SEUDO - LABELS
Our ablation study, presented in Figure 4 of the main paper, compared the precision and recall of pseudo-labels for all classes and the tail classes.
In this section, we further report the results (precision and recall of pseudo-labels) for the head and body classes.
As shown in Figure B, pseudo-labels produced by InPL consistently achieve higher precision with slightly lower recall across head and body classes.
This further suggests that the model trained with InPL is less biased towards the frequent classes in comparison to confidence-based pseudo-labeling.
A. A CCURACY OF F IX M ATCH WITH D IFFERENT T HRESHOLDS
As was shown in Section 4.4, trivially lowering the confidence threshold significantly hurts the pseudo-label precision.
We further demonstrate the corresponding overall accuracy in Table A. We [Table] al.,
[Table]
[Figure]
[Figure] FixMatch Number of OOD Examples Being Pseudo-labeled [Figure] see that none of these confidence thresholds for FixMatch is able to match the performance of our approach InPL in the long-tailed scenario, which the effectiveness of our approach.
A. M ORE R ESULTS ON R OBUSTNESS TO R EAL OOD S AMPLES
We present experimental results of InPL under the scenario of class mismatch in unlabeled data (Oliver et al., 2018).
Specifically, we use six animal classes (bird, cat, deer, dog, frog, horse) of CIFAR in labeled data and only evaluate the model on these classes.
The unlabeled data comes from four classes with different mismatch ratios.
For example, with a 50% mismatch ratio, only two of the four classes in the unlabeled data are among the six classes in the labeled data.
As shown in Figure Ca, when the mismatch ratio is low, all methods with strong augmentation perform similarly.
However, when the mismatch ratio becomes larger, InPL consistently achieves better performance.
When unlabeled data contains OOD examples from different datasets (Table 5),
InPL significantly outperforms FixMatch.
Figure Cb also shows that InPL consistently pseudo-labels less OOD examples in training.
[Table]
ReMixmatch + ABC-InPL w/o AML
[Table]
ReMixmatch + ABC-InPL
[Table]
A. C ONTRIBUTION OF A DAPTIVE M ARGIN L OSS
Finally, we investigate the contribution of the adaptive margin loss (AML) over vanilla cross-entropy loss in our approach InPL.
Within the FixMatch framework, the impact of AML can be derived from
Table 1 where AML brings an additional 1-2% point improvement in overall accuracy.
For the ABC framework, we use ReMixmatch + ABC-InPL as an example.
As shown in Table B, AML generally brings in less than 1% point accuracy improvement on top of the energy-based pseudo-labeling. A. R ESULTS ON S TANDARD SSL B ENCHMARKS [Table]
Due to adaptation difficulties, we report the results of DASH from its original paper (Xu et al., 2021), which uses a different codebase.
All methods (including ours) use the same backbone across experiments.
While designed to overcome the limitations of confidence-based pseudo-labeling on imbalanced data, InPL does not make any explicit assumptions about the class distribution.
Thus, a natural question is: how does InPL perform on balanced SSL benchmarks?
To answer this, we integrate InPL into FixMatch (Sohn et al., 2020) and evaluate it on the balanced
CIFAR10 (Krizhevsky & Hinton, 2009),
SVHN (Netzer et al., 2011), and STL10 (Coates et al., 2011) benchmarks using the default FixMatch training settings.
Table C summarizes the results.
When the amount of labeled data is small (CIFAR N = 40 and SVHN N = 40 ), InPL shows a noticeable improvement over FixMatch, UDA, and DASH (Xu et al., 2021).
This shows that the energy-based pseudo-labeling can still be useful in low-data regimes where confidence estimates may be less reliable even if the training data is balanced over classes.
In other settings with more data (STLN = 1000 ), InPL does not significantly outperform confidence-based methods such as FixMatch, but still shows competitive performance.