{"id":18686255,"url":"https://github.com/mrgiovanni/continuallearning","last_synced_at":"2025-10-16T16:44:21.482Z","repository":{"id":170402505,"uuid":"646536306","full_name":"MrGiovanni/ContinualLearning","owner":"MrGiovanni","description":"[MICCAI 2023] Continual Learning for Abdominal Multi-Organ and Tumor Segmentation","archived":false,"fork":false,"pushed_at":"2024-07-30T19:51:07.000Z","size":337,"stargazers_count":69,"open_issues_count":8,"forks_count":9,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-30T08:24:44.422Z","etag":null,"topics":["continual-learning","organ-segmentation","tumor-segmentation"],"latest_commit_sha":null,"homepage":"https://www.cs.jhu.edu/~alanlab/Pubs23/zhang2023continual.pdf","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrGiovanni.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}},"created_at":"2023-05-28T17:56:13.000Z","updated_at":"2025-03-17T02:30:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"6eab2d06-2792-483d-952a-ed2151236744","html_url":"https://github.com/MrGiovanni/ContinualLearning","commit_stats":null,"previous_names":["mrgiovanni/continuallearning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGiovanni%2FContinualLearning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGiovanni%2FContinualLearning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGiovanni%2FContinualLearning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrGiovanni%2FContinualLearning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrGiovanni","download_url":"https://codeload.github.com/MrGiovanni/ContinualLearning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250803776,"owners_count":21490167,"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":["continual-learning","organ-segmentation","tumor-segmentation"],"created_at":"2024-11-07T10:26:47.279Z","updated_at":"2025-10-16T16:44:16.444Z","avatar_url":"https://github.com/MrGiovanni.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Continual Learning\n\n## Paper\n\n\u003cb\u003eContinual Learning for Abdominal Multi-Organ and Tumor Segmentation\u003c/b\u003e \u003cbr/\u003e\n[Yixiao Zhang](https://scholar.google.com/citations?user=lU3wroMAAAAJ), [Xinyi Li](https://www.linkedin.com/in/lixinyi808/), [Huimiao Chen](https://scholar.google.com/citations?hl=en\u0026user=o-F4kBgAAAAJ), [Alan Yuille](https://www.cs.jhu.edu/~ayuille/), [Yaoyao Liu](https://www.cs.jhu.edu/~yyliu/), and [Zongwei Zhou](https://www.zongweiz.com/) \u003cbr/\u003e\nJohns Hopkins University  \u003cbr/\u003e\nMICCAI 2023 (early accept) \u003cbr/\u003e\n[paper](https://arxiv.org/pdf/2306.00988.pdf) | [code](https://github.com/MrGiovanni/ContinualLearning)\n\n## 0. Installation\n\n```bash\ngit clone https://github.com/MrGiovanni/ContinualLearning\n```\nSee [installation instructions](document/INSTALL.md) to create an environment and obtain requirements.\n\n## 1. Prepare your datasets\n#### 1.1 Prepare your image and label files in a customer path, then create a txt file in the dataset/dataset_list folder. See txt files under dataset/dataset_list folder as examples.\n#### 1.2 Put the class name embedding file word_embedding_38class.pth under ./pretrained_weights/ folder.\n\n## 2. Training\nUse the train.py file for training models. An example script is\n```\npython train.py \n--phase train\n--data_root_path ./data\n--train_data_txt_path ./dataset/dataset_list/btcv_train.txt\n--val_data_txt_path ./dataset/dataset_list/btcv_val.txt\n--organ_list 1 2 3 4 5 6\n--max_epoch 101\n--warmup_epoch 15\n--batch_size 2\n--num_samples 1\n--lr 1e-4\n--model swinunetr\n--trans_encoding word_embedding\n--word_embedding ./pretrained_weights/word_embedding_38class.pth\n--out_nonlinear softmax\n--out_channels 38\n--log_name your_log_folder_name\n```\nSwitch the argument `--model` for different models: `swinunetr` for SwinUNETR, `swinunetr_partial` for the proposed model with organ-specific segmentation heads (this model should be used with `--out_nonlinear sigmoid`).\n\n## 3. Testing\nUse the test.py file for testing models. An example script is\n```\npython test.py\n--log_name your_log_folder_name\n--resume your_checkpoint_path\n--data_root_path ./data\n--test_data_txt_path ./dataset/dataset_list/btcv_test.txt\n--organ_list 1 2 3 4 5 6\n--model swinunetr\n--out_nonlinear softmax\n--out_channels 38\n```\n\n## 4. Predicting and Pseudo Label Preparing\nUse predict.py to make organ segmentation predictions on the test images or images for continual learning\n```\npython predict.py \\\n    --log_name your_log_folder_name \\\n    --resume your_checkpoint_path \\\n    --data_root_path ./data \\\n    --predict_data_txt_path ./dataset/dataset_list/\u003cstep2 train files\u003e.txt \\\n    --organ_list 1 2 3 4 5 6 \\\n    --model swinunetr \\\n    --out_nonlinear softmax \\\n    --out_channels 38\n```\nYou would need to combine the predicted segmentation on some organs togethor with ground truth segmentation on other organs to generate pseudo labels for continual learning. Please take scripts in prepare_pseudo_dataset.ipynb as examples.\n\n## 5. Continual learning\nFor the proposed model, in continual learning stages, the same train.py is used to train the model but with different settings.\n```\npython train.py \\\n  --phase continue \\\n  --data_root_path ./data \\\n  --continue_data_txt_path ./dataset/dataset_list/\u003cdata list with generated pseudo label\u003e.txt \\\n  --organ_list 1 2 3 4 5 6 7 8 9 10 11 12 \\\n  --num_workers 8 \\\n  --max_epoch 101 \\\n  --warmup_epoch 15 \\\n  --store_num 10 \\\n  --batch_size 2 \\\n  --num_samples 1 \\\n  --lr 1e-4 \\\n  --model swinunetr_partial \\\n  --out_nonlinear sigmoid \\\n  --out_channels 38 \\\n  --pretrain checkpoint_of_previous_learning_stage \\\n  --trans_encoding word_embedding \\\n  --word_embedding ./pretrained_weights/word_embedding_38class.pth \\\n  --log_name your_log_folder_name\n```\nThe differences are that you are now using pseudo labels listed in the `continue_data_txt_path` file, training on both pretrained and continual organ targets, and use a checkpoint from the previous learning stage.\n\n## Acknowledgements\nThis work was supported by the Lustgarten Foundation for Pancreatic Cancer Research and partially by the Patrick J. McGovern Foundation Award. We appreciate the effort of the MONAI Team to provide open-source code for the community.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrgiovanni%2Fcontinuallearning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrgiovanni%2Fcontinuallearning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrgiovanni%2Fcontinuallearning/lists"}