YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

๐ŸŽฏ Intelligent Diagnostic Agent for Early Detection of Human Melanoma

An AI-powered web application for melanoma detection using a hybrid CNN-Transformer model with explainable AI (Grad-CAM) heatmaps.

Version: 1.0 | Status: Production Ready | License: MIT


๐Ÿ“‹ Table of Contents


โœจ Features

โœ… Real-time Melanoma Prediction โ€” Binary classification (Benign/Malignant)
โœ… Explainable AI โ€” Grad-CAM heatmaps highlight suspicious regions
โœ… Image Verification โ€” Rejects non-dermoscopic images
โœ… User Authentication โ€” JWT-based role-based access control
โœ… Dermatologist Dashboard โ€” Review predictions & provide feedback
โœ… Feedback Analytics โ€” Track model agreement rates
โœ… Corrective Fine-tuning โ€” Auto-retrain model from expert feedback
โœ… Admin Panel โ€” Manage users & platform settings
โœ… Cloud Storage โ€” Cloudinary integration for image hosting
โœ… RESTful API โ€” FastAPI with interactive Swagger docs


๐ŸŽฌ Demo

Frontend UI:

  • ๐Ÿ“ธ Drag & drop image upload
  • ๐ŸŽจ Visual heatmap overlay
  • ๐Ÿ“Š Confidence scores & metrics

Live API: http://localhost:8000/docs (after setup)


โšก Quick Start (5 Minutes)

Prerequisites

โœ“ Python 3.10+
โœ“ Node.js 18+
โœ“ Git

1๏ธโƒฃ Clone Repository

git clone https://github.com/yourusername/melanoma-diagnostic-agent.git
cd melanoma-diagnostic-agent

2๏ธโƒฃ Setup Backend (Terminal 1)

# Activate virtual environment
python -m venv project-env
project-env\Scripts\activate       # Windows
source project-env/bin/activate    # Linux/Mac

# Install dependencies
cd project-api
pip install -r requirements.txt

# Ensure model exists
# Copy melanoma_model.pth to project-api/models/

# Start backend
uvicorn main:app --reload --port 8000

โœ… Visit: http://localhost:8000/docs

3๏ธโƒฃ Setup Frontend (Terminal 2)

cd project-spa
npm install
npm run dev

โœ… Visit: http://localhost:5173

4๏ธโƒฃ Test It

  1. Open http://localhost:5173 in browser
  2. Register as Patient
  3. Upload a dermoscopic image
  4. Boom! ๐Ÿ’ฅ See prediction + heatmap

๐Ÿ–ฅ๏ธ System Requirements

Minimum Hardware

Component Requirement
CPU 4 cores (i5 or equivalent)
RAM 8 GB (16 GB recommended)
GPU Optional (NVIDIA CUDA for speed)
Storage 20 GB free
Browser Chrome, Firefox, Edge, Safari

Software

Tool Version
Python 3.10+
Node.js 18+
Docker Latest (optional)

๐Ÿ“ฆ Detailed Setup

Backend Setup

Step 1: Create Python Environment

# Windows
python -m venv project-env
project-env\Scripts\activate

# Linux/Mac
python3 -m venv project-env
source project-env/bin/activate

Verify activation: You should see (project-env) prefix in terminal.

Step 2: Install Python Dependencies

cd project-api
pip install -r requirements.txt

Expected packages:

  • fastapi โ€” Web framework
  • torch โ€” Deep learning (PyTorch)
  • torchvision โ€” Image processing
  • sqlalchemy โ€” Database ORM
  • pydantic โ€” Data validation
  • cloudinary โ€” Cloud storage

Step 3: Download Pre-trained Model

# Download from HuggingFace
# https://huggingface.co/charlykso/melanoma-classifier
# Or copy trained model:
cp ../path/to/melanoma_model.pth ./models/

File location (critical): project-api/models/melanoma_model.pth

Step 4: Configure Environment Variables

# Create .env file in project-api/
CLOUDINARY_API_KEY=your_key
CLOUDINARY_API_SECRET=your_secret
DATABASE_URL=postgresql://user:password@localhost/melanoma
JWT_SECRET=your-secret-key

Step 5: Initialize Database (if using PostgreSQL)

alembic upgrade head

Step 6: Start Backend Server

uvicorn main:app --reload --port 8000

Success Indicators:

INFO:     Uvicorn running on http://127.0.0.1:8000
INFO:     Application startup complete

Check API health:

curl http://localhost:8000/health
# Response: {"status": "healthy"}

Frontend Setup

Step 1: Install Node Dependencies

cd project-spa
npm install
# or
yarn install

Packages installed:

  • react โ€” UI framework
  • typescript โ€” Type safety
  • axios โ€” HTTP client
  • tailwindcss โ€” Styling
  • vite โ€” Build tool

Step 2: Configure API Endpoint (Optional)

# Create .env in project-spa/
VITE_API_URL=http://localhost:8000

Default: http://localhost:8000

Step 3: Start Development Server

npm run dev
# or
yarn dev

Success Indicators:

  Local:        http://localhost:5173/
  press h to show help

Step 4: Open in Browser

http://localhost:5173

๐ŸŽฎ Usage

1. Register Account

  • Click "Register"
  • Enter email & password
  • Select role: Patient (or Dermatologist if available)
  • Click "Sign Up"

2. Upload Image

  • On dashboard, click "Upload Image"
  • Drag & drop a dermoscopic skin lesion image (JPG/PNG)
  • Or click to browse files

3. Get Prediction

  • System verifies it's dermoscopic
  • Runs melanoma classifier
  • Generates Grad-CAM heatmap
  • Wait 3-5 seconds โณ

4. View Results

  • Prediction: Benign / Malignant
  • Confidence: 0-100%
  • Heatmap: Red regions = model focus areas
  • History: All predictions saved

5. Dermatologist Review (if available)

  • Log in as Dermatologist
  • Review assigned cases
  • Submit feedback (ground truth diagnosis)
  • Track agreement rates

๐Ÿ“ Project Structure

melanoma-diagnostic-agent/
โ”‚
โ”œโ”€โ”€ project-api/                 # Backend (FastAPI + PyTorch)
โ”‚   โ”œโ”€โ”€ main.py                 # Entry point
โ”‚   โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ config.py           # Settings
โ”‚   โ”‚   โ”œโ”€โ”€ routers/            # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ models/             # ML models code
โ”‚   โ”‚   โ”œโ”€โ”€ services/           # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ database/           # Database setup
โ”‚   โ”‚   โ””โ”€โ”€ schemas/            # Request/response schemas
โ”‚   โ”œโ”€โ”€ models/                 # Model weights
โ”‚   โ”‚   โ””โ”€โ”€ melanoma_model.pth  # Pre-trained model (REQUIRED)
โ”‚   โ””โ”€โ”€ static/                 # Generated heatmaps
โ”‚
โ”œโ”€โ”€ project-spa/                 # Frontend (React + TypeScript)
โ”‚   โ”œโ”€โ”€ package.json            # npm dependencies
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ main.tsx            # Entry point
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx             # Main component
โ”‚   โ”‚   โ”œโ”€โ”€ pages/              # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ components/         # Reusable components
โ”‚   โ”‚   โ”œโ”€โ”€ services/           # API client
โ”‚   โ”‚   โ””โ”€โ”€ styles/             # CSS/Tailwind
โ”‚   โ””โ”€โ”€ vite.config.ts          # Vite configuration
โ”‚
โ”œโ”€โ”€ project-env/                 # Python virtual environment
โ”‚   โ”œโ”€โ”€ Scripts/                # Executables (Windows)
โ”‚   โ””โ”€โ”€ lib/site-packages/      # Installed packages
โ”‚
โ”œโ”€โ”€ Software_Documentation.md    # Full documentation
โ””โ”€โ”€ README.md                    # This file

๐Ÿ”Œ API Documentation

Interactive Docs

Visit: http://localhost:8000/docs (Swagger UI)

Key Endpoints

Authentication

POST /auth/register       # Create account
POST /auth/login          # Login
GET  /auth/me            # Get profile

Predictions

POST /predict            # Upload image โ†’ get prediction
GET  /predictions        # Prediction history
GET  /predictions/{id}   # Single prediction

Dermatologist

GET  /dermatologist/stats       # Dashboard stats
GET  /dermatologist/predictions # Assigned cases
POST /predictions/{id}/feedback # Submit diagnosis

Admin

GET  /admin/stats        # Platform statistics
GET  /admin/users        # User management

๐Ÿ› Troubleshooting

Backend Issues

Problem Solution
ModuleNotFoundError: No module named 'torch' Run pip install -r requirements.txt again, ensure virtual env activated
Port 8000 already in use Use different port: uvicorn main:app --port 8001
Model not found error Download melanoma_model.pth and place in models/ directory
Database connection error Ensure PostgreSQL running: psql -U postgres
CORS error in browser Check backend is running on correct port (8000)

Frontend Issues

Problem Solution
npm ERR! Cannot find module Delete node_modules/ and package-lock.json, then npm install
Port 3000/5173 already in use Kill process: lsof -ti:5173 | xargs kill -9 (Linux/Mac) or use different port
Blank/white page Check browser console (F12), ensure backend URL in .env correct
Image upload not working Verify backend running & model loaded at http://localhost:8000/docs

General Issues

Problem Solution
Connection refused Ensure both backend & frontend are running in separate terminals
Slow inference (>10s) Model running on CPU. Install GPU drivers for CUDA acceleration
Database errors If using SQLite (default), ensure data/ folder exists with permissions

โœ… Verification Checklist

After setup, verify everything works:

Backend Check

# Health check
curl http://localhost:8000/health

# Should return:
# {"status": "healthy", "model_loaded": true}

Frontend Check

  • โœ… Page loads without white/blank screen
  • โœ… No errors in browser console (F12 โ†’ Console tab)
  • โœ… Can see login/register forms
  • โœ… Images upload without errors

Full System Test

  1. Register account
  2. Upload test dermoscopic image
  3. See prediction result
  4. View Grad-CAM heatmap
  5. Result appears in prediction history

๐Ÿš€ Next Steps

After successful setup:

Development

# Run with auto-reload
uvicorn main:app --reload

# Run tests
pytest project-api/tests/

# Format code
black project-api/

Production Deployment

# Using Docker
docker-compose up --build

# Or manual:
# - Set DEBUG=False in .env
# - Configure ALLOWED_HOSTS
# - Setup proper database (PostgreSQL recommended)
# - Use production server (Gunicorn)

Model Training

cd project-api
python train.py --epochs 50 --batch-size 32

๐Ÿ“š Documentation

  • Full Setup Guide: See Software_Documentation.md
  • API Reference: http://localhost:8000/docs (after startup)
  • Model Details: See project-api/README.md
  • Frontend Guide: See project-spa/README.md

๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License. See LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ผ Author

Charles โ€” MSc Thesis Project
Intelligent Diagnostic Agent for Early Detection of Human Melanoma


๐Ÿ†˜ Support

Issues? Check:

  1. Troubleshooting section above
  2. API docs: http://localhost:8000/docs
  3. Full docs: Software_Documentation.md

Contact: [your-email@example.com]


๐ŸŽ“ Citation

If you use this project in research, please cite:

@thesis{melanoma2026,
  author = {Charles},
  title = {Intelligent Diagnostic Agent for Early Detection of Human Melanoma},
  school = {University Name},
  year = {2026}
}

๐Ÿ“Š Project Status

Component Status
Backend API โœ… Production Ready
Frontend UI โœ… Production Ready
Model Training โœ… Completed (ISIC 2018)
Deployment โœ… Docker Support
Tests ๐Ÿ”„ In Progress
Documentation โœ… Complete

Last Updated: April 2026 | Version: 1.0

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support