aholk commited on
Commit
90994c4
·
verified ·
1 Parent(s): 7b5a7b3

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ best_validation_reconstruction.png filter=lfs diff=lfs merge=lfs -text
37
+ dice_curves.png filter=lfs diff=lfs merge=lfs -text
38
+ iou_curves.png filter=lfs diff=lfs merge=lfs -text
39
+ mcc_curves.png filter=lfs diff=lfs merge=lfs -text
40
+ training_loss.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - image-segmentation
5
+ - multilabel
6
+ - unet
7
+ - pytorch
8
+ - medical-imaging
9
+ library_name: transformers
10
+ pipeline_tag: image-segmentation
11
+ ---
12
+
13
+ # LN_segmentation_sweep_v2
14
+
15
+ A unet model for multilabel image segmentation trained with sliding window approach.
16
+
17
+ ## Model Description
18
+
19
+ ## Wandb Parameters
20
+
21
+ | Parameter | Value |
22
+ |-----------|-------|
23
+ | data_path | GleghornLab/Semi-Automated_LN_Segmentation_10_11_2025 |
24
+ | img_size | 128 |
25
+ | downsample_factor | 1 |
26
+ | num_channels | 3 |
27
+ | batch_size | 16 |
28
+ | lr | 1.7122348637490954e-05 |
29
+ | epochs | 100 |
30
+ | patience | 10 |
31
+ | weight_decay | 8.29726636990404e-05 |
32
+ | model_type | unet |
33
+ | n_filts | 32 |
34
+ | t | 3 |
35
+ | k | 3 |
36
+ | augment | False |
37
+ | norm | True |
38
+ | keep | 0.06990272917761037 |
39
+ | pruning_factor | 0.019243240405735405 |
40
+ | output_dir | pooled_metrics_hev_settings |
41
+ | device | None |
42
+ | num_workers | 4 |
43
+ | prefetch_factor | 2 |
44
+ | wandb_project | segmentation-sweep |
45
+ | wandb_run_name | hev-only-repro-pooled |
46
+ | wandb_mode | online |
47
+ | push_to_hub | True |
48
+ | hub_model_id | aholk/LN_segmentation_sweep_v2 |
49
+ | skip_report | False |
50
+ | sweep_mode | False |
51
+ | num_params | 34527236 |
52
+ | num_classes | 4 |
53
+
54
+ ## Model Parameters
55
+
56
+ | Parameter | Value |
57
+ |-----------|-------|
58
+ | num_channels | 3 |
59
+ | num_classes | 4 |
60
+ | n_filts | 32 |
61
+ | t | 3 |
62
+ | k | 3 |
63
+ | img_size | 128 |
64
+ | norm | True |
65
+ | model_arch | unet |
66
+ | transformers_version | 5.9.0 |
67
+ | architectures | ["UNetForSegmentation"] |
68
+ | output_hidden_states | False |
69
+ | return_dict | True |
70
+ | dtype | float32 |
71
+ | chunk_size_feed_forward | 0 |
72
+ | is_encoder_decoder | False |
73
+ | id2label | {"0": "LABEL_0", "1": "LABEL_1"} |
74
+ | label2id | {"LABEL_0": 0, "LABEL_1": 1} |
75
+ | problem_type | None |
76
+ | _name_or_path | |
77
+ | batch_size | 16 |
78
+ | downsample_factor | 1.0 |
79
+ | model_type | segmentation |
80
+ | output_attentions | False |
81
+
82
+ ## Performance Metrics
83
+
84
+ | Metric | Mean | Class 0 | Class 1 | Class 2 | Class 3 |
85
+ |--------|------|--------|--------|--------|--------|
86
+ | Dice | 0.8169 | 0.7188 | 0.8196 | 0.8181 | 0.9112 |
87
+ | IoU | 0.6961 | 0.5610 | 0.6943 | 0.6923 | 0.8369 |
88
+ | F1 | 0.8169 | 0.7188 | 0.8196 | 0.8181 | 0.9112 |
89
+ | MCC | 0.8124 | 0.7261 | 0.8171 | 0.8134 | 0.8928 |
90
+ | ROC AUC | 0.9768 | 0.9726 | 0.9923 | 0.9535 | 0.9888 |
91
+ | PR AUC | 0.8821 | 0.8046 | 0.8960 | 0.8652 | 0.9627 |
92
+
93
+
94
+ ## Usage
95
+
96
+ ```python
97
+ import numpy as np
98
+ from model import MODEL_REGISTRY, SegmentationConfig
99
+
100
+ # Load model
101
+ config = SegmentationConfig.from_pretrained("aholk/LN_segmentation_sweep_v2")
102
+ model = MODEL_REGISTRY["unet"].from_pretrained("aholk/LN_segmentation_sweep_v2")
103
+ model.eval()
104
+
105
+ # Run inference on a full image with sliding window
106
+ image = np.random.rand(2048, 2048, 3).astype(np.float32) # Your image here
107
+ probs = model.predict_full_image(
108
+ image,
109
+ dim=128,
110
+ batch_size=16,
111
+ device="cuda" # or "cpu"
112
+ )
113
+ # probs shape: (num_classes, H, W) with values in [0, 1]
114
+
115
+ # Threshold to get binary masks
116
+ masks = (probs > 0.5).astype(np.uint8)
117
+ ```
118
+
119
+ ## Training Plots
120
+
121
+ ![Training Loss](training_loss.png)
122
+ ![Dice Curves](dice_curves.png)
123
+ ![IoU Curves](iou_curves.png)
124
+ ![MCC Curves](mcc_curves.png)
125
+ ![Best Validation](best_validation_reconstruction.png)
126
+
127
+
128
+ ## Citation
129
+
130
+ If you use this model, please cite:
131
+
132
+ ```bibtex
133
+ @software{windowz_segmentation,
134
+ title={Multilabel Image Segmentation with Sliding Window U-Net},
135
+ author={Gleghorn Lab},
136
+ year={2025},
137
+ url={https://github.com/GleghornLab/ComputerVision2}
138
+ }
139
+ ```
best_validation_reconstruction.png ADDED

Git LFS Details

  • SHA256: 588dbce2b64f71236db8ebc109d5aa50f411f900997e2b0704b0cbca0a0bd180
  • Pointer size: 132 Bytes
  • Size of remote file: 2.04 MB
config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UNetForSegmentation"
4
+ ],
5
+ "batch_size": 16,
6
+ "downsample_factor": 1.0,
7
+ "dtype": "float32",
8
+ "img_size": 128,
9
+ "k": 3,
10
+ "model_arch": "unet",
11
+ "model_type": "segmentation",
12
+ "n_filts": 32,
13
+ "norm": true,
14
+ "num_channels": 3,
15
+ "num_classes": 4,
16
+ "t": 3,
17
+ "transformers_version": "5.9.0"
18
+ }
dice_curves.png ADDED

Git LFS Details

  • SHA256: 40f81873fdf5e1821f8a7b5f5a9351946142fed503b28b5a6635816cf5235141
  • Pointer size: 131 Bytes
  • Size of remote file: 194 kB
iou_curves.png ADDED

Git LFS Details

  • SHA256: a9c6c8d44f904838712c08d1a6e6dc0fff72991834fbf281d5c4ec78eeb7dad9
  • Pointer size: 131 Bytes
  • Size of remote file: 211 kB
mcc_curves.png ADDED

Git LFS Details

  • SHA256: f40ec01998d05597aea4ca673313f9e9a443b13a3a699616fbf3429859bf5656
  • Pointer size: 131 Bytes
  • Size of remote file: 181 kB
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f1eff854c71576b1811d78ee25a5b2413d5f3b5f7f164a2c6272e7a6cced5197
3
+ size 138178416
training_loss.png ADDED

Git LFS Details

  • SHA256: a9f038e54f368d0058a8dbe41062eac52e4912af19400c594af4e3be0e028fef
  • Pointer size: 131 Bytes
  • Size of remote file: 108 kB