Skin Cancer Detection Using CNN

Skin Cancer Detection Using CNN
Photo by SELECTO on Dribbble

Cancer, which is a common disease nowadays is mainly caused due to rapid growth of cancer cells inside our body. There are various types of cancers which are present such as Breast Cancer, Lung Cancer, Pancreatic Cancer etc.

Skin Cancer(Melanoma), which is mostly curable, can become deadly if not detected at an early early stage. Hence, it is important to detect which one is malignant and which one is benign.

The model proposed here is capable to classify images based on Convolutional Neural Networks and can eventually yield good results.

Table of Contents:


>Data Preparation

>Image Processing

>Model Training

>Model Evaluation

>Graph Plot

>Model Prediction


The dataset is available on Kaggle which was given by Claudio Fanconi. Basically, the data is splitted into 2 types, test and train data. There were approximately 2637 images in training set and 660 in the testing set. The images provided in the set were mostly quite clear and well formatted.

Data Preparation

The training and test set were already present in the dataset. However, the validation set was missing. So, we took 25% of the training data and converted it into validation data.

Dummy Data: This data will be useful for the model’s prediction, which consists of 5 images

Image Processing:

By definition, Image Processing is a method to perform some operations on an image, in order to get an enhanced image or to extract some useful information from it. It is a type of signal processing in which input is an image and output may be image or characteristics/features associated with that image.

Rescaling :

Since, the image size has a maximum pixel of 255, i.e it has a range of [0,255], but it becomes tough for the model to process such high pixel so we need to rescale it before feeding to model.

Model Training :

In this CNN Model, we have used 6 layers of “ReLU” and the last layer is of “Softmax”.

Model Evaluation:

The model performed well on the test and training both. It has able to yield an accuracy of approximately 82 % on train and 77% on test.

Graph Plot :


Train VS Val (Accuracy)
Train VS Val (Accuracy)

Train VS Val (Loss)
Train VS Val (Loss)

Model Prediction :

Model Prediction
Model Prediction

Link :

Click the below link to access the Notebook.

Credit: Tanmay

Also Read: Heart Disease Prediction using Neural