Awesome
Imbalanced Learning for Recognition
This repository contains the code of our papers on the topic of imbalanced learning for recognition.
- Our paper "Decoupled Kullback-Leibler (DKL) Divergence Loss" is accepted by NeurIPS 2024
- Our new paper "Classes Are Not Equal: An Empirical Study on Image Recognition Fairness" is accepted by CVPR 2024
- Our new arXiv paper "Decoupled Kullback-Leibler (DKL) Divergence Loss" achieves new state-of-the-art on knowledge distillation and adversarial robustness. Code is released.
- Code for RR & CeCo is partially released.
- Our paper "Generalized Parametric Contrastive Learning" is accepted by TPAMI 2023.
- Our paper "Understanding Imbalanced Semantic Segmentation Through Neural Collapse" is accepted by CVPR2023. The code will be released soon.
- The code for our preprint paper "Generalized Parametric Contrastive Learning" is released;
- The code for our preprint paper "Region Rebalance for Long-Tailed Semantic Segmentation" (paper) will be released soon;
- The code for our TPAMI 2022 paper "Residual Learning for Long-tailed recogntion" (paper and code);
- The code for our ICCV 2021 paper "Parametric Contrastive Learning" (paper and code);
Generalized Parametric-Contrastive-Learning
This repository contains the implementation code for ICCV2021 paper Parametric Contrastive Learning (https://arxiv.org/abs/2107.12028)
and TPAMI 2023 paper Generalized Parametric Contrastive Learning (https://arxiv.org/abs/2209.12400).
Full ImageNet Classification and Out-of-Distribution Robustness
CIFAR Classification
Method | Model | Top-1 Acc(%) | link | log |
---|
multi-task | ResNet-50 | 79.1 | --- | download |
GPaCo | ResNet-50 | 80.3 | --- | download |
Long-tailed Recognition
ImageNet-LT
iNaturalist 2018
Method | Model | Top-1 Acc(%) | link | log |
---|
GPaCo | ResNet-50 | 75.4 | download | download |
GPaCo | ResNet-152 | 78.1 | --- | download |
GPaCo | ensembel(2-ResNet-152) | 79.8 | --- | --- |
Places-LT
Semantic Segmentation
Method | Dataset | Model | mIoU (s.s.) | mIoU (m.s.) | link | log |
---|
GPaCo | ADE20K | Swin-T | 45.4 | 46.8 | --- | download |
GPaCo | ADE20K | Swin-B | 51.6 | 53.2 | --- | download |
GPaCo | ADE20K | Swin-L | 52.8 | 54.3 | --- | download |
GPaCo | COCO-Stuff | ResNet-50 | 37.0 | 37.9 | --- | download |
GPaCo | COCO-Stuff | ResNet-101 | 38.8 | 40.1 | --- | download |
GPaCo | Pascal Context 59 | ResNet-50 | 51.9 | 53.7 | --- | download |
GPaCo | Pascal Context 59 | ResNet-101 | 54.2 | 56.3 | --- | download |
GPaCo | Cityscapes | ResNet-18 | 78.1 | 79.7 | --- | download |
GPaCo | Cityscapes | ResNet-50 | 80.8 | 82.0 | --- | download |
GPaCo | Cityscapes | ResNet-101 | 81.4 | 82.1 | --- | download |
Get Started
Environments
We use python3.8, pytorch 1.8.1, mmcv 1.3.13 and timm==0.3.2. Our code is based on PaCo, MAE, and mmseg.
Train and Evaluation Scripts
On full ImageNet and OOD robustness,
We use 8 Nvidia GForce RTx 3090 GPUs. MAE pretrained models should be downloaded from here.
cd GPaCo/LT
bash sh/ImageNet/train_resnet50.sh
bash sh/ImageNet/eval_resnet50.sh
cd GPaCo/MAE-ViTs
bash sh/finetune_base_mae.sh
bash sh/finetune_base_mae_multitask.sh
bash sh/finetune_base_mae_gpaco.sh
bash sh/finetune_base_mae_gpaco_eval.sh
On imbalanced data,
cd GPaCo/LT
bash sh/LT/ImageNetLT_train_X50_multitask.sh
bash sh/LT/ImageNetLT_train_X50.sh
sh/LT/ImageNetLT_eval_X50.sh
bash sh/LT/Inat_train_R50.sh
sh/LT/Inat_eval_R50.sh
bash sh/LT/PlacesLT_train_R152.sh
bash sh/LT/PlacesLT_eval_R152.sh
On semantic segmentation,
cd GPaCo/Seg/semseg
bash sh/ablation_paco_ade20k/upernet_swinbase_160k_ade20k_paco.sh
bash sh/ablation_paco_coco10k/r50_deeplabv3plus_40k_coco10k_paco.sh
bash sh/ablation_paco_context/r50_deeplabv3plus_40k_context_paco.sh
bash sh/ablation_paco_cityscapes/r50_deeplabv3plus_40k_context.sh
Parametric-Contrastive-Learning
This repository contains the implementation code for ICCV2021 paper:
Parametric Contrastive Learning (https://arxiv.org/abs/2107.12028)
Overview
In this paper, we propose Parametric Contrastive Learning (PaCo) to tackle long-tailed recognition. Based on theoretical analysis, we observe supervised contrastive loss tends to bias on high-frequency classes and thus increases the difficulty of imbalance learning. We introduce a set of parametric class-wise learnable centers to rebalance from an optimization perspective. Further, we analyze our PaCo loss under a balanced setting. Our analysis demonstrates that 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 CIFAR, ImageNet, Places, and iNaturalist 2018 manifest the new state-of-the-art for long-tailed recognition. On full ImageNet, models trained with PaCo loss surpass supervised contrastive learning across various ResNet backbones.
Results and Pretrained models
Full ImageNet (Balanced setting)
ImageNet-LT (Imbalance setting)
iNaturalist 2018 (Imbalanced setting)
Method | Model | Top-1 Acc(%) | link | log |
---|
PaCo | ResNet-50 | 73.2 | TBD | download |
PaCo | ResNet-152 | 75.2 | TBD | download |
Places-LT (Imbalanced setting)
Method | Model | Top-1 Acc(%) | link | log |
---|
PaCo | ResNet-152 | 41.2 | TBD | download |
Get Started
For full ImageNet, ImageNet-LT, iNaturalist 2018, Places-LT training and evaluation. Note that PyTorch>=1.6. All experiments are conducted on 4 GPUs. If you have more GPU resources, please make sure that the learning rate should be linearly scaled and 32 images per gpu is recommented.
cd Full-ImageNet
bash sh/train_resnet50.sh
bash sh/eval_resnet50.sh
cd LT
bash sh/ImageNetLT_train_R50.sh
bash sh/ImageNetLT_eval_R50.sh
bash sh/PlacesLT_train_R152.sh
bash sh/PlacesLT_eval_R152.sh
cd LT
bash sh/CIFAR100_train_imb0.1.sh
Contact
If you have any questions, feel free to contact us through email (jiequancui@link.cuhk.edu.hk) or Github issues. Enjoy!
BibTex
If you find this code or idea useful, please consider citing our work:
@ARTICLE{10130611,
author={Cui, Jiequan and Zhong, Zhisheng and Tian, Zhuotao and Liu, Shu and Yu, Bei and Jia, Jiaya},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={Generalized Parametric Contrastive Learning},
year={2023},
volume={},
number={},
pages={1-12},
doi={10.1109/TPAMI.2023.3278694}}
@inproceedings{cui2021parametric,
title={Parametric contrastive learning},
author={Cui, Jiequan and Zhong, Zhisheng and Liu, Shu and Yu, Bei and Jia, Jiaya},
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
pages={715--724},
year={2021}
}
@ARTICLE{9774921,
author={Cui, Jiequan and Liu, Shu and Tian, Zhuotao and Zhong, Zhisheng and Jia, Jiaya},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={ResLT: Residual Learning for Long-Tailed Recognition},
year={2023},
volume={45},
number={3},
pages={3695-3706},
doi={10.1109/TPAMI.2022.3174892}
}
@article{cui2022region,
title={Region Rebalance for Long-Tailed Semantic Segmentation},
author={Cui, Jiequan and Yuan, Yuhui and Zhong, Zhisheng and Tian, Zhuotao and Hu, Han and Lin, Stephen and Jia, Jiaya},
journal={arXiv preprint arXiv:2204.01969},
year={2022}
}
@article{zhong2023understanding,
title={Understanding Imbalanced Semantic Segmentation Through Neural Collapse},
author={Zhong, Zhisheng and Cui, Jiequan and Yang, Yibo and Wu, Xiaoyang and Qi, Xiaojuan and Zhang, Xiangyu and Jia, Jiaya},
journal={arXiv preprint arXiv:2301.01100},
year={2023}
}