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
- ๐ Table of Contents
- โจ Features
- ๐ฌ Demo
- โก Quick Start (5 Minutes)
- ๐ฅ๏ธ System Requirements
- ๐ฆ Detailed Setup
- ๐ฎ Usage
- ๐ Project Structure
- ๐ API Documentation
- ๐ Troubleshooting
- โ Verification Checklist
- ๐ Next Steps
- ๐ Documentation
- ๐ค Contributing
- ๐ License
- ๐จโ๐ผ Author
- ๐ Support
- ๐ Citation
- ๐ Project Status
- ๐ Table of Contents
๐ฏ 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
- Demo
- Quick Start (5 Minutes)
- System Requirements
- Detailed Setup
- Usage
- Project Structure
- API Documentation
- Troubleshooting
- Contributing
โจ 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
- Open http://localhost:5173 in browser
- Register as Patient
- Upload a dermoscopic image
- 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 frameworktorchโ Deep learning (PyTorch)torchvisionโ Image processingsqlalchemyโ Database ORMpydanticโ Data validationcloudinaryโ 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 frameworktypescriptโ Type safetyaxiosโ HTTP clienttailwindcssโ Stylingviteโ 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
- Register account
- Upload test dermoscopic image
- See prediction result
- View Grad-CAM heatmap
- 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:
- Fork repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - 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:
- Troubleshooting section above
- API docs: http://localhost:8000/docs
- 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