Skip to content

VKonstantakos/Melanoma-Diagnosis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Melanoma diagnosis using CNNs

The objective of this project is to identify melanoma in images of skin lesions.

In particular, it contains the code for the ISIC 2018 Skin Lesion Classification Task, which includes 7 possible diagnoses:

AKIEC: Actinic keratosis / Bowen's disease (intraepithelial carcinoma)
BCC: Basal cell carcinoma
BKL: Benign keratosis (solar lentigo / seborrheic keratosis / lichen planus-like keratosis)
DF: Dermatofibroma
MEL: Melanoma
NV: Melanocytic nevus
VASC: Vascular lesion

Motivated by this challenge, the goal was to build an accurate model with good generalization that can predict the diagnosis of any skin lesion. That is, given a dermoscopic or camera image, we want to correctly classify it, especially when involving a possible melanoma diagnosis.

To accomplish that, we used the provided HAM10000 dataset with additional external data from BCN20000 and PAD-UFES-20, and implemented transfer learning using various CNN architectures (e.g., Inception-v3, ResNet-50, EfficientNet-B3).

The goal of the project was also to deploy the final models as a web application.

Launch the web app here:

Streamlit App

Demo

Demo

Table of contents

Introduction

In the United States, 5 million new cases of skin cancer are diagnosed every year. Among those, melanoma is the most dangerous one, being difficult to detect and causing serious problems once spread deeper. On the other hand, localized melanoma has a very good prognosis. Therefore, detecting melanoma early is of utmost importance. However, melanomas have many different shapes, sizes, and colors, thus making it harder to provide comprehensive warning signs. Convolutional neural networks provide significant progress in this field, making it possible to detect melanomas and help doctors in their effort for a timely diagnosis.

Training Process

  • Downloaded and merged external datasets.
    • Balanced class distribution (see Figures).
    • Improved generalization.
  • Image augmentation with Keras Image Generator and custom functions, such as hair drawing (see Figures).
  • Experimented with several pre-trained models and optimizers.
  • Loss function: Weighted Categorical Cross-Entropy to account for class imbalance and disease severity.
  • Evaluation metric: Weighted Accuracy, AUC.
  • Trained each model for 50 epochs with early stopping and reduce learning rate on plateau callbacks.
  • Implemented but with no improvement:
    • Augmentation & class balancing using GANs.
    • Bayesian Optimization to find the optimal CNN architecture.

Figures

Class distribution before and after merging additional data.

Class distribution

Image augmentation examples.

Image augmentation

Results

With weighted accuracy as the evaluation metric, the models performed as follows:

Base Models Training Validation
ConvNet (baseline) 67.0 % 67.5 %
NasNet-Large 81.5 % 68.5 %
DenseNet-201 78.5 % 70.3 %
InceptionResNet-v2 86.8 % 78.8 %
ResNet-50 88.1 % 79.0 %
Inception-V3 95.3 % 83.6 %
EfficientNet-B3 95.0 % 84.7 %

ISIC 2018 Top 15 Leaderboard

image

Submission Result (Average of EfficientNet-B3 and Inception-V3)

image

Installation

Requirements

Numpy
Pandas
GPyOpt
OpenCV
Seaborn
Matplotlib
Tensorflow
Scikit-learn
Streamlit
tqdm
gdown
sla-cli

Download the models' weights from the provided link and move them into the appropriate directory: Models' Weights

Download repository

$ git clone https://github.com/VKonstantakos/Melanoma-Diagnosis.git

After adding the models, run the following commands:

  • Install all the required libraries.
pip install -r requirements.txt
  • Run model app using Streamlit script.
streamlit run app.py

Support

For support, email [email protected]

About

Melanoma diagnosis using Convolutional neural networks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published