Add project page
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
language: en
|
| 3 |
-
license: cc-by-sa-4.0
|
| 4 |
library_name: torch
|
| 5 |
-
|
| 6 |
-
- medical
|
| 7 |
-
- segmentation
|
| 8 |
-
- sam
|
| 9 |
-
- medical-imaging
|
| 10 |
-
- ct
|
| 11 |
-
- mri
|
| 12 |
-
- ultrasound
|
| 13 |
pipeline_tag: image-segmentation
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
# MedSAM2: Segment Anything in 3D Medical Images and Videos
|
|
@@ -37,6 +37,7 @@ datasets:
|
|
| 37 |
</table>
|
| 38 |
</div>
|
| 39 |
|
|
|
|
| 40 |
|
| 41 |
## Authors
|
| 42 |
|
|
@@ -78,75 +79,4 @@ datasets:
|
|
| 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 |
-
|
| 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.
|
|
|
|
| 1 |
---
|
| 2 |
+
datasets:
|
| 3 |
+
- medical
|
| 4 |
language: en
|
|
|
|
| 5 |
library_name: torch
|
| 6 |
+
license: cc-by-sa-4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
pipeline_tag: image-segmentation
|
| 8 |
+
tags:
|
| 9 |
+
- medical
|
| 10 |
+
- segmentation
|
| 11 |
+
- sam
|
| 12 |
+
- medical-imaging
|
| 13 |
+
- ct
|
| 14 |
+
- mri
|
| 15 |
+
- ultrasound
|
| 16 |
---
|
| 17 |
|
| 18 |
# MedSAM2: Segment Anything in 3D Medical Images and Videos
|
|
|
|
| 37 |
</table>
|
| 38 |
</div>
|
| 39 |
|
| 40 |
+
[Project Page](https://medsam2.github.io/)
|
| 41 |
|
| 42 |
## Authors
|
| 43 |
|
|
|
|
| 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 |
+
<!-- rest of the model card -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|