Skip to content

Purvesh-PJ/skin_disease_detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Skin Disease Detection Using Deep Ensemble Learning

Project Python React TensorFlow License


πŸ“Έ Screenshot

Skin Disease Predictor


πŸ“‹ Overview

A web-based system to detect skin diseases from images using deep learning. The project uses ensemble learning with CNN architectures to improve diagnostic accuracy.

Users can upload a skin image, and the backend uses three trained CNNs (EfficientNetB3, ResNet101, DenseNet121) to classify it. The predictions are averaged to determine the final result.


✨ Features

  • πŸ–ΌοΈ Upload dermatoscopic images for prediction
  • 🧠 Ensemble of EfficientNetB3, ResNet101, and DenseNet121
  • βœ… JWT-based authentication system (register/login)
  • πŸ“Š Confidence score for each prediction
  • πŸ“– Description of predicted skin condition
  • πŸ“± Responsive UI using React 18

πŸ› οΈ Tech Stack

πŸ”™ Backend

  • Python 3.12
  • Flask + Flask-JWT-Extended
  • TensorFlow / Keras
  • MongoDB (via PyMongo)
  • OpenCV & Albumentations for preprocessing
  • dotenv for environment configs

πŸ”œ Frontend

  • React 18
  • Axios
  • React Router DOM
  • Styled Components
  • React Icons

πŸ“ Project Structure (Simplified)

skin_disease_detection/
β”œβ”€β”€ backend/
β”‚ β”œβ”€β”€ app/ # Backend app logic
β”‚ β”œβ”€β”€ main.py # Flask app entry
β”‚ β”œβ”€β”€ requirements.txt # Python dependencies
β”‚ └── uploads/ # Uploaded images
β”œβ”€β”€ frontend/
β”‚ └── src/ # React app
β”œβ”€β”€ trained_models/ # Pretrained .h5 models
└── README.md

πŸ“Š Dataset

  • Dataset: HAM10000 (Kaggle)
  • 10,000 labeled images across 7 classes:
    • akiec, bcc, bkl, df, mel, nv, vasc

To prepare:

  • Extract dataset into:
    backend/data/skin_disease_dataset/base_dir/
    with subdirectories: train_dir/, val_dir/, test_dir/

🧠 Model Details

  • Ensemble of:
    • βœ… DenseNet121
    • βœ… EfficientNetB3
    • βœ… ResNet101
  • Each model is trained independently.
  • Final prediction: average of softmax scores from all 3 models.

πŸ“₯ Download Trained Models

Download the pre-trained models from Google Drive:

πŸ”— Download Models

After downloading, extract and place the trained_models folder in the project root directory:

skin_disease_detection/
β”œβ”€β”€ backend/
β”œβ”€β”€ frontend/
β”œβ”€β”€ trained_models/      ← Place here
β”‚   β”œβ”€β”€ densenet121.h5
β”‚   β”œβ”€β”€ efficientnetb3.h5
β”‚   └── resnet101.h5
└── README.md

πŸ” Authentication

  • JWT-based login/register system
  • Tokens must be passed in Authorization header for prediction requests.

πŸ§ͺ API Endpoints

Endpoint Method Auth Description
/auth/register POST ❌ Register a new user
/auth/login POST ❌ Login, receive JWT token
/predict POST βœ… Upload image & get results

πŸš€ Getting Started

🧰 Prerequisites

  • Python 3.12+
  • Node.js v18+
  • MongoDB (local or cloud)
  • Git

βš™οΈ Backend Setup

# Navigate to backend
cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Create a .env file in backend/ with:

FLASK_SECRET_KEY=YourSecretKey
JWT_SECRET_KEY=YourJWTSecretKey
MONGO_URI=mongodb://localhost:27017/skin_disease_db

(Optional) Train Your Own Models

If you want to train the models yourself instead of using the pre-trained ones, download and extract the HAM10000 dataset into:

backend/data/skin_disease_dataset/base_dir/
β”œβ”€β”€ train_dir/
β”œβ”€β”€ val_dir/
└── test_dir/

Then run:

python main.py

🌐 Frontend Setup

cd frontend
npm install
npm start

πŸ§ͺ Prediction Flow

Login β†’ Receive JWT token

Upload skin image

Backend runs predictions using all 3 models

Softmax probabilities are averaged

Highest scoring class is selected

Response includes:

Predicted disease

Confidence score

Disease name + description

πŸ“„ License

MIT License See LICENSE file.

πŸ™‹ Contact

@Purvesh-PJ

πŸ“š Additional Documentation

Detailed project documentation is available in the docs/ folder:


πŸ™ Acknowledgements

About

Skin disease detection using deep learning ensemble with React and Flask

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors