--- license: other license_name: sam-license license_link: LICENSE base_model: facebook/sam3 library_name: pytorch pipeline_tag: image-segmentation tags: - medical-imaging - 3d-medical-image-segmentation - text-prompted-segmentation - sam3 --- # Dr. SAM3: Towards Generalizable Text-Prompted 3D Medical Segmentation [![Code](https://img.shields.io/badge/GitHub-Code-181717?logo=github)](https://github.com/UCSC-VLAA/Dr.SAM3) [![Project page](https://img.shields.io/badge/Project-page-0d9488)](https://ucsc-vlaa.github.io/Dr.SAM3) ![Paper](https://img.shields.io/badge/Paper-coming%20soon-b31b1b?logo=arxiv&logoColor=white) ![Dr. SAM3 on external CT and PET scans and on MedSegFM validation volumes](teaser.png) Dr. SAM3 adapts [SAM3](https://huggingface.co/facebook/sam3) to text-prompted 3D medical segmentation across CT, MR, ultrasound, PET and microscopy by changing only its training and inference, not its architecture. Given a volume and a class name such as `CT liver tumor`, it segments the target slice by slice (**Dr.SAM3-D**, detector only) or propagates masks through adjacent slices (**Dr.SAM3-T**, detector + tracker). On CT, MR and PET, Dr.SAM3-T re-decides the voxels claimed by several prompts with cross-view label voting: coronal and sagittal passes of the same model each cast one vote. Both models are fine-tuned on the public MedSegFM data (CVPR 2025 BiomedSegFM challenge). ## Files | File | Used by | Size | | --- | --- | --- | | `drsam3_detector.pt` | Dr.SAM3-D, Dr.SAM3-T | 3.4 GB | | `drsam3_tracker.pt` | Dr.SAM3-T | 1.9 GB | Both are PyTorch state dicts (`{"model": state_dict}`) at 504 x 504 input resolution. Dr.SAM3-T also needs the base SAM3 checkpoint `sam3.pt` from [facebook/sam3](https://huggingface.co/facebook/sam3) (gated), which provides the tracker modules that were not fine-tuned. ## Usage ```bash git clone https://github.com/UCSC-VLAA/Dr.SAM3.git && cd Dr.SAM3 # install PyTorch, then: pip install -r requirements.txt && pip install -e . hf download UCSC-VLAA/Dr.SAM3 drsam3_detector.pt drsam3_tracker.pt --local-dir checkpoints hf download facebook/sam3 sam3.pt --local-dir checkpoints # Dr.SAM3-D (add --backend tracker for Dr.SAM3-T) python scripts/predict.py --image ct.nii.gz --modality CT \ --prompts liver spleen "left kidney" "right kidney" --output ct_seg.nii.gz ``` The output is a label map on the input grid in which value *i* is the *i*-th prompt. For raw CT in Hounsfield units add an intensity window, e.g. `--window -160 240`. Dr.SAM3-T applies cross-view label voting by default (`--no-voting` keeps the axial pass only). See the [repository](https://github.com/UCSC-VLAA/Dr.SAM3) for batch prediction, evaluation and training, and the [project page](https://ucsc-vlaa.github.io/Dr.SAM3) for results. ## Intended use and limitations The models are research artifacts for text-prompted segmentation of biomedical volumes. They are not medical devices and must not be used for clinical decisions. Accuracy varies with modality, target and acquisition; it is lower for small or rare targets and for imaging conditions far from the training data. ## License The weights are fine-tuned from SAM 3 and are released under the [SAM License](LICENSE).