Views
No views yet
nn.Conv2d(feature_dim=256, out_channels=2, kernel_size=1)| Method | Dice | IoU | Sensitivity |
|---|---|---|---|
| Zero-shot SAM3 | 0.189 | 0.124 | 0.397 |
| Linear probe (frozen encoder) | 0.836 (pixel) / 0.801 (per-case mean) | — | — |
tumor_segmentation/sam3/sam3_linear_probe_tumor_segmentation_best.pt:
SAM3 frozen backbone + 1×1 Conv2d linear probe for brain tumor segmentation.1{
2 "model_state_dict": {"weight": ..., "bias": ...}, # Conv2d probe weights
3 "feature_dim": 256, # SAM3 feature channels
4}classifier.weight/bias, module.classifier.weight/bias, or flat weight/bias.1from huggingface_hub import hf_hub_download
2from agents.sam3_tool import SAM3Tool
3from config import DEFAULT_CONFIG
4
5probe_path = hf_hub_download(
6 repo_id="tamara-kostova/multiagentmed-tumor-segmentation",
7 filename="tumor_segmentation/sam3/sam3_linear_probe_tumor_segmentation_best.pt",
8)
9
10DEFAULT_CONFIG.model.sam3_linear_probe_checkpoint = probe_path
11
12tool = SAM3Tool(DEFAULT_CONFIG.model)
13result = tool.segment("path/to/brain_mri.png", text_prompt="brain tumor")
14
15print(result["mask_path"]) # binary segmentation mask
16print(result["bbox"]) # [x1, y1, x2, y2]
17print(result["guided_image_path"]) # original image with red bbox overlay1{
2 "mask_path": "outputs/segmentation/mask_<uid>.png", # binary mask (0/255)
3 "bbox": [x1, y1, x2, y2], # bounding box of mask
4 "guided_image_path": "outputs/segmentation/guided_<uid>.png", # bbox overlay for MedGemma
5 "skipped": False
6}