Skip to content

🪥 OralGuard is a mobile-friendly deep learning application designed to assist in the early detection of oral lesions (benign vs malignant) using advanced computer vision techniques. Built on MobileNetV3 with PyTorch transfer learning, the model is optimized for real-time predictions on mobile devices.

License

Notifications You must be signed in to change notification settings

CrispenGari/OralGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ OralGuard – AI-Powered Oral Cancer Detection

OralGuard is a mobile-friendly deep learning application designed to assist in the early detection of oral lesions (benign vs malignant) using computer vision.
Built on MobileNetV3 with PyTorch transfer learning, the model is optimized for real-time predictions on mobile devices and integrates with a Flask REST API for deployment.

logo

This repository contains two main sub directory which are:

  1. mobile - The mobile app that does classification by sending requests to the API server using images of a oral lesions images.
  2. server - This is an API server that serves an MobileNetV3 model that does cancer classification based on an oral lesion.

CI Status License: MIT Language: TypeScript Language: Python


📌 Features

  • Oral lesion classification (malignant vs benign) from mouth images
  • Lightweight & efficient model powered by MobileNetV3
  • REST API built with Flask for real-time predictions
  • Trained on the Oral Lesions: Malignancy Detection Dataset
  • Model exported as static PyTorch file (.pt) for cross-platform usage
  • Local Authentication

⚙️ Tech Stack

  • PyTorch & TorchVision – Transfer learning with MobileNetV3
  • Flask – REST API for serving predictions
  • Python – Data preprocessing, training, evaluation
  • NumPy / Matplotlib – Data handling & visualization

🚀 Workflow

  1. Data Preparation

    • Dataset split into training, validation, and testing sets
    • Augmentation applied (rotation, zoom, flip, etc.)
  2. Model Training

    • MobileNetV3 backbone + custom classifier head
    • Trained using transfer learning in PyTorch
    • Best weights saved as .pt file
  3. Deployment

    • Flask REST API wraps the trained model
    • Mobile app sends an image → API preprocesses → model predicts → returns JSON (benign / malignant)

Usage

  1. Capture or upload an image of oral lesions.
  2. The app sends the image to the AI server for analysis.
  3. Receive instant prediction results.

Future Enhancements:

  • Support multiple cancer types.
  • Offline predictions for areas with poor connectivity

Sample ScreenShots

The following screenshots shows the basic UI of the mobile application.

UI UI UI UI UI UI UI UI UI UI UI

🖥️ Installation & Setup

Clone Repository

git clone https://github.com/crispengari/OralGuard.git
cd OralGuard

Then navigate to the server and activate the virtual environment.

#
cd server

python -m venv venv
source venv/bin/activate   # On Linux/Mac
venv\Scripts\activate      # On Windows

Then install packages

pip install -r requirements.txt

You can then run the server as follows:

python app.py

Starting the client server

First navigate to the mobile folder:

cd mobile

Install the packages

yarn

Then you can start the expo go dev server

yarn start

📸 Example Prediction

The following commands can be used to test the API using cURL.

# benign
cURL -X POST -F image=@benign.jpg http://127.0.0.1:8000/api/v1/oral-cancer/predict

# malignant
cURL -X POST -F image=@malignant.jpg http://127.0.0.1:8000/api/v1/oral-cancer/predict

Expected Response

The following is the API expected response.

{
  "time": 0.09074282646179199,
  "ok": true,
  "status": "ok",
  "prediction": { "label": 1, "class_label": "malignant", "probability": 1.0 }
}

Notebooks

The notebooks that were used to train the model can be found in this folder 13_ORAL_CANCER_LESIONS.

LICENSE

This project is using the MIT LICENSE.

About

🪥 OralGuard is a mobile-friendly deep learning application designed to assist in the early detection of oral lesions (benign vs malignant) using advanced computer vision techniques. Built on MobileNetV3 with PyTorch transfer learning, the model is optimized for real-time predictions on mobile devices.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published