- This codebase is built on PC.
We currently provide the training code of xERM-PC for CIFAR100-LT and ImageNet-LT.
To obtain the same results, please make sure to set up the same environment.
conda create --name xERM --file spec-list.txt
- Prepare dataset: CIFAR-100, ImageNet-LT
- Please download those datasets following Decoupling.
Step 1: Train PC model
python main.py --seed 1 --cfg config/CIFAR100_LT/ce100.yaml --gpu 0
Step 2: Train xERM-PC model:
python main.py --seed 1 --cfg config/CIFAR100_LT/ce100.yaml --gpu 0 --xERM
Step 3: Evaluate:
python main.py --seed 1 --cfg config/CIFAR100_LT/ce100.yaml --gpu 0 --xERM --test
Step 1: Train PC model:
python main.py --seed 1 --gpu 0 --cfg config/CIFAR100_LT/ce50.yaml
Step 2: Train xERM-PC model:
python main.py --seed 1 --gpu 0 --cfg config/CIFAR100_LT/ce50.yaml --xERM
Step 3: Evaluate:
python main.py --seed 1 --gpu 0 --cfg config/CIFAR100_LT/ce50.yaml --xERM --test
Step 1: Train PC model
python main.py --seed 1 --gpu 0 --cfg config/CIFAR100_LT/ce10.yaml
Step 2: Train xERM-PC model:
python main.py --seed 1 --gpu 0 --cfg config/CIFAR100_LT/ce10.yaml --xERM
Step 3: Evaluate:
python main.py --seed 1 --gpu 0 --cfg config/CIFAR100_LT/ce10.yaml --xERM --test
Step 1: Train PC model
python main.py --cfg config/ImageNet_LT/ce.yaml --seed 1 --gpu 0,1,2,3
Step 2: Train xERM-PC model:
python main.py --cfg config/ImageNet_LT/ce.yaml --seed 1 --gpu 0,1,2,3 --xERM
Step 3: Evaluate
python main.py --cfg config/ImageNet_LT/ce.yaml --seed 1 --gpu 0,1,2,3 --xERM --test
*We modify the original config of PC. To run the original config of PC, please change the config/ImageNet_LT/ce.yaml to config/ImageNet_LT/ce_pc.yaml
if you find our codes helpful, please cite our paper:
@inproceedings{beierxERM,
title={Cross-Domain Empirical Risk Minimization for Unbiased Long-tailed Classification},
author={Zhu, Beier and Niu, Yulei and Hua, Xian-Sheng and Zhang, Hanwang},
booktitle={AAAI Conference on Artificial Intelligence},
year={2022}
}
The use of this software is released under BSD-3.