Add removed sections (#2)
Browse files- Add removed sections (05818554bc41fb7f01e94d9dbee51c30472116cb)
Co-authored-by: Niels Rogge <[email protected]>
README.md
CHANGED
|
@@ -75,8 +75,78 @@ tags:
|
|
| 75 |
- Versatile segmentation capability across diverse organs and pathologies
|
| 76 |
- Extensive user studies in large-scale lesion and video datasets demonstrate that MedSAM2 substantially facilitates annotation workflows
|
| 77 |
|
| 78 |
-
|
| 79 |
## Model Overview
|
| 80 |
MedSAM2 is a promptable segmentation segmentation model tailored for medical imaging applications. Built upon the foundation of the [Segment Anything Model (SAM) 2.1](https://github.com/facebookresearch/sam2), MedSAM2 has been specifically adapted and fine-tuned for various 3D medical images and videos.
|
| 81 |
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
- Versatile segmentation capability across diverse organs and pathologies
|
| 76 |
- Extensive user studies in large-scale lesion and video datasets demonstrate that MedSAM2 substantially facilitates annotation workflows
|
| 77 |
|
|
|
|
| 78 |
## Model Overview
|
| 79 |
MedSAM2 is a promptable segmentation segmentation model tailored for medical imaging applications. Built upon the foundation of the [Segment Anything Model (SAM) 2.1](https://github.com/facebookresearch/sam2), MedSAM2 has been specifically adapted and fine-tuned for various 3D medical images and videos.
|
| 80 |
|
| 81 |
+
## Available Models
|
| 82 |
+
|
| 83 |
+
- **MedSAM2_2411.pt**: Base model trained in November 2024
|
| 84 |
+
- **MedSAM2_US_Heart.pt**: Fine-tuned model specialized for heart ultrasound video segmentation
|
| 85 |
+
- **MedSAM2_MRI_LiverLesion.pt**: Fine-tuned model for liver lesion segmentation in MRI scans
|
| 86 |
+
- **MedSAM2_CTLesion.pt**: Fine-tuned model for general lesion segmentation in CT scans
|
| 87 |
+
- **MedSAM2_latest.pt** (recommended): Latest version trained on the combination of public datasets and newly annotated medical imaging data
|
| 88 |
+
|
| 89 |
+
## Downloading Models
|
| 90 |
+
|
| 91 |
+
### Option 1: Download individual models
|
| 92 |
+
You can download the models directly from the Hugging Face repository:
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
# Using huggingface_hub
|
| 96 |
+
from huggingface_hub import hf_hub_download
|
| 97 |
+
|
| 98 |
+
# Download the recommended latest model
|
| 99 |
+
model_path = hf_hub_download(repo_id="wanglab/MedSAM2", filename="MedSAM2_latest.pt")
|
| 100 |
+
|
| 101 |
+
# Or download a specific fine-tuned model
|
| 102 |
+
heart_us_model_path = hf_hub_download(repo_id="wanglab/MedSAM2", filename="MedSAM2_US_Heart.pt")
|
| 103 |
+
liver_model_path = hf_hub_download(repo_id="wanglab/MedSAM2", filename="MedSAM2_MRI_LiverLesion.pt")
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
### Option 2: Download all models to a specific folder
|
| 107 |
+
```python
|
| 108 |
+
from huggingface_hub import hf_hub_download
|
| 109 |
+
import os
|
| 110 |
+
|
| 111 |
+
# Create checkpoints directory if it doesn't exist
|
| 112 |
+
os.makedirs("checkpoints", exist_ok=True)
|
| 113 |
+
|
| 114 |
+
# List of model filenames
|
| 115 |
+
model_files = [
|
| 116 |
+
"MedSAM2_2411.pt",
|
| 117 |
+
"MedSAM2_US_Heart.pt",
|
| 118 |
+
"MedSAM2_MRI_LiverLesion.pt",
|
| 119 |
+
"MedSAM2_CTLesion.pt",
|
| 120 |
+
"MedSAM2_latest.pt"
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
# Download all models
|
| 124 |
+
for model_file in model_files:
|
| 125 |
+
local_path = os.path.join("checkpoints", model_file)
|
| 126 |
+
hf_hub_download(
|
| 127 |
+
repo_id="wanglab/MedSAM2",
|
| 128 |
+
filename=model_file,
|
| 129 |
+
local_dir="checkpoints",
|
| 130 |
+
local_dir_use_symlinks=False
|
| 131 |
+
)
|
| 132 |
+
print(f"Downloaded {model_file} to {local_path}")
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
Alternatively, you can manually download the models from the [Hugging Face repository page](https://huggingface.co/wanglab/MedSAM2).
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
## Citations
|
| 140 |
+
|
| 141 |
+
```
|
| 142 |
+
@article{MedSAM2,
|
| 143 |
+
title={MedSAM2: Segment Anything in 3D Medical Images and Videos},
|
| 144 |
+
author={Ma, Jun and Yang, Zongxin and Kim, Sumin and Chen, Bihui and Baharoon, Mohammed and Fallahpour, Adibvafa and Asakereh, Reza and Lyu, Hongwei and Wang, Bo},
|
| 145 |
+
journal={arXiv preprint arXiv:2504.03600},
|
| 146 |
+
year={2025}
|
| 147 |
+
}
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
## License
|
| 151 |
+
|
| 152 |
+
The model weights can only be used for research and education purposes.
|