This is the official implementation of Influence-balanced Loss for Imbalanced Visual Classification in PyTorch. The code heavily relies on LDAM-DRW.
Paper | Bibtex | Video | Slides
All codes are written by Python 3.7, and 'requirements.txt' contains required Python packages. To install requirements:
pip install -r requirements.txt
Create 'data/' directory and download original data in the directory to make imbalanced versions.
- Imbalanced CIFAR. The original data will be downloaded and converted by
imbalancec_cifar.py
. - Imbalanced Tiny ImageNet. Download the data first, and convert them by
imbalance_tinyimagenet.py
. - The paper also reports results on iNaturalist 2018. We will update the code for iNaturalist 2018 later.
We provide several training examples:
- CE baseline (CIFAR-100, long-tailed imabalance ratio of 100)
python cifar_train.py --dataset cifar100 --loss_type CE --train_rule None --imb_type exp --imb_factor 0.01 --epochs 200 --num_classes 100 --gpu 0
- IB (CIFAR-100, long-tailed imabalance ratio of 100)
python cifar_train.py --dataset cifar100 --loss_type IB --train_rule IBReweight --imb_type exp --imb_factor 0.01 --epochs 200 --num_classes 100 --start_ib_epoch 100 --gpu 0
- IB + CB (CIFAR-100, long-tailed imabalance ratio of 100)
python cifar_train.py --dataset cifar100 --loss_type IB --train_rule CBReweight --imb_type exp --imb_factor 0.01 --epochs 200 --num_classes 100 --start_ib_epoch 100 --gpu 0
- IB + Focal (CIFAR-100, long-tailed imabalance ratio of 100)
python cifar_train.py --dataset cifar100 --loss_type IBFocal --train_rule IBReweight --imb_type exp --imb_factor 0.01 --epochs 200 --num_classes 100 --start_ib_epoch 100 --gpu 0
- CE baseline (long-tailed imabalance ratio of 100)
python tinyimage_train.py --dataset tinyimagenet -a resnet18 --loss_type CE --train_rule None --imb_type exp --imb_factor 0.01 --epochs 100 --lr 0.1 --num_classes 200
- IB (long-tailed imabalance ratio of 100)
python tinyimage_train.py --dataset tinyimagenet -a resnet18 --loss_type IB --train_rule IBReweight --imb_type exp --imb_factor 0.01 --epochs 100 --lr 0.1 --num_classes 200 --start_ib_epoch 50
If you find our paper and repo useful, please cite our paper
@InProceedings{Park_2021_ICCV,
author = {Park, Seulki and Lim, Jongin and Jeon, Younghan and Choi, Jin Young},
title = {Influence-Balanced Loss for Imbalanced Visual Classification},
booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
month = {October},
year = {2021},
pages = {735-744}
}