Skip to content

About

Smart Dermatology is a deep learning–based system that uses Convolutional Neural Networks (CNNs) to classify skin cancer from dermatoscopic images. The project leverages image processing techniques and a dataset from the International Skin Imaging Collaboration (ISIC) to distinguish between 9 different skin Disease.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banner

🔬 Smart Dermatology AI

A Deep Learning-based Medical Application for Classifying Skin Lesions using a Custom Mini-ResNet and Grad-CAM Explainable AI.

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors


🎥 Demonstration

Watch the Artificial Intelligence diagnose skin lesions and generate real-time activation heatmaps in our deployed web application:

https://github.com/AnandkumarMall/Smart-Dermatology/raw/main/Readme_images/demo.mp4


📖 Table of Contents


🎯 Overview & Motivation

Smart Dermatology is an end-to-end medical machine learning pipeline designed to assist in the early detection of skin diseases, such as Melanoma and Basal Cell Carcinoma.

In the medical field, a standard "black box" neural network prediction is not enough—doctors and patients need to understand why the AI made its decision. To solve this, our system heavily focuses on Explainable AI, generating thermal-style heatmaps that highlight the exact visual features of the skin lesion that triggered the neural network's diagnosis.

This repository encompasses the entire lifecycle: from raw data exploration and model training (in Jupyter Notebooks/Kaggle), to building a production FastAPI backend, and finally deploying a Scandinavian-styled Frontend to the cloud.


📊 Dataset Details

The neural network was trained on high-resolution dermoscopy images sourced from the ISIC (International Skin Imaging Collaboration) archive. The model is capable of classifying 8 distinct dermatological classes:

  1. Actinic Keratosis
  2. Basal Cell Carcinoma
  3. Pigmented Benign Keratosis
  4. Dermatofibroma
  5. Melanoma
  6. Nevus
  7. Squamous Cell Carcinoma
  8. Vascular Lesion

Handling this dataset was incredibly challenging due to extreme Class Imbalance and limited sample sizes for rare diseases. We utilized extensive offline Data Augmentation (rotations, zooming, flipping) exclusively on the training set to prevent data leakage and balance the class distributions.


🧠 Model Architecture

Instead of fine-tuning massive pre-trained models (which often overfit on small medical datasets), we engineered a Custom Mini-ResNet architecture entirely from scratch using TensorFlow/Keras.

Key Architectural Decisions:

  • Residual Connections (Skip Connections): Allows gradients to flow easily through the network, preventing the vanishing gradient problem in our deeper layers.
  • Global Average Pooling (GAP): Replaced traditional dense flattening layers with GAP to massively reduce parameter count and prevent overfitting.
  • Loss Function: Utilized specialized loss calculations and class weights to heavily penalize the model for misclassifying rare, dangerous lesions (like Melanoma) compared to common benign lesions.
  • Learning Rate Scheduling: Implemented ReduceLROnPlateau and Cosine Annealing to smoothly converge to the global minimum.

🔍 Explainable AI (Grad-CAM)

To provide transparency, the backend uses Gradient-weighted Class Activation Mapping (Grad-CAM).

When an image is passed through the network, the API captures the gradients of the predicted class flowing into the final convolutional layer. By mathematically pooling these gradients and multiplying them by the layer's feature maps, we generate a 2D spatial heatmap.

  • Red/Hot Zones: Indicate high activation (the AI looked heavily at this region to make its decision).
  • Blue/Cool Zones: Indicate areas the AI deemed medically irrelevant to the specific diagnosis.

💻 Web Application & UI

The frontend was meticulously built using a custom "Nordic Yellow" Design System, prioritizing Scandinavian minimalism, function, and accessibility.

  • Tech Stack: Vanilla JavaScript, HTML5, CSS3.
  • Design Guidelines: Utilizes IKEA Blue (#003399) and IKEA Yellow (#FFDA1A) with strict 4px border radiuses, clean Level 1 box-shadows, and a highly structured flexbox grid.
  • Typography: Noto Sans for body and headers, and JetBrains Mono for highly legible monospace readouts.
  • Features: Includes drag-and-drop file uploading, animated loading spinners, and dynamic layout switching without relying on heavy frameworks like React.

☁️ Cloud Deployment

The application is unified into a single repository and designed for instant Serverless/Containerized Deployment on platforms like Railway.

  • Unified API: The FastAPI server not only handles heavy TensorFlow inference but also mounts and serves the static frontend (/web_app/frontend/) to bypass CORS issues entirely.
  • Git LFS Auto-Fallback: The best_skin_model.keras file is 134 MB and tracked via Git LFS. If the cloud deployment provider (like Nixpacks) fails to pull the LFS binary and only downloads the tiny pointer file, the Python backend intercepts the startup process and automatically downloads the real 134 MB model directly from the GitHub raw endpoint into memory.
  • Configuration: Includes a railway.json to explicitly configure the Nixpacks builder and define the Uvicorn start command.

🚀 Getting Started (Local Setup)

Want to run the AI model on your own machine? Follow these steps:

1. Prerequisites

Make sure you have Python 3.10+ installed and Git LFS enabled.

git lfs install

2. Clone the Repository

git clone https://github.com/AnandkumarMall/Smart-Dermatology.git
cd Smart-Dermatology

3. Setup Virtual Environment

python -m venv .venv
# Activate on Windows:
.venv\Scripts\activate
# Activate on macOS/Linux:
source .venv/bin/activate

4. Install Dependencies

pip install -r requirements.txt

5. Pull the Heavy AI Model

Without this step, your machine only holds a text pointer, not the 134MB binary model.

git lfs pull

6. Run the Application

uvicorn web_app.api:app --host 127.0.0.1 --port 8000 --reload

Navigate to http://127.0.0.1:8000 in your browser, upload a skin lesion image, and watch the AI generate the Grad-CAM heatmap!

About

Smart Dermatology is a deep learning–based system that uses Convolutional Neural Networks (CNNs) to classify skin cancer from dermatoscopic images. The project leverages image processing techniques and a dataset from the International Skin Imaging Collaboration (ISIC) to distinguish between 9 different skin Disease.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages