Giter Site home page Giter Site logo

upcl's Introduction

Rethinking Class Incremental Learning from a Dynamic Imbalanced Learning Perspective


Introduction

This code is based on PyCIL with modifications to details such as log output. All the original logs of the experiments mentioned in the paper are located in the logs/. The code for our proposed UPCL is located in models/upcl.py.

If you use our method or code in your research, please consider citing the paper as follows:

@article{wang2024rethinking,
  title={Rethinking Class-Incremental Learning from a Dynamic Imbalanced Learning Perspective},
  author={Wang, Leyuan and Xiang, Liuyu and Wang, Yunlong and Wu, Huijia and He, Zhaofeng},
  journal={arXiv preprint arXiv:2405.15157},
  year={2024}
}

Dependencies

  1. torch 1.81
  2. torchvision 0.6.0
  3. tqdm
  4. numpy
  5. scipy

Run experiment

  1. Edit the [MODEL NAME].json file for global settings.
  2. Edit the hyper-parameters in the corresponding [MODEL NAME].py file (e.g., models/icarl.py).
  3. Run: python main.py --config=./exps/[MODEL NAME].json
  4. hyper-parameters

When using PyCIL, you can edit the global parameters and algorithm-specific hyper-parameter in the corresponding json file.

These parameters include:

  • memory-size: The total exemplar number in the incremental learning process. Assuming there are $K$ classes at the current stage, the model will preserve $\left[\frac{memory_size}{K}\right]$ exemplar per class.
  • init-cls: The number of classes in the first incremental stage. Since there are different settings in CIL with a different number of classes in the first stage, our framework enables different choices to define the initial stage.
  • increment: The number of classes in each incremental stage $i$, $i$ > 1. By default, the number of classes per incremental stage is equivalent per stage.
  • convnet-type: The backbone network for the incremental model.
  • seed: The random seed adopted for shuffling the class order. According to the benchmark setting, it is set to 1993 by default.

Datasets

We have implemented the pre-processing of CIFAR100, imagenet100, Tinyimagenet, and imagenet1000. When training on CIFAR100, this framework will automatically download it. When training on imagenet100/1000 and Tinyimagenet, you should specify the folder of your dataset in utils/data.py.

    def download_data(self):
        assert 0,"You should specify the folder of your dataset"
        train_dir = '[DATA-PATH]/train/'
        test_dir = '[DATA-PATH]/val/'

upcl's People

Contributors

debatrix avatar

Watchers

 avatar

upcl's Issues

It won't run with the default settings

感谢您对 CIL 领域的贡献!
当我下载upcl代码后,用默认设置运行代码,出现了下面的问题,您能帮忙看看吗?
2024-06-12 21:13:55,771 [trainer.py] => 'UPCL_iCaRL' object has no attribute 'k'
Traceback (most recent call last):
File "/home/ps/dl/shuai/UPCL-main/trainer.py", line 82, in _train
model.incremental_train(data_manager)
File "/home/ps/dl/shuai/UPCL-main/models/icarl.py", line 74, in incremental_train
self._train(self.train_loader, self.test_loader)
File "/home/ps/dl/shuai/UPCL-main/models/upcl.py", line 273, in _train
k = min(fea_mask.sum(0).min(), self.k)
AttributeError: 'UPCL_iCaRL' object has no attribute 'k'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.