Explainable Machine Vision Techniques for Skin Cancer Detection
A machine learning project, developed during field training for ISIC, focuses on building and explaining models that classify skin-cancer images. This included model development, XAI technology, and deployment using Flask, Docker, and Crane Cloud.
This project applied machine learning and interpretable AI (XAI) techniques to classify skin-cancer images into three categories: melanoma, basal cell carcinoma, and squamous cell carcinoma. Built for ISIC, this project focuses on model accuracy, transparency, and real-world deployment.
1. Dataset Acquisition The dataset was obtained directly from the ISIC archive, containing 300 labeled images (100 per class).
2. Data Preprocessing and Exploratory Data Analysis (EDA) The raw images were cleaned and made suitable for training. Functions include: Uploading datasets to Google Drive Creating a Google Colab Workspace Visualizing raw image samples Plotting a heatmap and label correlation Removing duplicate images through hashing balance classes Resizing and enlarging images
3. Data Splitting The images were divided into training, validation, and testing sets to appropriately measure performance.
4. Model Architecture Two model architectures were explored: CNN (Convolutional Neural Network) Vision Transformer (ViT) – later became the best performer
5. Model fine-tuning Better performance through: tuning learning rate adjusting batch size additional image enhancements
6. Model Training 50 era Total 2100 processed images Image size: 250×250 pixels
7. Model evaluation Models were evaluated using: precision remember F1-Score training/validation loss Best Model: Vision Transformer (ViT) achieved: Precision: 0.9605 Recall: 0.9336 F1 Score: 0.9358
8. Explainable AI (XAI) Technologies To explain what the models were "seeing", three XAI methods were applied:
✔ LRP (Layer-wise Relevance Propagation) Used with VIT to advance predictions and highlight image areas that influence decisions.
✔ Grad-CAM Applied to CNN models to visualize the areas of the image contributing to its prediction.
9. Deployment The complete solution was deployed after containerization:
✔ Flask Application The trained model was wrapped into a simple inference API.
✔ Docker Containerization Built a Docker image Tested locally Published to Docker Hub
✔ Crane Cloud Deployment.
Links to Resources and notebooks;
1. Exploitary Data Analysis (EDA):https://colab.research.google.com/drive/19GdBgKDqaYSAi8dIXVwGHyBdS-DTg9-Q
2.CNN model notebook:https://colab.research.google.com/drive/1mEU9r8jKo_UaeviTj-R7O7Jx_hbWhgMl
3.VIT model notebook:https://colab.research.google.com/drive/1lrS78kDcPGtYWmBPADo6zb29am20nbO3
4.ISICDataset:https://www.isic-archive.com/
Explainable Machine Vision Techniques for Skin Cancer Detection