Skip to content

mahlaranjeet/Melanoma_Detection_Assignment_CNN

Repository files navigation

Melanoma Detection Assignment

By Dr Ranjeet Singh Mahla

Date April 22, 2023

Outline a brief description of your project.

Table of Contents

General Information

Problem statement:

To build a CNN based model which can accurately detect melanoma. Melanoma is a type of cancer that can be deadly if not detected early. It accounts for 75% of skin cancer deaths. A solution that can evaluate images and alert dermatologists about the presence of melanoma has the potential to reduce a lot of manual effort needed in diagnosis.

dataset

The dataset consists of 2357 images of malignant and benign oncological diseases, which were formed from the International Skin Imaging Collaboration (ISIC). All images were sorted according to the classification taken with ISIC, and all subsets were divided into the same number of images, with the exception of melanomas and moles, whose images are slightly dominant.

The data set contains the following diseases:

Actinic keratosis Basal cell carcinoma Dermatofibroma Melanoma Nevus Pigmented benign keratosis Seborrheic keratosis Squamous cell carcinoma Vascular lesion

Project Pipeline

Data Reading/Data Understanding → Defining the path for train and test images Dataset Creation→ Create train & validation dataset from the train directory with a batch size of 32. Also, make sure you resize your images to 180*180. Dataset visualisation → Create a code to visualize one instance of all the nine classes present in the dataset Model Building & training : Create a CNN model, which can accurately detect 9 classes present in the dataset. While building the model, rescale images to normalize pixel values between (0,1). Choose an appropriate optimiser and loss function for model training Train the model for ~20 epochs Write your findings after the model fit. You must check if there is any evidence of model overfit or underfit. Chose an appropriate data augmentation strategy to resolve underfitting/overfitting Model Building & training on the augmented data : Create a CNN model, which can accurately detect 9 classes present in the dataset. While building the model rescale images to normalize pixel values between (0,1). Choose an appropriate optimiser and loss function for model training Train the model for ~20 epochs Write your findings after the model fit, see if the earlier issue is resolved or not? Class distribution: Examine the current class distribution in the training dataset

  • Which class has the least number of samples?
  • Which classes dominate the data in terms of the proportionate number of samples? Handling class imbalances: Rectify class imbalances present in the training dataset with Augmentor library. Model Building & training on the rectified class imbalance data : Create a CNN model, which can accurately detect 9 classes present in the dataset. While building the model, rescale images to normalize pixel values between (0,1). Choose an appropriate optimiser and loss function for model training Train the model for ~30 epochs Write your findings after the model fit, see if the issues are resolved or not?

Conclusions

The rebalancing of the class played a significant role in mitigating overfitting of the data, resulting in a decrease in loss. However, the approach also resulted in a notable decrease in accuracy.

In the beginning, we experimented without utilizing the ImageDataGenerator, which led to a high degree of overfitting in the data. Subsequently, we implemented dropout and the ImageDataGenerator, which helped to reduce overfitting.

Finally, we incorporated Batch Normalization and Augmentation techniques, which proved to be extremely effective in moving forward.

some images of model building and visualizations (not all)

alt text

alt text

alt text

alt text

alt text

alt text

alt text

alt text

alt text

alt text

Technologies Used

all latest version

pathlib tensorflow matplotlib numpy pandas os PIL glob tensorflow keras

Acknowledgements

Give credit here.

  • Inspired by IIITB CNN assignment
  • Credit to IIITB and Upgrad
  • This project is done towards fultilment of partial requirements for msc in ai and ml

Contact

Created by [@mahlaranjeet] - feel free to contact me! mahlaranjeet@gmail.com

References

(1) Datasets: https://drive.google.com/file/d/1xLfSQUGDl8ezNNbUkpuHOYvSpTyxVhCs/view (2) Ddefault worksheet: https://github.com/ContentUpgrad/Convolutional-Neural-(4) (3) Networks/blob/main/Melanoma%20Detection%20Assignment/Starter_code_Assignment_CNN_Skin_Cancer%20(1).ipynb (4) Google drive where I stored my input data : https://drive.google.com/drive/u/0/folders/1R3fZKVrcs-HY5df-HSTppn3Too74pSjo (5) Image classification using CNN from https://www.analyticsvidhya.com/blog/2020/02/learn-image-classification-cnn-convolutional-neural-networks-3-datasets/ (6) Efficient way to build CNN architecture from https://towardsdatascience.com/a-guide-to-an-efficient-way-to-build-neural-network-architectures-part-ii-hyper-parameter-42efca01e5d7 (7) Melanoma Skin Cancer from https://www.cancer.org/cancer/melanoma-skin-cancer/about/what-is-melanoma.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published