aholk commited on
Commit
147e747
·
verified ·
1 Parent(s): 6d5c7c7

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,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
14
+
15
+ A unet model for multilabel image segmentation trained with sliding window approach.
16
+
17
+ ## Model Description
18
+
19
+ - **Architecture:** unet
20
+ - **Input Channels:** 3
21
+ - **Output Classes:** 4
22
+ - **Base Filters:** 32
23
+ - **Window Size:** 256
24
+
25
+ ### Model-Specific Parameters
26
+
27
+
28
+ ## Training Configuration
29
+
30
+ | Parameter | Value |
31
+ |-----------|-------|
32
+ | Batch Size | 64 |
33
+ | Learning Rate | 0.0003 |
34
+ | Weight Decay | 0.01 |
35
+ | Epochs | 100 |
36
+ | Patience | 10 |
37
+ | Dataset | GleghornLab/Semi-Automated_LN_Segmentation_10_11_2025 |
38
+
39
+ ## Performance Metrics
40
+
41
+ | Metric | Mean | Class 0 | Class 1 | Class 2 | Class 3 |
42
+ |--------|------|--------|--------|--------|--------|
43
+ | Dice | 0.5196 | 0.1800 | 0.2978 | 0.7189 | 0.8819 |
44
+ | IoU | 0.4059 | 0.0989 | 0.1749 | 0.5612 | 0.7887 |
45
+ | F1 | 0.5196 | 0.1800 | 0.2978 | 0.7189 | 0.8819 |
46
+ | MCC | 0.5044 | 0.1730 | 0.2861 | 0.7032 | 0.8554 |
47
+ | ROC AUC | 0.8338 | 0.6482 | 0.7772 | 0.9252 | 0.9847 |
48
+ | PR AUC | 0.4846 | 0.0767 | 0.1807 | 0.7583 | 0.9227 |
49
+
50
+
51
+ ## Usage
52
+
53
+ ```python
54
+ import numpy as np
55
+ from model import MODEL_REGISTRY, SegmentationConfig
56
+
57
+ # Load model
58
+ config = SegmentationConfig.from_pretrained("aholk/LN_segmentation")
59
+ model = MODEL_REGISTRY["unet"].from_pretrained("aholk/LN_segmentation")
60
+ model.eval()
61
+
62
+ # Run inference on a full image with sliding window
63
+ image = np.random.rand(2048, 2048, 3).astype(np.float32) # Your image here
64
+ probs = model.predict_full_image(
65
+ image,
66
+ dim=256,
67
+ batch_size=16,
68
+ device="cuda" # or "cpu"
69
+ )
70
+ # probs shape: (num_classes, H, W) with values in [0, 1]
71
+
72
+ # Threshold to get binary masks
73
+ masks = (probs > 0.5).astype(np.uint8)
74
+ ```
75
+
76
+ ## Training Plots
77
+
78
+ ![Training Loss](training_loss.png)
79
+ ![Dice Curves](dice_curves.png)
80
+ ![MCC Curves](mcc_curves.png)
81
+ ![Best Validation](best_validation_reconstruction.png)
82
+
83
+ ## Citation
84
+
85
+ If you use this model, please cite:
86
+
87
+ ```bibtex
88
+ @software{windowz_segmentation,
89
+ title={Multilabel Image Segmentation with Sliding Window U-Net},
90
+ author={Gleghorn Lab},
91
+ year={2025},
92
+ url={https://github.com/GleghornLab/ComputerVision2}
93
+ }
94
+ ```
best_validation_reconstruction.png ADDED

Git LFS Details

  • SHA256: 163138b00b49c7a767f0c6bee989d0ab31e93f21cf4ee621a178563eca80fdc8
  • Pointer size: 132 Bytes
  • Size of remote file: 2.03 MB
config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UNetForSegmentation"
4
+ ],
5
+ "dtype": "float32",
6
+ "img_size": 256,
7
+ "k": 2,
8
+ "model_arch": "unet",
9
+ "model_type": "segmentation",
10
+ "n_filts": 32,
11
+ "norm": false,
12
+ "num_channels": 3,
13
+ "num_classes": 4,
14
+ "t": 2,
15
+ "transformers_version": "5.2.0"
16
+ }
dice_curves.png ADDED

Git LFS Details

  • SHA256: 0b71ebc8ad81b354f4ac4bb1eb6ddafeb2c4cb0b72ad1b94e70a69ebda22bcdd
  • Pointer size: 131 Bytes
  • Size of remote file: 197 kB
iou_curves.png ADDED

Git LFS Details

  • SHA256: 5a2516a6d9caf79bceee68874091721c07bc388eb6ee6e3c8a30e2f17bee9107
  • Pointer size: 131 Bytes
  • Size of remote file: 198 kB
mcc_curves.png ADDED

Git LFS Details

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

Git LFS Details

  • SHA256: 4f04c4fa222999139d024095f39b1636726dc2cd43da27e8cb6350df9fd35629
  • Pointer size: 131 Bytes
  • Size of remote file: 107 kB