Class-incremental learning (CIL) with Prompt-Based Exemplar Super-Compression and Regeneration (PESCR), a diffusion-based approach that boosts CIL performance by storing exemplars with increased quantity and enhanced diversity under limited memory budget. PESCR works by
- extracting visual and textual prompts from selected images and saving prompts instead of images
- regenerating exemplars from prompts with ControlNet for CIL model training in subsequent phases
Official implementation of
Prompt-Based Exemplar Super-Compression and Regeneration for Class-Incremental Learning [BMVC 2025]
Ruxiao Duan1,
Jieneng Chen2,
Adam Kortylewski3,4,
Alan Yuille2,
Yaoyao Liu5,
1Yale University,
2Johns Hopkins University,
3University of Freiburg,
4Max Planck Institute for Informatics,
5University of Illinois Urbana-Champaign
git clone https://github.com/lllyasviel/ControlNet.git
conda env create -f ControlNet/environment.yaml
conda activate control
- Download ControlNet from HuggingFace and save the Canny edge model (
control_sd15_canny.pth) inControlNet/models/control_sd15_canny.pth.
- Choose an image classification dataset and save all images in the form of
<data-dir>/<dataset-name>/<mode>/<class-label>/<image-filename><data-dir>: directory to store all datasets.<dataset-name>: name of the dataset.<mode>: either "train" or "test".<class-label>: the class tag, e.g., "cupcakes".<image-filename>: the image filename, e.g., "0001.jpg".
- If the dataset is not implemented, add it to the scripts.
- In
utils/data.py, set another class by specifying the dataset name and its number of categories. - In
utils/data_manager.py, add a mapping from the dataset name to its class instance in_get_idata().
- In
- In
compress/compress.pyandcompress/compress_lowres.py, setCNET_DIRto<pwd>/ControlNet. - In
compress/compress.pyandcompress/compress_lowres.py, setDATA_DIRto<data-dir>. - In
utils/data.py, setself.data_dirto<data-dir>. - In
utils/toolkit.py, set return ofoutput_folder()as path to the output folder.
-
We compress all the training images into edge maps and generate their copies by ControlNet in advance.
-
In
compress/compress.pyandcompress/compress_lowres.py, setSEEDSto seeds of your choice, e.g.,range(5). -
If the images are relatively high-resolution, run
python compress/compress.py
- If the images are relatively low-resolution, run
python compress/compress_lowres.py
- In
exps/config.jsonset training parameters. Most configurations follow the convention of PyCIL, except:augmentation_prob: the probability of replacing a real image during one of its generated copies during training.augmentations_per_image: the number of generated copies per image.memory_per_class: memory budget in units per class.real_per_class: number of real exemplars per class.syn_per_class: number of synthetic exemplars per class.
- For instance, if we can set
memory_per_class=20,real_per_class=18, andsyn_per_class=48.
python main.py
The CIL framework is developed based on PyCIL.
