Skip to content

Latest commit

 

History

History
109 lines (55 loc) · 2.34 KB

README.md

File metadata and controls

109 lines (55 loc) · 2.34 KB

PPL with CRI Loss for Imbalanced Classification

Our code is based on MisLAS and RIDE models.

Installation

Requirements

  • numpy==1.22.0
  • python==3.9
  • pytorch==1.10.1
  • torchvision==0.11.2
  • tqdm==4.62.3
  • pillow==8.4.0

Dataset Preparation

For ImageNet-LT and iNaturalist2018, please prepare data in the data directory:

datasets
├── data_txt
    ├── iNaturalist18_train.txt
    ├── iNaturalist18_val.txt
    ├── ImageNet_LT_train.txt
    └── ImageNet_LT_test.txt

getting the txt files from data_txt file Link

For CRI+PPL, change the data_path in config/.../.yaml;

For CRI+PPW+RIDE, change the data_loader:{data_dir} in ./config/...json`.

Training

one GPU for Imbalance cifar10 & cifar100, two GPUs for ImageNet-LT, and eight GPUs iNaturalist2018.

Backbone network can be resnet32 for Imbalance cifar10 & cifar100, resnet10 for ImageNet-LT, and resnet50 for iNaturalist2018.

CRI+PPL

Imbalance cifar10 & cifar100:

python train.py --cfg ./config/cifar10/cifar10_CRI.yaml

python train.py --cfg ./config/cifar100/cifar100_CRI.yaml

ImageNet-LT:

python train.py --cfg ./config/imagenet/imagenet_CRI.yaml

ina2018:

python train.py --cfg ./config/ina2018/ina2018_CRI.yaml

CRI+PPW+RIDE

Imbalance cifar10 & cifar100:

python train.py --cfg ./config/cifar10.json

python train.py --cfg ./config/cifar100.json

ImageNet-LT:

python train.py --cfg ./config/imagenet.json

ina2018:

python train.py --cfg ./config/ina2018.json

Validation

CRI+PPL

python eval.py --cfg ./config/....yaml resume /path/ckps/...pth.tar

CRI+PPW+RIDE

python eval.py --cfg ./config/....json --resume /path/...pth

Results and Models

CRI+PPL

Links to models

CRI+PPW+RIDE

Links to models