Stationary Representations: Optimally Approximating Compatibility and Implications for Improved Model Replacements
This repo contains the source code of the Python package iamcl2r and it is the official implementation of:
Stationary Representations: Optimally Approximating Compatibility and Implications for Improved Model Replacements, Niccolò Biondi, Federico Pernici, Simone Ricci, Alberto Del Bimbo at CVPR2024.
Our paper has been selected as Poster Highlight (notable top 2.8%).
Arxiv link: https://arxiv.org/abs/2405.02581
The repo also contains several examples on Google Colab and IPython Notebook.
See NOTEBOOKS.md for more details.
We only support PyTorch for now.
See our paper for a detailed description of
There are several directories in this repo:
- notebooks/ contains the code for the Google Colab and IPython Notebook examples we provide;
- src/iamcl2r/ contains the source code for the package
iamcl2r; - configs/ contains the configuration files for the examples;
-
Installation
Installingiamcl2ris simplygit clone https://github.com/miccunifi/iamcl2r cd iamcl2r make installThis creates a virtual enviroment and installs all the required dependencies.
Create the .env file (Optional but suggested)
Create an
.envfile to automatically export your env vars before launching training. An example of an.envfile isWANDB_USERNAME=<your wandb username> WANDB_API_KEY=<your wandb private api key> WANDB_ENTITY=<wandb entity> WANDB_PROJECT=<wandb project name>
The
.envfile is not released for security reasons.
-
Download the pretrained models
These models are used to replace the fine-tuned model in a$\text{IAM-CL}^2\text{R}$ training.make download-pretrained-models
-
Run
$\text{IAM-CL}^2\text{R}$ training
We only support$d$ -Simplex-HOC and ER baseline for now.# d-Simplex-HOC training make run CONFIG=configs/hoc_7tasks.yaml make run CONFIG=configs/hoc_31tasks.yaml # ER baseline training make run CONFIG=configs/er_7tasks.yaml make run CONFIG=configs/er_31tasks.yaml
-
Run a compatibility evaluation
Customize the configuration file eval.yaml by changing thecheckpoint_pathline... checkpoint_path: <FOLDER_PATH> ...
After that, you can evaluate the compatibility of the models which checkpoints are in the
<FOLDER_PATH>you have specified above.make run CONFIG=configs/eval.yaml
We have released some experimental results obtained using the code in the repo. See NOTEBOOKS.md for more details.
If you use this code in your research, please kindly cite the following paper:
@inproceedings{biondi2024stationary,
title={Stationary Representations: Optimally Approximating Compatibility and Implications for Improved Model Replacements},
author={Biondi, Niccolò and Pernici, Federico and Ricci, Simone and Del Bimbo, Alberto},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2024},
}For help, new features, or reporting bugs associated with this repo, please open a GitHub issue or contact us if you have any questions.