{"id":22899792,"url":"https://github.com/follgad/revisitingcil-ce7454","last_synced_at":"2025-04-01T04:38:50.016Z","repository":{"id":193249841,"uuid":"688394830","full_name":"FOLLGAD/RevisitingCIL-CE7454","owner":"FOLLGAD","description":"RevisitingCIL","archived":false,"fork":false,"pushed_at":"2023-10-19T14:23:16.000Z","size":466,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T03:15:20.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FOLLGAD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-07T09:01:02.000Z","updated_at":"2023-09-07T09:04:10.000Z","dependencies_parsed_at":"2023-10-16T16:31:08.539Z","dependency_job_id":"f90b5ef9-e560-4d88-977f-81b4622d66c9","html_url":"https://github.com/FOLLGAD/RevisitingCIL-CE7454","commit_stats":null,"previous_names":["follgad/revisitingcil-ce7454"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FOLLGAD%2FRevisitingCIL-CE7454","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FOLLGAD%2FRevisitingCIL-CE7454/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FOLLGAD%2FRevisitingCIL-CE7454/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FOLLGAD%2FRevisitingCIL-CE7454/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FOLLGAD","download_url":"https://codeload.github.com/FOLLGAD/RevisitingCIL-CE7454/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246586108,"owners_count":20801026,"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":[],"created_at":"2024-12-14T01:16:35.155Z","updated_at":"2025-04-01T04:38:49.986Z","avatar_url":"https://github.com/FOLLGAD.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Revisiting Class-Incremental Learning with Pre-Trained Models: Generalizability and Adaptivity are All You Need\n\u003cdiv align=\"center\"\u003e\n\n\u003cdiv\u003e\n    \u003ca href='http://www.lamda.nju.edu.cn/zhoudw' target='_blank'\u003eDa-Wei Zhou\u003c/a\u003e\u003csup\u003e1\u003c/sup\u003e\u0026emsp;\n    \u003ca href='http://www.lamda.nju.edu.cn/yehj' target='_blank'\u003eHan-Jia Ye\u003c/a\u003e\u003csup\u003e1\u003c/sup\u003e\u0026emsp;\n    \u003ca href='http://www.lamda.nju.edu.cn/zhandc' target='_blank'\u003eDe-Chuan Zhan\u003c/a\u003e\u003csup\u003e1\u003c/sup\u003e\u0026emsp;\n    \u003ca href='https://liuziwei7.github.io/' target='_blank'\u003eZiwei Liu \u003c/a\u003e\u003csup\u003e2\u003c/sup\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003csup\u003e1\u003c/sup\u003eState Key Laboratory for Novel Software Technology, Nanjing University\u0026emsp;\n\n\u003csup\u003e2\u003c/sup\u003eS-Lab, Nanyang Technological University\u0026emsp;\n\u003c/div\u003e\n\u003c/div\u003e\n\nThe code repository for \"[Revisiting Class-Incremental Learning with Pre-Trained Models: Generalizability and Adaptivity are All You Need](http://arxiv.org/abs/2303.07338)\" in PyTorch.  If you use any content of this repo for your work, please cite the following bib entry: \n\n    @article{zhou2023revisiting,\n        author = {Zhou, Da-Wei and Ye, Han-Jia and Zhan, De-Chuan and Liu, Ziwei},\n        title = {Revisiting Class-Incremental Learning with Pre-Trained Models: Generalizability and Adaptivity are All You Need},\n        journal = {arXiv preprint arXiv:2303.07338},\n        year = {2023}\n    }\n\n\n\n\n\n## Updates\n[03/2023] [arXiv](http://arxiv.org/abs/2303.07338) paper has been released.\n\n[03/2023] Code has been released.\n\n## Introduction\nClass-incremental learning (CIL) aims to adapt to emerging new classes without forgetting old ones. Traditional CIL models are trained from scratch to continually acquire knowledge as data evolves. Recently, pre-training has achieved substantial progress, making vast pre-trained models (PTMs) accessible for CIL. Contrary to traditional methods, PTMs possess generalizable embeddings, which can be easily transferred for CIL. In this work, we revisit CIL with PTMs and argue that the core factors in CIL are adaptivity for model updating and generalizability for knowledge transferring. 1) We first reveal that frozen PTM can already provide generalizable\nembeddings for CIL. Surprisingly, a simple baseline (**SimpleCIL**) which continually sets the classifiers of PTM to prototype features can beat state-of-the-art even without training on the downstream task. 2) Due to the distribution gap between pre-trained and downstream datasets, PTM can be further cultivated with adaptivity via model adaptation. We propose **ADapt And Merge** (ADAM), which aggregates the embeddings of PTM and adapted models for classifier construction. ADAM is a general framework that can be orthogonally combined with any parameter-efficient tuning method, which holds the advantages of PTM’s generalizability and adapted model’s adaptivity. 3) Additionally, we find previous benchmarks are unsuitable in the era of PTM due to data overlapping and propose four new benchmarks for assessment, namely ImageNet-A, ObjectNet, OmniBenchmark, and VTAB. Extensive experiments validate the effectiveness of ADAM with a unified and concise framework.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"imgs/adam.png\" width=\"95%\"\u003e\n\n\u003ch3\u003eTL;DR\u003c/h3\u003e\n\nA simple baseline (**SimpleCIL**) beats SOTA even without training on the downstream task. **ADapt And Merge** (ADAM) extends SimpleCIL with better adaptivity and generalizability. Four new benchmarks are proposed for assessment.\n\u003c/div\u003e\n\n\n\n## Requirements\n### Environment\n1. [torch 1.11.0](https://github.com/pytorch/pytorch)\n2. [torchvision 0.12.0](https://github.com/pytorch/vision)\n3. [timm 0.6.12](https://github.com/huggingface/pytorch-image-models)\n\n\n### Dataset\nWe provide the processed datasets as follows:\n- **CIFAR100**: will be automatically downloaded by the code.\n- **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- **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- **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- **OmniBenchmark**: Google Drive: [link](https://drive.google.com/file/d/1AbCP3zBMtv_TDXJypOCnOgX8hJmvJm3u/view?usp=sharing) or Onedrive: [link](https://entuedu-my.sharepoint.com/:u:/g/personal/n2207876b_e_ntu_edu_sg/EcoUATKl24JFo3jBMnTV2WcBwkuyBH0TmCAy6Lml1gOHJA?e=eCNcoA)\n- **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- **ObjectNet**: Onedrive: [link](https://entuedu-my.sharepoint.com/:u:/g/personal/n2207876b_e_ntu_edu_sg/EZFv9uaaO1hBj7Y40KoCvYkBnuUZHnHnjMda6obiDpiIWw?e=4n8Kpy) You can also refer to the [filelist](https://drive.google.com/file/d/147Mta-HcENF6IhZ8dvPnZ93Romcie7T6/view?usp=sharing) if the file is too large to download.\n\nThese subsets are sampled from the original datasets. Please note that I do not have the right to distribute these datasets. If the distribution violates the license, I shall provide the filenames instead.\n\nYou need to modify the path of the datasets in `./utils/data.py`  according to your own path.\n\n## Running scripts\nPlease follow the settings in the `exps` folder to prepare your json files, and then run:\n\n```\npython main.py --config ./exps/[configname].json\n```\n\n\n## Acknolegment\nThis repo is based on [CIL_Survey](https://github.com/zhoudw-zdw/CIL_Survey) and [PyCIL](https://github.com/G-U-N/PyCIL).\n\nThe implemenations of parameter-efficient tuning methods are based on [VPT](https://github.com/sagizty/VPT), [AdaptFormer](https://github.com/ShoufaChen/AdaptFormer), and [SSF](https://github.com/dongzelian/SSF).\n\n## Correspondence\nIf you have any questions, please contact me via [email](mailto:zhoudw@lamda.nju.edu.cn) or open an [issue](https://github.com/zhoudw-zdw/RevisitingCIL/issues/new).\n\n\n\u003cdiv align=\"center\"\u003e\n\n![visitors](https://visitor-badge.laobi.icu/badge?page_id=zhoudw-zdw.RevisitingCIL\u0026left_color=green\u0026right_color=red)\n\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollgad%2Frevisitingcil-ce7454","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffollgad%2Frevisitingcil-ce7454","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollgad%2Frevisitingcil-ce7454/lists"}