Contrastive learning applied to self-supervised representation learning has seen a resurgence in recent years, leading to state of the art performance in the unsupervised training of deep image models. Modern batch contrastive approaches subsume or significantly outperform traditional contrastive losses such as triplet, max-margin and the N-pairs loss. In this work, we extend the self-supervised batch contrastive approach to the fully-supervised setting, allowing us to effectively leverage label information. Clusters of points belonging to the same class are pulled together in embedding space, while simultaneously pushing apart clusters of samples from different classes. We analyze two possible versions of the supervised contrastive (SupCon) loss, identifying the best-performing formulation of the loss. On ResNet-200, we achieve top-1 accuracy of 81.4% on the ImageNet dataset, which is 0.8% above the best number reported for this architecture. We show consistent outperformance over cross-entropy on other datasets and two ResNet variants. The loss shows benefits for robustness to natural corruptions and is more stable to hyperparameter settings such as optimizers and data augmentations. Our loss function is simple to implement, and reference TensorFlow code is released at https://t.ly/supcon.
翻译:用于自我监督的演示学习的对比性学习近年来再次出现,导致在未经监督的深图像模型培训中出现艺术性能状况,导致在未经监督的深图像模型中进行分类,现代批量对比性方法包含或大大优于传统的对比性损失,例如三重、最大间距和N皮尔斯损失。在这项工作中,我们将自我监督的批量对比性方法推广到完全监督的设置,使我们能够有效地利用标签信息。属于同一类的一组点在嵌入空间时被拉在一起,同时将样本从不同类别中分离出来。我们分析了监督的对比性(SupCon)损失的两个可能的版本,确定了损失的最佳公式。在ResNet-200上,我们在图像网络数据集上实现了81.4%的顶级-1精确度,比为这个架构报告的最佳数字高出0.8%。我们在其他数据集和两个ResNet变异体上显示交叉式的性能持续超前。损失表明对自然腐败的好处,并且更稳定地显示对超光谱的设置。在优化/ AS-Florma 中,我们的数据功能是最佳的。