ly17 commited on
Commit
eda526e
·
verified ·
1 Parent(s): 39a0736

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -0
README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SAM3 Blood Vessel Segmentation
2
+
3
+ Fine-tuned SAM3 model for blood vessel angiography segmentation.
4
+
5
+ ## Model Performance
6
+
7
+ | Model | Dice | IoU | Recall |
8
+ |-------|------|-----|--------|
9
+ | Original SAM3 | 0.00 | 0.00 | 0.00 |
10
+ | Baseline (5 epochs) | 0.79 | 0.66 | 0.73 |
11
+ | **Dice Optimized (10 epochs)** | **0.82** | **0.69** | **0.77** |
12
+ | Dice Optimized + Post-processing | **0.83** | **0.70** | **0.78** |
13
+
14
+ ## Files
15
+
16
+ - `checkpoint_dice_optimized.pt` - **Recommended** - Dice optimized model
17
+ - `checkpoint_baseline.pt` - Baseline fine-tuned model
18
+ - `sam3_original.pt` - Original SAM3 weights
19
+
20
+ ## Usage
21
+
22
+ ```python
23
+ from huggingface_hub import hf_hub_download
24
+ import torch
25
+ from sam3.model_builder import build_sam3_image_model
26
+ from sam3.model.sam3_image_processor import Sam3Processor
27
+
28
+ # Download weights
29
+ checkpoint = hf_hub_download(
30
+ repo_id="qimingfan10/sam3-vessel-segmentation",
31
+ filename="checkpoint_dice_optimized.pt"
32
+ )
33
+
34
+ # Load model
35
+ model = build_sam3_image_model(
36
+ checkpoint_path="path/to/sam3_original.pt",
37
+ enable_segmentation=True,
38
+ device="cuda"
39
+ )
40
+
41
+ # Load fine-tuned weights
42
+ ckpt = torch.load(checkpoint, map_location="cuda")
43
+ state_dict = {k.replace('module.', ''): v for k, v in ckpt['model'].items()}
44
+ model.load_state_dict(state_dict, strict=False)
45
+ model.eval()
46
+
47
+ # Inference
48
+ processor = Sam3Processor(model)
49
+ state = processor.set_image(image)
50
+ output = processor.set_text_prompt(state=state, prompt="blood vessel")
51
+ masks = output["masks"]
52
+ ```
53
+
54
+ ## Training
55
+
56
+ See [VESSEL_SEGMENTATION_GUIDE.md](https://github.com/qimingfan10/Sam3/blob/main/VESSEL_SEGMENTATION_GUIDE.md) for training details.
57
+
58
+ ## Citation
59
+
60
+ Please cite SAM3 if you use this model.