An intelligent and lightweight backend for skin cancer detection — combining multiple deep learning models into a robust ensemble, accessible via a FastAPI interface.
SkinGlance-ModelAPI is the backend engine for the SkinGlance Android application — a mobile-first solution for early detection of skin cancer using deep learning. This repository contains:
- 🧪 Code to train and save multiple CNN models (
DenseNet169,InceptionV3,MobileNetV2) - 🤖 A fuzzy ensemble prediction strategy combining model outputs
- 🚀 A FastAPI-based RESTful API to serve predictions in real-time
- 🧹 Can be run locally or cloud environments like Kaggle Notebooks
SkinGlance-ModelAPI/
├── model_training/ # Model development notebooks scripts
├── api_service/ # FastAPI app + saved models
└── README.md
Ideal for experimenting without setting up a local environment
Follow these steps:
-
🔁 Clone this repo to understand the full project structure:
git clone https://github.com/sandip-mondal-0248/SkinGlance-ModelAPI
-
📅 Import the training notebook (
model_training/skinglance_model.ipynb) into Kaggle Notebooks. -
📂 Add a skin cancer dataset: Use ISIC Dataset(Preprocess version) or any other similar dataset of your choice. Structure it like:
dataset/ ├── train/ │ ├── benign/ │ └── malignant/ └── test/ -
🧠 Train the models by running the notebook in Kaggle. It will save:
DenseNet169_best.kerasInceptionV3_best.kerasMobileNetV2_best.keras
-
✅ Test the ensemble prediction logic in the same notebook.
-
⬇️ Download the trained models from Kaggle into your local computer.
-
📦 Place them into:
api_service/app/models/ -
🚀 Run the FastAPI server locally using the command in
main.py(Replace with actual host and port number):uvicorn app.main:app --host 0.0.0.0 --port 8000
-
🌐 Test the API:
- Using Postman or any HTTP client
- Or simply send an image request from browser
If you're setting up the full system on your machine follow these steps:
-
🔁 Clone the repo:
git clone https://github.com/sandip-mondal-0248/SkinGlance-ModelAPI cd SkinGlance-ModelAPI -
🔧 Modify paths (if needed):
- Replace dataset paths in notebooks or scripts with local ones
- Set up any file I/O based on your directory structure
-
🧠 Train the models by running the notebooks. It will save:
DenseNet169_best.kerasInceptionV3_best.kerasMobileNetV2_best.keras
-
🧱 Set up the api environment:
cd api_service python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r requirements.txt
-
⏩ Continue with the same process as described in Case 1:
- Train models
- Save them to
api_service/app/models/ - Run FastAPI server
- Test the API
You can also try our Android app, which uses this same API.
📱 Android App GitHub Repo: SkinGlance Android App
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check |
| POST | /predict |
Upload an image for prediction |
- ✅ DenseNet169 (
models/DenseNet169_best.keras) - ✅ InceptionV3 (
models/InceptionV3_best.keras) - ✅ MobileNetV2 (
models/MobileNetV2_best.keras) - 📊 Combined using a fuzzy rank-based fusion strategy
You can use public datasets like:
- ISIC preprocess version available on kaggle: skin-cancer-malignant-vs-benign
- Or your own dataset formatted as:
train/benign,train/malignant
This project is licensed under the MIT License
Pull requests are welcome. For major changes, please open an issue first. If you find this helpful, please ⭐ star the repo!
For questions, suggestions, or collaborations:
Sandip Mondal — https://sandipmondal.bio.link/
🔗 LinkedIn