In this project, we try to build a model to detect melanoma, the deadliest form of skin cancer. In particular, our model will distinguish this malignant skin tumor from skin lesions dataset. Visually, we can distinguish normal moles and abnormal moles using ABCDEF Method
- Clone this repository
git clone https://github.com/virgiawan/yog2a-melanoma.git
- Download and unzip data from kaggle (3 GB)
kaggle datasets download -d drscarlat/melanoma
unzip -q melanoma.zip -d .
- You're recommended to using Google Colaboratory for easy implementation, but if you're not using Google Colaboratory, please install all these libraries
tensorflow==2.2.0
matplotlib==3.2.1
seaborn==0.10.1
scikit-learn==0.22.2.post1
requests==2.23.0
google-cloud-storage==1.18.1
google-api-python-client==1.7.12
Werkzeug==1.0.1
Flask==1.1.2
- Install gcloud and gsutil tools
- Follow the instruction from this notebook
- If you want to know how we explore our model, please check all our notebooks
In experimenting with the model, we make adjustments to the following parameters:
- Neural Network Architecture
- ResNet50 => 50% val_accuracy
- Vanilla CNN => 85% val_accuracy
- VGG16 => 90% val_accuracy
- InceptionV3 => 92% val_accuracy
- MobileNetV2 => 93% val_accuracy
- Data Augmentation
- Before data augmentation => overfitting
- After data augmentation => reduce overfitting
- Optimizer
- Adam => fastest converge
- RMSprop => 2nd converge
- Adagrad => 3rd converge
- SGD => slowest converge
- Learning Rate
- 0.01 => fast but random fit
- 0.001 => well speed & fit
- 0.0001 => slow but well fit
Before we do the improvement model, we get 85% final accuracy. It appears that the train accuracy graph always increases and the train loss graph always decreases, it means that the model learns well. However, the model is still not perfect in generalizing so that the validation graph fluctuates. After we make the improvement model, we get 94% final accuracy. As you can see that the movement of the train and validation graph are almost always same, it means the model learns and generalize well.
- True Negative (TN) => 29
- False Positive (FP) => 21
- False Negative (FN) => 21
- True Positive (TP) => 29
If you want to know how to understand ROC Curves, please read: Understanding AUC - ROC Curve
AUC Score: 0.5938
It means that our model has no discrimination capacity to distinguish between positive class and negative class. It also shows that our model is still not perfect.
As you can see, our model has high accuracy but has a low AUC score. Why did it happen? According to our analysis, it happened because of the imbalanced dataset. So the data we took from Kaggle does look like it has an equal distribution, but actually the melanoma
class data has been augmented so it can be equivalent to the not melanoma
class data. So our model learns well to detect not melanoma
class because it has a good variety of original data.
Another reason is also that our model tends to have the attention to color features. So if there is a lesion that has a blackish color, it can definitely be detected as melanoma
. But if there is melanoma
lesion that has another color, our model still fails to detect it as melanoma.
We made a website to implement our model. This website is deployed and hosted using Google Cloud Platform. We made this application to help users both medical and non-medical users. For medical users, this application is useful to help recognize the stage of skin cancer so that it can accelerate the process of diagnosis and treatment of diseases. For non-medical users, this is useful for detecting skin cancer early.
Please check our web app: Melanoma Web App
- Dataset
- Web App Source
- Epidemiology of Melanoma and Nonmelanoma skin cancer - The Role of Sunlight
- Melanoma skin cancer statistics - World Cancer Research Fund
- Using the 7-point checklist as a diagnostic aid for pigmented skin lesions in general practice: a diagnostic validation study
- Malignant Melanoma Staging
- Skin Cancer Treatment
- Malignant Melanoma Treatment & Management