/GCLLoss

official source code for the Paper: **Long-tailed Visual Recognition via Gaussian Clouded Logit Adjustment** based on Pytorch.

Primary LanguagePython

GCL: Long-tailed Visual Recognition via Gaussian Clouded Logit Adjustment

This is the source code for our CVPR (2022) paper: Long-tailed Visual Recognition via Gaussian Clouded Logit Adjustment based on Pytorch. This version is a demo of how to use GCL loss. The version that supports more datasets is in the works and is coming soon.

This repository also include the source code for our TAI paper: Adjusting Logit in Gaussian Form for Long-Tailed Visual Recognition. The angular form GCL can be found in losses.py GCLAngLoss.

CIFAR10

First stage

$ python cifar_train_backbone.py --arch resnet32 /
                                 --dataset cifar10 --data_path './dataset/data_img' /
                                 --loss_type 'GCL' --imb_factor 0.01 /
                                 --batch_size 64 --learning_rate 0.1 

Second stage

$ python cifar_train_classifier.py --arch resnet32 /
                                 --dataset cifar10 --data_path './dataset/data_img' /
                                 --loss_type 'GCL' --imb_factor 0.01 /
                                 --train_rule 'BalancedRS'/
                                 --batch_size 64 --learning_rate 0.1 

Results and Models for Large-scale Datasets (temporarily)

*Note: I have modified the code several times. The code in this repository may need to be modified (Mainly the backbone and classifier loading parts, the classifier network layer names may be inconsistent.) to match the pth file. Since I left my previous workplace, there is no GPU retraining model now. I temporarily share previously stored pth file for the model. Sorry for the inconvience and hope you can understand.

Sorry. I have run out of the storage space and the model parameters are temporarily unavailable. Looking for other disk now.

  • Stage-1:
Dataset Arch Top-1 Accuracy Log Model
ImageNet-LT ResNet-50 52.928% link link
iNat 2018 ResNet-50 70.327% link link
Places-LT ResNet-152 34.589% link link
  • Stage-2:
Dataset Arch Top-1 Accuracy Log Model
ImageNet-LT ResNet-50 54.884% link (train) link (val) link
iNat 2018 ResNet-50 72.005% link link
Places-LT ResNet-152 40.641% link link

Citation

To do list:

  • Support Cifar10/100-LT dataset
  • Support imageNet-LT
  • Support iNaturalist2018
  • Support Places365-LT
  • More loss functions
  • Separate configuration files for easier execution
  • Some other minor performance improvements

Other Resources of long-tailed visual recognition

Awesome-LongTailed-Learning

Awesome-of-Long-Tailed-Recognition

Long-Tailed-Classification-Leaderboard

BagofTricks-LT

Connection

If you have any questions, please send the email to Mengke Li at: csmkli@comp.hkbu.edu.hk.

Citation

@inproceedings{Li2022GCL,
  author    = {Mengke Li, Yiu{-}ming Cheung, Yang Lu},
  title     = {Long-tailed Visual Recognition via Gaussian Clouded Logit Adjustment},
  pages = {6929-6938},
  booktitle = {CVPR},
  year      = {2022},
}
@article{Li2024AGCL,
  author={Li, Mengke and Cheung, Yiu-ming and Lu, Yang and Hu, Zhikai and Lan, Weichao and Huang, Hui},
  journal={IEEE Transactions on Artificial Intelligence}, 
  title={Adjusting Logit in Gaussian Form for Long-Tailed Visual Recognition}, 
  year={2024},
  volume={},
  number={},
  pages={1-15},
  doi={10.1109/TAI.2024.3401102}}

Acknowledgment

We refer to some codes from MisLAS. Many thanks to the authors.