Home

Awesome

BudgetCL

This repository contains the code for the paper:

Computationally Budgeted Continual Learning: What Does Matter?, CVPR 2023
Ameya Prabhu*, Hasan Abed Al Kader Hammoud*, Puneet Dokania, Philip Torr, Ser-Nam Lim, Bernard Ghanem, Adel Bibi

[Arxiv] [PDF] [Bibtex]

<p align="center"> <img src="https://github.com/drimpossible/BudgetCL/assets/74360386/5af6d831-a8ea-40f9-a213-15855fc9d509" width="250" alt="Figure which describes our conclusions"> </p>

Getting started

Running our code requires 1x80GB A100 GPU with PyTorch >=1.13.

# First, activate a new virtual environment
$ pip install -r requirements.txt

Setting up the Datasets

Recreating the dataset

ImageNet2K

ImageNet2K is a dataset introduced by us, consists of 1K classes from the original dataset and 1K additional classes from ImageNet21K.

To create ImageNet2K dataset:

python select_subset_imagenet21k.py PATH_TO_IMAGENET21K PATH_TO_IMAGENET1K 1000 1200 ../clim2k/
python copy_imnet21k_to_imnet2k.py PATH_TO_IMAGENET21K PATH_TO_IMAGENET2K ../clim2k/

Continual Google Landmarks V2 (CGLM)

Directory structure

BudgetCL/
|–– data/
|–––– cglm/
|–––– clim2k/
|–– src/
|–– scripts/
|–– README.md
|–– requirements.txt
|–– .gitignore
|–– LICENSE

Usage

To run any model specified in the paper one needs to simply modify the arguments, an example command below (reproduces our Naive baseline on CI-ImageNet2K):

python main.py --log_dir='../logs/sampling/' \
              --order_file_dir=../data/clim2k/order_files/ \
              --train_batch_size 1500 \
              --test_batch_size 1500 \
              --crop_size 224 \
              --dset_mode='class_incremental' \
              --num_classes_per_timestep=50 \
              --num_timesteps=20 \
              --increment_size=0 \
              --optimizer="SGD" \
              --model='resnet50' \
              --sampling_mode='uniform' \
              --model_type='normal' \
              --maxlr=0.1 \
              --total_steps=400 \
              --seed=1 \
              --weight_decay=0 \
              --clip=2.0 \
              --num_workers=8 \
              --momentum 0.9

Arguments you can tweak for your new cool CL pipeline/formulation/method:

To vary the number of timesteps change:

In DI-ImageNet2K and CGLM:

In CI-ImageNet2K, increase one and decrease the other:

Extension to New Datasets

If you discover any bugs in the code please contact me, I will cross-check them with my nightmares.

Discovered mistakes:

Citation

We hope our benchmark and contributions are valuable to advance your work in continual learning! To cite our work:

@inproceedings{prabhu2023computationally,
  title={Computationally Budgeted Continual Learning: What Does Matter?},
  author={Prabhu, Ameya and Hammoud, Hasan Abed Al Kader and Dokania, Puneet and Torr, Philip HS and Lim, Ser-Nam and Ghanem, Bernard and Bibi, Adel},
  booktitle={IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2023},
}