Skip to content

This is the backend of the skin disease detection using image processing on google colab detects 8 diseases: chickenpox, shingles, cellulitis, impetigo, athlete's foot, nail fungus, ringworm, and cutaneous larva migrans

Notifications You must be signed in to change notification settings

de-code-bot/skin-disease-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

88 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Developed as part of Mobile Application Development with AI coursework.


๐Ÿ“ž Support

For issues, questions, or contributions:

  • Open an issue on GitHub
  • Check the troubleshooting section
  • Review configuration guides

๐ŸŽ‰ Acknowledgments

  • TensorFlow/Keras team for the ML framework
  • Android development community
  • Open-source contributors
  • Dataset providers

Made with โค๏ธ for better healthcare accessibility


Quick Start Commands

# Backend
cd skin-disease-detection-main
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python run_for_phone.py

# Android (in Android Studio)
# File โ†’ Open โ†’ Select project folder
# Run โ†’ Run 'app'

Now you're ready to detect skin diseases! ๐Ÿš€

Skin Disease Detection - Android App with AI Backend

An end-to-end mobile application that uses artificial intelligence and deep learning to detect and classify skin diseases from smartphone images.

Android Python TensorFlow


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Overview

Problem Statement

Skin diseases affect millions of people worldwide. Early detection and accurate diagnosis are crucial for effective treatment, but there's a shortage of dermatologists, especially in remote areas. Manual diagnosis is time-consuming, subjective, and often inaccessible to those who need it most.

Our Solution

This application provides an accessible, instant, AI-powered skin disease detection system that:

  • Democratizes Healthcare - Anyone with a smartphone can get instant preliminary diagnosis
  • Reduces Diagnosis Time - From days/weeks to seconds
  • Assists Healthcare Workers - Provides a second opinion and helps prioritize cases
  • Maintains Privacy - Images are processed locally, not shared publicly
  • Educational Tool - Helps users understand different skin conditions

Disease Categories Detected

The AI model can detect various skin diseases including:

  • Fungal Infections (FU): Ringworm, Athlete's Foot, Candidiasis
  • Viral Infections (VI): Shingles, Herpes, Warts
  • Parasitic Infections (PA): Cutaneous Larva Migrans, Scabies

๐Ÿ”ฌ How It Works

System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   ANDROID APPLICATION                        โ”‚
โ”‚                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚
โ”‚  โ”‚  Camera  โ”‚  โ”‚   Gallery   โ”‚  โ”‚  Results Display โ”‚      โ”‚
โ”‚  โ”‚ Capture  โ”‚  โ”‚  Selection  โ”‚  โ”‚      Screen      โ”‚      โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ฒโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ”‚        โ”‚              โ”‚                   โ”‚                 โ”‚
โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ”‚
โ”‚                       โ”‚                                     โ”‚
โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                        โ”‚
โ”‚              โ”‚   MainActivity      โ”‚                        โ”‚
โ”‚              โ”‚  (Image Handler)    โ”‚                        โ”‚
โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                        โ”‚
โ”‚                       โ”‚                                     โ”‚
โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                        โ”‚
โ”‚              โ”‚  RetrofitClient     โ”‚                        โ”‚
โ”‚              โ”‚  (HTTP Client)      โ”‚                        โ”‚
โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                        โ”‚
โ”‚                       โ”‚                                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                        โ”‚ HTTP POST (Image)
                        โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   PYTHON BACKEND                             โ”‚
โ”‚                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚       Quart Web Server (Async Python)                โ”‚  โ”‚
โ”‚  โ”‚              Port: 5000                              โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                       โ”‚                                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚     API Endpoint: /api/v1/predictions/              โ”‚  โ”‚
โ”‚  โ”‚     (Receives Image, Returns Prediction)            โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                       โ”‚                                     โ”‚
โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                      โ”‚
โ”‚         โ”‚             โ”‚             โ”‚                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
โ”‚  โ”‚ Image Save  โ”‚ โ”‚   CNN   โ”‚ โ”‚  Database   โ”‚            โ”‚
โ”‚  โ”‚  & Rename   โ”‚ โ”‚  Model  โ”‚ โ”‚   Logging   โ”‚            โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ”‚         โ”‚            โ”‚             โ”‚                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
โ”‚  โ”‚   Classification Result                   โ”‚            โ”‚
โ”‚  โ”‚   DiseaseName_YYYY-MM-DD_HH-MM-SS.jpg    โ”‚            โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ”‚                      โ”‚                                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ JSON Response  โ”‚
              โ”‚   to Mobile    โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Workflow Explanation

1. Image Capture/Selection

  • User opens the Android app
  • Chooses to either take a photo with the camera or select from gallery
  • Image is loaded into memory

2. Image Upload

  • App uses Retrofit (HTTP client) to send the image to the backend
  • Image is sent as multipart/form-data to http://YOUR_SERVER:5000/api/v1/predictions/
  • Request includes the image file

3. Backend Processing

  • Step 1: Quart server receives the image
  • Step 2: Image is temporarily saved with a timestamp
  • Step 3: Image is preprocessed:
    • Resized to model's expected input size
    • Normalized pixel values
    • Converted to array format
  • Step 4: Deep learning model (CNN) analyzes the image
  • Step 5: Model outputs prediction (disease category)
  • Step 6: Image is renamed to descriptive format: DiseaseName_YYYY-MM-DD_HH-MM-SS.jpg
  • Step 7: Prediction is logged to SQLite database

4. Response & Display

  • Backend sends JSON response: {"prediction": "Fungal Infection"}
  • Android app receives and parses the response
  • Results are displayed in a beautiful Material Design card
  • User sees the detected disease type

5. Storage & History

  • Image stored locally on server: backend/image_bucket/DiseaseName_2025-11-07_14-30-45.jpg
  • Database record created with:
    • Timestamp
    • Prediction result
    • Image filename
    • Processing time

โœจ Features

Mobile App Features

  • ๐Ÿ“ท Camera Integration - Capture images directly
  • ๐Ÿ–ผ๏ธ Gallery Selection - Choose existing images
  • ๐Ÿค– AI Analysis - Instant disease detection
  • ๐Ÿ“Š Results Display - Clear, easy-to-understand results
  • โš™๏ธ Settings - Configure backend server URL
  • ๐Ÿ”„ Dynamic URL Configuration - Change server address without recompiling
  • ๐ŸŽจ Modern UI - Material Design 3 components
  • ๐ŸŒ™ Dark Mode Support - Automatic theme switching

Backend Features

  • ๐Ÿง  Deep Learning - TensorFlow/Keras CNN model
  • ๐Ÿ’พ Database Logging - SQLite for prediction history
  • ๐Ÿ“ Smart Naming - Auto-rename images with results
  • ๐Ÿ”„ Async Processing - Fast, non-blocking operations
  • ๐Ÿ“ก RESTful API - Clean, standardized endpoints
  • ๐Ÿ“ Comprehensive Logging - Debug and monitor everything
  • ๐Ÿ”’ Error Handling - Robust validation and error responses

๐Ÿ› ๏ธ Technology Stack

Frontend (Android)

  • Language: Java
  • IDE: Android Studio Koala | 2024.1.1
  • Build System: Gradle 8.7
  • Min SDK: Android 11 (API 30)
  • Target SDK: Android 14 (API 35)

Key Libraries:

  • Retrofit 2.9.0 - HTTP networking
  • OkHttp 4.11.0 - HTTP client
  • Gson 2.10.1 - JSON parsing
  • Material Design 3 - UI components

Backend (Python)

  • Language: Python 3.11
  • Framework: Quart (async Flask)
  • ML Framework: TensorFlow 2.x / Keras
  • Database: SQLite 3
  • Image Processing: Pillow (PIL)

Key Libraries:

quart==0.19.4
tensorflow==2.x
pillow==10.0.0
numpy==1.24.3

Machine Learning

  • Architecture: Convolutional Neural Network (CNN)
  • Training: Google Colab / Jupyter Notebook
  • Input Size: 224x224x3 (RGB images)
  • Output: Multi-class classification
  • Model Format: HDF5 (.h5 file)

๐Ÿ“ Project Structure

Skin_Disease/
โ”œโ”€โ”€ app/                                          # Android Application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ main/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ java/com/ahaanmehta/skin_disease/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MainActivity.java            # Image upload & analysis
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ HomeActivity.java            # Landing page
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SplashActivity.java          # Startup screen
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AboutActivity.java           # About page
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SettingsActivity.java        # Backend URL config
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ RetrofitClient.java          # HTTP client setup
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ApiService.java              # API endpoints
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ PredictionResponse.java      # Response model
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ res/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ layout/                      # XML layouts
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ drawable/                    # Icons & graphics
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ values/                      # Strings, colors, themes
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ xml/                         # Network & file configs
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AndroidManifest.xml              # App configuration
โ”‚   โ”‚   โ””โ”€โ”€ test/                                # Unit tests
โ”‚   โ””โ”€โ”€ build.gradle.kts                         # App dependencies
โ”œโ”€โ”€ skin-disease-detection-main/                 # Python Backend
โ”‚   โ”œโ”€โ”€ backend/
โ”‚   โ”‚   โ”œโ”€โ”€ app.py                               # Main application
โ”‚   โ”‚   โ”œโ”€โ”€ blueprints/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ model_blueprint.py               # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ classification/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ predictions.py                   # ML prediction logic
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ categories.json                  # Disease categories
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ final_file_tech_proj.ipynb       # Model training notebook
โ”‚   โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ genesis.py                       # Database setup
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ population.py                    # Data operations
โ”‚   โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ app_config.toml                  # App settings
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ server_config.toml               # Server settings
โ”‚   โ”‚   โ”œโ”€โ”€ instance/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ classifier.h5                    # โš ๏ธ ML model (required!)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ app.db                           # SQLite database
โ”‚   โ”‚   โ””โ”€โ”€ image_bucket/                        # Uploaded images
โ”‚   โ”œโ”€โ”€ requirements.txt                         # Python dependencies
โ”‚   โ””โ”€โ”€ run_for_phone.py                         # Server startup script
โ”œโ”€โ”€ .gitignore                                   # Git exclusions
โ”œโ”€โ”€ CONFIG_SETUP.md                              # Configuration guide
โ”œโ”€โ”€ GITHUB_READY_CHECKLIST.md                    # Deployment checklist
โ””โ”€โ”€ README.md                                    # This file

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have the following installed:

For Android App Development

  • โœ… Android Studio (latest version)
  • โœ… Java Development Kit (JDK) 11 or higher
  • โœ… Android SDK (automatically installed with Android Studio)
  • โœ… Android Device or Emulator
    • Physical device: Android 11 (API 30) or higher
    • Emulator: Use Android Studio AVD Manager

For Backend Development

Network Requirements

  • โœ… Same WiFi Network - Phone and computer must be on the same network
  • โœ… Firewall Configuration - Allow Python through Windows Firewall

๐Ÿš€ Local Setup Guide

Step 1: Clone the Repository

# Clone the repository
git clone https://github.com/de-code-bot/skin-disease-detection.git

# Navigate to the project directory
cd skin-disease-detection

Step 2: Set Up Python Backend

2.1 Install Python Dependencies

# Navigate to the backend directory
cd skin-disease-detection-main

# Create a virtual environment (recommended)
python -m venv venv

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

# Install required packages
pip install -r requirements.txt

2.2 Set Up the ML Model

โš ๏ธ IMPORTANT: You need the trained model file!

The model file classifier.h5 should be placed in:

skin-disease-detection-main/backend/instance/classifier.h5

Options to get the model:

  1. Train your own model using the Jupyter notebook:

    • Open backend/classification/final_file_tech_proj.ipynb
    • Run all cells in Google Colab or Jupyter
    • Save the trained model as classifier.h5
  2. Use a pre-trained model (if available)

    • Download from project resources
    • Place in backend/instance/ folder

2.3 Initialize the Database

# From the skin-disease-detection-main directory
python -m backend.database.genesis

You should see: Database initialized successfully!

2.4 Configure Firewall (Windows)

Run Command Prompt as Administrator:

netsh advfirewall firewall add rule name="Python Server" dir=in action=allow program="C:\Path\To\Python\python.exe" enable=yes

Or use the provided batch file:

# Run as Administrator
add_firewall_rule.bat

Step 3: Set Up Android App

3.1 Open in Android Studio

  1. Launch Android Studio
  2. Click Open (or File โ†’ Open)
  3. Navigate to the cloned repository folder
  4. Select the main Skin_Disease folder
  5. Click OK
  6. Wait for Gradle sync to complete (this may take a few minutes)

3.2 Configure Backend URL

You have two options:

Option A: Use In-App Settings (Recommended)

  • Just run the app and configure the URL in Settings
  • No code changes needed!

Option B: Edit Source Code

Open app/src/main/java/com/ahaanmehta/skin_disease/RetrofitClient.java

Find this line (around line 67):

return "http://YOUR_SERVER_IP:5000/";

Replace with:

  • For Emulator: http://10.0.2.2:5000/
  • For Physical Device: http://YOUR_COMPUTER_IP:5000/

How to find your computer's IP:

# On Windows
ipconfig

# Look for "IPv4 Address" under your WiFi adapter
# Example: 192.168.1.15

3.3 Update Network Security Config (Optional)

If using a physical device, edit: app/src/main/res/xml/network_security_config.xml

Add your computer's IP:

<domain includeSubdomains="true">192.168.1.15</domain>

๐ŸŽฎ Running the Application

Start the Backend Server

# Navigate to backend directory
cd skin-disease-detection-main

# Activate virtual environment (if not already active)
venv\Scripts\activate  # Windows
# source venv/bin/activate  # Mac/Linux

# Start the server
python run_for_phone.py

Expected Output:

Starting Skin Disease Detection Backend
============================================================
๐ŸŒ Server will be accessible at:
   - From this computer: http://127.0.0.1:5000/
   - From your phone:    http://192.168.1.15:5000/
============================================================
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://192.168.1.15:5000

โœ… Backend is now running! Keep this terminal open.

Run the Android App

Using Android Emulator:

  1. Open Android Studio
  2. Click Run (โ–ถ๏ธ button) or press Shift + F10
  3. Select an emulator device
  4. Wait for the app to install and launch
  5. The emulator will automatically use http://10.0.2.2:5000/

Using Physical Device:

  1. Enable Developer Options on your phone:

    • Go to Settings โ†’ About Phone
    • Tap "Build Number" 7 times
  2. Enable USB Debugging:

    • Settings โ†’ Developer Options โ†’ USB Debugging
  3. Connect phone via USB cable

  4. In Android Studio:

    • Click Run (โ–ถ๏ธ)
    • Select your device
    • Wait for installation
  5. Configure Backend URL:

    • Open app โ†’ Settings
    • Click "Change Backend URL"
    • Enter your computer's IP: http://192.168.1.15:5000
    • Click "Test Connection"
    • Should show "โœ“ Connection successful!"

Test the Application

  1. Launch the app - Opens with splash screen
  2. Home screen - Click "Start Detection"
  3. Main screen - Select image source:
    • Click "๐Ÿ“ท Camera" to take a new photo
    • Click "๐Ÿ–ผ๏ธ Gallery" to choose existing image
  4. Select/capture an image of a skin condition
  5. Click "Analyze Image" button
  6. Wait for results (usually 1-3 seconds)
  7. View diagnosis - Results appear in a card showing the detected disease type

๐Ÿ› Troubleshooting

Common Issues & Solutions

1. Backend: "Model file not found"

Error: Could not find classifier.h5

Solution:

  • Ensure classifier.h5 exists in backend/instance/
  • Train the model using the Jupyter notebook
  • Check file permissions

2. Android: "Connection failed"

Error: Failed to connect to /192.168.1.15:5000

Solutions:

  • โœ… Verify backend is running (python run_for_phone.py)
  • โœ… Check devices are on same WiFi network
  • โœ… Verify firewall allows Python
  • โœ… Ping the server from your phone's browser: http://192.168.1.15:5000/
  • โœ… Check the IP address is correct

3. Android: "Unable to resolve host"

Error: Unable to resolve host "YOUR_SERVER_IP"

Solution:

  • You forgot to replace YOUR_SERVER_IP with actual IP
  • Edit RetrofitClient.java or use in-app Settings

4. Gradle Sync Failed

Error: Could not resolve dependencies

Solution:

# In Android Studio terminal:
./gradlew clean
./gradlew build --refresh-dependencies

5. Python: "Module not found"

ModuleNotFoundError: No module named 'quart'

Solution:

# Activate virtual environment first!
venv\Scripts\activate
pip install -r requirements.txt

6. Emulator: Very Slow

Solution:

  • Use x86_64 system image (not ARM)
  • Enable hardware acceleration (HAXM/WHPX)
  • Allocate more RAM to emulator
  • Or use a physical device

7. Port 5000 Already in Use

Error: Address already in use

Solution:

# Find what's using port 5000
netstat -ano | findstr :5000

# Kill the process (replace PID with actual number)
taskkill /PID <PID> /F

# Or change port in server_config.toml

Still Having Issues?

  1. Check Logs:

    • Android: Android Studio โ†’ Logcat
    • Backend: Terminal output
  2. Test Backend Directly:

    # Open browser or use curl
    curl http://localhost:5000/
  3. Verify Network:

    # From phone, open browser and visit:
    http://YOUR_COMPUTER_IP:5000/
    # You should see a webpage

๐Ÿ“š Additional Resources

Learning Materials

Dataset Information

The model was trained on a skin disease dataset containing:

  • Multiple disease categories
  • Thousands of labeled images
  • Various skin types and conditions

Training notebook: backend/classification/final_file_tech_proj.ipynb


๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Areas for Improvement

  • Add more disease categories
  • Improve model accuracy
  • Add multi-language support
  • Implement user authentication
  • Create prediction history in app
  • Add confidence scores to results

โš ๏ธ Disclaimer

IMPORTANT: This application is intended for educational and research purposes only. It is NOT a substitute for professional medical advice, diagnosis, or treatment.

  • โŒ Do NOT use for actual medical diagnosis
  • โŒ Do NOT delay seeking professional medical care
  • โœ… Always consult a qualified dermatologist
  • โœ… Use as a learning tool only

๐Ÿ“„ License

This project is for educational purposes. Feel free to use, modify, and distribute for learning and non-commercial purposes.


๐Ÿ‘ฅ Team

About

This is the backend of the skin disease detection using image processing on google colab detects 8 diseases: chickenpox, shingles, cellulitis, impetigo, athlete's foot, nail fungus, ringworm, and cutaneous larva migrans

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •