aholk commited on
Commit
2657d76
·
verified ·
1 Parent(s): d750a38

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +87 -0
  2. config.json +16 -0
  3. model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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:** 128
23
+ - **Window Size:** 128
24
+ - **Downsample Factor:** 1.0
25
+
26
+ ### Model-Specific Parameters
27
+
28
+
29
+ ## Training Configuration
30
+
31
+ | Parameter | Value |
32
+ |-----------|-------|
33
+ | Batch Size | 8 |
34
+ | Learning Rate | 7.77451918775676e-06 |
35
+ | Weight Decay | 0.00164040349077736 |
36
+ | Epochs | 100 |
37
+ | Patience | 10 |
38
+ | Dataset | GleghornLab/Semi-Automated_LN_Segmentation_10_11_2025 |
39
+
40
+ ## Performance Metrics
41
+
42
+ No test metrics available.
43
+
44
+ ## Usage
45
+
46
+ ```python
47
+ import numpy as np
48
+ from model import MODEL_REGISTRY, SegmentationConfig
49
+
50
+ # Load model
51
+ config = SegmentationConfig.from_pretrained("aholk/LN_segmentation_sweep")
52
+ model = MODEL_REGISTRY["unet"].from_pretrained("aholk/LN_segmentation_sweep")
53
+ model.eval()
54
+
55
+ # Run inference on a full image with sliding window
56
+ image = np.random.rand(2048, 2048, 3).astype(np.float32) # Your image here
57
+ probs = model.predict_full_image(
58
+ image,
59
+ dim=128,
60
+ batch_size=16,
61
+ device="cuda" # or "cpu"
62
+ )
63
+ # probs shape: (num_classes, H, W) with values in [0, 1]
64
+
65
+ # Threshold to get binary masks
66
+ masks = (probs > 0.5).astype(np.uint8)
67
+ ```
68
+
69
+ ## Training Plots
70
+
71
+ ![Training Loss](training_loss.png)
72
+ ![Dice Curves](dice_curves.png)
73
+ ![MCC Curves](mcc_curves.png)
74
+ ![Best Validation](best_validation_reconstruction.png)
75
+
76
+ ## Citation
77
+
78
+ If you use this model, please cite:
79
+
80
+ ```bibtex
81
+ @software{windowz_segmentation,
82
+ title={Multilabel Image Segmentation with Sliding Window U-Net},
83
+ author={Gleghorn Lab},
84
+ year={2025},
85
+ url={https://github.com/GleghornLab/ComputerVision2}
86
+ }
87
+ ```
config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "UNetForSegmentation"
4
+ ],
5
+ "dtype": "float32",
6
+ "img_size": null,
7
+ "k": 5,
8
+ "model_arch": null,
9
+ "model_type": "segmentation",
10
+ "n_filts": 128,
11
+ "norm": null,
12
+ "num_channels": 3,
13
+ "num_classes": 4,
14
+ "t": 3,
15
+ "transformers_version": "5.3.0"
16
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16649a1d727ddf7f3ebeb663a375f4c91d8ec9655e70f45aad83f37dc12481d1
3
+ size 2208895776