This is the official repository for the CVPR 2021 Continual Learning workshop paper: "A Tale of Two CILs: The Connections between Class Incremental Learning and Class Imbalanced Learning, and Beyond" [Paper] [Supp]
You can perform the following three steps to run our codes!
The code is implemented in Python 3.6.
As for CUDA, we use CUDA 10.1 and cuDNN 7.6.
For requirements for the Python modules, you can simply run:
pip install -r requirements.txt
For CIFAR-100, download the python version of CIFAR-100
and extract it in a certain folder, let's say /home/user/cifar-100-python, then set data_path of cifar100.py to
this folder.
For Group ImageNet, download the
ImageNet64x64 ([Google Drive] [百度网盘 (提取码:nqi7)]
dataset first and change data_path in imagenet64x64.py to your folder path. ImageNet64x64 is a downsampled ImageNet
according to https://patrykchrabaszcz.github.io/Imagenet32/.
After downloading the datasets and changing the data_path, simply run the following scripts for CIFAR-100 and
Group ImageNet respectively (some configurations in the script should be set in advance, e.g. LD_LIBRARY_PATH):
bash scripts/cifar100.sh
bash scripts/imagenet64x64.sh
By default, the scripts above use LeNet on CIFAR-100 and ResNet-18 on Group ImageNet. You can change
the COMMON_FLAGS if you want to try other settings.
Also, by default it will run 5 different class orders on CIFAR-100 and 3 different class orders on Group ImageNet, and
it may take too much time to finish training. For acceleration, you can simply change the for i in {1..5}
to for i in {1..1} to reduce the number of class orders.
After running all experiments above, you can run the following scripts to show the top-1 accuracy and running time of all methods:
bash scripts/show_cifar100.sh
bash scripts/show_imagenet64x64.sh
Note that if you reduce the number of class orders, the value of num_orders in those two scripts should also be
changed. For instance, if you use for i in {1..1} in 3.1 Training, the value of num_orders should be set
to 1.
To obtain the violin graphs and the polar charts, simply go to the result folders of post-scaling and MDFCIL,
which are
in result/cifar100_random_1/base_10_inc_10_total_100/seed_1993/skip_first_resnet_70_adam_0.005_aug_wd_0.0001_random_20_total_lwf_1.0_temp_2.0_post_scaling
and result/imagenet64x64_10x10_random_1/base_10_inc_10_total_100/seed_1993/skip_first_resnet18_70_adam_0.005_aug_wd_0.0001_random_20_total_lwf_1.0_temp_2.0_adj_w_weight_aligning_no_bias
respectively.
If you use these codes, please cite our paper:
@inproceedings{he2021tale,
title={A Tale of Two CILs: The Connections Between Class Incremental Learning and Class Imbalanced Learning, and Beyond},
author={He, Chen and Wang, Ruiping and Chen, Xilin},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops},
pages={3559--3569},
year={2021}
}You can regard this repository as a Tensorflow library for Class Incremental Learning methods, a counterpart for Avalanche or Sequoia implemented by PyTorch. A more comprehensive version can be found in TF2-CIL.
However, the main purpose of this work is to compare the anti-biasing techniques in recent Class Incremental Learning methods. Thus, unfair techniques such as cutmix, intense data augmentation are removed.
If your goal is to fully reproduce results listed in other papers, then this repository might not be the optimal solution.
If you have any question, feel free to contact me. My email is chen.he@vipl.ict.ac.cn