Skip to content

About

Deep Learning-based Skin Cancer Classification using FastAI and ResNet | Includes dataset, Jupyter Notebook, PR & ROC curves, confusion matrix, and literature review.

Resources

Stars

14 stars

Watchers

0 watching

Forks

Repository files navigation

🩺 Skin Lesion Classification using FastAI & PyTorch

Python FastAI PyTorch License

A lightweight end-to-end deep learning pipeline for classifying dermatoscopic skin lesion images using transfer learning with FastAI and PyTorch.


📌 Overview

This project implements a Convolutional Neural Network (CNN) using FastAI and a PyTorch backend to classify skin cancer lesions from dermatoscopic images.

It uses a ResNet18 model pre-trained on ImageNet and fine-tunes it on a curated subset of the Skin Cancer ISIC dataset.

⚠️ Disclaimer: This project is for educational & research purposes only. It is not a substitute for professional medical diagnosis.

⚠️ Note: Due to resource and training time constraints, the notebook uses only a subset of classes (some classes were removed) from the original dataset.


✨ Key Features

Feature Description
🧠 Transfer Learning Pre-trained ResNet18 model fine-tuned with FastAI best practices.
⚡ Simplified Workflow FastAI abstracts away boilerplate PyTorch code for faster prototyping.
🔄 Data Augmentation Uses aug_transforms (flips, rotation, zoom, warp) for generalization.
📊 Comprehensive Evaluation Includes Confusion Matrix, Precision-Recall Curve, and ROC Curve.
🎯 Prediction Demo Load the trained model and run single-image predictions with probabilities.
🧪 Test-Time Augmentation (TTA) Achieved 80.68% accuracy by averaging predictions over augmented images.
📈 Learning Rate Finder Automatically selects the best learning rate with learn.lr_find().

📂 Project Structure

Skin-Cancer-Detection-CNN-FastAI/
├── code.ipynb                  # Main Jupyter Notebook
├── README.md                   # Project documentation
├── literature_review.pdf       # Background research

📦 Dataset

We use the publicly available Skin Cancer ISIC dataset from Kaggle: 🔗 Skin Cancer 9 Classes (ISIC) - Kaggle

Important Note: To reduce training time and manage resources, the notebook does not use all 9 classes. One or more classes were intentionally excluded during training. You can modify the notebook to include all classes if needed.


🧠 Technical Details

  • Model Architecture: ResNet18
  • Framework: PyTorch
  • High-Level API: FastAI
  • Training Strategy: fine_tune + fit_one_cycle
  • Metrics: Accuracy, Precision-Recall, ROC-AUC
  • Visualization: Confusion Matrix, Top Losses, Optimal LR plots
  • Dataset Subsetting: Some classes from the original ISIC dataset were excluded for practical training duration.

🚀 Getting Started

Prerequisites

  • Python 3.9+
  • Jupyter Notebook or JupyterLab
  • Kaggle API (for downloading dataset if not manually done)

Installation

# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/Skin-Cancer-Detection-CNN-FastAI.git
cd Skin-Cancer-Detection-CNN-FastAI

# 2. Install dependencies
pip install fastai timm matplotlib scikit-learn

# 3. Download dataset (manually or via Kaggle CLI)
# Example using Kaggle CLI:
kaggle datasets download -d nodoubttome/skin-cancer9-classesisic
unzip skin-cancer9-classesisic.zip

# 4. Launch Jupyter
jupyter notebook code.ipynb

📊 Results & Visualizations

The model’s performance was assessed using multiple metrics.

Confusion Matrix, Optimal Learning Rate & Top Losses

Precision-Recall & ROC Curves


📄 License

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


👨‍💻 Authors

GitHub LinkedIn


🔹 Surya

GitHub


🔹 Nayana

GitHub


⭐️ If you found this repository helpful, please consider giving it a star!

About

Deep Learning-based Skin Cancer Classification using FastAI and ResNet | Includes dataset, Jupyter Notebook, PR & ROC curves, confusion matrix, and literature review.

Resources

Stars

14 stars

Watchers

0 watching

Forks

Contributors

Languages