Improve model card: Add pipeline tag, license, and update content (#1)
Browse files- Improve model card: Add pipeline tag, license, and update content (0977f68f19054421eade42b44f195cd6245794d5)
Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -1,100 +1,87 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
[](https://arxiv.org/abs/2511.13001)
|
| 4 |
[](https://openreview.net/forum?id=9vCx66pnLn#discussion)
|
|
|
|
|
|
|
| 5 |
[](https://huggingface.co/spc819/Medal-S-V1.0/resolve/main/teamx.tar.gz)
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
## Paper
|
| 10 |
-
|
| 11 |
-
**Medal-S: Spatio-Textual Prompt Model for Medical Segmentation**
|
| 12 |
-
*CVPR 2025 Workshop MedSegFM*
|
| 13 |
-
[arXiv Paper](https://arxiv.org/abs/2511.13001) | [OpenReview Discussion](https://openreview.net/forum?id=9vCx66pnLn#discussion)
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
Download the pre-built Docker image for testing submission (2025/05/30):
|
| 20 |
-
```bash
|
| 21 |
-
# Download from Hugging Face
|
| 22 |
-
wget https://huggingface.co/spc819/Medal-S-V1.0/resolve/main/teamx.tar.gz
|
| 23 |
-
```
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
1. **Install nnU-Net v2.4.1:**
|
| 28 |
```bash
|
|
|
|
| 29 |
wget https://github.com/MIC-DKFZ/nnUNet/archive/refs/tags/v2.4.1.tar.gz
|
| 30 |
tar -xvf v2.4.1.tar.gz
|
| 31 |
pip install -e nnUNet-2.4.1
|
| 32 |
-
```
|
| 33 |
|
| 34 |
-
2. **Install customized dynamic-network-architectures:**
|
| 35 |
-
```bash
|
| 36 |
cd model
|
| 37 |
pip install -e dynamic-network-architectures-main
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
scikit-learn
|
| 55 |
-
scikit-image
|
| 56 |
-
batchgenerators
|
| 57 |
-
acvl_utils
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
## Dataset
|
| 61 |
-
|
| 62 |
-
The model is trained on the [CVPR-BiomedSegFM](https://huggingface.co/datasets/junma/CVPR-BiomedSegFM) dataset available on Hugging Face:
|
| 63 |
-
|
| 64 |
-
```python
|
| 65 |
-
from datasets import load_dataset
|
| 66 |
-
|
| 67 |
-
dataset = load_dataset("junma/CVPR-BiomedSegFM")
|
| 68 |
```
|
| 69 |
|
| 70 |
-
## Training
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
-
```bash
|
| 78 |
-
sh/cvpr2025_Blosc2_pretrain_1.0_1.0_1.0_UNET_ps192.sh
|
| 79 |
-
```
|
| 80 |
|
| 81 |
-
**
|
| 82 |
-
- **224×224×128 (1.5,1.5,3.0) spacing:** 2× H100-80GB GPUs, ~7 days, batch size 2/GPU
|
| 83 |
-
- **192×192×192 (1.0,1.0,1.0) spacing:** 4× H100-80GB GPUs, batch size 2/GPU
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
Run inference on test data:
|
| 88 |
```bash
|
| 89 |
python inference.py
|
| 90 |
```
|
| 91 |
|
| 92 |
-
##
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: image-segmentation
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Medal S: Spatio-Textual Prompt Model for Medical Segmentation
|
| 7 |
|
| 8 |
[](https://arxiv.org/abs/2511.13001)
|
| 9 |
[](https://openreview.net/forum?id=9vCx66pnLn#discussion)
|
| 10 |
+
[](https://huggingface.co/spc819/Medal-S-V1.0)
|
| 11 |
+
[](https://github.com/yinghemedical/Medal-S)
|
| 12 |
[](https://huggingface.co/spc819/Medal-S-V1.0/resolve/main/teamx.tar.gz)
|
| 13 |
|
| 14 |
+
This repository provides guidance for training and inference of Medal S within the [CVPR 2025: Foundation Models for Text-Guided 3D biomedical image segmentation](https://www.codabench.org/competitions/5651/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
Docker link for the 2025/05/30 testing submission: [Medal S](https://drive.google.com/file/d/1HRJqYUXajptGsKaXEhn-s3rGcnKIwGs7/view)
|
| 17 |
|
| 18 |
+
## Requirements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
The U-Net implementation relies on a customized version of [dynamic-network-architectures](https://github.com/MIC-DKFZ/dynamic-network-architectures). To install it, navigate to the `model` directory and run:
|
| 21 |
|
|
|
|
| 22 |
```bash
|
| 23 |
+
# Install nnU-Net v2.4.1:
|
| 24 |
wget https://github.com/MIC-DKFZ/nnUNet/archive/refs/tags/v2.4.1.tar.gz
|
| 25 |
tar -xvf v2.4.1.tar.gz
|
| 26 |
pip install -e nnUNet-2.4.1
|
|
|
|
| 27 |
|
|
|
|
|
|
|
| 28 |
cd model
|
| 29 |
pip install -e dynamic-network-architectures-main
|
| 30 |
+
````
|
| 31 |
+
|
| 32 |
+
**Python Version:** 3.10.16
|
| 33 |
+
|
| 34 |
+
**Key Python Packages:**
|
| 35 |
|
| 36 |
+
```
|
| 37 |
+
torch==2.2.0
|
| 38 |
+
transformers==4.51.3
|
| 39 |
+
monai==1.4.0
|
| 40 |
+
nibabel==5.3.2
|
| 41 |
+
tensorboard
|
| 42 |
+
einops
|
| 43 |
+
positional_encodings
|
| 44 |
+
scipy
|
| 45 |
+
pandas
|
| 46 |
+
scikit-learn
|
| 47 |
+
scikit-image
|
| 48 |
+
batchgenerators
|
| 49 |
+
acvl_utils
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
```
|
| 51 |
|
| 52 |
+
## Training Guidance
|
| 53 |
|
| 54 |
+
First, download the dataset from [Hugging Face: junma/CVPR-BiomedSegFM](https://huggingface.co/datasets/junma/CVPR-BiomedSegFM).
|
| 55 |
|
| 56 |
+
* **Data Preparation**: Preprocess and organize all training data into a `train_all.jsonl` file using the provided script: `data/challenge_data/get_train_jsonl.py`.
|
| 57 |
|
| 58 |
+
* **Knowledge Enhancement**: You can either use the pre-trained text encoder from SAT ([https://github.com/zhaoziheng/SAT/tree/cvpr2025challenge](https://github.com/zhaoziheng/SAT/tree/cvpr2025challenge)) available on [Hugging Face](https://huggingface.co/zzh99/SAT/tree/main/Pretrain), or pre-train it yourself following the guidance in this [repository](https://github.com/zhaoziheng/SAT-Pretrain/tree/master). As recommended by SAT, we **freeze** the text encoder when training the segmentation model.
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
* **Segmentation**: The training script is located at `sh/cvpr2025_Blosc2_pretrain_1.0_1.0_1.0_UNET_ps192.sh`. Before training, NPZ files will be converted to the Blosc2 compressed format (from the nnU-Net framework).
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
Training takes approximately 7 days with 2x H100-80GB GPUs for a 224x224x128 (1.5, 1.5, 3.0) spacing model, using a batch size of 2 per GPU. For a 192x192x192 (1.0, 1.0, 1.0) spacing model, it requires 4x H100-80GB GPUs with a batch size of 2 per GPU. You may modify the patch size and batch size to train on GPUs with less memory.
|
| 63 |
+
|
| 64 |
+
## Inference Guidance
|
| 65 |
+
We provide inference code for test data:
|
| 66 |
|
|
|
|
| 67 |
```bash
|
| 68 |
python inference.py
|
| 69 |
```
|
| 70 |
|
| 71 |
+
## Citation
|
| 72 |
+
```
|
| 73 |
+
@misc{shi2025medalsspatiotextualprompt,
|
| 74 |
+
title={Medal S: Spatio-Textual Prompt Model for Medical Segmentation},
|
| 75 |
+
author={Pengcheng Shi and Jiawei Chen and Jiaqi Liu and Xinglin Zhang and Tao Chen and Lei Li},
|
| 76 |
+
year={2025},
|
| 77 |
+
eprint={2511.13001},
|
| 78 |
+
archivePrefix={arXiv},
|
| 79 |
+
primaryClass={cs.CV},
|
| 80 |
+
url={https://arxiv.org/abs/2511.13001},
|
| 81 |
+
}
|
| 82 |
+
```
|
| 83 |
|
| 84 |
+
## Acknowledgements
|
| 85 |
+
This project is significantly improved based on [nnU-Net](https://github.com/MIC-DKFZ/nnUNet/tree/master) and [SAT](https://github.com/zhaoziheng/SAT/tree/cvpr2025challenge). We extend our gratitude to both projects.
|
| 86 |
+
Medal-S is developed and maintained by Medical Image Insights.
|
| 87 |
+
<img src="https://github.com/yinghemedical/Medal-S/raw/main/assets/yh_logo.png" height="100px" />
|