Official codebase for TMI paper: MiM: Mask in Mask Self-Supervised Pre-Training for 3D Medical Image Analysis
- Python 3.8
- PyTorch 2.0.1
- MONAI 1.0.0
- CUDA 11.8
- cuDNN 8.5
- NVIDIA GPU with compute capability 8.6
The details of the pretraining dataset and finetuning dataset are shown in the following figures. Since these datasets are all publicly available, you can download them from their official websites.
The project contains two directories, i.e.,
- Pretrain
- Finetune
Since pre-training can be time-consuming, optimizing data loading is essential. A recommended approach is to first generate cache files, then use the MONAI DataLoader to load them. While these cache files may be large, they significantly accelerate the loading process. You can find the conversion script in
generate_cache_files.py
Please refer to the Pretrain directory for the pretraining code. Make sure you have installed the requirements and downloaded the datasets.
bash scripts/xxx.sh
Please refer to the Finetune directory for the finetuning code. Make sure you have installed the requirements and downloaded the datasets.
We provide the pretrained model on 10k via the Onedrive link and you can finetune the model. Let's take the BTCV as an example.
bash scripts/BTCV/run.sh
@article{mim,
title={Mim: Mask in mask self-supervised pre-training for 3d medical image analysis},
author={Zhuang, Jiaxin and Wu, Linshan and Wang, Qiong and Fei, Peng and Vardhanabhuti, Varut and Luo, Lin and Chen, Hao},
journal={IEEE Transactions on Medical Imaging},
year={2025},
publisher={IEEE}
}
This codebase heavily references the following projects and we thanks their efforts:
- Masked Autoencoders: pretraining code
- SwinUNETR: data preparation and pretraining code
- MONAI: a powerful medical image analysis library
Wellcomes to star our repo, and feel free to raise issues if you have any questions.
And also wellcomes to our other works:
- VoCo: pretrained on the largest 3D medical image datasets (160k+), and achieves new state-of-the-art performance on multiple 3D medical image analysis tasks (~50 tasks).