ayushirathour commited on
Commit
99f2452
Β·
verified Β·
1 Parent(s): a4cafce

docs: add model card

Browse files
Files changed (1) hide show
  1. README.md +205 -0
README.md ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language: en
4
+ library_name: tensorflow
5
+ tags:
6
+ - medical-imaging
7
+ - chest-xray
8
+ - pneumonia-detection
9
+ - pediatric
10
+ - computer-vision
11
+ - cross-validation
12
+ datasets:
13
+ - paultimothymooney/chest-xray-pneumonia
14
+ - iamtanmayshukla/pneumonia-radiography-dataset
15
+ metrics:
16
+ - accuracy
17
+ - sensitivity
18
+ - specificity
19
+ model-index:
20
+ - name: PneumoDetectAI
21
+ results:
22
+ - task:
23
+ type: image-classification
24
+ name: Pediatric Pneumonia Detection
25
+ dataset:
26
+ name: Cross-Operator Validation Dataset
27
+ type: medical-imaging
28
+ metrics:
29
+ - type: accuracy
30
+ name: Cross-Operator Accuracy
31
+ value: 0.86
32
+ - type: sensitivity
33
+ name: Sensitivity
34
+ value: 0.964
35
+ - type: specificity
36
+ name: Specificity
37
+ value: 0.748
38
+ ---
39
+
40
+ # PneumoDetectAI
41
+
42
+ Binary classification model for pneumonia detection in pediatric chest X-rays (ages 1-5). Built with TensorFlow and MobileNetV2, validated on independent operator cohort with 86% accuracy and 96.4% sensitivity.
43
+
44
+ **Author**: Ayushi Rathour
45
+ **Contact**: [email protected]
46
+ **Framework**: TensorFlow 2.19
47
+ **Model Size**: ~14 MB
48
+
49
+ ## Model Overview
50
+
51
+ PneumoDetectAI is a deep learning model designed to detect pneumonia in chest X-rays of pediatric patients aged 1 to 5 years. The model uses transfer learning from MobileNetV2 for efficient inference while maintaining clinically relevant performance.
52
+
53
+ ### Key Specifications
54
+
55
+ | Property | Value |
56
+ |----------|-------|
57
+ | **Architecture** | MobileNetV2 (ImageNet pretrained) + custom head |
58
+ | **Input Shape** | 224 Γ— 224 Γ— 3 (RGB) |
59
+ | **Output** | Binary classification (NORMAL/PNEUMONIA) |
60
+ | **File Format** | TensorFlow SavedModel (.h5) |
61
+ | **Model Size** | ~14 MB |
62
+ | **Inference Time** | 0.46 seconds on CPU |
63
+ | **Target Population** | Pediatric patients (1-5 years) |
64
+
65
+ ### Intended Users
66
+ - ML researchers working on medical imaging
67
+ - Healthcare AI developers building screening tools
68
+ - Students learning medical AI validation approaches
69
+ - Radiologists interested in AI-assisted screening
70
+
71
+ ## Performance Metrics
72
+
73
+ | Validation Type | Dataset | Samples | Accuracy | Sensitivity | Specificity |
74
+ |-----------------|---------|---------|----------|-------------|-------------|
75
+ | **Internal** | Mooney 2018 | 269 | 94.8% | 89.6% | 100% |
76
+ | **Cross-Operator** | Radiography 2024 | 485 | **86.0%** | **96.4%** | 74.8% |
77
+
78
+ ### Clinical Interpretation
79
+ - **High Sensitivity (96.4%)**: Catches 96 out of 100 pneumonia cases, suitable for screening
80
+ - **Moderate Specificity (74.8%)**: 25% false positive rate acceptable for screening tool
81
+ - **Generalization**: 8.8% accuracy drop on independent cohort indicates reasonable robustness
82
+
83
+ ## Quick Start Usage
84
+
85
+ ```python
86
+ from huggingface_hub import hf_hub_download
87
+ import tensorflow as tf
88
+ import numpy as np
89
+ from PIL import Image
90
+
91
+ # Download and load model
92
+ model_path = hf_hub_download(
93
+ repo_id="ayushirathour/chest-xray-pneumonia-detection",
94
+ filename="best_chest_xray_model.h5"
95
+ )
96
+ model = tf.keras.models.load_model(model_path)
97
+
98
+ # Preprocess image
99
+ def preprocess_xray(image_path):
100
+ img = Image.open(image_path).convert("RGB").resize((224, 224))
101
+ img_array = np.array(img) / 255.0
102
+ return np.expand_dims(img_array, axis=0)
103
+
104
+ # Make prediction
105
+ image_array = preprocess_xray("chest_xray.jpg")
106
+ probability = model.predict(image_array)[0][0]
107
+ diagnosis = "PNEUMONIA" if probability >= 0.5 else "NORMAL"
108
+ confidence = probability * 100 if probability >= 0.5 else (1 - probability) * 100
109
+
110
+ print(f"Diagnosis: {diagnosis}")
111
+ print(f"Confidence: {confidence:.1f}%")
112
+ ```
113
+
114
+ ## Training Details
115
+
116
+ ### Datasets
117
+ - **Training Data**: Chest X-Ray Images (Pneumonia) by Paul Timothy Mooney
118
+ - Source: Guangzhou Women and Children's Medical Center
119
+ - Size: ~5,863 images (pediatric patients aged 1-5)
120
+ - Split: Pre-divided train/validation/test
121
+
122
+ - **External Validation**: Pneumonia Radiography Dataset by Tanmay Shukla
123
+ - Source: Same hospital, different operators and time period
124
+ - Size: 485 independent samples
125
+ - Purpose: Cross-operator generalization testing
126
+
127
+ ### Architecture Details
128
+ - **Base Model**: MobileNetV2 (ImageNet weights frozen initially)
129
+ - **Custom Head**: Global Average Pooling β†’ Dropout (0.5) β†’ Dense (128) β†’ Dense (1, sigmoid)
130
+ - **Optimization**: Adam optimizer (lr=0.0001)
131
+ - **Loss Function**: Binary crossentropy
132
+ - **Training**: 20 epochs with early stopping
133
+
134
+ ## Limitations & Risks
135
+
136
+ ### Technical Limitations
137
+ - **Single Institution**: Both datasets from same medical center
138
+ - **Age Restriction**: Validated only on pediatric patients (1-5 years)
139
+ - **Binary Output**: Cannot distinguish pneumonia subtypes (viral vs bacterial)
140
+ - **Image Quality**: Performance degrades with poor quality or non-standard views
141
+
142
+ ### Clinical Limitations
143
+ - **False Positive Rate**: 25.2% may increase radiologist workload
144
+ - **Screening Only**: Not suitable for definitive diagnosis
145
+ - **Population Bias**: Trained on Asian pediatric cohort only
146
+ - **No Clinical Context**: Cannot incorporate patient history or symptoms
147
+
148
+ ### Deployment Risks
149
+ - **Overconfidence**: High sensitivity may create false sense of security
150
+ - **Misuse**: Risk of use without proper medical oversight
151
+ - **Generalization**: Performance may vary on different imaging equipment
152
+
153
+ ## Responsible AI & Ethics
154
+
155
+ ### Bias Considerations
156
+ - **Population Bias**: Model trained exclusively on Asian pediatric population
157
+ - **Institutional Bias**: Single medical center may not represent global imaging practices
158
+ - **Age Bias**: Performance on other age groups unknown
159
+
160
+ ### Required Safeguards
161
+ - **Human Oversight**: All predictions must be reviewed by qualified radiologists
162
+ - **Screening Context**: Should only be used as preliminary screening tool
163
+ - **Informed Consent**: Patients must be informed of AI involvement in screening
164
+ - **Quality Assurance**: Regular monitoring of real-world performance required
165
+
166
+ ### Regulatory Status
167
+ - **Not FDA Approved**: Research prototype only
168
+ - **Not CE Marked**: Not approved for clinical use in EU
169
+ - **Research Use**: Intended for academic and development purposes only
170
+
171
+ ## Citation
172
+
173
+ ```bibtex
174
+ @misc{rathour2025pneumodetectai,
175
+ title={PneumoDetectAI: Pediatric Chest X-Ray Pneumonia Detection with Cross-Operator Validation},
176
+ author={Rathour, Ayushi},
177
+ year={2025},
178
+ note={Cross-operator validation on 485 independent samples},
179
+ url={https://huggingface.co/ayushirathour/chest-xray-pneumonia-detection}
180
+ }
181
+ ```
182
+
183
+ ## Acknowledgements
184
+
185
+ ### Datasets
186
+ - **Training Dataset**: Chest X-Ray Images (Pneumonia) - Paul Timothy Mooney (Kaggle)
187
+ - **Validation Dataset**: Pneumonia Radiography Dataset - Tanmay Shukla (Kaggle)
188
+ - **Original Research**: Kermany et al., "Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning", Cell 2018
189
+
190
+ ### Technical Stack
191
+ - **Framework**: TensorFlow 2.19
192
+ - **Architecture**: MobileNetV2 (Google)
193
+ - **Deployment**: Streamlit, FastAPI
194
+ - **Hosting**: Hugging Face Hub
195
+
196
+ ## Additional Resources
197
+
198
+ - 🌐 **Live Demo**: [PneumoDetectAI Web App](https://pneumodetectai.streamlit.app/)
199
+ - πŸ“‚ **Source Code**: [GitHub Repository](https://github.com/ayushirathour/chest-xray-pneumonia-detection)
200
+ - πŸ“– **API Documentation**: Available when running locally
201
+ - πŸ’¬ **Issues & Support**: GitHub Issues or email contact
202
+
203
+ ---
204
+
205
+ **Disclaimer**: This model is for research and educational purposes only. It is not a medical device and should not be used for clinical diagnosis without appropriate medical supervision.