{"id":28069854,"url":"https://github.com/tf63/acmap","last_synced_at":"2025-05-12T19:15:47.700Z","repository":{"id":284111667,"uuid":"897173745","full_name":"tf63/ACMap","owner":"tf63","description":"[CVPR2025] The implementation of Adapter Merging with Centroid Prototype Mapping for Scalable Class-Incremental Learning","archived":false,"fork":false,"pushed_at":"2025-05-04T14:11:24.000Z","size":358,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T19:15:39.735Z","etag":null,"topics":["cvpr2025","docker","python","pytorch","rye","wandb"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2412.18219","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tf63.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-02T06:57:52.000Z","updated_at":"2025-05-04T14:30:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"14a57a14-7a08-4472-83ca-c75f3ea20aeb","html_url":"https://github.com/tf63/ACMap","commit_stats":null,"previous_names":["tf63/acmap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2FACMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2FACMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2FACMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf63%2FACMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tf63","download_url":"https://codeload.github.com/tf63/ACMap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805841,"owners_count":21967054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cvpr2025","docker","python","pytorch","rye","wandb"],"created_at":"2025-05-12T19:15:47.193Z","updated_at":"2025-05-12T19:15:47.693Z","avatar_url":"https://github.com/tf63.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eAdapter Merging with Centroid Prototype Mapping \u003cbr\u003e for Scalable Class-Incremental Learning\u003c/h1\u003e\n\n[![GitHub stars](https://img.shields.io/github/stars/tf63/ACMap?style=social)](https://github.com/tf63/ACMap/stargazers)\n[![arXiv](https://img.shields.io/badge/arxiv-2412.18219-B31B1B?logo=arxiv\u0026logoColor=white)](https://arxiv.org/abs/2412.18219)\n[![Poster@CVPR2025](https://img.shields.io/badge/Poster-CVPR2025-1B427D?logo=files\u0026logoColor=white)](https://cvpr.thecvf.com/virtual/2025/poster/32443)\n![Python](https://img.shields.io/badge/Python-3.8.10-3571A1?logo=python\u0026logoColor=white)\n![PyTorch](https://img.shields.io/badge/PyTorch-2.0.1-5F9870?logo=pytorch\u0026logoColor=white)\n![CUDA](https://img.shields.io/badge/CUDA-11.7-89BF3E?logo=nvidia\u0026logoColor=white)\n\u003c!-- ![License: MIT](https://img.shields.io/badge/LICENSE-MIT-yellow?logo=open-source-initiative) --\u003e\n\n\n\u003ci\u003eTakuma Fukuda\u003c/i\u003e, \u003ci\u003eHiroshi Kera\u003c/i\u003e, \u003ci\u003eKazuhiko Kawamoto\u003c/i\u003e\n\n\u003c!-- [[arxiv]](https://arxiv.org/abs/2412.18219) | [[poster]](https://cvpr.thecvf.com/virtual/2025/poster/32443) --\u003e\n\n**Abstract**\n\nWe propose Adapter Merging with Centroid Prototype Mapping (ACMap), an exemplar-free framework for classincremental learning (CIL) that addresses both catastrophic\nforgetting and scalability. While existing methods tradeoff between inference time and accuracy, ACMap consolidates task-specific adapters into a single adapter, ensuring constant inference time across tasks without compromising accuracy. The framework employs adapter merging to build a shared subspace that aligns task representations and mitigates forgetting, while centroid prototype\nmapping maintains high accuracy through consistent adaptation in the shared subspace. To further improve scalability, an early stopping strategy limits adapter merging\nas tasks increase. Extensive experiments on five benchmark datasets demonstrate that ACMap matches state-ofthe-art accuracy while maintaining inference time comparable to the fastest existing methods\n\n\u003c/div\u003e\n\n![](docs/method.png)\n\n### 📰 News\n\n-   [2025/02/27] 🎉 Our paper has been accepted to CVPR2025!!\n-   [2024/12/24] 📄 [arxiv](https://arxiv.org/abs/2412.18219) paper has been released.\n-   [2024/12/24] 🏁 Code has been released.\n\n### 💐 Acknowledgements\n\nWe extend our gratitude to the authors of the following resources for their invaluable contributions to the field of class-incremental learning, which significantly informed and inspired our research:\n\n-   [Deep Class-Incremental Learning: A Survey](https://github.com/zhoudw-zdw/CIL_Survey)\n-   [PILOT: A Pre-Trained Model-Based Continual Learning Toolbox](https://github.com/sun-hailong/LAMDA-PILOT)\n-   [Revisiting Class-Incremental Learning with Pre-Trained Models: Generalizability and Adaptivity are All You Need](https://github.com/zhoudw-zdw/RevisitingCIL)\n-   [Expandable Subspace Ensemble for Pre-Trained Model-Based Class-Incremental Learning](https://github.com/sun-hailong/CVPR24-Ease)\n\n## 💬 Installation\n\nThis repository supports two setup methods:\n\n-   ⭐️ **A. Container setup with Docker (recommended)**\n-   👻 **B. Local setup with Rye**\n\nWindows is not supported, so please refer to `docker/Dockerfile` and `pyproject.toml` to set up the environment manually.\n\n### ⭐️ A. Container setup with Docker (recommended)\n\nBuild the Docker container:\n\n```shell\nbash docker.sh build\n```\n\nCreate a `.env` file by copying `.env.example`. **Be sure to exclude `.env` from version control**.\n\n```shell\ncp .env.example .env\n```\n\nStart the container shell:\n\n```shell\nbash docker.sh shell\n```\n\n### 👻 B. Local setup with Rye\n\nIf you haven't installed [Rye](https://rye.astral.sh/guide/installation/) yet, run:\n\n```shell\ncurl -sSf https://rye.astral.sh/get | bash\n```\n\nYou can install Python and the necessary packages:\n\n```shell\nrye sync\n```\n\n## 🌠 Dataset Preparation\n\nDownload the datasets with `cmd/download.py` from the [source](https://github.com/sun-hailong/CVPR24-Ease), and extract its contents:\n\n```shell\npython3 cmd/download.py --help\n\n    Usage: download.py [OPTIONS]\n\n    Options:\n        --name TEXT     Dataset name (CUB200|ImageNet-R|ImageNet-A|VTAB)  [required]\n        --out_dir TEXT  Download destination  [required]\n        --help          Show this message and exit\n```\n\n\u003e These datasets are referenced from the [APER](https://github.com/zhoudw-zdw/RevisitingCIL).\n\u003e\n\u003e -   **CIFAR100**: will be automatically downloaded by the code.\n\u003e -   **CUB200**: Google Drive: [link](https://drive.google.com/file/d/1XbUpnWpJPnItt5zQ6sHJnsjPncnNLvWb/view?usp=sharing) or Onedrive: [link](https://entuedu-my.sharepoint.com/:u:/g/personal/n2207876b_e_ntu_edu_sg/EVV4pT9VJ9pBrVs2x0lcwd0BlVQCtSrdbLVfhuajMry-lA?e=L6Wjsc)\n\u003e -   **ImageNet-R**: Google Drive: [link](https://drive.google.com/file/d/1SG4TbiL8_DooekztyCVK8mPmfhMo8fkR/view?usp=sharing) or Onedrive: [link](https://entuedu-my.sharepoint.com/:u:/g/personal/n2207876b_e_ntu_edu_sg/EU4jyLL29CtBsZkB6y-JSbgBzWF5YHhBAUz1Qw8qM2954A?e=hlWpNW)\n\u003e -   **ImageNet-A**: Google Drive: [link](https://drive.google.com/file/d/19l52ua_vvTtttgVRziCZJjal0TPE9f2p/view?usp=sharing) or Onedrive: [link](https://entuedu-my.sharepoint.com/:u:/g/personal/n2207876b_e_ntu_edu_sg/ERYi36eg9b1KkfEplgFTW3gBg1otwWwkQPSml0igWBC46A?e=NiTUkL)\n\u003e -   **VTAB**: Google Drive: [link](https://drive.google.com/file/d/1xUiwlnx4k0oDhYi26KL5KwrCAya-mvJ_/view?usp=sharing) or Onedrive: [link](https://entuedu-my.sharepoint.com/:u:/g/personal/n2207876b_e_ntu_edu_sg/EQyTP1nOIH5PrfhXtpPgKQ8BlEFW2Erda1t7Kdi3Al-ePw?e=Yt4RnV)\n\u003e\n\u003e https://github.com/zhoudw-zdw/RevisitingCIL\n\n## 🚵 Training\n\nTo start training, run the following command:\n\n```bash\npython3 src/acmap/train.py --config exps/cifar.yaml --dataset_dir ./dataset\n```\n\nThe adapter checkpoints for each task will be saved in `./data/acmap/ckpts/`.\nTo skip saving checkpoints, include the `--debug` option.\n\nTo adjust the initial number of classes (`init_cls`) and the incremental step size (`increment`), run:\n\n```\npython3 src/acmap/train.py --init_cls 20 --increment 20\n```\n\nFor more details, refer to `src/acmap/utils/options.py`.\n\n### (Optional) Logging with W\u0026B\n\nWe support logging with [W\u0026B](https://wandb.ai/) for tracking experiments and visualizing results.\nTo enable this, obtain an API key from [W\u0026B](https://wandb.ai/) and add it to `.env`, then run the following command:\n\n```bash\npython3 src/acmap/train.py --logger wandb\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf63%2Facmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftf63%2Facmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf63%2Facmap/lists"}