An Approach to Skin Cancer Detection using Keras and Tensorflow

For humankind, skin cancer is a troubling illness. Given the rapid growth rate of skin cancer, its high treatment cost and death rate, the need for early detection of skin cancer has been increased. Now, the world has evolved in a way where skin cancer detection is possible by image pre-processing and machine learning methods. One well known and well worked method is Convolutional Neural Network (CNN). After segmentation of dermoscopic images, the features of the affected skin cells are extracted using feature extraction technique. We propose a convolutional neural network model to detect cancerous state of a person’s skin and classify them as malignant (melanoma) and benign (non-malignant). The above model’s architecture contains various layers which helps in reading the dataset by computer. Accurate results are always expected in these cases. We are using manual approach instead of automatic approach to overcome possible errors.


Introduction
Skin cancer has become a major disease in the present world alongside other commonly occurring cancer. Skin cancer is of two types, melanoma (malignant) and non-melanoma (benign). A patch of dark spot, scar, and disfigure on the skin or similar looking patches could be a symptom for skin cancer, but it does not always have to be cancerous. It could be skin rash as well. Signs of skin cancer include changes in skin colour, size, shape, itching etc. Basically, we will only know after getting checked. It can cause severe pain as well as bleeding on the skin. One very well known cause of skin cancer is ultraviolet rays. Direct exposure to this UV radiation is known to be one of the common cause for skin cancer.
A biopsy would usually be done to identify melanoma by doctors / dermatologists. In current scenario, with the help of computation, machine learning in general, made it possible to identify benign and malignant melanoma. In this world of technology, experience is something you can only gain through time and effort. Doctors who have studied for years and helping people in ways only they can do. Though various research shows that technology has outperformed doctors in terms of knowledge, a doctor's opinion in some cases, if not, all the cases, is needed instead of just depending on the technology. In addition, technology can be used as a tool to back the doctor's opinion in the case of expert advices.
Multiple research studies on automatic classification of images of melanoma using machine learning and computing vision method has been developed. While these studies deliver promising results, the use of computer vision and conventional machine learning significantly impacts their classification performance by the segmentation result of the skin lesion and the features identified for the method of classification. We are proposing a deep convolution neural network in this research to classify images 2 of melanoma into a benign and malignant group. Hopefully, the designed model can be adapted for real application that can help the professional to make diagnosis and recovery effectively. Figure 1. Stages of melanoma

Literature Survey
The working system of [1] consist of CNN done with the help of Keras API with Conv2D, MaxPool2D, ReLu and ADAM optimizer. They've also used CNN algorithm on VGG, ResNet andDenseNet methods. They've achieved 79% accuracy with CNN with 50 epochs, 90% accuracy with both ResNet50 and DenseNet121 and finally 85% accuracy with VGG11 BN with 10 epochs for other models other than CNN. In [2], they introduced a new and effective model using the Convolution Neural Networks algorithm to precisely identify and describe the type of skin cancer without any clinical procedure. They started with Patch extraction followed by Convolution Layer, Activation Layer, Pooling Layer and finally, fully connected Layer. They achieved a maximum of 91% after 10 epochs with data size being 8000. In [3], in addition to CNN model, they've used something called Gabor filter (GCN) before the process of CNN starts. The process done in this Gabor filter is then injected into CNN and follow the steps of CNN model. The dataset consists of 33, 569 images. They've done 15 epochs with just CNN and GCN/CNN combined using ADAM optimizer. In [4], they divide their dataset into multiple splits and run them each to find the one which gives out the highest accuracy. They have split the dataset into 90-10, 80-20, 70-30, 60-40 and 50-50. They achieved a highest accuracy of 88% for a split of 90-10 with 12000 images in the dataset for each split. In [5], with the dataset size of 200 images, using ANN. The pre-processing stage of ANN consists of handling missing data and selecting important features. They compared this proposed model with SVM and RF models and proved that their model scores high than the other two. In [6], they have used various ML algorithms and compared each other to show which did best. Using ANN, LDA, NB and SVM to compare, LDA tops with 82.26% accuracy in binary class classification and SVM tops with 81.61% accuracy in multi class classification. In [7], they used SVM model and achieved an accuracy of 90% with SVM architecture being a bit different from CNN architecture having pre-enhanced images and converted into 1-Dimensional array and finally trained in SVM model. In [8], they've used CNN with convolution layer, ReLU layer, Pooling layer, fully connected layer. The batch size was 20 and the epoch size was 25. They gained 70% accuracy in the end. In [9], they have used YUV based method with 300 images and 80-20 split. Trained using SVM, they achieved an overall accuracy of 86.7%. [10] Speaks about detecting the disease with the help of a dataset consisting 28,000 images collected from a hospital. They had 2 datasets A and B where A achieved 86.54% accuracy and B achieved 85.86% accuracy. [11] Uses CNN model without the normalization layer which helps in removing non trainable parameters from the dataset which in turn helps with the efficiency of the model.

Proposed Method
The proposed approach of predicting skin cancer using image processing offers early diagnosis of skin cancer using machine-aided processing that provides doctors with great help to diagnose skin cancer before spreading. In order to implement our model using Keras and TensorFlow libraries, we use deep learning techniques using a convolutional neural network algorithm.

Figure 2. Basic Architecture
CNN primarily deals with processing images. It consists of three layers, a hidden layer, an input layer and a middle layer. In any neural network, all the middle layers are hidden because the activation function and convolutions hide their inputs and outputs. The first layer whi ch is convolution layer performs convolutions on CNN followed by Activation layer, Pooling layer, fully connected layer and normalization layer. We use the activation function ReLu here in our model, which converts all positive pixels to 1 and all zeros and negative pixels to 0. There will be a uniformity of the pixels of each image and it is very simple for classification and analysis. To calculate loss function, we use binary cross entropy which calculates the average measure of difference between two probability distribution for random events. Binary cross entropy is followed by sigmoid activation function. Sigmoid activation function is monotonic function which is used to find probability which exist between 0 and 1. In our model, we are using the combination of sigmoid and ReLu activation function, so that our model will be optimized accurately. In the normalization layer, we have used batch normalization. Batch normalization is used to improve the performance and stability of deep neural network. It normalizes the input layer by re-centering and rescaling. They remove the parameters from training which reduces the performance of the model and change them to non-trainable parameters. We use Tensorflow and Keras libraries in jupyter notebook to implement this model. They are purely python-based framework used to implement neural networks. Fig.3 represents detailed architecture of CNN. It is clearly explained the different layer approaches of   Table 2. We changed the dropout value and noted the performance change. Dropout layer is used to increase the performance of the model. Dropout layer forces the model to look for the important features of the data while leaving out unwanted or less important features. 10 epochs as constant value for different dropout values. We can see that at 0% dropout, we achieved the highest accuracy of 86% after 10 epochs.    Table 3. And Figure 4. Shows the confusion matrix and classification report for the data we predicted. Expected prediction and actual prediction is used to determine the confusion matrix and we got values through classification report.  Using the values we got, we've performed various performance metrics and tabulated them in Table 4. Table 5 specifies the Geometric mean or G-mean is the performance metrics of specificity and sensitivity. Matthew's correlation coefficient is used as the measure of binary classifications. It takes into account the true and false positives and negatives and is generally regarded as a balanced measure which can be used even if the classes are of very different sizes.  This shows the variation in training and testing accuracy as well as the training and testing loss occurred per epoch. We did 100 epochs and in the graph we can see the variations. Hence our proposed model is superior to the existing model in terms of efficiency and accuracy. We used Normalization Layer which separated non trainable parameters from the data and made the training process faster and efficient.

Conclusion
Diagnosing skin cancer in the earlier stages is one of the major criteria for the proper treatment. In fact, it's the same for any type of cancer. It is difficult to diagnose cancer in very early stages before tumour or any structural change occurs in the appearance. It can be done using biopsy as a medical procedure. But in this world evolved with technology, with machine aided support, it can be done using algorithms and datasets. Our model provides such an assistance to doctors to recognise at the earliest. This deep learning model of skin cancer detection using Convolutional Neural Network can be used as an added assistance to doctors, with respect to doctor's experience as well.