All Projects → dvlab-research → Parametric-Contrastive-Learning

dvlab-research / Parametric-Contrastive-Learning

Licence: MIT license
Parametric Contrastive Learning (ICCV2021)

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects
shell
77523 projects
Dockerfile
14818 projects
Batchfile
5799 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Parametric-Contrastive-Learning

ResLT
ResLT: Residual Learning for Long-tailed Recognition (TPAMI 2022)
Stars: ✭ 40 (-74.19%)
Mutual labels:  class-imbalance, imbalanced-data, imbalanced-learning, long-tailed-recognition
mesa
NeurIPS’20 | Build powerful ensemble class-imbalanced learning models via meta-knowledge-powered resampler. | 设计元知识驱动的采样器解决类别不平衡问题
Stars: ✭ 88 (-43.23%)
Mutual labels:  class-imbalance, imbalanced-data, imbalanced-learning
imbalanced-ensemble
Class-imbalanced / Long-tailed ensemble learning in Python. Modular, flexible, and extensible. | 模块化、灵活、易扩展的类别不平衡/长尾机器学习库
Stars: ✭ 199 (+28.39%)
Mutual labels:  class-imbalance, imbalanced-data, imbalanced-learning
Skin Lesions Classification DCNNs
Transfer Learning with DCNNs (DenseNet, Inception V3, Inception-ResNet V2, VGG16) for skin lesions classification
Stars: ✭ 47 (-69.68%)
Mutual labels:  imagenet, image-classification
Iresnet
Improved Residual Networks (https://arxiv.org/pdf/2004.04989.pdf)
Stars: ✭ 163 (+5.16%)
Mutual labels:  imagenet, image-classification
Imgclsmob
Sandbox for training deep learning networks
Stars: ✭ 2,405 (+1451.61%)
Mutual labels:  imagenet, image-classification
Regnet
Pytorch implementation of network design paradigm described in the paper "Designing Network Design Spaces"
Stars: ✭ 129 (-16.77%)
Mutual labels:  imagenet, image-classification
Neural Pipeline
Neural networks training pipeline based on PyTorch
Stars: ✭ 315 (+103.23%)
Mutual labels:  supervised-learning, image-classification
Labelimg
🖍️ LabelImg is a graphical image annotation tool and label object bounding boxes in images
Stars: ✭ 16,088 (+10279.35%)
Mutual labels:  imagenet, image-classification
Malware Classification
Towards Building an Intelligent Anti-Malware System: A Deep Learning Approach using Support Vector Machine for Malware Classification
Stars: ✭ 88 (-43.23%)
Mutual labels:  supervised-learning, image-classification
SCL
📄 Spatial Contrastive Learning for Few-Shot Classification (ECML/PKDD 2021).
Stars: ✭ 42 (-72.9%)
Mutual labels:  image-classification, contrastive-learning
head-network-distillation
[IEEE Access] "Head Network Distillation: Splitting Distilled Deep Neural Networks for Resource-constrained Edge Computing Systems" and [ACM MobiCom HotEdgeVideo 2019] "Distilled Split Deep Neural Networks for Edge-assisted Real-time Systems"
Stars: ✭ 27 (-82.58%)
Mutual labels:  imagenet, image-classification
Alexnet
implement AlexNet with C / convolutional nerual network / machine learning / computer vision
Stars: ✭ 147 (-5.16%)
Mutual labels:  imagenet, image-classification
Efficientnet
Implementation of EfficientNet model. Keras and TensorFlow Keras.
Stars: ✭ 1,920 (+1138.71%)
Mutual labels:  imagenet, image-classification
Torchdistill
PyTorch-based modular, configuration-driven framework for knowledge distillation. 🏆18 methods including SOTA are implemented so far. 🎁 Trained models, training logs and configurations are available for ensuring the reproducibiliy.
Stars: ✭ 177 (+14.19%)
Mutual labels:  imagenet, image-classification
Aognet
Code for CVPR 2019 paper: " Learning Deep Compositional Grammatical Architectures for Visual Recognition"
Stars: ✭ 132 (-14.84%)
Mutual labels:  imagenet, image-classification
alexnet-architecture.tensorflow
Unofficial TensorFlow implementation of "AlexNet" architecture.
Stars: ✭ 15 (-90.32%)
Mutual labels:  supervised-learning, imagenet
Petridishnn
Code for the neural architecture search methods contained in the paper Efficient Forward Neural Architecture Search
Stars: ✭ 112 (-27.74%)
Mutual labels:  imagenet, image-classification
Labelbox
Labelbox is the fastest way to annotate data to build and ship computer vision applications.
Stars: ✭ 1,588 (+924.52%)
Mutual labels:  imagenet, image-classification
Face.evolve.pytorch
🔥🔥High-Performance Face Recognition Library on PaddlePaddle & PyTorch🔥🔥
Stars: ✭ 2,719 (+1654.19%)
Mutual labels:  supervised-learning, imbalanced-learning

Imbalanced Learning for Recognition

This repository contains the code of our papers on the topic of imbalanced learning for recognition.

  • 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 arXiv paper Generalized Parametric Contrastive Learning (https://arxiv.org/abs/2209.12400).

PWC PWC PWC PWC

Full ImageNet Classification and Out-of-Distribution Robustness

Method Model Full ImageNet ImageNet-C (mCE) ImageNet-C (rel. mCE) ImageNet-R ImageNet-S link log
GPaCo ResNet-50 79.7 50.9 64.4 41.1 30.9 download download
CE ViT-B 83.6 39.1 49.9 49.9 36.1 --- download
CE ViT-L 85.7 32.4 41.4 60.3 45.5 --- download
multi-task ViT-B 83.4 --- --- --- --- --- download
GPaCo ViT-B 84.0 37.2 47.3 51.7 39.4 download download
GPaCo ViT-L 86.0 30.7 39.0 60.3 48.3 download download

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

Method Model Top-1 Acc(%) link log
GPaCo ResNet-50 58.5 download download
GPaCo ResNeXt-50 58.9 download download
GPaCo ResNeXt-101 60.8 download download
GPaCo ensemble( 2-ResNeXt-101) 63.2 --- ---

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

Method Model Top-1 Acc(%) link log
GPaCo ResNet-152 41.7 download download

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)

Method Model Top-1 Acc(%) link log
PaCo ResNet-50 79.3 download download
PaCo ResNet-101 80.9 download download
PaCo ResNet-200 81.8 download download

ImageNet-LT (Imbalance setting)

Method Model Top-1 Acc(%) link log
PaCo ResNet-50 57.0 download download
PaCo ResNeXt-50 58.2 download download
PaCo ResNeXt-101 60.0 download download

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 ([email protected]) or Github issues. Enjoy!

BibTex

If you find this code or idea useful, please consider citing our work:

@article{cui2022generalized,
  title={Generalized Parametric Contrastive Learning},
  author={Cui, Jiequan and Zhong, Zhisheng and Tian, Zhuotao and Liu, Shu and Yu, Bei and Jia, Jiaya},
  journal={arXiv preprint arXiv:2209.12400},
  year={2022}
}

@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={2022},
  volume={},
  number={},
  pages={1-1},
  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}
  }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].