Inspiration

Over 30% of Nigeria's population lives in rural or remote regions, where access to dermatological expertise and lab-based malaria diagnostics is severely constrained. According to the World Malaria Report, Nigeria accounts for 27% of global malaria deaths, and the ratio of dermatologists to population is staggeringly low with fewer than 100 registered dermatologists serving a country of over 200 million. Inspired by mobile microscopy and telemedicine pilots, we set out to build a fully offline AI assistant that runs on any Android phone turning it into a low-cost clinical decision tool for frontline health workers.

What it does

  1. Skin Lesion Classifier Identifies and classifies 7 types of pigmented skin lesions from dermatoscopic images. Built using the HAM10000 dataset, fine-tuned for mobile efficiency. Uses OpenCV edge detection to highlight the affected lesion area. Supports triage by indicating likelihood of malignancy (e.g., melanoma vs benign nevus) and recommending urgency levels (e.g., refer urgently, monitor).
  2. Malaria Parasite Classifier Detects and classifies 4 Plasmodium species (Falciparum, Vivax, Malariae, Ovale) from blood smear images. Based on a cleaned and class-balanced version of a Kaggle malaria microscopy dataset. Class-specific identification can inform appropriate treatment recommendations, as drug responses vary by species.
  3. Offline Android App Built in Kotlin, the app performs inference using TFLite models directly on-device. Enables diagnostic assistance in areas without internet or constant electricity. Features a touch-friendly, icon-based UI with support for local languages and simple tap navigation. Designed for low digital literacy, with minimal text input and clear visual guidance.

How we built it

Skin Lesion Classifier Input size: 128×128 | Backbone: ResNet18 (pretrained on ImageNet) Dataset: HAM10000 (7-class dermatoscopic image dataset) Training: Full fine-tuning of all layers Optimizer: Adam, LR: 1e-4, Batch: 16, Epochs: 20 Early stopping and best-model checkpointing Performance: >85% accuracy on validation set Conversion: PyTorch → TFLite (using ai-edge-torch)

Malaria Parasite Classifier Input size: 224×224 | Backbone: ResNet18 (ImageNet pretrained) Dataset: Kaggle malaria microscopy (cleaned + class balanced) Training: Class-weighted loss to address imbalance Two-phase training: Phase 1: Train classifier head (frozen backbone) Phase 2: Fine-tune last residual block (layer4) Optimizer: Adam, LR: 1e-3 → 1e-4, Batch: 16, Epochs: 30 + 30 Performance: >90% accuracy with balanced class-specific recall Conversion: Same as above → TFLite PyTorch → TFLite (using ai-edge-torch)

How Images Are Captured in the Field Skin Images: Dermatoscopic images can be captured using a clip-on dermoscope attachment for smartphones, or manually using close-up camera shots if magnification tools are unavailable. Malaria Smears: Blood smear slides are captured using a mobile microscope or clip-on lens adapters available in field clinics. The app includes built-in guidelines for angle, lighting, and focus. Image Quality Handling: The models were trained with augmentation (brightness, blur, noise) to simulate low-resource imaging conditions and ensure robustness to real-world variability. Key Features That Empower Health Workers Intelligent triage: Skin: Labels high-risk lesions and provides urgency score (refer, observe, non-urgent) Malaria: Identifies species → supports correct drug selection Offline first: No internet required for use or diagnosis Explainability (planned): Integration of Grad-CAM for heatmap overlays on skin lesions

Challenges we ran into

Severe class imbalance in malaria data, particularly underrepresented species like P. malariae and P. ovale Maintaining accuracy while compressing models for TFLite Dealing with inconsistent image quality across low-end Android devices Compatibility issues in Android Studio during integration of PyTorch → TFLite pipelines

Accomplishments that we're proud of

Two robust AI models with real-world performance (>85% and >90%) Fully functional Android prototype supporting offline, on-device diagnosis Demonstrated feasibility of deploying clinical-grade AI tools in rural Nigerian health posts

What we learned

Transfer learning is powerful but must be tailored with selective layer freezing and class weighting for best results on small/imbalanced medical datasets. Data relevance matters: To generalize well, future versions must incorporate locally sourced images (especially dark skin tones and Nigerian parasite morphology). Offline deployment is not just a tech choice — it's a design philosophy. It shapes model size, interface layout, update mechanisms, and more.

What's next for MedGrid: AI Diagnosis for Skin & Malaria on Android

Collaborate with Nigerian healthcare providers (e.g., in Plateau or Kaduna) to test and refine the app in the field Collect and ethically annotate local diagnostic images for fine-tuning and fairness auditing Add Grad-CAM visual explanations to support decision transparency Pilot real-time updates via offline patching and community-based update hubs

Built With

Share this project:

Updates