🫁 Pneumonia Detector

Python ViT PyTorch HuggingFace

🎯 Live Demo

πŸ‘‰ Try it on Hugging Face Spaces

πŸ” Overview

A medical image classification system that detects pneumonia from chest X-ray images using Vision Transformer (ViT) with Grad-CAM explainability. The model highlights which regions of the X-ray influenced the prediction, making it transparent and trustworthy for medical screening.

πŸ“Š Results

Metric Score
Overall Accuracy 87%
AUC-ROC 0.9805
PNEUMONIA Recall 1.00
NORMAL Precision 0.99

πŸ“ˆ Classification Report

Class Precision Recall F1-Score
NORMAL 0.99 0.66 0.79
PNEUMONIA 0.83 1.00 0.91

✨ Features

  • βœ… Chest X-ray classification: NORMAL vs PNEUMONIA
  • βœ… Vision Transformer (ViT) fine-tuned on medical images
  • βœ… Grad-CAM heatmap visualization for explainability
  • βœ… Handles class imbalance with weighted loss
  • βœ… Gradio demo for interactive predictions

πŸ—οΈ Architecture

Chest X-Ray Image β†’ Preprocessing (224x224) β†’ ViT Base Patch16 β†’ Fine-tuned Classifier Head β†’ Prediction + Grad-CAM Heatmap

πŸ› οΈ Tech Stack

Component Tool
Model Google ViT Base Patch16 224
Framework PyTorch
Explainability Grad-CAM
Dataset Chest X-Ray Images (Pneumonia) β€” Kaggle
UI Gradio
Training Google Colab T4 GPU

πŸ“ Dataset

πŸš€ How to Use


Downloads last month
56
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for mou11/pneumonia-detector

Finetuned
(2034)
this model