This deep learning model is designed to automate the identification of Malaria parasites in thin blood smear slides. Leveraging EfficientNet-B0 and Explainable AI (Grad-CAM), the system achieves state-of-the-art accuracy while providing clinicians with visual evidence for every diagnostic decision.
๐ Live Demo: https://deep-learning-malaria-detection.vercel.app
๐ ML Model API: https://deep-learning-malaria-detection.onrender.com
- Diagnostic Bottlenecks: Manual microscopy is time-intensive and requires highly trained pathologists who are scarce in endemic regions.
- Human Error: Fatigue and low parasite density often lead to false negatives (missed diagnoses).
- Lack of Trust: "Black box" AI models give answers without reasons, making doctors hesitant to adopt them.
- Global Health Gap: Over 200 million malaria cases occur annually, requiring scalable, automated screening tools.
This platform addresses these challenges by providing a 97%+ accurate screening tool that not only flags infected cells but generates attention maps to pinpoint exactly where the parasite is located.
- High-Precision Classification: Distinguishes between "Parasitized" and "Uninfected" cells with 97.32% accuracy.
- Confidence Scoring: Assigns a probability score (e.g., 98.4%) to help clinicians prioritize ambiguous cases.
- Real-Time Inference: Process slide images in under 50ms using optimized PyTorch backbones.
- Grad-CAM Visuals: Generates heatmaps highlighting the specific regions (trophozoites/schizonts) triggering the diagnosis.
- Trust Verification: Ensures the model focuses on the parasite and not on staining artifacts or noise.
- Accuracy: 97.32% - State-of-the-art performance on NIH Dataset
- Precision: 97.34% - Minimizes false positives
- F1-Score: 97.32% - Perfect balance between precision and recall
- ROC-AUC: 0.9948 - Exceptional discriminative ability
- Base Model: EfficientNet-B0 (Transfer Learning from ImageNet)
- Custom Head:
Dropout(0.5) -> Linear(512) -> ReLU -> Linear(2) - Training Strategy: Adam Optimizer with ReduceLROnPlateau Scheduler
- Data Augmentation: Random Rotations, Flips, and Color Jittering
- Loss Function: CrossEntropyLoss
- Input Resolution: 224x224 pixels (Resized from NIH standard)
- Output Classes: 2 (Parasitized, Uninfected)
- Inference Time: ~15ms on GPU / ~120ms on CPU
- Model Size: 4.6M Parameters (Lightweight compared to ResNet-50's 25M)
- Test Dataset: 2,755 unseen images (10% split)
- Cross-Validation: Validated against VGG16 (94.89%) and ResNet-50 (95.83%)
- Early Stopping: Training halted at Epoch 18 to prevent overfitting
- Robustness: Tested on varied cell staining intensities
| Component | Technologies Used |
|---|---|
| Frontend Interface | React.js, Bootstrap, JavaScript, Plotly.js |
| Backend API | Python, FastAPI, Uvicorn, Pydantic |
| Deep Learning | PyTorch, Torchvision, EfficientNet, Transfer Learning |
| Explainability | Grad-CAM, Captum, Matplotlib, Seaborn |
| Image Processing | OpenCV, PIL (Pillow), NumPy, Albumentations |
| Deployment | Docker, Render (Backend), Vercel (Frontend) |
| Version Control | Git, GitHub |
- ml-model/ - Jupyter notebooks for training, evaluation, and XAI generation
- backend-api/ - FastAPI server implementation and route logic
- frontend-dashboard/ - React interface for slide upload and visualization
- training.ipynb: Complete research pipeline from data loading to Grad-CAM export
- main.py: FastAPI entry point handling prediction requests
- gradcam.py: Utility module for generating attention heatmaps
- model_utils.py: Helper functions for image preprocessing and tensor conversion
- Node.js (v16+)
- Python 3.8+
- PyTorch 2.0+
- FastAPI & Uvicorn
- Git
-
Navigate to backend directory:
cd backend-api pip install -r requirements.txt -
Start the FastAPI server:
uvicorn main:app --reload - API will be available at http://localhost:8000
-
Navigate to frontend directory:
cd frontend-dashboard npm install -
Start the development server:
npm start - Open http://localhost:3000 in your browser
- GET /health - System status check and model readiness
- POST /api/v1/predict - Submit an image and get label + confidence score
- POST /api/v1/predict-cam - Get prediction + Base64 Grad-CAM heatmap string
- Edge Deployment: Quantize model to TFLite for offline use on mobile phones in rural clinics.
- Species Identification: Expand dataset to classify P. falciparum vs. P. vivax.
- Adversarial Defense: Train on noisy/blurred images to simulate poor microscope quality.
- Federated Learning: Enable multi-hospital training without sharing patient data.
- Report Generation: Auto-generate PDF diagnostic reports for patient records.
We welcome contributions to this project. Please feel free to submit issues, feature requests, or pull requests to help improve the diagnostic accuracy or platform usability.


