Skip to content

valencodes/DermTrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DermTrace AI — Skin Lesion Classification & Explainability System 🩺

Python 3.10+ TensorFlow 2.12+ Streamlit App Open In Colab License: MIT

Samsung Innovation Campus & EOI — AI Capstone Project
DermTrace AI is a deep learning system designed for multi-class skin lesion diagnosis (HAM10000 dataset), incorporating DullRazor hair artifact removal, two-phase transfer learning (ResNet152 / Xception), class imbalance correction, and Grad-CAM visual explainability.


📌 Key Features

  • DullRazor Preprocessing: Mathematical morphology (Black-Hat filter + Telea inpainting) to eliminate hair artifacts without distorting underlying lesion pigment networks.
  • Anti-Leakage Partitioning: Strict lesion_id grouping (GroupShuffleSplit) to prevent artificial metric inflation caused by duplicate images of the same lesion.
  • Two-Phase Transfer Learning:
    • Phase 1 (Feature Extraction): Backbone frozen (ResNet152 / Xception), training ~1.06M head parameters with $\text{LR}=10^{-3}$.
    • Phase 2 (Fine-Tuning): Unfreezing deep convolutional blocks with low learning rate ($\text{LR}=10^{-5}$).
  • Class Imbalance Mitigation: Dynamic real-time data augmentation + class-weighted categorical cross-entropy loss.
  • Visual Explainability (Grad-CAM): Gradient-weighted Class Activation Mapping generating heatmaps that highlight key diagnostic regions driving network predictions.
  • Streamlit Web Application: Interactive web interface featuring drag-and-drop file upload, live mobile camera capture, side-by-side preprocessed views, and risk severity alerts.

📊 Benchmark & Experimental Results (E1 – E8)

Exp ID Model Architecture & Pipeline Split Method Balanced Acc (%) Macro-F1 (%) Melanoma Recall (%)
E1a Baseline (MobileNetV2, no DullRazor) Image-level 74.2% 63.5% 54.8%
E1b MobileNetV2 + DullRazor Filter Image-level 78.5% 68.2% 61.3%
E2 ResNet152 (Trained from scratch) Lesion-level 45.1% 38.0% 29.4%
E3 ResNet152 (Without Class Weights) Lesion-level 68.4% 58.1% 42.0%
E4 ResNet152 + DullRazor + Class W. Lesion-level 92.4% 88.7% 89.5%
E5 Xception + DullRazor + Class W. Lesion-level 91.8% 87.9% 88.2%
E7 ResNet152 (No Data Augmentation) Lesion-level 81.3% 76.5% 71.0%
E8 ResNet152 (Image-level Leakage Test) Image-level 97.8% (Inflated) 94.2% (Inflated) 95.1% (Inflated)

📁 Repository Structure

DermTrace_Clean_Repo/
├── .gitignore
├── README.md
├── requirements.txt
├── LICENSE
├── docs/
│   ├── Samsung_AI_Capstone_Project_Final_Report_DermTrace.md
│   └── Samsung_AI_Capstone_Project_Final_Report_DermTrace.docx
├── src/
│   ├── __init__.py
│   ├── dullrazor.py
│   ├── preprocess.py
│   └── gradcam.py
├── notebooks/
│   ├── 01_EDA_HAM10000.ipynb
│   └── 02_DermTrace_Colab_Training.ipynb
├── app/
│   ├── .streamlit/
│   │   └── config.toml
│   ├── app.py
│   └── labels.json
└── assets/
    └── screenshots/

🚀 Quickstart Guide

1. Local Environment Setup

# Clone repository
git clone https://github.com/username/DermTrace_Clean_Repo.git
cd DermTrace_Clean_Repo

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Launch Streamlit Web Application

streamlit run app/app.py

📜 License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages