Skip to content

Latest commit

Β 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”¬ MelaNoMore

AI-Powered Skin Lesion Screening for Clinical Decision Support

πŸ† TinyHack Turin 2025 – 1st Place (Winning Project)

This repository contains the prototype developed in 24 hours during the TinyHack Turin 2025 hackathon, awarded 1st place.
It is an experimental research prototype for skin lesion image classification.
Not a medical device. Not for diagnostic use. Use only for educational and research purposes.


Overview

MelaNoMore is a computer vision-based decision support tool designed to assist dermatologists in the early detection and classification of skin lesions. By combining edge AI on the Arduino Nicla Vision with a powerful server-side deep learning model, MelaNoMore provides a two-tier screening system that balances speed, accuracy, and accessibility.

Key Features

  • ⚑ Fast on-device screening - Binary classification (suspicious vs. non-suspicious) directly on the Nicla Vision
  • 🧠 Advanced server-side analysis - Multi-class classification across 7 lesion types using Vision Transformer
  • πŸ“‘ Seamless WiFi integration - Automatic image upload for suspicious cases
  • 🎯 Distance guidance - Time-of-Flight sensor ensures correct positioning
  • πŸ’‘ Intuitive LED feedback - Color-coded status for real-time user guidance
  • 🌐 Web dashboard - Accessible interface for reviewing detailed predictions

πŸ‘₯ Team


Use Case

MelaNoMore serves as a "second set of eyes" for dermatologists during clinical examinations:

  1. Pre-screening happens instantly on the handheld device, even offline
  2. Suspicious cases are automatically escalated to a more powerful model running on a server
  3. Detailed classification helps dermatologists make informed decisions about diagnosis and treatment

This workflow helps:

  • ⏱️ Save time during patient consultations
  • πŸ” Reduce diagnostic errors
  • 🩺 Improve early detection of dangerous skin cancers like melanoma

πŸ—οΈ System Architecture

MelaNoMore employs a two-tier classification system:

Tier 1: Edge Device (Arduino Nicla Vision)

  • Model: fai-cls-n-coco (Focoos AI)
  • Task: Binary classification (suspicious vs. non-suspicious)
  • Input: 96x96 RGB images
  • Inference: Real-time, on-device
  • Output: Classification + LED feedback

Tier 2: Server (PC/Cloud)

  • Model: Vision Transformer Large (ViT-L/16)
  • Task: Multi-class classification across 7 lesion types
  • Parameters: ~305M
  • Inference: Triggered only for suspicious cases
  • Output: Detailed classification with confidence scores

Communication Flow

[Nicla Vision] -> Capture Image -> On-Device Inference
       |
  Suspicious?
       |
    [YES] -> WiFi Upload -> [Flask Server] -> ViT-L/16 Inference
       |                          |
    [NO]                   Web Dashboard
       |
   Green LED

🧬 Dataset

HAM10000 (Human Against Machine with 10,000 training images) Source: ISIC Archive - Collection 212

Lesion Categories (7 classes)

  1. Actinic Keratoses
  2. Basal Cell Carcinoma
  3. Benign Keratosis-like lesions
  4. Dermatofibroma
  5. Melanocytic Nevi
  6. Melanoma
  7. Vascular lesions

πŸ€– Model Details

Edge Model (Nicla Vision)

  • Architecture: fai-cls-n-coco (Focoos AI)
  • Pretraining: COCO dataset
  • Fine-tuning: Binary classification on HAM10000 (suspicious vs. non-suspicious)
  • Input Size: 96x96
  • Export Format: ONNX with quantization
  • Deployment: Flashed via Zant

Server Model (PC)

  • Architecture: Vision Transformer Large (ViT-L/16)
  • Parameters: ~305M
  • Pretraining: ImageNet-21k
  • Fine-tuning: HAM10000 with Focal Loss (to handle class imbalance)
  • Framework: PyTorch

Performance Metrics

Edge Model (Nicla Vision) Binary Classification

Metric Score
Accuracy 76%
Precision 67.99%
Recall 94.01%
F1-Score 76.44%

Server Model (ViT-L/16) Multi-Class Classification

Metric Score
Accuracy 84.60%
F1 (Macro) 72.80%
F1 (Weighted) 83.40%

πŸ”§ Hardware Components

Required Hardware

  • Arduino Nicla Vision - Edge AI processing and image capture
  • PC/Server - Flask web server + Vision Transformer inference

Device Integration

The Nicla Vision is integrated into a handheld, dermatoscope-like form factor for ease of use in clinical settings.


πŸ’» Software Stack

On-Device (Arduino Nicla Vision)

  • Arduino IDE
  • Focoos AI platform (model training & export)
  • ONNX runtime
  • Zant (firmware flashing)

Server-Side (PC)

  • Python 3.8+
  • Flask (web server)
  • PyTorch
  • torchvision
  • scikit-learn
  • NumPy, Pandas

πŸš€ Getting Started

1. Hardware Setup

  1. Assemble the MelaNoMore handheld device with Nicla Vision
  2. Ensure ToF sensor and camera are properly connected
  3. Verify LED indicators are functional

2. Deploy Edge Model

# Flash the ONNX model to Nicla Vision using Zant
zant flash --model model.onnx --device nicla-vision

3. Upload Arduino Sketch

# Open sketch.ino in Arduino IDE and upload to Nicla Vision
arduino-cli compile --fqbn arduino:mbed_nicla:nicla_vision sketch.ino
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:mbed_nicla:nicla_vision sketch.ino

4. Start Server

# Navigate to server directory
cd server/

# Create venv
python -m venv venv

# Activate venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Start Flask server
python app.py --host 0.0.0.0 --port 8000

5. Configure WiFi

Update WiFi credentials in sketch.ino:

const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const char* serverURL = "http://YOUR_SERVER_IP:8000/ingest";

πŸ“– Usage Guide

Clinical Workflow

  1. Position Device

    • Hold the MelaNoMore device over the patient's skin lesion
    • Yellow LED indicates positioning mode
    • ToF sensor ensures correct distance (3-5 cm)
  2. Capture Image

    • Once positioned correctly, Blue LED activates
    • Image is automatically captured
  3. On-Device Classification

    • Nicla Vision runs binary classification
    • Green LED = Non-suspicious (Done)
    • Red LED = Suspicious (Image uploaded to server)
  4. Server Analysis (for suspicious cases only)

    • Image automatically transmitted via WiFi
    • Vision Transformer performs detailed 7-class classification
    • Results appear on web dashboard
  5. Review Results

    • Dermatologist reviews detailed classification on PC dashboard
    • Prediction includes lesion type and confidence scores
    • Clinical decision made based on AI recommendation + medical expertise

πŸ’‘ LED Feedback System

LED Color Meaning
🟑 Yellow Positioning - adjust distance
πŸ”΅ Blue Capturing image
🟒 Green Non-suspicious lesion detected
πŸ”΄ Red Suspicious lesion - uploading to server

πŸ“ Project Structure

SkinCancerDetection_TinyHack/
β”œβ”€β”€ README.md                   # Project overview and documentation
β”œβ”€β”€ 1st_tier/
β”‚   └── sketch.ino              # Arduino Nicla Vision firmware (tier-1 classifier)
β”œβ”€β”€ 2nd_tier/
β”‚   β”œβ”€β”€ dataset.py              # Dataset utilities for HAM10000
β”‚   β”œβ”€β”€ evaluate.py             # Evaluation pipeline and metrics
β”‚   β”œβ”€β”€ metrics.py              # Metric computation helpers
β”‚   β”œβ”€β”€ model.py                # Vision Transformer model definition
β”‚   β”œβ”€β”€ train.py                # Training entrypoint
β”‚   β”œβ”€β”€ visualize.py            # Visual analysis scripts
β”‚   └── requirements.txt        # Python dependencies for training
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ app.py                  # Flask server entrypoint
β”‚   β”œβ”€β”€ classifier.py           # Tier-2 inference orchestration
β”‚   β”œβ”€β”€ requirements.txt        # Runtime dependencies for the server
β”‚   β”œβ”€β”€ static/
β”‚   β”‚   β”œβ”€β”€ dashboard.js        # Dashboard interactivity
β”‚   β”‚   └── styles.css          # Dashboard styling
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   β”œβ”€β”€ base.html           # Base HTML layout
β”‚   β”‚   └── dashboard.html      # Dashboard view
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ best_model.pth      # Fine-tuned ViT weights
β”‚   β”‚   β”œβ”€β”€ inference_api.py    # Model loading and inference helpers
β”‚   β”‚   └── INTEGRATION_GUIDE.md  # Deployment/integration notes
β”‚   └── incoming/               # Uploaded lesion images from the device
└── venv/                       # (Optional) Local Python virtual environment

⚑ Technical Highlights

Edge AI Optimization

  • Quantization: ONNX model optimized for embedded inference
  • Resolution: 96x96 input size balances accuracy and speed
  • Offline capability: On-device inference works without internet

Server-Side Intelligence

  • Focal Loss: Addresses class imbalance in HAM10000 dataset
  • Vision Transformer: State-of-the-art architecture for medical imaging
  • Scalability: Server can handle multiple concurrent requests

Sensor Fusion

  • ToF + Camera: Ensures consistent image quality
  • WiFi + LED: Provides seamless user experience

🎯 Future Improvements

  • Mobile app integration for patient record management
  • Database integration for longitudinal lesion tracking
  • Multi-language support for global deployment
  • Real-time analytics dashboard for dermatology clinics
  • HIPAA-compliant encryption for patient data

πŸ“š References


🧠 Model Weights (Not Included)

The fine‑tuned Vision Transformer weights (best_model.pth, ~3.4 GB) are not included in this repository to keep the codebase small and fast to clone. When the file is absent the application automatically falls back to a mock classifier so you can still run the full ingestion + dashboard flow.


πŸ“œ License

This project was developed as part of a 24-hour hackathon challenge.


πŸ™ Acknowledgments

Special thanks to the organizers of the hackathon and the creators of the Focoos, Zant, and Arduino Nicla Vision platforms for making edge AI accessible to developers.


MelaNoMore - Empowering dermatologists with AI-driven decision support 🩺

Built with ❀️ by Arslan, Vittorio, and Alessandro

About

This repository contains the prototype developed in 24 hours during the TinyHack Turin 2025 hackathon, awarded 1st place

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages