Hybrid EfficientNetV2-S + GLCM with Attention Fusion, Uncertainty Awareness, and Calibrated Decision-Making
A clinically-inspired AI system focused on reliability, interpretability, and real-world deployment.
Pneumonia causes ~2.5 million deaths annually, yet diagnosis from chest X-rays still depends heavily on human interpretation.
Even experts can disagree. Fatigue and subtle patterns make diagnosis difficult.
Most AI models focus only on accuracy.
This project focuses on something more important:
Can we trust the model’s prediction?
- 🧠 Hybrid model combining CNN + GLCM texture features
- 🎯 Attention mechanism learns which features to trust
- 📉 Threshold optimization using Youden Index (not fixed 0.5)
⚠️ Uncertainty estimation using Monte Carlo Dropout- 🔍 Explainability via Grad-CAM
This is not just a classifier. It is a decision-support system prototype.
- Hybrid feature fusion (CNN + GLCM)
- Attention-based adaptive weighting
- Two-stage training (freeze → fine-tune)
- Youden Index threshold calibration
- Monte Carlo Dropout uncertainty estimation
- Test-Time Augmentation (TTA)
- Logistic stacking ensemble
- Albumentations data augmentation
- Class imbalance handling
- Grad-CAM explainability
- Calibration analysis
| Model | AUC | Accuracy | Sensitivity | Specificity |
|---|---|---|---|---|
| GLCM-only | 0.8080 | 0.7740 | 0.8103 | 0.7137 |
| CNN-only | 0.8524 | 0.8141 | 0.8128 | 0.8162 |
| Hybrid | 0.8552 | 0.7949 | 0.7641 | 0.8462 |
| Ensemble | 0.8780 | 0.8333 | 0.8282 | 0.8419 |
- Hybrid improves specificity
- Ensemble achieves best overall performance
- Better balance between sensitivity and reliability
Instead of using a fixed 0.5 threshold:
- Sensitivity: 0.9141
- Specificity: 0.9701
This improves detection but increases false positives, reflecting real clinical trade-offs.
- Data preprocessing and split correction
- Class imbalance handling
- Feature extraction (CNN + GLCM)
- Two-stage training
- Test-Time Augmentation
- Ensemble stacking
- Threshold calibration
- Uncertainty estimation
GLCM
Captures spatial texture patterns in images.
Attention Fusion
Learns how much to trust CNN vs GLCM features.
Monte Carlo Dropout
Runs multiple predictions to estimate uncertainty.
Youden Index
Finds optimal threshold balancing sensitivity and specificity.
pneumonia-detection/
├── notebooks/
├── assets/
├── models/
├── data/
├── requirements.txt
└── README.mdgit clone https://github.com/your-username/pneumonia-detection.git
cd pneumonia-detection
pip install -r requirements.txtjupyter notebook notebooks/Pneumoniadetection.ipynb- Multi-dataset evaluation
- Better calibration methods
- Transformer-based fusion
- Advanced uncertainty methods
- Multi-class classification These are fused using an attention mechanism.
This project demonstrates that combining deep representations with handcrafted texture features, along with proper calibration and uncertainty estimation, can lead to more reliable medical AI systems.
It highlights the importance of:
- moving beyond accuracy as the only metric
- incorporating uncertainty into predictions
- designing models with real-world constraints in mind
Toward trustworthy and interpretable AI for healthcare.






