FengheTan9 commited on
Commit
7c4e3d9
Β·
verified Β·
1 Parent(s): 6da2a44

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +206 -202
README.md CHANGED
@@ -1,202 +1,206 @@
1
-
2
-
3
- ## [MIA'25] MambaMIM: Pre-training Mamba with State Space Token Interpolation and its Application to Medical Image Segmentation
4
-
5
- <p align="center" width="100%">
6
- <!---->
7
- </p>
8
-
9
- ![MambaMIM](img/TOKI.png)
10
-
11
-
12
-
13
- <div align="center">
14
- <span class="author-block">
15
- <a href="https://scholar.google.com/citations?user=x1pODsMAAAAJ&hl=en" target="_blank">Fenghe Tang</a><sup>1,2</sup>,</span>
16
- <span class="author-block">
17
- <a target="_blank">Bingkun Nian</a><sup>3</sup>,</span>
18
- <span class="author-block">
19
- <a href="https://scholar.google.com/citations?user=ocAtNkkAAAAJ&hl=en" target="_blank">Yingtai Li</a><sup>1,2</sup>,</span>
20
- <span class="author-block">
21
- <a href="https://scholar.google.com/citations?user=Wo8tMSMAAAAJ&hl=en" target="_blank">Zihang Jiang</a><sup>1,2</sup>,</span>
22
- <span class="author-block">
23
- <a href="https://scholar.google.com/citations?user=tmx7tu8AAAAJ&hl=en" target="_blank">Jie Yang</a><sup>3</sup>,</span>
24
- <span class="author-block">
25
- <a href="https://scholar.google.com/citations?user=Vbb5EGIAAAAJ&hl=en" target="_blank"> Liu Wei</a><sup>3</sup>,</span>
26
- <span class="author-block">
27
- <a href="https://scholar.google.com/citations?user=8eNm2GMAAAAJ&hl=en" target="_blank">S.Kevin Zhou</a><sup>1,2</sup>
28
- </span>
29
- </div>
30
-
31
-
32
- <br>
33
-
34
- <div align="center">
35
- <sup>1</sup>
36
- <a href='https://en.ustc.edu.cn/' target='_blank'>School of Biomedical Engineering, University of Science and Technology of China</a>&emsp;
37
- <br>
38
- <sup>2</sup> <a href='http://english.ict.cas.cn/' target='_blank'>Suzhou Institute for Advanced Research, University of Science and Technology of China</a>&emsp;
39
- <br>
40
- <sup>3</sup> <a href='http://www.pami.sjtu.edu.cn/En/Home' target='_blank'>Department of Automation, Institute of Image Processing and Pattern Recognition, Shanghai Jiao Tong University</a>
41
- <br>
42
- </div>
43
-
44
- <br>
45
- <br>
46
-
47
- ​ [![arXiv](https://img.shields.io/badge/arxiv-2408.08070-b31b1b)](https://arxiv.org/pdf/2408.08070.pdf) [![github](https://img.shields.io/badge/github-MambaMIM-purple)](https://github.com/FengheTan9/MambaMIM) <a href="#LICENSE--citation"><img alt="License: Apache2.0" src="https://img.shields.io/badge/LICENSE-Apache%202.0-blue.svg"/></a>
48
-
49
-
50
-
51
- ## News
52
-
53
- - **MambaMIM accepted by Medical Image Analyses (MIA'25) ! πŸ₯°**
54
- - **Weights released ! 😎**
55
- - **Code released !** 😘
56
- - **Code and weights will be released soon !** 😘
57
- - **[2024/08/16] Paper released !**
58
-
59
-
60
-
61
- ## TODOs
62
-
63
- - [x] Paper released
64
- - [x] Code released
65
- - [x] Weight released
66
-
67
-
68
-
69
- ## Getting Started
70
-
71
- ### Download weights
72
-
73
- | Name | Resolution | Intensities | Spacing | Weights |
74
- | :------: | :----------: | :-----------: | :----------------: | :----------------------------------------------------------: |
75
- | MambaMIM | 96 x 96 x 96 | [-175, - 250] | 1.5 x 1.5 x 1.5 mm | [Google Drive (87MB)](https://drive.google.com/file/d/1B3j5aRPxkDJqf8UPGKDiAjg2X85a3Kwx/view?usp=sharing) |
76
-
77
-
78
-
79
- ### Prepare Environments
80
-
81
- ```
82
- conda create -n mambamim python=3.9
83
- conda activate mambamim
84
- pip install torch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117
85
- pip install packaging timm==0.5.4
86
- pip install transformers==4.34.1 typed-argument-parser
87
- pip install numpy==1.21.2 opencv-python==4.5.5.64 opencv-python-headless==4.5.5.64
88
- pip install 'monai[all]'
89
- pip install monai==1.2.0
90
- pip install causal_conv1d-1.2.0.post2+cu118torch1.13cxx11abiTRUE-cp38-cp38-linux_x86_64.whl
91
- pip install mamba_ssm-1.2.0.post1+cu118torch1.13cxx11abiFALSE-cp38-cp38-linux_x86_64.whl
92
- ```
93
-
94
-
95
-
96
- ### Prepare Datasets
97
-
98
- We recommend that you convert the dataset into the [nnUNet](https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/dataset_format.md) format.
99
-
100
- ```
101
- └── MambaMIM
102
- β”œβ”€β”€ data
103
- β”œβ”€β”€ Dataset060_TotalSegmentator
104
- └── imagesTr
105
- β”œβ”€β”€ xxx_0000.nii.gz
106
- β”œβ”€β”€ ...
107
- β”œβ”€β”€ Dataset006_FLARE2022
108
- └── imagesTr
109
- β”œβ”€β”€ xxx_0000.nii.gz
110
- β”œβ”€β”€ ...
111
- └── Other_dataset
112
- └── imagesTr
113
- β”œβ”€β”€ xxx_0000.nii.gz
114
- β”œβ”€β”€ ...
115
- ```
116
-
117
- An example ```dataset.json``` will be generated in ```./data```
118
-
119
- The content should be like below:
120
-
121
- ```json
122
- {
123
- "training": [
124
- {
125
- "image": "./Dataset060_TotalSegmentator/imagesTr/xxx_0000.nii.gz"
126
- },
127
- {
128
- "image": "./Dataset006_FLARE2022/imagesTr/xxx_0000.nii.gz"
129
- },
130
- ]
131
- }
132
-
133
- ```
134
-
135
-
136
-
137
- ## Start Training
138
-
139
- ![MambaMIM](img/masking_consistency.png)
140
-
141
-
142
-
143
- Run training on multi-GPU :
144
-
145
- ```sh
146
- # An example of training on 4 GPUs with DDP
147
- torchrun --nproc_per_node=4 --nnodes=1 --node_rank=0 --master_addr=localhost --master_port=12351 main.py --exp_name=debug --data_path=./data --model=mambamim --bs=16 --exp_dir=debug_mambamim_ddp_4
148
- ```
149
-
150
- Run training on the single-GPU :
151
-
152
- ```sh
153
- # An example of training on the single GPU
154
- python main.py --exp_name=debug --data_path=./data --model=mambamim --bs=4 --exp_dir=debug_mambamim
155
- ```
156
-
157
-
158
-
159
- ## Fine-tuning
160
-
161
- Load pre-training weights :
162
-
163
- ```python
164
- # An example of Fine-tuning on BTCV (num_classes=14)
165
- from models.network.hymamba import build_hybird
166
-
167
- model = build_hybird(in_channel=1, n_classes=14, img_size=96).cuda()
168
-
169
- model_dict = torch.load("mambamim_mask75.pth")
170
-
171
- if model.load_state_dict(model_dict, strict=False):
172
- print("MambaMIM use pretrained weights successfully !")
173
- ```
174
-
175
- Downstream pipeline can be referred to [UNETR]([research-contributions/UNETR/BTCV at main Β· Project-MONAI/research-contributions (github.com)](https://github.com/Project-MONAI/research-contributions/tree/main/UNETR/BTCV)).
176
-
177
-
178
-
179
- ## Acknowledgements:
180
-
181
- This code uses helper functions from [SparK](https://github.com/keyu-tian/SparK) and [HySparK](https://github.com/FengheTan9/HySparK).
182
-
183
-
184
-
185
- ## Citation
186
-
187
- If the code, paper and weights help your research, please cite:
188
-
189
- ```
190
- @article{tang2024mambamim,
191
- title={MambaMIM: Pre-training Mamba with State Space Token-interpolation},
192
- author={Tang, Fenghe and Nian, Bingkun and Li, Yingtai and Yang, Jie and Wei, Liu and Zhou, S Kevin},
193
- journal={arXiv preprint arXiv:2408.08070},
194
- year={2024}
195
- }
196
- ```
197
-
198
-
199
-
200
- ## License
201
-
202
- This project is released under the Apache 2.0 license. Please see the [LICENSE](LICENSE) file for more information.
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-feature-extraction
4
+ ---
5
+
6
+
7
+ ## [MIA'25] MambaMIM: Pre-training Mamba with State Space Token Interpolation and its Application to Medical Image Segmentation
8
+
9
+ <p align="center" width="100%">
10
+ <!---->
11
+ </p>
12
+
13
+ ![MambaMIM](img/TOKI.png)
14
+
15
+
16
+
17
+ <div align="center">
18
+ <span class="author-block">
19
+ <a href="https://scholar.google.com/citations?user=x1pODsMAAAAJ&hl=en" target="_blank">Fenghe Tang</a><sup>1,2</sup>,</span>
20
+ <span class="author-block">
21
+ <a target="_blank">Bingkun Nian</a><sup>3</sup>,</span>
22
+ <span class="author-block">
23
+ <a href="https://scholar.google.com/citations?user=ocAtNkkAAAAJ&hl=en" target="_blank">Yingtai Li</a><sup>1,2</sup>,</span>
24
+ <span class="author-block">
25
+ <a href="https://scholar.google.com/citations?user=Wo8tMSMAAAAJ&hl=en" target="_blank">Zihang Jiang</a><sup>1,2</sup>,</span>
26
+ <span class="author-block">
27
+ <a href="https://scholar.google.com/citations?user=tmx7tu8AAAAJ&hl=en" target="_blank">Jie Yang</a><sup>3</sup>,</span>
28
+ <span class="author-block">
29
+ <a href="https://scholar.google.com/citations?user=Vbb5EGIAAAAJ&hl=en" target="_blank"> Liu Wei</a><sup>3</sup>,</span>
30
+ <span class="author-block">
31
+ <a href="https://scholar.google.com/citations?user=8eNm2GMAAAAJ&hl=en" target="_blank">S.Kevin Zhou</a><sup>1,2</sup>
32
+ </span>
33
+ </div>
34
+
35
+
36
+ <br>
37
+
38
+ <div align="center">
39
+ <sup>1</sup>
40
+ <a href='https://en.ustc.edu.cn/' target='_blank'>School of Biomedical Engineering, University of Science and Technology of China</a>&emsp;
41
+ <br>
42
+ <sup>2</sup> <a href='http://english.ict.cas.cn/' target='_blank'>Suzhou Institute for Advanced Research, University of Science and Technology of China</a>&emsp;
43
+ <br>
44
+ <sup>3</sup> <a href='http://www.pami.sjtu.edu.cn/En/Home' target='_blank'>Department of Automation, Institute of Image Processing and Pattern Recognition, Shanghai Jiao Tong University</a>
45
+ <br>
46
+ </div>
47
+
48
+ <br>
49
+ <br>
50
+
51
+ ​ [![arXiv](https://img.shields.io/badge/arxiv-2408.08070-b31b1b)](https://arxiv.org/pdf/2408.08070.pdf) [![github](https://img.shields.io/badge/github-MambaMIM-purple)](https://github.com/FengheTan9/MambaMIM) <a href="#LICENSE--citation"><img alt="License: Apache2.0" src="https://img.shields.io/badge/LICENSE-Apache%202.0-blue.svg"/></a>
52
+
53
+
54
+
55
+ ## News
56
+
57
+ - **MambaMIM accepted by Medical Image Analyses (MIA'25) ! πŸ₯°**
58
+ - **Weights released ! 😎**
59
+ - **Code released !** 😘
60
+ - **Code and weights will be released soon !** 😘
61
+ - **[2024/08/16] Paper released !**
62
+
63
+
64
+
65
+ ## TODOs
66
+
67
+ - [x] Paper released
68
+ - [x] Code released
69
+ - [x] Weight released
70
+
71
+
72
+
73
+ ## Getting Started
74
+
75
+ ### Download weights
76
+
77
+ | Name | Resolution | Intensities | Spacing | Weights |
78
+ | :------: | :----------: | :-----------: | :----------------: | :----------------------------------------------------------: |
79
+ | MambaMIM | 96 x 96 x 96 | [-175, - 250] | 1.5 x 1.5 x 1.5 mm | [Google Drive (87MB)](https://drive.google.com/file/d/1B3j5aRPxkDJqf8UPGKDiAjg2X85a3Kwx/view?usp=sharing) |
80
+
81
+
82
+
83
+ ### Prepare Environments
84
+
85
+ ```
86
+ conda create -n mambamim python=3.9
87
+ conda activate mambamim
88
+ pip install torch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117
89
+ pip install packaging timm==0.5.4
90
+ pip install transformers==4.34.1 typed-argument-parser
91
+ pip install numpy==1.21.2 opencv-python==4.5.5.64 opencv-python-headless==4.5.5.64
92
+ pip install 'monai[all]'
93
+ pip install monai==1.2.0
94
+ pip install causal_conv1d-1.2.0.post2+cu118torch1.13cxx11abiTRUE-cp38-cp38-linux_x86_64.whl
95
+ pip install mamba_ssm-1.2.0.post1+cu118torch1.13cxx11abiFALSE-cp38-cp38-linux_x86_64.whl
96
+ ```
97
+
98
+
99
+
100
+ ### Prepare Datasets
101
+
102
+ We recommend that you convert the dataset into the [nnUNet](https://github.com/MIC-DKFZ/nnUNet/blob/master/documentation/dataset_format.md) format.
103
+
104
+ ```
105
+ └── MambaMIM
106
+ β”œβ”€β”€ data
107
+ β”œβ”€β”€ Dataset060_TotalSegmentator
108
+ └── imagesTr
109
+ β”œβ”€β”€ xxx_0000.nii.gz
110
+ β”œβ”€β”€ ...
111
+ β”œβ”€β”€ Dataset006_FLARE2022
112
+ └── imagesTr
113
+ β”œβ”€β”€ xxx_0000.nii.gz
114
+ β”œβ”€β”€ ...
115
+ └── Other_dataset
116
+ └── imagesTr
117
+ β”œβ”€β”€ xxx_0000.nii.gz
118
+ β”œβ”€β”€ ...
119
+ ```
120
+
121
+ An example ```dataset.json``` will be generated in ```./data```
122
+
123
+ The content should be like below:
124
+
125
+ ```json
126
+ {
127
+ "training": [
128
+ {
129
+ "image": "./Dataset060_TotalSegmentator/imagesTr/xxx_0000.nii.gz"
130
+ },
131
+ {
132
+ "image": "./Dataset006_FLARE2022/imagesTr/xxx_0000.nii.gz"
133
+ },
134
+ ]
135
+ }
136
+
137
+ ```
138
+
139
+
140
+
141
+ ## Start Training
142
+
143
+ ![MambaMIM](img/masking_consistency.png)
144
+
145
+
146
+
147
+ Run training on multi-GPU :
148
+
149
+ ```sh
150
+ # An example of training on 4 GPUs with DDP
151
+ torchrun --nproc_per_node=4 --nnodes=1 --node_rank=0 --master_addr=localhost --master_port=12351 main.py --exp_name=debug --data_path=./data --model=mambamim --bs=16 --exp_dir=debug_mambamim_ddp_4
152
+ ```
153
+
154
+ Run training on the single-GPU :
155
+
156
+ ```sh
157
+ # An example of training on the single GPU
158
+ python main.py --exp_name=debug --data_path=./data --model=mambamim --bs=4 --exp_dir=debug_mambamim
159
+ ```
160
+
161
+
162
+
163
+ ## Fine-tuning
164
+
165
+ Load pre-training weights :
166
+
167
+ ```python
168
+ # An example of Fine-tuning on BTCV (num_classes=14)
169
+ from models.network.hymamba import build_hybird
170
+
171
+ model = build_hybird(in_channel=1, n_classes=14, img_size=96).cuda()
172
+
173
+ model_dict = torch.load("mambamim_mask75.pth")
174
+
175
+ if model.load_state_dict(model_dict, strict=False):
176
+ print("MambaMIM use pretrained weights successfully !")
177
+ ```
178
+
179
+ Downstream pipeline can be referred to [UNETR]([research-contributions/UNETR/BTCV at main Β· Project-MONAI/research-contributions (github.com)](https://github.com/Project-MONAI/research-contributions/tree/main/UNETR/BTCV)).
180
+
181
+
182
+
183
+ ## Acknowledgements:
184
+
185
+ This code uses helper functions from [SparK](https://github.com/keyu-tian/SparK) and [HySparK](https://github.com/FengheTan9/HySparK).
186
+
187
+
188
+
189
+ ## Citation
190
+
191
+ If the code, paper and weights help your research, please cite:
192
+
193
+ ```
194
+ @article{tang2024mambamim,
195
+ title={MambaMIM: Pre-training Mamba with State Space Token-interpolation},
196
+ author={Tang, Fenghe and Nian, Bingkun and Li, Yingtai and Yang, Jie and Wei, Liu and Zhou, S Kevin},
197
+ journal={arXiv preprint arXiv:2408.08070},
198
+ year={2024}
199
+ }
200
+ ```
201
+
202
+
203
+
204
+ ## License
205
+
206
+ This project is released under the Apache 2.0 license. Please see the [LICENSE](LICENSE) file for more information.