I NCREMENTAL F ALSE N EGATIVE D ETECTION FOR C ONTRASTIVE L EARNING
A BSTRACT
Self-supervised learning has recently shown great potential in vision tasks through contrastive learning, which aims to discriminate each image, or instance, in the dataset.
However, such instance-level learning ignores the semantic relationship among instances and sometimes undesirably repels the anchor from the semantically similar samples, termed as “false negatives”.
In this work, we show that the unfavorable effect from false negatives is more signiﬁcant for the large-scale datasets with more semantic concepts.
To address the issue, we propose a novel self-supervised contrastive learning framework that incrementally detects and explicitly removes the false negative samples.
Speciﬁcally, following the training process, our method dynamically detects increasing high-quality false negatives considering that the encoder gradually improves and the embedding space becomes more semantically structural.
Next, we discuss two strategies to explicitly remove the detected false negatives during contrastive learning.
Extensive experiments show that our framework outperforms other self-supervised contrastive learning methods on multiple benchmarks in a limited resource setup.
The source code is available at https://github.com/tsaishien-chen/IFND .
I NTRODUCTION
Self-supervised learning of visual representation (Doersch et al., 2015; Pathak et al., 2016; Noroozi & Favaro, 2016;
Oord et al., 2018; Gidaris et al., 2018; Chen et al., 2020a) aims to learn a semanticaware embedding space based on the image data without the supervision of human-labeled annotations.
Recently, signiﬁcant advances have been made by contrastive learning approaches (Hjelm et al., 2019; Tian et al., 2019;
Chen et al.
, 2020b;c; He et al., 2020; Chen et al., 2020d) to reduce the performance gap with the supervised counterparts.
Most unsupervised contrastive learning methods are developed based on the instance discrimination assumption. These approaches treat each training image as an individual instance and learn the representations that discriminate every single sample.
Speciﬁcally, considering an arbitrary image as an anchor, the only positive sample is generated by applying a different data augmentation to the anchor image, while all other images are treated as negative samples.
The training objective is to attract the positive to the anchor while repelling the negative samples from the anchor.
While instance-level contrastive learning has shown impressive performance, these methods do not take the semantic relationship among images into consideration.
Although some images share similar semantic concepts with the anchor, they are still considered as negative samples and are equally pushed away from the anchor with all other negatives.
We deﬁne these samples as “false negatives” in self-supervised contrastive learning, which would adversely affect the representation learning (Saunshi et al., 2019).
One might argue that such undesirable effects might be minor for the datasets with diverse semantic concepts since the probabilities of drawing false negatives are relatively low.
However, as shown in Figure 1, we empirically ﬁnd the opposite results that the performance drops due to training with false negative samples are more signiﬁcant on large-scale datasets with more semantic categories.
These results bring up the issue of instance-level contrastive learning when it is applied to datasets with more complex semantic contents.
To handle the false negative issue, we propose a novel framework to incrementally detect and explicitly remove false negatives for self-supervised contrastive learning.
During training, we cluster samples in the embedding space and assign the cluster indices as the pseudo labels to the training images.
Instances with an identical label to the anchor are then detected as false negatives.
However, we notice that the pseudo labels generated in the earlier training stages are comparably unreliable to represent the semantic relationship among instances since the semantic structure of the embedding space is still under development.
Therefore, we propose a novel strategy to assign the pseudo labels in an incremental manner.
In the early training stage, we only use a small portion of pseudo labels with higher conﬁdence while treating other samples as individual instances.
In the later training stage, as the pseudo labels become more reliable, we dynamically include more conﬁdent labels to detect and remove false negatives and hence, can beneﬁt semantic-aware representation learning.
Furthermore, we discuss two types of training objectives to explicitly address the detected false negatives during contrastive learning: elimination and attraction.
We theoretically show that they are the generalization of triplet loss (Schroff et al., 2015).
While both objectives avoid discriminating the anchor and its false negatives, the attraction objective further minimizes the distances between them.
Empirically, we ﬁnd that such a more aggressive strategy is less tolerant to noisy pseudo labels and unsuitable to our self-supervised framework.
The main contributions of this paper are summarized as follows:
• We highlight the issue of false negatives in contrastive learning, especially on the largescale datasets with more diverse semantic contents.
• We propose a novel contrastive learning framework with incremental false negative detection (IFND) that smoothly bridges instance-level and semantic-aware contrastive learning.
Our approach explicitly detects and incrementally removes false negatives as the embedding space becomes more semantically structural through the training process.
• Our approach performs favorably against the existing self-supervised contrastive learning frameworks on multiple benchmarks under a limited training resource setup.
Besides, we introduce two metrics: mean true positive/negative rates to evaluate the clustering quality.
R ELATED W ORK
Instance-level contrastive learning.
Learning semantic-aware visual representation without human supervision is an essential but challenging task.
Numerous approaches are developed based on the instance discrimination task (Dosovitskiy et al., 2015; Wu et al., 2018;
Ye et al., 2019; Misra & Maaten, 2020), where each instance in the dataset is treated as an individual sample and a representation is learned to classify or contrastively separate samples.
Recently, with the contrastive loss (Gutmann & Hyv¨arinen, 2010) and a set of image transformations or augmentations (Chen et al., 2020b), the instance-level contrastive learning methods (Hjelm et al., 2019; Tian et al., 2019;
Chen et al.
, 2020b;c; He et al., 2020; Chen et al., 2020d) achieve state-of-the-art results and even outperform some supervised pre-training approaches.
While signiﬁcant improvement is achieved, instance-level contrastive learning frameworks typically do not take high-level semantics into ac- count.
For example, any two samples in the dataset would be considered as a negative pair and be pushed apart by the contrastive loss although some of them are semantically similar and should be nearby in the embedding space.
Especially when the huge amounts of negative samples (8192 for
Chen et al.
(2020b), 65536 for He et al.
(2020)) play a critical role in the success of contrastive learning, these instance-level approaches inevitably draw some “false negatives” and learn less effective representation models as shown by a recent study (Saunshi et al., 2019).
In this paper, we further show that the performance gap between the contrastive learning trained with and without false negatives is more signiﬁcant on the datasets with more semantic classes.
Semantic-aware contrastive learning.
To address the limitation of instance-level contrastive learning, several methods are developed to exploit the semantic relationship among images.
Chuang et al.
(2020) show that the original instance-level sampling strategy includes a sampling bias and propose a debiased contrastive loss.
However, this method does not explicitly handle false negative samples.
Huynh et al.
(2020) determine false negatives of an anchor by ﬁnding top k similar samples without referring to global embedding distribution.
Khosla et al.
(2020) propose a supervised contrastive loss that utilizes label information and treats images of the same class (i.e., false negatives) as positives.
However, manually annotated labels cannot be acquired in the unsupervised setting.
Closely related to our method, PCL (Li et al., 2021) discovers the representative prototypes for each semantic concept and encourages an image embedding to be closer to its belonging prototype.
There are two fundamental differences between PCL and the proposed method: a) PCL uses all assigned prototypes regardless of inferior clustering results in early stages, which cannot properly reﬂect the semantic relationship among images, b) without treating semantically similar samples as false negatives, PCL applies instance-level InfoNCE loss (Oord et al., 2018) as the primary supervision, which fails to avoid the images within the same prototype being pushed apart.
In contrast, leveraging the progressive detection and explicit removal of false negatives, our framework achieves greater clustering quality and representation learning.
More comparisons are in Section 4.2 and Appendix E.
Clustering for deep unsupervised learning.
A few unsupervised learning methods have recently beneﬁted from clustering techniques to construct more effective representation models (Caron et al., 2018;
Yang et al., 2016; Xie et al., 2016; Caron et al., 2019; Zhuang et al., 2019; Asano et al., 2020).
The main idea is to use cluster indices as pseudo labels and learn visual representations in a supervised manner.
However, most existing methods require all pseudo labels to optimize the supervised loss, e.g., cross-entropy.
In this work, we show that the pseudo labels obtained in earlier training processes are relatively unreliable, and the full adoption of pseudo labels in the early stage would further disrupt the representation learning.
To handle this issue, we incorporate instance-level learning with clustering which allows us to only use a set of pseudo labels with sufﬁcient conﬁdence while treating the others as individual instances.
P ROPOSED M ETHOD 3. I NSTANCE -L EVEL C ONTRASTIVE L EARNING
An instance-level contrastive learning method learns a representation that discriminates one sample from every other.
Given M randomly sampled images from a training set X , a contrastive training mini-batch
I consists of 2 M images obtained by applying two sets of data augmentation on each sampled image.
For any anchor image i ∈ I , the only positive sample is another view (or transformation) of the same image, denoted as i (cid:48) , while the other 2( M − 1) images jointly constitute the set of negative samples
N ( i ) .
The instance-level discrimination is then optimized by the following contrastive loss:
[Equation]
where z i =
g
( f ( i )) is the embedding of the image i from an encoder f and a projection head g , sim( u , v ) =
exp( 1 τ ( u · v ) (cid:107) u (cid:107)(cid:107) v (cid:107) ) is the similarity of two input vectors, and τ represents a temperature hyper-parameter.
For instance-level contrastive learning, the negative sample set N ( i ) inevitably includes some samples with similar semantic content as the anchor i , which we term as false negatives, especially when a larger M is commonly used.
Consequently, it would separate semantically similar image pairs, which is suboptimal for learning good semantic-aware visual representations.
3. I NCREMENTAL F ALSE N EGATIVE D ETECTION
To learn an effective semantic-aware representation by self-supervised contrastive learning, our method explicitly detects and removes the false negative samples.
Speciﬁcally, we follow the same procedure in PCL (Li et al., 2021) to perform k -means clustering on the features f ( i ) of all training images { i ∈ X} and cluster the features into k groups.
We use the centroids to represent the embeddings of the discovered semantic concepts and denote the centroid representation of k -th cluster as c k .
The pseudo label y i of the image i is assigned based on the closest centroid, formally y i =
arg min k (cid:107) f
( i ) − c k (cid:107) .
In the learning process, two images with an identical assigned pseudo label would be treated as a false negative pair.
Nonetheless, as illustrated in the leftmost of Figure 2(a) (or Figure 3 for a realistic case), we observe that the semantic structure of early embedding space is less reliable and could generate noisy pseudo labels, which would disrupt the representation learning.
We provide a quantitative analysis of this effect in Section 4.4 and Appendix F. To tackle this problem, in early training stages, we only adopt the pseudo labels with higher conﬁdence while treating the other images as individual samples.
For an arbitrary image i , the desired conﬁdence κ i should be larger when the image embedding f ( i ) is not only closer to the centroid of the belonging group, i.e., c yi , but also farther to the other centroids.
To this end, we measure the conﬁdence of an assigned pseudo label by:
[Equation]
which is the softmax of cosine similarities between the image representation and every centroid.
We then only assign a speciﬁc rate (termed as acceptance rate) of pseudo labels with larger conﬁdence.
As plotted in the rest part of Figure 2 (or Figure 3), following the training progress, the encoder is better trained and the semantic structure of embedding space is more clear which can generate more reliable pseudo labels.
Hence, we propose to incrementally increase the acceptance rate and leverage semantic-aware representation learning.
In Section 4.4, we demonstrate that a simple strategy that linearly increases the acceptance rate from 0% to 100% throughout the whole training process can achieve a signiﬁcant improvement.
Hierarchical semantic deﬁnition.
In an unsupervised setting, the precise class number of a dataset is usually unknown, and also, a different number of classes can be selected by choosing a different level of granularity.
To enhance the ﬂexibility and robustness of our method, we incorporate hierarchical clustering techniques (Johnson, 1967; Corpet, 1988; Murtagh & Legendre, 2014; Li et al., 2021) into our framework.
Speciﬁcally, we perform multiple times of k -means with different cluster numbers to deﬁne the false negatives in the different levels of granularity.
As such, the objective function (will be introduced in Section 3.3) is revised as the average of the original ones computed by the false negatives deﬁned in different levels of granularity.
3. C ONTRASTIVE L EARNING WITHOUT F ALSE N EGATIVE
Given the assigned pseudo labels
[Equation]
our next goal is to revise the objective of instance-level contrastive learning, i.e., L inst in Equation 1, to explicitly deal with the detected false negatives.
We discuss two strategies to exploit false negatives.
First, false negative elimination approach excludes the false negatives from the negative sample set N ( i ) :
[Equation]
Second, considering that the anchor and its false negatives are assigned with the same pseudo label
[Equation]
we view the false negatives as additional positive samples:
[Equation]
Behaviors of elimination and attraction strategies.
Compared to the original contrastive learning objective L inst , L elim removes the similarities between the anchor and its false negatives from the denominator while on the other hand, L attr places them on the numerator.
They both show a great capability to enlarge the similarities between the anchor and the false negatives when the objective is minimized.
To further explore and compare their behaviors, we derive the gradients with regard to the embedding of the anchor z i as:
[Equation]
and
[Equation]
where σ is the weighted coefﬁcient.
The detailed formulation and derivation are in Appendix A.
Based on their gradients in Equation 5, L elim and L attr are the generalization of triplet loss † (Schroff et al., 2015) which would intrinsically repel the negatives and attract the positive(s) to the anchor.
While both of them fully eliminate the detected false negatives (i.e., { n | n ∈ N ( i ) , y n = y i } ) from the negative samples and avoid them being pushed apart from the anchor, L attr further minimizes the distances between the anchor and its false negatives.
Such a more aggressive strategy results in less tolerance to noisy pseudo labels which are inevitably generated from an unsupervised clustering.
Hence, although SupCon (Khosla et al., 2020) presents the effectiveness of L attr with manual label annotations, we ﬁnd L elim is more stable and suitable to our self-supervised framework.
Finally, we illustrate the framework in Figure 2(b) and present the pseudo-code in Appendix B.
E XPERIMENTS
We validate and analyze our framework on several benchmarks.
We train the model on 8 Nvidia V100 GPUs for all experiments.
For fair comparisons, we group prior self-supervised algorithms with a similar setting to demonstrate the efﬁcacy of our proposed method.
4. I MPLEMENTATION D ETAILS
We use ResNet-50 (He et al., 2016) as the encoder, followed by a 3-layer MLP as the projection head to obtain 128-D features z .
We apply the proposed method to ImageNet (Deng et al., 2009) and CIFAR (Krizhevsky et al., 2009).
For ImageNet pre-training, we follow the same setting in
MoCo v2 (Chen et al., 2020d) and PCL (Li et al., 2021) for fair comparisons.
Speciﬁcally, we train the encoder for 200 epochs with a mini-batch size of 256 and use the memory-based method (He et al., 2020) to increase the number of contrastive samples in default.
For pseudo label assignment, we employ k -means clustering implemented by Johnson et al.
(2019) to re-assign the pseudo labels after every training epoch and use three cluster numbers { 1000 , 3000 , 10000 } to deﬁne semantic concepts.
In default, we linearly increase the pseudo label acceptance rate from 0% to 100% through the whole training process and use the elimination loss L elim as the objective.
The training lasts for 60 hours of which 3.5 hours is spent on pseudo label assignment.
More details and the setting for
CIFAR pre-training are provided in Appendix C.
[Table]
[Table]
[Table]
4. C OMPARISON WITH THE S TATE - OF
- THE -A RTS
Linear evaluation and transfer learning on image classiﬁcation benchmarks.
We ﬁrst assess the performance of the image representations after pre-training on ImageNet.
We train a linear classiﬁer with the ﬁxed representations as input on three benchmarks: ImageNet (Deng et al., 2009),
VOC2007 (Everingham et al., 2010) and Places205 (Zhou et al., 2014) and report the results in
Table 1.
IFND obtains consistent improvements compared to previous self-supervised contrastive learning approaches with a similar experiment setting.
The direct comparison to PCL (Li et al., 2021) emphasizes the advantages of incrementally detecting and explicitly removing the false negatives in contrastive learning.
We provide a more in-depth ablation study with PCL in Appendix E.
Semi-supervised learning on ImageNet.
Next, we evaluate the embeddings pre-training on ImageNet in the semi-supervised setting.
We follow the protocol described in SimCLR (Chen et al., 2020b) and use the same 1% or 10% fraction of ImageNet labeled training set to ﬁnetune the pretrained encoder.
The results are shown in Table 2.
IFND outperforms the prior approaches within a similar setup; notably, when using the 1% label, it can achieve more superior performance than
SimCLR with 16 times larger batchsize and 5 times more training epochs.
Object detection and instance segmentation on COCO.
We evaluate our representation on the tasks of object detection and semantic segmentation.
Following the experiment setting in MoCo (He et al., 2020) and PCL, we ﬁnetune all layers end-to-end on the COCO (Lin et al., 2014) train
[Table] [Table]
the performance drop due to training with false negatives
[Table]
and evaluate on val2017 dataset.
We report the results in Table 3.
IFND outperforms MoCo, PCL, and supervised pre-training in all metrics.
Clustering quality on ImageNet.
We also measure the clustering quality on the ImageNet pretraining representations and report the results in Table 4.
Compared to MoCo v2, our method leverages semantic-aware learning and shows a signiﬁcant improvement of 9 . 6% on NMI.
Moreover, IFND achieves the best clustering quality compared to existing deep clustering-based contrastive learning frameworks.
In Appendix F [Table] we analyze the clusterings during the training process to better study our incremental manner to apply the clustering assignments
[Table]
4. E FFECT OF F ALSE N EGATIVE S AMPLES
Experimental Setup.
To study the effect of false negatives on self-supervised contrastive learning, we compare three representative frameworks, including SimCLR (Chen et al., 2020b) as instancelevel learning, SupCon (Khosla et al., 2020) as supervised learning using label information to completely exclude the false negatives, and our method.
For a fair comparison, we reproduce SimCLR and SupCon by using the same data augmentations and network architecture (i.e., ResNet-50 with 3-layer MLP).
We also apply SimCLR-based implementation for our method without maintaining a momentum feature bank in this section.
Considering that the probability of sampling false negatives in a training mini-batch I is largely determined by the number of semantic classes, we conduct the experiments on CIFAR (Krizhevsky et al., 2009) and ImageNet (Deng et al., 2009) with different numbers of object categories.
For ImageNet, we use WordNet (Miller, 1998) lexical hierarchy to redeﬁne the semantic classes in different depths, as detailed in Appendix D. We then train and perform the linear evaluation for three frameworks on each dataset and report the results in Table 5.
[Table]
Based on the performance drops of SimCLR compared to SupCon ( ∆ (SupCon, SimCLR) in Table 5)
[Table]
we observe that the adverse effect of false negatives is more signiﬁcant on the datasets with more object categories [Table] although they are less likely to sample false negatives during contrastive learning.
Similar results are observed on both CIFAR and ImageNet.
The results convey an issue of vanilla instance-level contrastive learning when it is applied to datasets with more complex semantic concepts.
With the explicit elimination of the detected false negatives, IFND effectively narrows the gap between self-supervised and supervised frameworks, numerically reducing 51 .
7% of the gap between SimCLR and SupCon on ImageNet with original labels (i.e., Depth 18).
4. S TRATEGY FOR F ALSE N EGATIVE D ETECTION AND R EMOVAL
In this section, we ﬁrst introduce a comprehensible evaluation metric for clustering assignment and then present the quantitative study on different strategies to utilize the clustering labels or to remove the detected false negatives.
The results on CIFAR-100 are shown in Table 6.
More interpretable metric for clustering performance.
Considering that the pseudo labels are used to detect false negatives, we propose Mean True Positive/Negative Rate (MTPR/MTNR) to evaluate the clustering.
MTPR is the average probability that an actual false negative (i.e., an actual positive) will be detected as a false negative sample, while MTNR indicates the average probability that an actual negative is still treated as a negative sample.
Taking the instance-level contrastive learning as a toy example, it does not perform false negative detection, so MTPR is 0% while MTNR is 100% .
The goal is to increase MTPR of the clustering but keep MTNR as high as possible.
Strategies for pseudo label assignment.
First, we compare three schemes to determine the acceptance rate of the pseudo labels, including constant ([b], as in DeepCluster (Caron et al., 2018)), step ([c], as in PCL (Li et al., 2021)), and linear ([g], Ours ) schemes.
The linear strategy achieves both higher MTPR and MTNR.
The results validate that using the clustering indices in an incremental manner can ﬁnd the false negatives more effectively and further improve the performance of contrastive learning.
Next, we analyze the effect of using different ﬁnal acceptance rates for the linear strategy ([d,e,f,g]).
Intuitively, higher acceptance rates indicate more false negatives can be detected (MTPR increases), but more true negatives are also improperly treated as false negative samples and removed (MTNR decreases).
However, we ﬁnd that using the 100% ﬁnal acceptance rate ([g]) can averagely detect nearly a half ( 43 . 3% ) of the actual false negatives with only a slight drop ( 0 . 35% ) of MTNR compared to the instance-level approach ([a]).
Along with the elimination loss, we improve the downstream Top-1 classiﬁcation accuracy from 71 .
5% to 74 .
Strategies for false negative removal.
Finally, we compare the elimination and attraction losses ([g,h]).
We ﬁnd that the representation learning through minimizing L attr are unstable and rely on the high-quality pseudo labels at the early training stages.
This observation can be explained by the theoretical analysis in Section 3.3 indicating that L attr applies a more aggressive strategy that would be more sensitive to noisy pseudo labels.
Empirically, we observe that the model supervised by L attr performs even worse than the instance-level learning.
V ISUALIZATION OF E MBEDDING S PACE
In Figure 3, we visualize the embedding spaces and corresponding pseudo label assignments in different training stages using t-SNE (Van der Maaten & Hinton, 2008).
In the early stages (e.g., 100 th epoch), the semantic structure of the embedding space is still under-developed.
Hence, IFND only adopts a small portion of pseudo labels with higher conﬁdence scores.
Later in the training process, with the better-trained encoder and more semantically structural embedding space, incrementally including more high-quality pseudo labels can beneﬁt the semantic-aware representation learning.
Finally, we compare the embedding spaces learned through SimCLR, SupCon, and our approach in
Figure 4.
IFND can learn the embedding space with more compact clusters than the instance-level learning and is also more similar to the supervised framework.
We present a quantitative analysis in
Appendix F and also provide more visualizations and discussions in Appendix G.
C ONCLUSION
In this work, we analyze the undesired effects of false negatives for self-supervised contrastive learning.
To mitigate such adverse effects, we then introduce an incremental false negative detection approach to progressively detect and remove the false negatives through the training stage.
Extensive experiment results validate the effectiveness of the proposed framework on several benchmarks and also demonstrate the capability to reduce the gap from the supervised framework.
A T HEORETICAL A NALYSIS FOR E LIMINATION AND A TTRACTION L OSSES
In this section, we show the derivation of the gradients of two discussed objective functions: elimination loss L elim (Equation 3) and attraction loss L attr (Equation 4).
Furthermore, we demonstrate that they have the inherent capability of hard sample mining (Oh Song et al., 2016; Harwood et al., 2017; Wu et al., 2017).
Without loss of generality
[Equation]
we use i to represent an arbitrary anchor image, and re-write the two losses as:
[Equation]
and
[Equation]
We then derive the gradient of L elim
[Equation]
i with regard to the embedding of the anchor image z i : ∂ L elim,i
[Equation]
where
[Equation]
and
[Equation]
are the coefﬁcient terms respectively for the negative or positive sample x .
Next, the gradient of L attr,i is derived in a similar way:
[Equation]
attr,
i
[Equation]
where
[Equation]
and
[Equation]
Note that the coefﬁcient terms σ + x and σ − x in Equation 9 and 11 are determined by sim( z i , z x ) .
Larger coefﬁcients are given when negative/positive samples are relatively more similar/dissimilar to the anchor.
This observation indicates that these two loss functions have the implicit capability of hard sample mining, i.e., focusing on differentiating the “hard negatives” that are near the anchor and attracting the “hard positives” which are far away from the anchor.
B
P SEUDO C ODE contrastive learning with false negative
// pseudo label assignment
C P RE - TRAINING AND E VALUATION D ETAILS
As described in Section 4.1, we use the proposed method to pre-train ResNet-50 (He et al., 2016) on
ImageNet (Deng et al., 2009), CIFAR-10, and CIFAR-100 (Krizhevsky et al., 2009).
For ImageNet pre-training, we follow the setting of previous work (He et al., 2020; Chen et al., 2020d) that uses
SGD optimizer (Kiefer et al., 1952) with a weight decay of 0 . 0001 and a momentum of 0 .
The learning rate is set to 0 .
03 initially and then multiplied by 0 .
1 at 120 and 160 epochs.
For CIFARand CIFAR-100 pre-training, we train the encoder for 1000 epochs with a mini-batch size of 1024 .
Because of the larger mini-batch size, we implement our framework based on SimCLR (Chen et al., 2020b) structure without maintaining a memory bank for the momentum instance features.
We also use SGD optimizer with the same weight decay and momentum.
But, we set the initial learning rate to 0 .
5 and use a linear warm-up strategy for the ﬁrst 10 epochs.
In the rest of the training, we decay the learning rate with the cosine annealing schedule (Loshchilov & Hutter, 2016).
For pseudo label assignment, we re-assign the pseudo labels after every 20 training epochs (due to more training epochs and fewer training images) for CIFAR and also use three cluster numbers, { 10 , 30 , 100 } for CIFAR-10 and { 100 , 300 , 1000 } for CIFAR-100, to hierarchically deﬁne semantic concepts.
For linear evaluation on ImageNet, we train the classiﬁer (a fully connected layer followed by softmax) with the ﬁxed pre-trained representations for 100 epochs.
Following the same hyper-parameter setting used in MoCo v2 (Chen et al., 2020d) and PCL (Li et al., 2021), we optimize the model by SGD optimizer with a batch size of 256 , an initial learning rate of 10 , a momentum of 0 . 9 , and a weight decay of 0 .
As for semi-supervised learning, we ﬁne-tune the pre-trained ResNet-50 model and the classiﬁer using the subsets of 1% or 10% ImageNet labeled training data (note that we use the same subsets of ImageNet training data as in SimCLR).
The model is trained using SGD optimizer for 20 epochs, a batch size of 256 , a momentum of 0 . 9 , and a weight decay of 0 . 0005 .
The learning rate for ResNet-50 is 0 .
01 while the one for the linear classiﬁer is [-
-]0 .
1 (for 10% ImageNet) or 1 (for 1% ImageNet).
All learning rates are multiplied by 0 .
2 at 12 nd and 16 th epochs.
D H IERARCHICAL C LASS D EFINITION FOR I MAGE N ET
Based on WordNet (Miller, 1998) lexical database, we use the corresponding synset IDs to represent original 1000 classes in ImageNet and recursively trace the “hypernyms” (parent synset) for each class until the coarsest synset, “entity”, in WordNet.
Then, we construct the tree structure with entity synset as the root, the synsets of original classes as the leaves, and the relations of hypernym or hyponym as the edges.
We then re-deﬁne the semantic class with different granularities in different
Method
Objective
Pseudo Label
Assignment
Numbers of
Clusters ( ×
[Table]
Conﬁdence
Estimation
TopAcc.
SimCLR
L inst
Constant - - 71.
PCL
L ProtoNCE
Step { 25 , 50 , 100 }
Eq. 9 in PCL 72.
IFND (Ours)
L elim
Linear { 1 , 3 , 10 }
Eq.74.
PCL †
L elim
Step { 25 , 50 , 100 }
Eq. 9 in PCL 73.1 (0.3 ↑ )
IFND †
L ProtoNCE
Linear { 1 , 3 , 10 }
Eq.73.4 (0.6 ↓ )
PCL †
L ProtoNCE
Linear { 25 , 50 , 100 }
Eq. 9 in PCL 73.5 (0.7 ↑ )
IFND †
L elim
Step { 1 , 3 , 10 }
Eq.73.1 (0.9 ↓ )
PCL †
L ProtoNCE
Step { 1 , 3 , 10 }
Eq. 9 in PCL 69.9 (2.9 ↓ )
IFND †
L elim
Linear { 25 , 50 , 100 }
Eq.73.2 (0.8 ↓ )
IFND †
L elim
Linear { 1 , 3 , 10 }
Eq. 9 in PCL 71.2 (2.8 ↓ ) depths of the tree.
In Section 4.3, we employ the datasets deﬁned in Depth = { 3, 5, 7, 9, 18 } .
Here, we show some example images with the semantic classes deﬁned in these depths in Figure 5.
E I N -D EPTH A BLATION C OMPARISON WITH PCL
Here, we provide an ablation comparison with PCL (Li et al., 2021) in terms of 1) objective function, 2) pseudo label assignment, 3) numbers of clusters, and 4) conﬁdence estimation.
The experimental setup is the same as in Section 4.3.
Brieﬂy, we re-implement PCL and our IFND with SimCLR (Chen et al., 2020b) based implementation and evaluate the frameworks on CIFAR-100 (Krizhevsky et al., 2009).
The results are reported in Table 7.
Objective function.
PCL applies L ProtoNCE which includes instance-level infoNCE loss (Gutmann & Hyv¨arinen, 2010), i.e., L inst , and would suffer from the false negative effect.
In contrast, IFND applies L elim that explicitly eliminates the detected false negatives from negative sample set (as proven in Section 3.3) and performs favorably against L ProtoNCE .
Pseudo label assignment.
For the utilization of clustering indices, PCL uses Step scheme that ﬁrst warms up the framework by instance-level learning and adopts all indices afterward.
On the other hand, IFND progressively includes increasing conﬁdent labels, which better ﬁts the gradually well-trained encoder (as demonstrated in Appendix F).
Numbers of clusters.
The performance of the PCL approach degrades signiﬁcantly when the number of clusters becomes smaller while the proposed method is more robust to the number of clusters.
It is worth mentioning that with smaller numbers of clusters, PCL performs similarly to the attraction strategy (69.9% versus 70.2% as in Table 6).
Conﬁdence estimation.
PCL estimates a single conﬁdence score for the instances within the same cluster.
On the contrary, our method computes the conﬁdence score for each individual instance and also refers to the centroids of other clusters for the estimation.
As a result, the representation learning with our conﬁdence estimation performs more favorably.
F C LUSTERING Q UALITY T HROUGH T RAINING P ROCESS
In this section, we measure the clustering results in different training stages to ﬁrst verify the claim that the clusterings are comparably unreliable in the early training stages and also study the practical effect of our incremental manner to adopt clustering indices.
We compute Normalized Mutual
Information (Strehl & Ghosh, 2002) between the ground truth labels and the clustering indices of all training images and plot the results in Figure 6.
We can observe that following the training, the clustering is gradually improved and becomes better to reﬂect the semantic relationship among images.
Hence, for the model that consistently uses all pseudo labels (green line), the earlier inferior labels would disturb the training. In contrast, the proposed model (blue line) progressively applies increasing high-quality labels that can beneﬁt semantic-aware learning and ﬁnally achieve both better representation learning and clustering as in Table 6 and Figure 6.
G V ISUALIZATION OF E MBEDDING S PACE THROUGH T RAINING P ROCESS
In this section, we visualize and compare the embedding spaces learned by four contrastive learning frameworks, including (a) SimCLR (Chen et al., 2020b),
(b) IFND (trained by L elim ), (c) IFND (trained by L attr ), and (d) SupCon (Khosla et al., 2020), through the training process in Figure 7.
Compared to IFND trained by L elim , the one trained by L attr learns the embedding space with more concentrated clusters, which are more similar to SupCon due to using similar attraction objective function.
However, during training, the unsupervised clustering would inevitably produce some noisy pseudo labels (as supported by the MTNR in Table 6 being less than 100% ).
Consequently, the attraction loss may inappropriately pull actual negative samples closer to the anchor.
We can then ﬁnd that although the embedding space in the rightmost of Figure 7(c) shows more concentrated clusters, nonetheless, a cluster is not constituted by the image embeddings of the same semantic content.
Also, as shown in Table 6, the attraction loss leads to inferior representation performance compared to the elimination objective.
For the ﬁnal proposed method, i.e., IFND trained by L elim , it learns a similar embedding space as SimCLR in the early stage since the acceptance rate for assigning the pseudo label is still low.
Following the training process, with increasing reliable pseudo labels, the proposed framework effectively bridges the instance-level and semantic-aware representation learning and learns a more favorable embedding space against SimCLR.