BioHCL-SSSM
a lightweight hybrid architecture for pneumonia detection
2 min readupdated
BioHCL-SSSM is a hybrid computer vision model by unknownBrain that combines convolutional networks with state-space models (Hierarchical Convolutional State-Space Hybrid Architecture) to detect pediatric pneumonia from chest X-rays. The repository bundles a complete workflow: 10 trained cross-validation checkpoints, modular PyTorch code, evaluation scripts, heatmap generators, and benchmark tables comparing it against other architectures. At just 14.01M parameters, it outperforms much heavier transformers like ViT-Base (86.57M parameters). This project is useful for medical AI researchers, developers building X-ray analysis systems, and anyone exploring compact alternatives to Vision Transformers.
Key features
- Compact and fast: The model packs 14.01M parameters and requires 8.56 GFLOPs, yet beats ViT-Base on the official test set (96.47% vs. 92.47% accuracy) with 83.8% fewer parameters, while also outperforming Swin-T at half the size.
- High cross-validation accuracy: Across 10 folds, the model achieved a mean accuracy of 99.37% (±0.33%), an F1-score of 0.9957, and a ROC-AUC of 0.9929, making only 33 errors across 5,232 images.
- Explainability (XAI) tools: The project includes the
build_xai.pyscript to generate attention maps and explain model predictions using Attention, GradCAM, LIME, and SHAP. - Full reproducibility: Alongside weights for all 10 folds (54 MB each) and the best checkpoint
best_student_cv.pt, the repo provides raw logs from 64 ablation runs, CSV metric tables, and ready-made ROC, PR, and confusion matrix plots.
What you can do
- Use pretrained weights for inference and fine-tuning: Load the
best_student_cv.ptcheckpoint (99.81% validation accuracy, 100% recall) or any of the 10 folds for chest X-ray classification experiments. - Visualize pathological regions: Run
build_xai.pyto generate GradCAM, LIME, or SHAP heatmaps and inspect which lung areas the model relies on for its diagnosis. - Reproduce ablation experiments: Use the standalone
run_colab_remaining_ablations.pyscript to run the remaining sweeps with different loss weights (lambda_bio) and benchmark against the baseline MHSA attention mechanism.
Example
git clone [https://huggingface.co/unknownBrain/BioHCL-SSSM-Complete-Workspace](https://huggingface.co/unknownBrain/BioHCL-SSSM-Complete-Workspace)
cd BioHCL-SSSM-Complete-Workspace
pip install torch torchvision timm albumentations huggingface_hub scikit-learn pandas pillow
python run_colab_remaining_ablations.py
Read more
DetailsOfficial test set (624 images from the Guangzhou Women and Children’s Medical Center dataset, Kermany et al., 2018): 96.47% Accuracy, 97.22% F1, 99.37% ROC-AUC.
Best cross-validation fold (Fold 2): 99.81% Accuracy, 0.9987 F1, 100% Recall, 99.26% Specificity.
Hardware and runtime: Running the remaining experiments script takes about 10 minutes on an RTX 3080 Ti-class GPU or in Google Colab.
License: MIT.










Comments