This repo contains the implementation for paper:
Xiaofan Yu, Tajana Rosing, Yunhui Guo. "EVOLVE: Enhancing Unsupervised Continual Learning with Multiple Experts" in WACV 2024.
We emulate the hybrid mode of cloud and edge device in one environment.
OnlineContrast
holds the implementation of our method Evolve and CaSSLe. The code is implemented based on SupContrast.UCL
holds the implementation of LUMP, PNN, SI, DER adapted from the original repo UCL.
Dataset configuration for OnlineContrast
and UCL
is in data_utils.py
. Model and training configuration is in set_utils.py
. The shared evaluation functions are in eval_utils.py
.
In each folder, set up the environment with pip3 install -r requirements.txt
.
To use the pretrained models as teacher models, please download the zip file pretrained_models.zip
from here and unzip it in the root directory.
We mainly focus on image classification while the methodology can be applied to more general scenarios. In this repo, we test with CIFAR-10 (10 classes), TinyImageNet (100 classes), CoRe50 (50 classes) and Stream-51 (51 classes).
For all methods in OnlineContrast
and UCL
folders, the shared root dataset directory is datasets
.
- All download and configuration should be completed automatically by the code.
- For TinyImageNet, sometimes the download cannot proceed normaly. If that is the case, please download the original TinyImageNet. Unzip the file under
datasets/TINYIMG
. - Our data loaders for CoRe50 and Stream51 is adapted from Avalanche.
We list the commands to fire our method and each baseline in the following lines.
To run our method Evolve:
cd OnlineContrast/scripts
bash ./run-evolve.sh evolve <cifar10/tinyimagenet/core50/stream51> <iid/seq/seq-im> <trial#>
- We test with three types of data streams as discussed in the paper: (1) iid, (2) sequential classes (seq), and (3)sequential classes with imbalance lengths (seq-im). More details about data stream configuration are explained later.
- For all implementations, the last argument of
trial#
(e.g.,0,1,2
) determines the random seed configuration. Hence using the sametrial#
produces the same random selection.
You can run run-cassle.sh
to run the corresponding baseline with similar argument format.
The linear evaluation of all methods is implemented in main_linear.py
and run_linear.sh
.
We replace the original data loader with our own loader. For evaluation, we also adapt the original code with our own clustering and kNN classifier on the learned embeddings.
We run LUMP (mixup
in argument), PNN, SI and DER as baselines to compare:
cd UCL
bash ./run-baseline.sh <mixup/pnn/si/der> <simclr/byol/simsiam/barlowtwins/vicreg> <cifar10/tinyimagenet/core50/stream51> <iid/seq/seq-im> <trial#>
The single-pass and non-iid data streams are the key motivation of the paper, with more details discussed in our precedent work.
More implementation details can be found in ./data_utils.py
in the SeqSampler
class.
If you found the codebase useful, please consider cite our work.
MIT
If you have any questions, please feel free to contact x1yu@ucsd.edu.