Generalized Parametric Contrastive Learning

26 Sep 2022  ·  Jiequan Cui, Zhisheng Zhong, Zhuotao Tian, Shu Liu, Bei Yu, Jiaya Jia ·

In this paper, we propose the Generalized Parametric Contrastive Learning (GPaCo/PaCo) which works well on both imbalanced and balanced data. Based on theoretical analysis, we observe that supervised contrastive loss tends to bias high-frequency classes and thus increases the difficulty of imbalanced learning. We introduce a set of parametric class-wise learnable centers to rebalance from an optimization perspective. Further, we analyze our GPaCo/PaCo loss under a balanced setting. Our analysis demonstrates that GPaCo/PaCo can adaptively enhance the intensity of pushing samples of the same class close as more samples are pulled together with their corresponding centers and benefit hard example learning. Experiments on long-tailed benchmarks manifest the new state-of-the-art for long-tailed recognition. On full ImageNet, models from CNNs to vision transformers trained with GPaCo loss show better generalization performance and stronger robustness compared with MAE models. Moreover, GPaCo can be applied to the semantic segmentation task and obvious improvements are observed on the 4 most popular benchmarks. Our code is available at https://github.com/dvlab-research/Parametric-Contrastive-Learning.

PDF Abstract
Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Semantic Segmentation ADE20K GPaCo (Swin-L) Validation mIoU 54.3 # 56
Image Classification ImageNet GPaCo (Vit-B) Top 1 Accuracy 84.0% # 336
Image Classification ImageNet GPaCo (ViT-L) Top 1 Accuracy 86.01% # 175
Image Classification ImageNet GPaCo (ResNet-50) Top 1 Accuracy 79.7% # 685
Domain Generalization ImageNet-C GPaCo (ViT-L) mean Corruption Error (mCE) 39.0 # 13
Long-tail Learning ImageNet-LT GPaCo (2-ResNeXt101-32x4d) Top-1 Accuracy 63.2 # 10
Domain Generalization ImageNet-R GPaCo (ViT-L) Top-1 Error Rate 39.7 # 15
Domain Generalization ImageNet-Sketch GPaCo (ViT-L) Top-1 accuracy 48.3 # 12
Long-tail Learning iNaturalist 2018 GPaCo (ResNet-50) Top-1 Accuracy 75.4% # 10
Image Classification iNaturalist 2018 GPaCo (ResNet-152) Top-1 Accuracy 78.1% # 17
Long-tail Learning iNaturalist 2018 GPaCo (2-R152) Top-1 Accuracy 79.8% # 5
Image Classification iNaturalist 2018 GPaCo (ResNet-50) Top-1 Accuracy 75.4% # 20
Long-tail Learning iNaturalist 2018 GPaCo (ResNet-152) Top-1 Accuracy 78.1% # 6
Semantic Segmentation PASCAL Context GPaCo (ResNet101) mIoU 56.2 # 21
Long-tail Learning Places-LT GPaCo (ResNet-152) Top-1 Accuracy 41.7 # 10

Methods