Bawil commited on
Commit
f3a6a31
Β·
verified Β·
1 Parent(s): 8df9083

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +262 -3
README.md CHANGED
@@ -1,3 +1,262 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - medical-imaging
5
+ - image-segmentation
6
+ - white-matter-hyperintensities
7
+ - mri
8
+ - flair
9
+ - deep-learning
10
+ - tensorflow
11
+ - keras
12
+ - neurology
13
+ - multiple-sclerosis
14
+ datasets:
15
+ - custom
16
+ - msseg2016
17
+ metrics:
18
+ - dice-coefficient
19
+ - hausdorff-distance
20
+ library_name: tensorflow
21
+ pipeline_tag: image-segmentation
22
+ ---
23
+
24
+ # WMH Segmentation: Normal vs Abnormal Classification
25
+
26
+ Pre-trained models for **white matter hyperintensity (WMH) segmentation** with explicit distinction between normal periventricular changes and pathological lesions.
27
+
28
+ ## Model Description
29
+
30
+ This repository contains 8 pre-trained deep learning models (4 architectures Γ— 2 training scenarios) for automated WMH segmentation from FLAIR MRI images. The models implement a novel **three-class approach** that distinguishes between:
31
+
32
+ - **Class 0**: Background
33
+ - **Class 1**: Normal WMH (aging-related periventricular changes)
34
+ - **Class 2**: Abnormal WMH (pathologically significant lesions)
35
+
36
+ This approach addresses the critical challenge of false positive detection in periventricular regions, achieving up to **27.1% improvement** in Dice coefficient compared to traditional binary segmentation.
37
+
38
+ ## Model Architectures
39
+
40
+ | Architecture | Parameters | Best Dice (3-Class) | Binary Baseline | Improvement |
41
+ |--------------|-----------|---------------------|-----------------|-------------|
42
+ | **U-Net** ⭐ | 31.0M | **0.768** | 0.497 | **+54.5%** |
43
+ | **Attention U-Net** | 34.9M | 0.740 | 0.486 | +52.1% |
44
+ | **TransUNet** | 105.3M | 0.700 | 0.510 | +37.3% |
45
+ | **DeepLabV3Plus** | 40.3M | 0.586 | 0.374 | +56.7% |
46
+
47
+ ⭐ **Recommended**: U-Net with Scenario 2 (three-class) for optimal performance
48
+
49
+ ## Repository Structure
50
+
51
+ ```
52
+ models/
53
+ β”œβ”€β”€ unet/models/
54
+ β”‚ β”œβ”€β”€ scenario1_binary_model.h5 # Binary: Background vs Abnormal
55
+ β”‚ └── scenario2_multiclass_model.h5 # 3-Class: Background, Normal, Abnormal
56
+ β”œβ”€β”€ attention_unet/models/
57
+ β”‚ β”œβ”€β”€ scenario1_binary_model.h5
58
+ β”‚ └── scenario2_multiclass_model.h5
59
+ β”œβ”€β”€ deeplabv3plus/models/
60
+ β”‚ β”œβ”€β”€ scenario1_binary_model.h5
61
+ β”‚ └── scenario2_multiclass_model.h5
62
+ └── transunet/models/
63
+ β”œβ”€β”€ scenario1_binary_model.h5
64
+ └── scenario2_multiclass_model.h5
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ ### Installation
70
+
71
+ ```bash
72
+ pip install huggingface_hub tensorflow numpy nibabel
73
+ ```
74
+
75
+ ### Download Models
76
+
77
+ ```python
78
+ from huggingface_hub import hf_hub_download
79
+
80
+ # Download best performing model (U-Net Three-Class)
81
+ model_path = hf_hub_download(
82
+ repo_id="Bawil/wmh_leverage_normal_abnormal_segmentation",
83
+ filename="unet/models/scenario2_multiclass_model.h5"
84
+ )
85
+
86
+ # Load model
87
+ from tensorflow.keras.models import load_model
88
+ model = load_model(model_path)
89
+ ```
90
+
91
+ ### Inference Example
92
+
93
+ ```python
94
+ import numpy as np
95
+ from tensorflow.keras.models import load_model
96
+
97
+ # Load pre-trained model
98
+ model = load_model(model_path)
99
+
100
+ # Prepare input (256x256 grayscale FLAIR MRI, normalized)
101
+ # input_image shape: (batch_size, 256, 256, 1)
102
+ input_image = preprocess_flair(your_flair_image)
103
+
104
+ # Run inference
105
+ predictions = model.predict(input_image)
106
+
107
+ # Get class predictions
108
+ predicted_classes = np.argmax(predictions, axis=-1)
109
+ # 0: Background
110
+ # 1: Normal WMH (periventricular)
111
+ # 2: Abnormal WMH (pathological)
112
+
113
+ # Extract pathological lesions only
114
+ abnormal_mask = (predicted_classes == 2).astype(np.uint8)
115
+ ```
116
+
117
+ ## Training Data
118
+
119
+ ### Dataset Composition
120
+
121
+ - **Local Dataset**: 100 MS patients (2,000 FLAIR MRI slices)
122
+ - Demographics: 26 males, 74 females
123
+ - Age range: 18-68 years
124
+ - Scanner: 1.5-Tesla TOSHIBA Vantage
125
+
126
+ - **Public Dataset**: MSSEG2016 (15 patients, 750 FLAIR slices)
127
+
128
+ ### Annotations
129
+
130
+ - Expert annotations by board-certified neuroradiologists (20+ years experience)
131
+ - Three-class labeling: Background, Normal WMH, Abnormal WMH
132
+ - Approved by Ethics Committee (IR.TBZMED.REC.1402.902)
133
+
134
+ ### Data Split
135
+
136
+ - **Training**: 80% patients (local) + 60% patients (public)
137
+ - **Validation**: 10% patients (local) + 20% patients (public)
138
+ - **Testing**: 10% patients (local) + 20% patients (public)
139
+ - **Strategy**: Patient-level stratified split (no slice-level leakage)
140
+
141
+ ## Model Training
142
+
143
+ ### Configuration
144
+
145
+ - **Framework**: TensorFlow 2.11, Keras
146
+ - **Optimizer**: Adam (learning rate: 0.0001)
147
+ - **Loss Functions**:
148
+ - Scenario 1: Weighted binary cross-entropy
149
+ - Scenario 2: Weighted categorical cross-entropy
150
+ - **Epochs**: 50 (with early stopping)
151
+ - **Batch Size**: 8
152
+ - **Input Size**: 256Γ—256Γ—1
153
+ - **Data Augmentation**: Rotation, flipping, elastic deformation
154
+
155
+ ### Hardware
156
+
157
+ - **GPU**: NVIDIA RTX 3060 (12GB VRAM)
158
+ - **Training Time**: 2-3 hours per model
159
+ - **Inference Time**: ~35-40ms per image
160
+
161
+ ## Model Performance
162
+
163
+ ### Dice Coefficient (Primary Metric)
164
+
165
+ | Model | Scenario 1 | Scenario 2 | Ξ” Improvement | p-value | Cohen's d |
166
+ |-------|-----------|-----------|---------------|---------|-----------|
167
+ | U-Net | 0.497Β±0.145 | **0.768Β±0.124** | **+0.271** | <0.0001 | 0.564 |
168
+ | Attention U-Net | 0.486Β±0.157 | 0.740Β±0.133 | +0.253 | <0.0001 | 0.442 |
169
+ | TransUNet | 0.510Β±0.116 | 0.700Β±0.097 | +0.190 | <0.0001 | 0.478 |
170
+ | DeepLabV3Plus | 0.374Β±0.110 | 0.586Β±0.092 | +0.212 | <0.0001 | 0.565 |
171
+
172
+ ### Additional Metrics
173
+
174
+ - **Hausdorff Distance**: 27.4mm (U-Net 3-class) vs 29.8mm (binary)
175
+ - **Precision**: Significant improvement in pathological lesion detection
176
+ - **False Positive Reduction**: Marked decrease in periventricular regions
177
+ - **Clinical Feasibility**: 1.5s total processing time per case (40 slices)
178
+
179
+ ### Statistical Validation
180
+
181
+ - Paired t-tests confirm significant improvements (all p < 0.0001)
182
+ - Effect sizes range from medium (0.44) to large (0.56)
183
+ - 95% confidence intervals reported for all metrics
184
+ - Wilcoxon signed-rank test for non-parametric validation
185
+
186
+ ## Use Cases
187
+
188
+ ### Clinical Applications
189
+
190
+ - **MS Lesion Quantification**: Accurate measurement of disease burden
191
+ - **Differential Diagnosis**: Distinguish pathological from normal aging
192
+ - **Longitudinal Monitoring**: Track disease progression over time
193
+ - **Treatment Response**: Evaluate therapeutic efficacy
194
+ - **Radiological Reporting**: Reduce false positive alerts
195
+
196
+ ### Research Applications
197
+
198
+ - **Baseline Comparisons**: Standardized evaluation framework
199
+ - **Method Development**: Foundation for advanced segmentation approaches
200
+ - **Multi-center Studies**: Protocol for broader validation
201
+ - **Reproducible Research**: Complete implementation available
202
+
203
+ ## Limitations
204
+
205
+ - **Single Modality**: Trained on FLAIR MRI only
206
+ - **Scanner Specificity**: Primarily 1.5T TOSHIBA data
207
+ - **Disease Focus**: Optimized for MS patients
208
+ - **2D Segmentation**: Slice-by-slice processing (no 3D context)
209
+ - **Resolution**: Fixed 256Γ—256 input size
210
+
211
+ ## Model Card
212
+
213
+ ### Intended Use
214
+
215
+ - **Primary**: Automated WMH segmentation for research and clinical decision support
216
+ - **Users**: Radiologists, neurologists, researchers, AI developers
217
+ - **Out-of-scope**: Not FDA/CE approved; not for standalone clinical diagnosis
218
+
219
+ ### Ethical Considerations
220
+
221
+ - **Privacy**: All data anonymized per HIPAA/GDPR standards
222
+ - **Bias**: Limited scanner/protocol diversity may affect generalization
223
+ - **Clinical Validation**: Requires expert review before clinical use
224
+ - **Transparency**: Complete methodology and code openly available
225
+
226
+ ### Model Card Authors
227
+
228
+ Mahdi Bashiri Bawil, Mousa Shamsi, Ali Fahmi Jafargholkhanloo, Abolhassan Shakeri Bavil
229
+
230
+ ## Citation
231
+
232
+ ```bibtex
233
+ @article{bawil2025wmh,
234
+ title={Incorporating Normal Periventricular Changes for Enhanced Pathological
235
+ White Matter Hyperintensity Segmentation: On Multi-Class Deep Learning Approaches},
236
+ author={Bawil, Mahdi Bashiri and Shamsi, Mousa and Jafargholkhanloo, Ali Fahmi and
237
+ Bavil, Abolhassan Shakeri and Jafargholkhanloo, Ali Fahmi},
238
+ year={2025},
239
+ note={Models: https://huggingface.co/Bawil/wmh_leverage_normal_abnormal_segmentation}
240
+ }
241
+ ```
242
+
243
+ ## License
244
+
245
+ MIT License - See [LICENSE](https://github.com/Mahdi-Bashiri/wmh-normal-abnormal-segmentation/blob/main/LICENSE)
246
+
247
+ ## Additional Resources
248
+
249
+ - **πŸ“„ Paper**: [Under Review]
250
+ - **πŸ’» GitHub Repository**: [Mahdi-Bashiri/wmh-normal-abnormal-segmentation](https://github.com/Mahdi-Bashiri/wmh-normal-abnormal-segmentation)
251
+ - **πŸ“§ Contact**: m_bashiri99@sut.ac.ir
252
+ - **πŸ₯ Institution**: Sahand University of Technology & Tabriz University of Medical Sciences
253
+
254
+ ## Acknowledgments
255
+
256
+ - **Golgasht Medical Imaging Center**, Tabriz, Iran for providing clinical data
257
+ - Expert neuroradiologists for manual annotations
258
+ - Ethics Committee approval: IR.TBZMED.REC.1402.902
259
+
260
+ ---
261
+
262
+ **Keywords**: white matter hyperintensities, FLAIR MRI, medical imaging, deep learning, image segmentation, multiple sclerosis, U-Net, attention mechanisms, transformers, clinical AI