Skip to content

TonyPod/Two-CILs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Two-CILs

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!

1. Requirements

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

2. Datasets

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/.

3. Usage

3.1 Training

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.

3.2. Comparison

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.

3.3. Visualization

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.

Citation

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}
}

Note

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.

Further

If you have any question, feel free to contact me. My email is chen.he@vipl.ict.ac.cn

About

Codes 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"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors