Project Report
Project Report
BELAGAVI-590018
A Project Report On
MACHINE LEARNING”
Submitted in the partial fulfillment of the requirements for the award of the Degree of
Bachelor of Engineering in Computer Science and Engineering
Submitted by
NIDHI SURESH BADNAL (1OX17CS064)
S VINODHINI (1OX17CS081)
SANDHYA V (1OX17CS086)
SOMAGUTTA SAI BHARGAVI (1OX17CS097)
CERTIFICATE
Certified that the project work entitled “Skin cancer detection using machine learning”
carried out by S Vinodhini (1OX15CS081), Sandhya V (1OX17CS086), Somagutta Sai
Bhargavi (1OX17CS097), Nidhi Suresh Badnal (1OX17CS064),bonafide students of
The Oxford College of Engineering, Bangalore in partial fulfillment for the award of the
Degree of Bachelor of Engineering in Computer Science and Engineering of
Visvesvaraya Technological University, Belagavi during the year 2020-2021. The
project report has been approved as it satisfies the academic requirements in respect of
project work prescribed for the said degree.
External Viva
Name of the Examiners Signature with Date
1.
2.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
THE OXFORD COLLEGE OF ENGINEERING
Hosur Road, Bommanahalli, Bangalore-560068
(Approved by AICTE, New Delhi, Accredited by NBA, NAAC, New Delhi & Affiliated to VTU, Belagavi)
Department Vision
Department Mission
DECLARATON
We, the students of Eighth semester B.E, at the Department of Computer Science and
Engineering, The Oxford College of Engineering, Bangalore declare that the project work
entitled “Skin cancer detection using machine learning” has been presented by us and
submitted in partial fulfillment of course requirements for the award of degree in Bachelor
of Engineering in Computer Science and Engineering discipline of Visvesvaraya
Technological University, Belagavi during the academic year 2020-2021.
Place: Bangalore
Date:
ABSTRACT
Skin cancer is a dangerous disease for humans. Scientists have been trying to implement
conventional ways across the world especially in developing and developed countries to cure
the deadliest form of skin cancer in human which is known as Melanoma. But efforts are always
blockaded by various challenges like high cost of sustaining traditional telemedicine and less
availability of experts. There are broadly three types of skin cancer: basal cell cancer, squamous
cell cancer, and melanoma. Greater than 90% of the cases are caused by exposure to ultraviolet
radiation from the sun. The requirement of initial analysis of skin cancer has been amplified
due to the rapid growth rate of melanoma skin cancer, its huge treatment price, and its death
toll rate. These cancer cells are sensed physically and it takes a lot of time to treat them in most
of the cases. This project proposes a man-made melanoma detection system using image
processing and the machine learning method. The structures of the pretentious skin cells are
removed after the separation of the thermoscopic images by means of the feature extraction
technique. A deep learning-based method convolutional neural network classifier is used for
the stratification of the extracted structures. An accuracy of 81% and consequently the training
accuracy of 97% are attained after using the real-time data set. The proposed work has been
presented in conference.
i
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any task
would be incomplete without the mention of the people who made it possible, whose
constant guidance and encouragement crowned our efforts with success.
We have great pleasure in expressing our deep sense of gratitude to our beloved and
respected founder chairman late Shri S. Narasa Raju Garu and to the respected chairman Shri
S.N.V.L Narasimha Raju Garu for having provided us with great infrastructure and well-
furnished labs.
We are grateful to the Head of the Department Dr. R.Ch. A Naidu, Department of
CSE, for his unfailing encouragement and suggestion given to us in the course of my
internship.
Guidance and deadlines play a very important role in successful completion of the
project on time. We also convey our gratitude to Prof. Seema Patil, project guide,
Department of CSE, for having constantly monitored the development of the project report
and setting up precise deadlines.
ii
TABLE OF CONTENTS
ABSTRACT i
ACKNOWLEGEMENT ii
1. INTRODUCTION 1
1.1 Preamble 1
2. LITERATURE SURVEY 4
5. SYSTEM IMPLEMENTATION 20
5.1 Python Introduction 20
5.1.1. Features 20
5.1.2 Why Python Emerging as a Leader 21
5.3. Methodology 27
5.4 Implementation 29
5.4.1 Dataset 29
5.4.4 Normalization 35
6. TESTING 53
6.1 Software Testing Introduction 53
6.3.2 Design 53
6.3.3 Testing 54
6.3.4 Maintenance 54
6.4.5 V-Model 54
REFERENCES 67
APPENDIX A 69
APPENDIX B 73
LIST OF FIGURES
Figure A1: Displays the web page to choose the file or image 66
CHAPTER 1
INTRODUCTION
1.1 PREAMBLE
Skin cancer is a dangerous disease for humans. The necessity of early diagnosis of skin cancer has
been increased because of the rapid growth rate of Melanoma skin cancer, its high treatment costs,
and its death rate. These cancer cells are detected manually and it takes time to cure in most cases.
This paper proposed a man-made carcinoma detection system using image processing and the
machine learning method. The features of the affected skin cells are extracted after the segmentation
of the thermoscopic images using the feature extraction technique. A deep learning-based method
convolutional neural network classifier is employed for the stratification of the extracted features.
An accuracy of 80.5% and therefore the training accuracy of 98.7% are achieved after applying the
publicly available data set.
Skin cancer is a clause in which there is an anomalous increase of melanocytes cell in the skin. The
malignant melanoma class of skin cancer is normally caused by the pigment-containing cells known
as melanocytes. Melanoma is found in non-Hispanic white males and females and results in an
approximately 75% death rate. According to a world cancer report, the reason for skin cancer is
ultra violates radiation from the sunlight or from some cosmetic devices such as tanning beds.
Skin cancer can be labelled into three main categories: Melanoma, Squamous cell skin cancer and
Basal cell skin cancer. Melanoma is the most harmful and general type of skin cancer and can
emerge on eyes or mouth where SCC and BCC are less ordinary and do not reach other parts and
are suspected to cause death. Melanoma can be cured by surgical excision if detected early before
it spreads to other organs. When malignant melanoma has spread to other organs, it is hard to treat,
therefore it has the highest mortality rate. It is important to distinguish between benign and
malignant melanoma as early as possible to increase the chance of recovery.
Biopsy by the medical doctor is generally needed to distinguish between benign and malignant
melanoma. However, the development of computational technology, especially machine learning
and computer vision made it possible to classify the disease based on images. According to World
Health Organization, 132,000 melanoma skin cancer cases are diagnosed globally each year.
We focus on detecting skin cancer on certain skin cancer images with the help of the Convolution
Neural Network. We pre-process the data and train the model using CNN and identify the cancerous
cell.
Nowadays, there are many ways to predict skin cancer using different techniques. From the dataset,
we pre-process the image and fed it into CNN. The accuracy of their work using CNN on ROI is
93.50%. Rika Rokhana used proposed network architecture consists of numerous sets of
convolutional layers and max-pooling layers, followed by a drop-out layer and a fully connected
layer. From the tentative results, the best epoch value for the training process is 10, which gives an
accuracy of 84.76%. Ammirreza Mahbod used three pre-trained deep neural networks such as Alex
Net, Res Net-18, and VGG16 for feature extraction. The features are used to train support vector
machines. SVM is trained for each pre-trained model and outputs of SVM are combined to get a
classification result. Khalid M. Hosny used a pre-trained Alex Net and a transfer learning technique.
The accuracy of their proposed method is 80% of original images and 98% for augmented images.
Tasneem Alkarakatly used four performance measures for computing the proposed model and to
compare with the existing model, their results achieved an accuracy of 94%.
The main objectives of this project are:
To develop a prototype of skin cancer detection system for diagnoses melanoma in early
stages.
To implement image processing to make a system that can recognize skin cancer symptoms.
To help patients to prevent the melanoma in early stage.
The figure 1.1 shows labelled images like “benign”, “melanoma", “acne”, “nevus”, “dermatitis”,
“eczema”, “pigmented”, “seborrheic keratosis”, “squamous cell carcinoma”, “vascular lesion” was
used in this system. The images labelled as "other and unknown" were not used because the images
in those groups could not be analysed. Images were put into dataset be dependent upon their analysis
mark which has been removed from the metadata of the images. The dataset has been systematized
into two classes, one containing all the training images and other containing testing images. The
images from real-time dataset of thermoscopic collection have been selected randomly for the
experimental segment.
In our proposed system, there exist three layers. First layer is the input layer where the datasets are
trained on. Input layer gathers data that are delivering and adding some weight with it that goes to
hidden layers. The neurons of hidden layer unconnected the features from the data to find out a
pattern. The pattern is then used as source to output layers that selects to suitable classes. However,
our system is implemented using convolutional neural network are described in the given figure.
CHAPTER 2
LITERATURE SURVEY
Pratik et al [1]. encourage the use of Convolution Neural Networks (CNN) as future scope, since
CNN models can be used for classification of the affected skin images without the need for
performing segmentation and feature extraction independently.
Mobeen et al [2]. have made use of custom-made automated segmentation and have used a novel
approach for implementation of the CNN methodology, where CNN has been used for feature
extraction and ANN was used to classify those extracted features. The advantage of this proposed
system is that CNN does not require any additional classifier like SVM, KNN since 3 fully-
connected layers were used for training the classification model. This type of classification brings
its own unique benefits, like it is possible to apply backpropagation algorithm, which adjusts the
parameters ofneurons in all layers to obtain better classification model
Aya Abu Ali [3] and Hasan Al-Marzouqi [3] have employed transfer learning by using and
modifying the convolution neural network (CNN) architecture in the Light Net pre-trained model
to achieve higher accuracy. They classified the images without applying lesion segmentation or
without using complex image pre-processing techniques. The images were pre-processed and
resized to create uniformity in the sizes of all the images. Each block of the 5 blocks had a
convolution, relu, pooling and a dropout layer except for the last block where the Last block has
fully connected layer and softmax layer. They calculated the error by comparing the predicted
output with the actual output. The advantage of the proposed model presented in this paper is that
it is simpler as it does not use data augmentation and uses lesser no of parameters which is crucial
in mobile applications where constraints on the Size of the network and energy consumption affect
the utility of developed tools. This model attains comparable results with fewer parameters.
However, Improved results can be obtained by usmg better feature extraction techniques like the
ABCD rule and better image pre-processing.
E. Nasr-Esfahani et al [4]. proposed an implementation of a deep learning sy'stem on a computer
server, equipped with graphic processing unit (GPU), is proposed for detection of melanoma
lesions. Clinical (non-dermoscopic) Images are used m the proposed system, which could assist a
dermatologist in early diagnosis of this type of skin cancer. In the proposed system, input clinical
images, which could contain illumination and noise effects, are pre-processed in order to reduce
such artifacts. Afterward, the enhanced images are fed to a pre-trained convolutional neural network
(CNN) which is a member of deep learning models. The CNN classifier, which is trained by large
number of training samples, distinguishes between melanoma and benign cases. Experimental
results show that the proposed method is superior in terms of diagnostic accuracy in comparison
with the state-of-the-art methods. In this paper CNN, as a deep learning framework, is used for
automatic detection of melanoma. CNNs take advantage of a set of powerful convolve-filters. They
can examine various structures in input images. Hence, in utilization of CNN, the Input is the Image
itself and the network automatically extracts appropriate aspects of the image. Usually there should
be a large number of samples for proper training of any CNN However, due to difficulties in
collection and labelling of Images the existing datasets usually have limited number of Images for
detection of melanoma from non-dermoscopic Images.
NavidRazmjooy et al [5]. have proposed a new hybrid algorithm between the artificial neural
network and world cup optimization for enhancing the back-propagation algorithm efficiency and
for escaping from trappmg in the local minima. World cup optimization (WCO) algorithm has been
used to help ANN to find the initial optimal weights in the backpropagation algorithm, to speed up
the convergence speed and to minimize the root mean square error between the actual output and
the target output. In WCO algorithm, the best teams from each group arise to the next level and the
rest are eliminated. They have used the same concept in Back propagation algorithm to search
around the best cost for some epochs and if the search result is better than the best cost, the output
will be the achieved; otherwise, previous output will be selected. The biggest advantage of the
proposed method IS the use of world cup optimization to resolve the drawbacks of back propagation
algorithm
Agung W. Setiawan et al [6]. proposed an effect of color enhancement on early detection of skin
cancer using Convolutional Neural Network. The advantage of CNN is used as classifier in this
study due to this is the common method in Dermoscopy Image Analysis (DIA) since 2015, provide
higher classification accuracy than the dermatologist efficacy. VGG16 is used in this study as CNN
architecture. There are two types of images that are used in this study, the first dataset consists of
the original images or the original dataset. The second dataset consists of the enhanced image from
the first dataset or enhanced dataset. The disadvantage of CNN is there is no other image processing
techniques that are used other than CLAHE and MSRCR. Usmg this approaches, it is expected that
the results of this study can examine the role of image enhancement using CLAHE and MSRCR in
the early detection of skin cancer using CNN
Esther, Amadou et al [7]. has proposition of convolutional neural network-based system for skin
cancer detection. CNN are used to classify skin lesions in two fundamentally different ways. On the
one hand, a network pre-trained on another large dataset, such as ImageNet, can be used as a feature
extractor. In this case, classification is performed by another classifier, such as k-nearest neighbours,
support vector machines, or artificial neural networks. The advantage is a CNN can directly learn
relationship between the raw pixel data and the class labels through end-to-end learning. In contrast
with the classical workflow typically applied in machine learning, feature extraction becomes an
integral part of classification and is no longer considered as a separate, independent processing step.
If the CNN is trained by end-to-end learning, the research can be additionally divided into two
different approaches: learning the model from scratch or transfer learning. The disadvantage of
CNNs is more and more essential in images classification, but their use for medical Images is
difficult because these models require very large training sets (tens of thousands to millions of
images).
A. Pennisi et al [8]. have proposed a method for Melanoma Detection Using Delaunay
Triangulation. First, they have pre-processed the image to remove the hair on skin by morphological
closing and then the image is equalized. The next step is detection of skin by defining boundaries
in the chosen color space. The main advantage of this method is that it does not require a training
phase. The next step involves extracting the contours of the lesion by edge detection using canny
edge detector. The proposed approach is highly accurate when dealing with benign lesions, while
the detection accuracy significantly decreases when melanoma Images are segmented.
Additionally, this algorithm is highly sensitive with respect to images containing irregular borders,
multiple shades of pigmentation, and varying structure and thus, it presents a lesion area that is
smaller than the actual area. This behaviour is the main reason as to why they had to consider
geometrical and color features extracted from the output of the proposed algorithm as input for four
different binary classifiers. However, the disadvantage of the proposed system is that it is not
suitable for diagnostic applications.
Hiam et al. [9] classify images of skin lesion as Normal or Melanoma using S VM in the year 2017.
The steps Involved in this research are Image pre-processmg, segmentation using thresholding,
statistical feature extraction using Gray Level Co-occurrence Matrix (GLCM), feature selection
using Principal component analysis (PCA), and classification using Support Vector Machine
(SVM). They have pre-processed the image by improving the contrast of the image, while noise
filtering was done to remove the hair cover on the skin. The next step was image segmentation
where the ROI (region of interest) was selected. In this step, they performed thresholding, image
filling to remove the background pixels from inside the object, image opening to remove the extra
background pixels, smoothening the contour of the object's boundary and then finally cropping the
image to appropriate size. The next step involved extracting the features of Asymmetry, border
irregularity, Energy, correlation, homogeneity, entropy and mean. PCA was then used to reduce the
number of features to the best 5 features: TDS, mean, standard deviation, energy, and contrast
respectively. Finally, they used kernel S VM with radial basis function to classify the images as
benign and malignant.
Youssef Filali, Hasnae El Khoukhi [10], propose the use of the ABCD rule along with the texture
analysis in the year 2016. Texture analysis is commonly used to classify the lesions in the computer-
aided diagnoses. The texture analysis is an important key to classify the skin cancer as either
malignant or non-malignant. The problem with the texture analysis is that there are many irrelevant
and excessive features that need to be selected. GLCM (gray level co-occurrence matrix), HOG
(histogram of oriented gradients) and LBP (local binary pattern) [3, 4] are examples of texture
features extraction. To solve this problem, in the proposed approach, the texture lesion will be the
inputted into a convolutional neuronal network (CNN) using trainable convolutional layers as the
feature’s extractors. The CNN will learn to utilize the features extractions for classification during
the training process. In this approach, Partial Differential Equations (PDE) decomposition IS used
to reduce the noise that is contained in the lesion Images. Next, In the segmentation step, the Otsu's
algorithm is applied m the pre-processed image. Then, the segmented mages are projected on the
texture. These Images will be inputted into a convolutional
Pratik et al [3]. propose the use of the ABCD rule for extracting features and a backpropagation
neural network to classify the lesions as melanoma or benign in the year 2017 The criteria that
combine to create the ABCD rule of dermoscopy are asymmetry, border, color, and diameter. In
this paper, they have extracted the features based on the ABCD rule after successful segmentation.
As the number of classes increase, it becomes difficult to classify lesions into their appropriate
classes accurately. Neural Networks inherently possess better capability of handling complex
relationships between different parameters. Thus, the proposed model makes use of Back-
propagation neural networks. However, the proposed method as certain drawbacks. The major
drawbacks of this method are slow convergence rates and trapping.
Geoffrey E. Hinton Alex Krizhevsky[11], trained a large, deep convolutional neural network to
classify the 1.2 million high-resolution images in the ImageNet LSVRC-2010 contest into the 1000
different classes. On the test data, we achieved top-1 and top-5 error rates of 37.5% and 17.0%
which is considerably better than the previous state-of-the-art. The neural network, which has 60
million parameters and 650,000 neurons, consists of five convolutional layers, some of which are
followed by max-pooling layers, and three fully-connected layers with a final 1000-way softmax.
To make training faster, we used non-saturating neurons and a very efficient GPU implementation
of the convolution operation. To reduce over fitting in the fully-connected layers we employed a
recently-developed regularization method called “dropout” that proved to be very effective. We also
entered a variant of this model in the ILSVRC-2012 competition and achieved a winning top-5 test
error rate of 15.3%, compared to 26.2% achieved by the second-best entry.
Rogers, H. W. Weinstocks [12] analyses were based primarily on 2 distinct Medicare databases and
on national survey data. The Physician/Supplier Procedure Summary Master File (Total Claims
Data Set) was analyzed for the years 2006 through 2012. For our primary approach to the estimation
of incident NMSC, the Total Claims Data Set was used to provide total numbers of approved fee-
for-service Medicare claims categorized by Current Procedural Terminology (CPT).
The total number of procedures for skin cancer in the Medicare fee-for-service population increased
by 13% from 2 048 517 in 2006 to 2 321 058 in 2012. The age-adjusted skin cancer procedure rate
per 100 000 beneficiaries increased from 6075 in 2006 to 7320 in 2012. The number of procedures
in Medicare beneficiaries specific for NMSC increased by 14% from 1 918 340 in 2006 to 2 191 100
in 2012. The number of persons with at least 1 procedure NMSC increased by 14% (from 1 177 618
to 1 336 800) from 2006 through 2012. In the 2012Medicare fee-for-service population, the age-
adjusted procedure rate for BCC and SCC were 3280 and 3278 per 100 000 beneficiaries,
respectively. The ratio of BCC to SCC treated in Medicare beneficiaries was 1.0. We estimate the
total number of NMSCs in the US population in 2012 at 5 434 193 and the total number of persons in
the United States treated for NMSC at 3 315 554.
Dorj U, Lee K, Choi J, Lee M[13] proposed convolutional neural network However, through the
use of a specific training procedure called transfer learning, powerful CNN models with several
million free parameters can also be employed for classification, even if only a small amount of data
are available for training. In this case, the CNN is pretrained using a very large dataset, such as
ImageNet; it is then used as an initialization of the CNN for the respective task. In particular, the
last fully connected layer of the pretrained CNN model is modified according to the number of
training classes in the actual classification task. There are then two options for the weights of the
pretrained CNN: to fine-tune all layers of the CNN or to freeze some of the front layers because of
overfitting problems and to fine-tune only some back layers of the network. The idea behind this
technique is that that the front layers of a CNN contain more generic features (eg, edge or color-
blob detectors) that are useful for many tasks, but the back layers of the CNN become increasingly
specific to the details of the classes contained in the original dataset.
Pomponiu et al [14] used only 399 images from a standard camera for the classification of
melanomas versus benign nevi. First, data augmentation and preprocessing were performed.
Subsequently, a pretrained AlexNet was applied for the extraction of representational features. The
lesions were then classified with a k-nearest-neighbor classifier using cosine distance metrics. The
algorithm was not tested with an independent test dataset; only a cross-validation was performed.
The algorithm achieved a sensitivity of 92.1%, a specificity of 95.18%, and an accuracy of 93.64%.
In addition to the nonexistent independent test dataset, it is also critical to note that the region of
interest for each skin lesion must be manually annotated.
Esteva et al [15] presented a landmark publication. For the first time, a CNN model was trained
with a large amount of data, specifically 129,450 images, of which 3374 were obtained from
dermatoscopic devices and represented 2032 different skin lesions. Two binary classification
problems were considered: keratinocyte carcinomas versus benign seborrheic keratosis and
malignant melanomas versus benign nevi. The last classification differentiation was performed for
both clinical and dermatoscopic images. The authors used a GoogleNet Inception v3 model for the
classification, which was pretrained with the large image database ImageNet. The CNN model was
then fine-tuned to classify skin lesions using transfer learning. A special property of this approach
is the use of a novel tree-structured disease taxonomy in which the individual diseases form the
leaves of the tree. The inner nodes group together individual diseases that are visually and clinically
similar. The CNN does not have a two-dimensional vector as the output; instead, it reports a
probability distribution with over 757 training classes. To determine the probabilities of a coarser
lesion class (i.e, an inner node at a higher level in the tree), the probabilities of the child nodes of
this coarser lesion class are summed together. The authors show within the evaluation that a CNN
that has been trained for finer classes has a better performance than a CNN that has been trained for
the distinct classes that are of interest for the problem. The trained CNN was tested with test data
that were fully biopsy-proofed and achieved an ROC AUC of .96 for carcinomas, an ROC AUC of
.96 for melanomas, and an ROC AUC of 94 for melanomas classified exclusively with
dermatoscopic images.
In Nasr-Esfahani et al [16], a two-layer CNN was trained from scratch for the distinction of
melanoma versus benign nevi based on clinical images. Only 136 images were used to train the
model and the test dataset contained only 34 images. The images were all from the public image
archive of the Department of Dermatology of the University Medical Center Groningen. The
method achieved a sensitivity of 81%, a specificity of 80%, and an accuracy of 81%. However, the
result should be viewed critically because the test dataset was very limited.
Abbas, Q. Garcia, I [17] Malignant melanoma and basal cell carcinoma are common skin tumours.
For skin lesion classification it is necessary to determine and calculate different attributes such as
exact location, size, shape and appearance. It has been noted that illumination, dermoscopic gel and
features such as blood vessels, hair and skin lines can affect border detection. Thus, there is a need
for approaches that minimise the effect of such features. This study aims to detect multiple borders
from dermoscopy with increased sensitivity and specificity for the detection of early melanoma and
other pigment lesions. An automated border detection method based on minimising geodesic active
contour energy and incorporating homomorphic, median and anisotropic diffusion (AD) filtering,
as well as top-hat watershed transformation is used. Extensive experiments on various skin lesions
were conducted on real dermoscopic images and proved to enhance accurate border detection and
improve the segmentation result by reducing the error rate from 12.42% to 7.23%. The results have
validated the integrated enhancement of numerous lesion border detections with the noise removal
algorithm which may contribute to skin cancer classification.
Gutman D, Codella NCF [18] In this article, we describe the design and implementation of a
publicly accessible dermatology image analysis benchmark challenge. The goal of the challenge is
to sup- port research and development of algorithms for automated diagnosis of melanoma, a lethal
form of skin cancer, from dermoscopic images. The challenge was divided into sub-challenges for
each task involved in image analysis, including lesion segmentation, dermoscopic feature detection
within a lesion, and classification of melanoma. Training data included 900 images. A separate test
dataset of 379 images was provided to measure resultant performance of systems developed with
the training data. Ground truth for both training and test sets was generated by a panel of
dermoscopic experts. In total, there were 79 submissions from a group of 38 participants, making
this the largest standardized and comparative study for melanoma diagnosis in dermoscopic images
to date. While the official challenge duration and ranking of participants has concluded, the datasets
remain available for further research and development.
Oliveira RB, Papa JP, Pereira AS, Tavares JMRS [19]. Melanoma cases have caused an increasing
number of deaths worldwide, since this type of skin cancer is the most aggressive compared to other
types. Computational methods have been developed to assist dermatologists in early diagnosis of
skin cancer. An overview of the main and current computational methods that have been proposed
for pattern analysis and pigmented skin lesion classification is addressed in this review. They
succeeded by achieving 94% accuracy.
Han SS, Kim MS, Lim W, Park GM, Park I, Chang SE. [20] We tested the use of a deep learning
algorithm to classify the clinical images of 12 skin diseases-basal cell carcinoma, squamous cell
carcinoma, intraepithelial carcinoma, actinic keratosis, seborrheic keratosis, malignant melanoma,
melanocytic nevus, lentigo, pyogenic granuloma, hemangioma, dermatofibroma, and wart. The
convolutional neural network (Microsoft ResNet-152 model; Microsoft Research Asia, Beijing,
China) was fine- tuned with images from the training portion of the Asan dataset, MED-NODE
dataset, and atlas site images (19,398 images in total). The trained model was validated with the
testing portion of the Asan, Hallym and Edinburgh datasets. With the Asan dataset, the area under
the curve for the diagnosis of basal cell carcinoma, squamous cell carcinoma, intraepithelial
carcinoma, and melanoma was 0.96 ± 0.01, 0.83 ± 0.01, 0.82 ± 0.02, and 0.96 ± 0.00, respectively.
With the Edinburgh dataset, the area under the curve for the corresponding diseases was 0.90 ±
0.01, 0.91 ± 0.01, 0.83 ± 0.01, and 0.88 ± 0.01, respectively. With the Hallym dataset, the
sensitivity for basal cell carcinoma diagnosis was 87.1% ± 6.0%. The tested algorithm performance
with 480 Asan and Edinburgh images was comparable to that of 16 dermatologists. To improve the
performance of convolutional neural network, additional images with a broader range of ages and
ethnicities should be collected.
Dr. Sonali Patil [21] In this study, we have presented a methodological approach to classify various
skin lesions into their respective category with the help of Neural Networks. Neural Networks
provide a sophisticated way to classify complex data with a high degree of accuracy. We have
classified 463 images into their respective categories, with an overall accuracy rate of 76.9%, this
error, the network may overfit and the performance of the network on previously unseen images
will degrade. The overall accuracy rate and performance of the system can be improved by training
the neural network on a much larger and diverse dataset with high intra-class variability. This would
decrease the misclassification and positively impact the accuracy rate. An alternative to diversifying
the dataset is increasing the number of features extracted from the images.
R. Kasmi and K. Mokrani[22]. They proposed ABCD (asymmetry, border irregularity, colour and
dermoscopic structure) rule of dermoscopy is a scoring method used by dermatologists to quantify
dermoscopy findings and effectively separate melanoma from benign lesions. Automatic detection
of the ABCD features and separation of benign lesions from melanoma could enable earlier
detection of melanoma. In this study, automatic ABCD scoring of dermoscopy lesions is
implemented. Pre-processing enables automatic detection of hair using Gabor filters and lesion
boundaries using geodesic active contours. Algorithms are implemented to extract the
characteristics of ABCD attributes. Methods used here combine existing methods with novel
methods to detect colour asymmetry and dermoscopic structures. To classify lesions as melanoma
or benign nevus, the total dermoscopy score is calculated. The experimental results, using 200
dermoscopic images, where 80 are malignant melanomas and 120 benign lesions, show that the
algorithm achieves 91.25% sensitivity of 91.25 and 95.83% specificity. This is comparable to the
92.8% sensitivity and 90.3% specificity reported for human implementation of the ABCD rule. The
experimental results show that the extracted features can be used to build a promising classifier for
melanoma detection.The algorithm reaches an overall accuracy of 94.0%, achieving sensitivity and
a specificity of 91.25% and 95.83, respectively, as shown in Table 4. Nachbar et al. [5], with a
manual implementation of the ABCD rule, reported a sensitivity and a specificity of 92.80 and
90.30%, respectively. The results show that the extracted features are useful for a computer-assisted
melanoma identification tool. However, the approach misclassified 12 lesions: seven melanomas
and five benign cases.
CHAPTER 3
SYSTEM REQUIREMENT SPECIFICATION
Jupyter notebooks are great for doing machine learning development work. In order to get
Jupyter notebook to work the way we want with this new TensorFlow environment we will
need to add a "kernel" for it.
With our environment activated do, conda install ipykernel
Now create the Jupyter kernel, using the command: “python -m ipykernel install –user –
name variable_name –display-name “TensorFlow-GPU”
Now we can open jupyter notebook with activated virtual environment in anaconda terminal
just by typing the command: “jupyter notebook”.
Throughout this entire process, the networks building blocks like the weights and the feature maps,
are trained and repeatedly altered in order for the network to reach the optimal performance that
will make it able to classify mages and object as accurately' as possible.
3.2.2 Non-Functional Requirements:
Non-functional requirements describe how a system must behave and establish constraints of
its functionality. This type of requirements is also known as the system’s quality attributes.
Attributes such as performance, security, usability, compatibility are not the feature of the system,
they are a required characteristic. They are "developing" properties that emerge from the whole
arrangement and hence it can't compose a particular line of code to execute them. Any attributes
required by the customer are described by the specification.
Reliability: The system will perform skin cancer detection within a specified period of time
without any failures in all desired environments.
Security: The system will be guaranteed with authentication by providing user ID and
password.
Maintainability: The system will adapt to any changes in the medical field, bugs will be
discovered and fixed and new ways will be identified to increase the quality of the system.
Performance: The system will be verified with various calculations, numerical data, graphs
or tabular data.
Portability: The system can be migrated or upgraded to nay higher level and configuration.
If any issues arise, we can handle it.
Scalability: The system will be able to increase the accuracy even when large inputs of data
and resources will be added.
Flexibility: The system is quite flexible as it has the ability to increase the performance and
also absorb to new changes in the medical science fields. The project will be tested with all
the possible Inputs.
CHAPTER 4
SYSTEM DESIGN AND MODELING
4.1 Preliminary Design
Preliminary design means documents, including drawings, which serves as the basis for plans
and specifications for the final design and construction constraints for each of the module.
Preliminary design also means the part of the development phase where all of the geometric design
elements, including a preliminary estimate of the preferred design solution are documented for input
to the detailed design stage. This stage is also known as conceptual design whose main purpose is
to create a design that would really and truly implement the requirements.
This approach, skin cancer detection using machine learning involves few major steps
throughout the process.
They are:
a. Data Pre-Processing
b. Implementing OR Building DCNN models
c. Training the models
d. Testing the models
e. Saving the models
The standard image data set is considered having various labelled images of different classes are
fed for the process called pre-processing. In this pre-processing, the image data set is divided into
training and validation dataset. Then the image data set is trained, validated with various DCNN
models.
The Dataflow diagram explains about the process in the skin cancer detection project. Firstly, we
collect the skin cancer images from the ISIC dataset and few hospitals dataset which is needed for
the prediction. ISIC is known as International Skin Imaging Collaboration. We initialize all the
Images and all the parameters that are needed for the system. We take the skin cancer images
fromthe ISIC dataset and few hospitals dataset and do image processing.
We train the image data using Convolutional Neural Network and save the trained model for the
prediction of the cancerous cell.
Real-time
dataset
A flow chart is a type of diagram that represents a work flow or process. A flow chart can also
be defining as a diagrammatic representation of an algorithm, a step-by-step approach to solve a
task. The flow chart shows the step as boxes of various kinds, and their order by connecting the
boxes with arrows. This diagrammatic representation illustrates a solution model to a given
problem. Flow charts are used in analysing, designing, documenting or managing a process or
program in various fields. A flow chart is a formalized graphical representation of a logic sequence,
work or manufacturing process, organization chart, or similar formalized structure. The purpose of
a flow chart is to provide people with a common language or reference point when dealing with a
project or process. Flowchart breaks a problem up into easily definable parts. The defined process
displayed by the flowchart demonstrates the method of solving a complex problem.
Figure 4.2 depicts flow chart of skin cancer detection system. In this process, the image dataset
is uploaded with labels. Then the dataset is split into training and validation dataset. The DCNN
models are designed and the divided dataset is trained and validated by the models. After training
the model is saved and evaluated for validation accuracy and loss. Then the model is tested with
new input data.
A use case is a diagram showing the various user roles and the way those users interact with
the system and at its simplest it is a representation of a user's interaction with the system that shows
the relationship between the user and the different use cases in which the user is involved. A use
case is a methodology used in system analysis to identify, clarify and organize system requirements.
In this context, the term system refers to something being developed or operated. Use case diagrams
are employed in UML, a standard notation for the modelling of real-world objects and systems. It
can identify the different types of users of a system and the different use cases and will often be
accompanied by other types of diagrams as well. It is represented by either circles or ellipses. The
boundary, which defines the system of interest in relation to the world around it. The actors, usually
individuals involved with the system defined according to their roles. The use cases, which the
specific roles are played by the actors within and around the system. The relationships between and
among the actors and the use cases. The use case diagram looks something like a flowchart. Intuitive
symbols represent the system elements. The use case diagrams serve as a kind of table of contents
for the data activates that must be supported by the system. It is used to identify the uses or use
cases, of the new system-in other words, to identify how the system will be used and which actors
will be involved in which use cases. A use case diagram is a convenient way to document the system
events. Sometimes a single, comprehensive diagram is used to identify all use cases for an entire
system. At other times, a set of narrower use case diagrams is used.
The Figure 4.3 shows how a use case is documented in a use case diagram. A simple stick figure
is used to represent an actor. The stick figure is given a name that characterizes the role the actor is
playing. The use case itself is symbolized by an oval with the name of the use case inside. The
connecting lines between actors and use cases indicate which actors utilize which use cases.
Although hands are not part of the standard UML notation, the actor in this figure 4.3 is drawn with
hands are to help you remember that this actor must have direct access to the automated system.
A use case diagram as its simplest is a representation of a user's Interaction with the system that
shows the relationship between the user and the different use cases in which the user is involved.
CHAPTER 5
SYSTEM IMPLEMENTATION
5.1 Python Introduction
Python is an easy to learn, powerful programming language. It has efficient high level data
structures and a simple but effective approach to object-oriented programming. Python’s elegant
syntax and dynamic typing, together with its interpreted nature, make it an ideal language for
scripting and rapid application development in many areas on most platforms. Python is a high-
level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly
readable. It uses English keywords frequently where as other languages use punctuation, and it has
fewer syntactical constructions than other languages.
5.1.1 Features
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly. • Easy-to-read − Python code is
more clearly defined and visible to the eyes. • Easy-to-maintain − Python's source code is
fairly easy - to - maintain.
A broad standard library − Python's bulk of the library is very portable and cross platform
compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.
Extendable − you can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient. • Databases −
Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs than shell
scripting.
There’s battle out there happening in the minds of aspiring data scientists to choose the best data
science tool. Though there are quite a number of data science tools that provide the much-needed
option, the close combat narrows down between two popular languages – Python and R.
Between the two, Python is emerging as the popular language used more in data science
applications.
There are tailor-made situations where it is the best data science tool for the job. It is perfect when
data analysis tasks involve integration with web apps or when there is a need to incorporate
statistical code into the production database. The full-fledged programming nature of Python makes
it a perfect fit for implementing algorithms.
Its packages rooted for specific data science jobs. Packages like Numpy, SciPy, and pandas produce
good results for data analysis jobs. While there is a need for graphics, Python’s matplotlib emerges
as a good package, and for machine learning tasks, scikitlearn becomes the ideal alternate.
It is Pythonic when the code is written in a fluent and natural style. Apart from that, it is also known
for other features that have captured the imaginations of data science community.
Easy to learn
The most alluring factor of Python is that anyone aspiring to learn this language can learn
it easily and quickly. When compared to other data science languages like R, Python
promotes a shorter learning curve and scores over others by promoting an easy-to-
understand syntax.
Scalability
When compared to other languages like R, Python has established a lead by emerging as a
scalable language, and it is faster than other languages like Matlab and Stata. Python’s
scalability lies in the flexibility that it gives to solve problems, as in the case of YouTube
that migrated to Python.
If you’re going to write programs, there are literally dozens of commonly used languages to choose
from. Why choose Python? Here are some of the features that make Python an appealing choice.
Python is Popular
Python has been growing in popularity over the last few years. The 2018 Stack Overflow Developer
Survey ranked Python as the 7th most popular and the number one most wanted technology of the
year. World-class software development countries around the globe use Python every single day.
Due to the popularity and widespread use of Python as a programming language, Python developers
are sought after and paid well. Many languages are compiled, meaning the source code you create
needs to be translated into machine code, the language of your computer’s processor, before it can
be run. Programs written in an interpreted language are passed straight to an interpreter that runs
them directly.
Python is Free
The Python interpreter is developed under an OSI-approved open-source license, making it free to
install, use, and distribute, even for commercial purposes. A version of the interpreter is available
for virtually any platform there is, including all flavors of UNIX, Windows, macOS, smartphones
and tablets, and probably anything else you ever heard of. A version even exists for the half dozen
people remaining who use OS/2.
Python is Portable
Because Python code is interpreted and not compiled into native machine instructions, code written
for one platform will work on any other platform that has the Python interpreter installed. (This is
true of any interpreted language, not just Python.)
Python is Simple
Python code has a simple and clean structure that is easy to learn and easy to read. In fact, as you
will see, the language definition enforces code structure that is easy to read. But It’s Not That
Simple, For all its syntactical simplicity, Python supports most constructs that would be expected
in a very high-level language, including complex dynamic data types, structured and functional
programming, and object-oriented programming. Additionally, a very extensive library of classes
and functions is available that provides capability well beyond what is built into the language, such
as database manipulation or GUI programming. Python accomplishes what many programming
languages don’t: the language itself is simply designed, but it is very versatile in terms of what you
can accomplish with it.
When it comes to data science, machine learning is one of the significant elements used to maximize
value from data. With Python as the data science tool, exploring the basics of machine learning
becomes easy and effective. In a nutshell, machine learning is more about statistics, mathematical
optimization, and probability. It has become the most preferred machine learning tool in the way it
allows aspirants to ‘do math’ easily.
For example, as we see figure 5.1 which implies A diagrammatic view of deep learning
technique, the first hidden layer could learn how to detect edges, and the last learns how to
detect more complex shapes specifically catered to the shape of the object we are trying to
recognize.
Deep Learning represents a class of ML algorithms that use a cascade of multiple layers of
nonlinear processing units. The first layer receives the input data, and each successive layer
uses the output from the previous layer as input.
DL architectures are able to solve complicated AI tasks (e.g., in computer vision, language,
biomedicine, etc.) by learning high-level abstractions from raw data.
A cascade of multiple layers of nonlinear processing units, where each processing unit
receives input from the previous layer, is called a Fully Connected Neural Network
(FCNN).
In a typical FCNN, layer i computes an output vector zi using the following equation:
zi =f(bi+Wizi−1) (5.1)
where bi (biases) and Wi (weights) are the parameters for the ith layer, zi−1 is the output
vector of the previous layer, and z0 is the input data.
The activation function f can be a Rectified Linear Unit (ReLU), as follows:
f (c) =max (0, c) (5.2)
or some other nonlinear function, for example, sigmoid or tanh.
For classification problems, the final output layer (zi) usually uses a softmax activation
function, as follows:
Zij = ebi j +Wi j z i −1 ∑ j e bi j +Wi j z i −1 (5.3)
where j represents the jth row of the weights Wi.
The softmax function has a nice property, as follows:
∑ j ZIj =1 (5.4)
and it is always positive; thus, it can be used as an estimator for an input data sample x to
belong to the jth class for a specific problem, as follows:
P(y=j|x) (5.5)
The parameters of the network (bi and Wi) are learned using an optimization algorithm, for
example, gradient descent.
When doing multi-class classification, categorical cross entropy loss is used a lot. It
compares the predicted label and true label and calculates the loss. In Keras with
TensorFlow backend support Categorical Cross-entropy, and a variant of it: Sparse
Categorical Cross-entropy.
CNNs are a type of NN that are designed with three main architectural ideas to ensure some
degree of shift, scale, and distortion in variance. This is achieved by utilizing the following:
local receptive fields, i.e., each unit in a layer receives input from a set of neighbouring
units in the previous layers.
shared weights (units in a layer are organized in groups and all units in one group share the
same set of weights); the set of outputs of the units in one group is called a feature map,
and the set of connection weights used by the units to create the feature map is called a
kernel or filter.
spatial or temporal sampling, where, if the input is shifted, the feature map output will also
be shifted.
To reduce the internal covariance shift, each CNN layer is followed by a batch
normalization layer.
To speed up the training process, ReLU activation layers are used.
For the dimensionality reduction, each residual block ends up with a maximum pooling
layer.
Optimization is an important process which optimize the input weights by comparing the
prediction and the loss function, so an optimizer must be used.
An optimizer is one of the two arguments required for compiling a Keras model: We can
either instantiate an optimizer before passing it to model.compile() or you can call it by its
name during the training period.
Stochastic gradient descent (often abbreviated SGD) is an iterative method for optimizing
an objective function with suitable smoothness properties (e.g. differentiable or
subdifferentiable).
It can be regarded as a stochastic approximation of gradient descent optimization, since it
replaces the actual gradient (calculated from the entire data set) by an estimate thereof
(calculated from a randomly selected subset of the data). Especially in big data applications
this reduces the computational burden, achieving faster iterations in trade for a slightly
lower convergence rate.
While the basic idea behind stochastic approximation can be traced back to the Robbins–
Monro algorithm of the 1950s, stochastic gradient descent has become an important
optimization method in machine learning.
Adam is a popular algorithm in the field of deep learning because it achieves good results
fast.
Adam realizes the benefits of both AdaGrad and RMSProp. • The strides parameter is a 2-
tuple of integers, specifying the “step” of the convolution along the x and y axis of the input
volume.
Padding is a term relevant to convolutional neural networks as it refers to the number of
pixels added to an image when it is being processed by the kernel of a CNN.
For example, if the padding in a CNN is set to zero, then every pixel value that is added
will be of value zero. If, however, the zero padding is set to one, there will be a one-pixel
border added to the image with a pixel value of zero.
The compilation is the final step in creating a model. After creating the model and compiled
it has to be trained and the validated model must be saved to use in future.
5.3 Methodology
The Melanoma images are obtained from the ISIC dataset and hospital dataset. We have ten
categories of skin cancer images. We perform data pre-processing and split the images as training
images and testing images. The training set and the testing set consists of some images among the
ten categories. We perform an autoencoder process to remove the unwanted elements in the image
like hairs in the skin. To categorize the melanoma images, we anticipated applying a deep
convolutional neural network (CNN) method. CNN is the progress of neural network algorithm
which is used for image classification. In the feed-forward process, the system tries to forecast the
category of the input image by using the multiplication process through numerous filters or kernels
whose first values are set as arbitrary values. The forecast result is then compared among the real
class to compute the error value of the network. This feed-forward and back-propagation process is
repeatedly done until the end of the epoch iteration or until the error value is changed. Once the
epoch iteration is done, we get the accuracy value and loss value for training and testing.
STEPS IN METHODOLOGY:
In this section, we describe the following steps and the flowchart of our methodology shown in
Figure 5.2. DCNN and transfer learning models are used for the classification task between 10
classes. Some extra layers are used in our proposed DCNN model. additionally, we use some
transfer learning models like ResNet, VGG-16 on this same dataset for the performance comparison.
where X is a fixed number (say 80%), the model is then iteratively trained and validated on these
different sets. So, we will follow the same method to prepare data for training and testing phase.
We are building our model by using Convolutional neural network. Convolutional neural networks
(CNN) are a special architecture of artificial neural networks, proposed by Yann LeCun in 1988.
CNN uses some features of the visual cortex. Now that we’re done pre-processing, we can start
implementing our neural network. We’re going to have 3 convolution layers with 2 x 2 max-pooling.
Max-pooling: A technique used to reduce the dimensions of an image by taking the
maximum pixel value of a grid. This also helps reduce over fitting and makes the model
more generic. After that, we add 2 fully connected layers. Since the input of fully
connected layers should be two dimensional, and the output of convolution layer is four
dimensional, we need a flattening layer between them. At the very end of the fully
connected layers is a softmax layer.
Phase4 – The fourth phase is to training the model. After model construction it is time for model
training. We were able to build an artificial convolutional neural network that can recognize images.
Split the dataset into train and test dataset. Finally, we will build and train the model using training
dataset.
Phase5 – The fifth phase is model testing and evaluation. Once the model has been trained it is
possible to carry out model testing. During this phase a test set of data is loaded. This data set has
never been seen by the model and therefore its true accuracy will be verified. Finally, the saved
model can be used in the real world. The name of this phase is model evaluation. This means that
the model can be used to evaluate new data.
5.4 Implementation
5.4.1 Dataset.
Our dataset is the collection of different types of skin cancer images from real-time hospital data
and the ISIC dataset. It is better to use a large amount of data to provide a good result. The images
in the dataset are dermoscopy images.
Table 5.1: Categories and no. of images in dataset
The table 5.1 shows the category names and number of images in the dataset. So, the total number
of images for training set are 1355 and the total number of images for images are 309.
5.4.2 Data pre-processing.
Data pre-processing is the first step in preparing the data for building the model. The main objectives
of pre-processing are to augment the original image by removing the air bubble's noise. The input
feature dimension is 60X60X3. There are three channels of images; the three channels are RGB.
The data set contains images that are extremely huge in width and height. The width of the images
is 1022 and the height of the images is 767 which is enormously large to process and considerably
more time-consuming and wastage of memory. We need to resize the image, so we can process the
image with less memory. The pre-processed images are saved along with their classes. From the
dataset, we have discarded the images which do not come under the ten categories and the saved
images are fed into the CNN.
Algorithm:
1. Importing necessary libraries
2. Allocating the data directories to the named variable.
3. Taking 80% of images for training and 20% of images for testing the data from the dataset.
4. Listing the categories.
5. Listing the total images used for training and testing.
6. Based on the above step specify no. of train samples, no. of test samples, no. of classes, and
image rows, columns and channels i.e., 64x64x3.
7. Create train and valid function using load_training_data() and load_validation_data().
8. Load the training images and validation images.
8.1. It will take the directory train_data_dir that has all the labels.
8.2. The labels will be storing into one variable name called labels then print labels.
9. Create empty array of X_train and Y_train for training images and X_test and Y_test for
validation images.
10. Create training and validation images
11. For label in labels:
11.1. each iteration will go to train directory, label (i.e., train_data_dir = foldername/train
and test_data_dir = foldername/test)
11.2. check the length of the image name and then print total numbers.
12. Create nested for loop for training images – for image-name in image_names_train:
12.1. each iteration will go to train directory, label i.e., train_data_dir = foldername/train
12.2. it will read the colored image then it will store into one variable name called img.
12.3. resize the image and store that images into variable named X_train[i].
13. Create nested for loop for training images – for image-name in image_names_test:
13.1. each iteration will go to train directory, label i.e., train_data_dir = foldername/test
13.2. it will read the colored image then it will store into one variable name called img.
13.3. resize the image and store that images into variable named X_test[i].
14. Print training data and validation data.
15. Normalize the data.
Data pre-processing to build pure CNN model:
While using above given algorithm for pre-process the data, the accuracy is getting very low. So to
avoid that, that means to increase the accuracy we have used another algorithm for pre-process the
data to get a better accuracy.
Algorithm:
1. Importing necessary libraries.
2. Allocating the data directories to the named variable.
3. Taking 80% of images for training and 20% of images for testing the data from the dataset.
4. Listing the categories.
5. Listing the total images used for training and testing.
6. Based on the above step specify no. of train samples, no. of test samples, no. of classes, and
image rows, columns and channels i.e., 64x64x3.
7. Pre-process the train data.
7.1. Create empty array of X_train and Y_train for training images.
7.2. list the directories of the training images.
7.3. check the length of the image name and then print total numbers.
7.4. Create nested for loop for training images
7.4.1. Specify the path of the training images by setting target size.
7.4.2. resize the image and store that images into variable named X_train[j].
7.4.3. Print training data.
8. Pre-process the train data.
8.1. Create empty array of X_test and Y_test for training images.
8.2. list the directories of the testing images.
8.3. check the length of the image name and then print total numbers.
8.4. Create nested for loop for testing images
8.4.1. Specify the path of the testing images by setting target size.
8.4.2. resize the image and store that images into variable named X_test[j].
8.4.3. Print testing data.
9. Reshape the train and test arrays.
10. Plot the image.
5.4.3 Feeding the pre-processed data into a Convolutional neural network for
classification.
CNN has an input layer, an output layer, and hidden layers. The hidden layers have three functional
layer convolutional layers, ReLU layers, pooling layers, and fully connected layers. Convolutional
layers apply a convolution process to the input dermoscopy images. This gives the information to
the next layer. Pooling combines the outputs of clusters of neurons into a distinct neuron in the next
layer. Fully connected layers bond each neuron in one layer to each neuron in the next layer. In a
convolutional layer, neurons just obtain input from a subarea of the preceding layer. In a fully
connected layer, every neuron obtains input from every element of the preceding layer A CNN
mechanism is extracting features from the input images. This eliminates the manual feature
extraction. The extracted features are not trained. They are learned when the network trains on a set
of input images. CNN learns feature detection through many hidden layers. Each layer increases the
complication of the learned features. Compared to other classification algorithms, CNN uses
incredibly modest preprocessing. CNN can be used in plenty of applications from image and video
detection, image classification, and medical image analysis. CNN is encouraged by biological
processes. A CNN begins with an input image, applies several unusual filters to generate a
characteristic map, applies a ReLU function to augment non-linearity, applies a pooling layer to
every characteristic map flattens the pooled dermoscopy images into one long vector. It also inputs
the vector into a fully connected artificial neural network. It processes the features through the
network. The ultimate fully connected layer provides the classes and trains during forwarding
propagation and backpropagation for various epochs. This will repeat until we have a distinct neural
network with trained weights and feature detectors.
So, firstly we have built the DCNN model using Encoders and Decoders
Algorithm:
1. Split the dataset into train and test
2. Import the necessary libraries
3. Set the shape of the input image
4. Define an encoder function
4.1 Add first 2D- convolutional layer
4.1.1. Set input shape
4.1.2. Set number of filters
13. Place all the auto encoded images in the out model
14. Create the CNN model
15. Design the DCNN
15.1. VGG16
15.2. VGG19
15.3. Resnet 50
16. Compile the model
16.1. set the loss
16.2. set the optimizer
6.3. set the metrics for accuracy
17. Summarize the designed deep convolutional neural network
18. Set weights for the classes
19. Check for the weights before training the model
20. Train and validate model with encoded images
20.1. set the train image path
20.2. set the test image path
20.3. set the train batch size
20.4. set the epoch size
21. Save the model
22. Evaluate the last epoch
23. Load weights from the saved model
Now, building the model using pure Deep convolution neural network:
Algorithm:
1. Define model type (Sequential).
2. Add first 2D- convolutional layer.
2.1. set input shape.
2.2. set no. of filters.
2.3. set the activation function.
2.4. set padding
2.5. set kernel size.
3. Add max pooling layer.
3.1. set pool kernel size
4. Add dropout function.
The pooling layer (MaxPooling2D): is used to decrease the size of input images for faster
training.
Batch size (100): the number of processed images in every iteration.
Initial learning rate (0.001): it will set up with which rate will begin the learning procedure.
Optimizer (Adam): Adam is a replacement optimization algorithm for stochastic gradient
descent in order to minimize the loss function for training models.
Loss function (binary cross-entropy): sets up a binary classification problem from the
dataset.
Number of epochs (100): the no. of times the using dataset is delivered to the DNN.
In our case, we divided the dataset into three categories such as training, validation, and testing in
order to fine-tuning and evaluate the proposed DCNN model. The dataset is categorized into two
ways like 70% as the training, 20% as the validation, with 10% as the testing set, and 80% as the
training, 10% as the validation, with 10% as the testing set for the better comparison between
transfer learning models and our proposed DCNN model.
The model was implemented in jupyter notebook (8 GB RAM) on a system with AMD A9-9425
RADEON R5, COMPUTE CORES 2C+3G processor, 4 GB of RAM. In this field, the performance
of each and every model is getting compared with the current neural network based on Accuracy,
Precision, Recall, F-measure, and execution time. additionally, we have shown the confusion matrix
in Fig. 3 which is a table of recommended output for measuring the model performances. There are
four significant terms in the confusion matrix:
True Positives (TP): The occurrence was negative and predicted negative
True Negatives (TN): the occurrence was positive and predicted positive
False Positives (FP): the occurrence was negative but predicted positive
False Negatives (FN): the occurrence was positive but predicted negative
Precision: It is known as the no. of right positive result values partitioned by the number of positive
outcomes predicted by the classifier.
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = 𝑇 𝑃 / 𝑇 𝑃 + 𝐹 𝑃 (5.7)
Recall: It is the quantity of correct certain outcomes divided by the no. of every conjugate sample
(all samples that ought to have been identified as sure).
𝑅𝑒𝑐𝑎𝑙𝑙 = 𝑇 𝑃 /𝑇 𝑃 + 𝐹 𝑁 (5.8)
F1-score: It is also called a weighted harmonic mean that measures to seek a balance between
precision and recall. It takes both false positive values and false negative values for the calculation
and performs well on an unfair dataset.
𝐹1 − 𝑠𝑐𝑜𝑟𝑒 = 2𝑇 𝑃 /2𝑇 𝑃 + 𝐹 𝑃 + 𝐹 𝑁 (5.9)
Accuracy: It is the ratio of no. of correct predictions to the total no. of input samples.
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = 𝑇 𝑃 + 𝑇 𝑁/ 𝑇 𝑃 + 𝑇 𝑁 + 𝐹 𝑃 + 𝐹 𝑁 (5.10)
DCNN Training:
Algorithm:
1. Import necessary modules
2. Specify the path of the preprocessed images.
3. Compile the model.
3.1. set the loss.
3.2. set the optimizer.
3.3. set the metric(accuracy).
4. Summarize the designed DCNN.
5. Train and validate the model with preprocessed images.
5.1. set the train images path
5.2. set train batch size
5.3. set the validation images path
5.4. set epoch size
5.5. set batch size
6. Predict the model.
6.1. set batch size
6.2. set verbose
7. Use the model to make prediction for actual and predicted values.
8. Define confusion matrix.
8.1. set title
8.2. set color map
B. VGG 16
The VGG16 network was developed by the visual geometry group from where its name was
invented and was the winner at ILSVRC (ImageNet Large-Scale Visual Recognition Competition)
2014 localization task and 2nd best in the classification task. It is a very deep, 16- convolutional-
layer network with an unchanging architecture. The model was initially trained on millions of
images in a data store called ImageNet. It uses only 3x3 same convolutions with an increasing no.
of filters. The architecture contains 5 convolutional blocks (a total of 13 convolutional layers) and
a fully connected classifier (a total of 3 fully connected layers). Pooling layers are not calculated as
formal layers as they do not have trainable parameters or weight matrices. We instantiated the pre-
trained VGGNet from the 1st convolutional block up to the last and loaded its weights. We then
pre-calculated the bottleneck features since that is where most of the computation time is. Once we
pre-computed them, the activation maps were benefited to train a small fully connected model on
top of the bottleneck features. Rectifier linear unit.
Structure:
VGG16 has 16 layers as shown in figure 5.4: 13 convolution layers, 3 fully connected layers.
The input to VGG16 is RGB image of size 224×224.
The first Convolution Layer of VGG16 contains 64 kernels that outputs the graph size of
222*222.
The second convolution layer has 64 kernels that outputs the graph size of 220*220 which
is then passed on to the maxpooling that maps 64 features and outputs graph size of 110*110.
The third convolution layer outputs 108* 108 graph that has 128 kernels.
The fourth convolution layer has 128 kernels that maps 106* 106 graph.
Then the maxpooling layer maps 128 features and outputs graph size of 53*53.
The fifth, sixth and seventh convolution layers has 256 features that maps graph size of
51*51, 49*49, 47*47 respectively.
There is a maxpooling layer after the seventh convolution layer that has 23*23*256 feature
maps.
The eighth, nineth and tenth convolution layers has 512 features that maps graph size of
21*21, 19*19, 17*17 respectively. There is a maxpooling layer after the tenth convolution
layer that has 8*8*512 feature maps.
The eleventh, twelfth and thirteeth convolution layers has 512 features that maps graph size
of 6*6, 4*4, 2*2 respectively. Then there is a maxpooling layer after the thirteenth
convolution layer that has 1*1*512 feature maps.
Last 3 are fully connected layers where the first two dense layers have 5096 neurons each
and the third dense layer is output layer. it contains 138357544 trainable parameters 0 Non
trainable parameters.
Algorithm:
1. Import vgg16 model using keras
2. Pre-train the weights on imagenet
3. Summarize the vgg16 model
4. Split the tarin and validation dataset
5. Load vgg16 model
6. Flatten the output of the convolutional part
7. Set three dense layers (hidden layers)
8. Set the final softmax layer with 10 categories
9. Create the full model
10. Summarize the full model
11. For each layer in conv_model.layers
11.1 Set the trainable layers as false
12. Summarize the full model
13. Compile the vgg16 model
13.1 Set the loss
13.2 Set the optimizer
13.3 Set the metrics (accuracy)
14. Train the model
18.1 Set workers
18.2 Set the epoch size
15. Plot training and validation accuracy
16. Plot training and validation loss
C. VGG 19
VGG19 is different from the VGG model which in brief contains 19 layers that are 16
convolution layers, 3 fully connected layers, 5 Max Pool layers, and 1 SoftMax layer.
Structure:
VGG19 has 19 layers as shown in Figure 5.5: 16 convolution layers, 3 fully connected
layers.
The input to VGG19 is RGB image of size 224×224.
The first Convolution Layer of VGG19 contains 64 kernels that outputs the graph size of
222*222.
The second convolution layer has 64 kernels that outputs the graph size of 220*220 which
is then passed on to the max-pooling that maps 64 features and outputs graph size of
110*110.
The third convolution layer outputs 108* 108 graph that has 128 kernels.
The fourth convolution layer has 128 kernels that maps 106* 106 graph. Then the max-
pooling layer maps 128 features and outputs graph size of 53*53.
The fifth, sixth, seventh and eighth convolution layers has 256 features that maps graph size
of 51*51, 49*49, 47*47 and 45*45 respectively.
There is a maxpooling layer after the eighth convolution layer that has 22*22*256 feature
maps.
The nineth, tenth, eleventh and twelfth convolution layers has 512 features that maps graph
size of 20*20, 18*18, 16*16 and 14*14 respectively.
The thirteenth, fourteenth, fifteenth and sixteenth convolution layers has 512 features that
maps graph size of 12*12, 10*10, 8*8 and 6*6 respectively. Then there is a maxpooling
layer after the thirteenth convolution layer that has 3*3*512 feature maps.
Last 3 are fully connected layers where the first two dense layers have 4096 neurons each
and the third dense layer is output layer.
After summarizing the model is compiled with stochastic gradient optimizer.
The trained model is saved in filename.h5 format which stores the trained part only when
the accuracy is improved. It 251220 trainable parameters and 20024384 non trainable
parameters
Here the given epoch is 25, when VGG19 trains images provided the accuracy of 9.7.
VGG19 algorithm:
1. Import vgg19 model from keras
2. Load the vgg19 model
3. For each layer in conv_model.layers
3.1 Set the trainable layers as false
4. Set three dense layers (hidden layers)
5. Set the final softmax layer with 10 categories
6. Create the full model
7. Summarize the full model
8. Compile the vgg19 model
8.1 Set the loss
8.2 Set the optimizer
8.3 Set the metrics (accuracy)
9. Train the model
9.1 Set workers
9.2 Set the epoch size
10. Plot training and validation accuracy
11. Plot training and validation loss
D. ResNet50:
ResNet50 is a variant of the ResNet model; it is a strong neural network with a depth of 50
layers which has 48 Convolution layers along with 1 MaxPool and 1 Average Pool layer. It has
3.8 x 10^9 Floating point operations. We can load a pre-train version of a network trained on
more than one million images from the Image Net database. The pretended network can classify
images into 1000 object categories. The ResNet-50 model consists of 5 stages with a
convolution and identity block. Each convolution block has 3 convection layers and each
detection block also has 3 convolution layers.
Structure:
The resnet-50 has 50 layers which is shown in figure 5.6: first 49 layers are convolution
layers and the last output layer is SoftMax which gives the output based on the probability
belonging to particular class.
In our project we have imported the resnet-50 model using transfer learning approach that
reduces the time. On summarizing the designed resnet-50 model the total number of
parameters obtained are 25,639,715, trainable parameters are 1003860 and nontrainable
parameters are 2358771.
After summarizing the model is compiled with stochastic gradient descent optimizer.
The trained model is saved in filename.h5 format which stores the trained part only when
the accuracy is improved.
Here the given epoch is 45, the gradient weight is updated by the mentioned optimizer, and
the learning rate decreases after the number of patience when the accuracy is not improved.
Resnet-50 when trained with dataset images provided the accuracy of 41%,
Resnet50 algorithm:
1. Import resnet50 model using keras
2. Split the tarin and validation dataset
3. Load the resnet50 model
4. For each layer in conv_model.layers
4.1 Set the trainable layers as false
5. Set three dense layers (hidden layers)
6. Set the final softmax layer with 10 categories
7. Create the full model
8. Summarize the full model
9. Compile the resnet50 model
9.1 Set the loss
9.2 Set the optimizer
9.3 Set the metrics (accuracy)
10. Train the model
10.1 Set workers
10.2 Set the epoch size
11. Plot training and validation accuracy
12. Plot training and validation loss
13. Save and load the keras model
25
47%
20
15 29%
10
5 12%
0
VGG16 Resnet50 VGG19
DCNN MODELS
The figure 5.7. bar graph represents the comparison of validation accuracy of different deep
convolution neural network models obtained after loading the weights from the saved model.
It can be noticed that Resnet and VGG19 has low accuracy compared to other models, VGG
16 has moderate accuracy.
1.8
1.6
1.4
1.2
LOSS VALUE
0.8 1.6262
0.6
0.4
0.2
0.5187
0.278
0
VGG16 VGG19 RSENET
DCNN MODELS
The figure 5.8. bar graph represents the comparison of validation loss of different deep convolution
neural network models obtained after loading the weights from the saved model. Comparing to
ResNet50, VGG 16 and VGG19 has more loss value.
Python GUI using flask: Flask is a web framework, it's a python module that lets you develop web
applications easily. Flask is a web application framework written in python. Flask is based on the
Werkzeg WSGI has been used as a standard for python web application development. WSGI is the
specification of a common interface between web servers and applications.
Creating a GUI application using Flask, all you need to do is perform the following steps:
Import the Flask.
Import secure_fiename from werkzeug
Create the GUI application main window.
Add one or more of the above-mentioned widgets to the GUI application.
Enter the main event loop to take action against each event triggered by the user.
On running, the saved keras model loads and the GUI appears where the image can be selected and
used for prediction.
Figure 5.9 Displays the web page to choose the file or image
Choose the image from the file to predict whether it is cancerous or non-cancerous
If we select or choose the image from non- cancerous category it shows that it is a non- cancerous
If we select or choose the from the cancerous category then it will display that it is a cancerous
CHAPTER 6
TESTING
6.1 Software Testing Introduction
Software testing is a process used to help identify the correctness, completeness and quality
of developed computer software. Software testing is the process used to measure the quality of
developed software. Testing is the process of executing a program with the intent of finding errors.
Software testing is often referred to as verification & validation.
6.3.2 Design
Plans are laid out concerning the physical construction, hardware, operating systems,
programming, communications, and security issues for the software. Design phase is concerned
with making sure the software system will meet the requirements of the product. There are 2 stages
in design:
HLD – gives the architecture of the software product to be developed and is done by architects and
senior developers.
LLD – done by senior developers. It describes how each and every feature in the product should
work and how every component should work. Here, only the design will be there and not the code.
6.3.3 Testing
Testing is evaluating the software to check for the user requirements. Here the software is
evaluated with intent of finding defects.
6.3.4 Maintenance
Once the new system is up and running for a while, it should be exhaustively evaluated.
Maintenance must be kept up rigorously at all times. Users of the system should be kept up-to date
concerning the latest modifications and procedures.
6.4.5 V-Model
V model is a process where the development and testing phases can do parallely. For every
development phase there is a testing phase. Development phases are called as verification whereas
testing phases are called as validation.
1. Test Plan
2. Test Development
3. Test Execution
4. Analyse Results
5. Defect Tracking
6. Summaries Report
Each program components are tested for errors to discover defects in the testing stage. The
components may be any of the program functions, objects or modules. The integrated components
are used in system testing to form the complete system. In this stage testing must be focused to
establish the system that meets functional requirements and must be ensured that system does not
behave in an unexpected way.
Test data are inputs that are been devised and trained to test the system whereas test cases are inputs
used to test the system and if the system works as specified with the given input the output is
specified for the given input, the behaviour is examined in a cohesive system. The test cases are
opted for ensuring that the system behaviour is examined in all the possible combinations of
conditions considered.
Accordingly, system behaviour that is expected under various combinations of conditions is given.
Therefore, test cases are selected which have inputs and the outputs on expected lines, inputs that
are not valid and for which suitable messages must be given and inputs that do not occur frequently
which can be regarded as special cases. In this chapter, several test cases have been explained with
the underlying the proposed techniques.
Testing Strategy
The strategy that is used to perform unit testing is described below:
Features to be tested: The features to be tested, most importantly include the operation of
individual component for the proper execution of the entire program.
Items to be tested: The items to be tested include all the individual units or functions, which
collectively form the whole system. In case of unit testing the items to be tested, are the main
graphical user interface, deploying the sensor nodes and handling the events in the sensor network.
Purpose of testing: The purpose of the testing is to check the unit functionality of the main source
of the project.
Pass/Fail Criteria: The pass or fail criteria are designed with the basis of appropriate compilation
of the main source file.
Module Test 1:
Remark Successful
Explanation:
The table 6.1 refers module test 1 which is used to prepare the dataset for training and validating
the model. So, the image dataset has to be divided into train images (80%) and validation images
(20%), which are then fed as input the deep convolution neural network.
Module Test 2:
Remark Successful
Explanation
The table 6.2 refers module test 2 where the pre-processed image-dataset are fed as input to the
developed CNN to train and validate. As the CNN model is trained, the trained model is saved by
monitoring the validation accuracy.
Module Test 3:
Table 6.3: Module Test 3
Serial No 3
Remark Successful
Explanation
The table 6.3 shows the prediction phase that uses the model saved in the previous step to predict
the classes that are correctly and incorrectly classified.
Module Test 4:
Remark Successful
Explanation
The table 6.4 shows the module test 4 where the GUI is developed to make user-friendly with the
trained model. The model saved in test 2 is loaded in the backend of GUI and asks the input to
upload an image. Once the image is selected it classifies the image that displays whether the given
input is nevus, benign or melanoma.
CHAPTER 7
INFERENCE FROM THE RESULTS
7.1 Results
7.1.1 Comparison Results
Table 7.1. Result of the training set
The table 7.1 implies the comparison results of training set. We are comparing accuracy of training
set of CNN algorithm with VGG16, VGG19, Resnet50 Algorithm’s accuracy. So that we can say
that after comparing CNN algorithm with remaining algorithms, CNN algorithm without using any
encoder-decoder has got highest accuracy as 98.8% of training set.
The table 7.2 implies the comparison results of validation set. We are comparing accuracy of
validation set of CNN algorithm with VGG16, VGG19, Resnet50 Algorithm’s accuracy. So that we
can say that after comparing CNN algorithm with remaining algorithms, CNN algorithm without
using any encoder-decoder has got highest accuracy as 81.5% of validation set.
Figure 7.1 Regarding performance, confusion matrix of the proposed DCNN model.
The figure 7.1 implies the confusion matrix of the Deep Convolutional Neural Network Model. This
confusion matrix shows each combination of the true and predicted classes for a validation dataset.
In the above given confusion matrix, the diagonal values/index are correctly classified values.
Rather than the diagonal values, remaining all values are wrongly classified values or miss classified
records.
We see that in fig 7.2, the VGG16 model accuracy increases gradually. The accuracy plateaus
as we train and validate the model for epoch 5. Both the line in the accuracy shows the
training and validation accuracy.
We see that in fig 7.3, the VGG16 model produces some loss during the training and validation
of the model. Both the line in graph represents the loss while training and validating the model.
We see in fig 7.4, the VGG19 model which is similar as VGG16 model. This graph plots both
training and validation accuracy. The blue line reperesents training accuracy and orange line
represents the validation accuracy.
The graph shown in fig 7.5 is for training and validation loss of VGG19 model. In VGG19
model we get similar training and validation loss as 0.51 and 0.54 where there is only point
difference while running the epoch for size 5.
The above graph in fig 7.6 shows the training and validation loss for ResNet50 model. As we
can see for Resnet50 model, the loss gradually decreases and is lowest for 4 epochs.
The above graph in fig 7.7 plots the training and validation accuracy for ResNet50 model. All
the six graphs are based on the accuracy values and loss values which we got for all the three
models. All the three models are developed to compare the models with CNN model which
obtained the accuracy of 97% for training and 80% for testing.
CHAPTER 8
CONCLUSION AND FUTURE ENHANCEMENT
8.1 Conclusion
Skin cancer is one of the deadliest diseases, identifying it in early stages helps human to cure the
disease. Hence, we use high level of machine learning techniques and algorithms so that it can be
detected in the early stages and help doctors and humans to take preventive measures and treat
humans suffering from skin cancer especially melanoma. We have proposed a system, which will
be very useful in predicting the skin cancer and give accurate result. Here we give RGB images as
the input to our system which helps in identifying the disease better. Specifically designed to find
whether the image is melanoma or non-melanoma. Melanoma is one of the skin cancers, which is
very difficult to predict. Hence, we are training our algorithm to predict it better than the existing
system. We developed few Deep Convolution Neural Networks and trained the DCNN models. It
is observed that pure DCNN performed better than other models from the graph comparison shown.
And the GUI developed has DCNN model to use for prediction. The loss is very less for VGG16,
VGG19 and Resnet50 compared to DCNN model and moreover, adam optimizer is the extension
of classical stochastic gradient, so we prefer DCNN (adam) to use for predicting if a single model
has to be used. And the GUI that loads the model automatically loads the DCNN (adam) model.
An android application to detect the skin cancer that loads the trained model to predict.
One can train with a more number of images(say.,10,000) and use it for better prediction.
REFERENCES
[1] Dubai, Pratik, et al. "Skin cancer detection and classification." Electrical Engineering and
Informatics (ICEEI), 2017 6th International Conference on. IEEE, 2017.
[2] urRehman, Mobeen, et al. "Classification of Skin Lesion by Interference of Segmentation and
Convolotion Neural Network." 2018 2nd International Conference on Engineering Innovation
(ICEI). IEEE, 2018.
[3] Ali, Aya Abu, and Hasan Al-Marzouqi. "Melanoma detection using regular convolutional neural
networks."Electrical and Computing Technologies and Applications (ICECTA), 2017
International Conference on IEEE, 2017.
[4] E. Nasr-Esfahani, S. Samavi, N. Karimi, S. M. R. Soroushmehr, K. Ward, M. H. Jafari, B.
Felfeliyan, K. Najarian, “Vessel Extraction in X-Ray Angiograms Conference of the IEEE
Engineering in Medicine and Biology Society (EMBC), Florida, 2016.
[5] Razmjooy, N., Sheykhahmad, F. R., & Ghadimi, N. (2018). “A hybrid neural network – world
cup optimization algorithm for melanoma detection”. Open Medicine, 13(1), 9–16.
doi:10.1515/med-2018-0002.
[6] Agung W. Setiawan. “An effect of color enhancement on early detection of skin cancer using
Convolutional Neural Network”. IEEE 2020 IEEE International Conference on Informatics,
IoT, and Enabling Technologies 2020 IEEE.
[7] Esther Chabi Adjobo; Amadou Tidjani Sanda Mahama. “Proposition of Convolutional Neural
Network Based System for Skin Cancer Detection”. 2019 15th International Conference on
Signal-Image Technology & Internet-Based Systems (SITIS) 2020 IEEE.
[8] Pennisi, Andrea, et al. “Melanoma detection using delaunay triangulation.” Tools with Artificial
Intelligence (ICTAI), 2015 IEEE 27th International Conference on.IEEE, 2015.
[9] Alquran, Hiam, et al. “The melanoma skin cancer detection and classification using support
vector machine.” Applied Electrical Engineering and Computing Technologies (AEECT), 2017
IEEE Jordan Conference on. IEEE, 2017.
[10] Youssef Filali, Hasnae, El Khoukhi, “the use of the ABCD rule” , “ the texture analysis”
2016.
[11] Geoffrey E. Hinton Alex Krizhevsky, Ilya Sutskever. 2012. "ImageNet Sorting with Deep
Convolutional Neural Networks". "Neuronic Info Dispensation Systems" (2012).Swati
Srivastava Deepti Sharma. 2016. "Robotically Recognition of Skin Malignancy by Organization
of Neuronic System" Global Journal of Engineering and Technical Research 4, 1 (2016), 15-18.
[22] R. Kasmi and K. Mokrani, "Classification of malignant melanoma and benign skin
lesions: implementation of automatic ABCD rule", IET Image Processing, vol. 10, no. 6, pp.
448-455, 2016.
APPENDIX A
SNAPSHOTS OF SKIN CANCER DETECTION PROJECT
Snapshot for displays the web page to choose the file or image:
In this page we choose the image for predicting whether the image belong to cancerous or non-
cancerous.
Figure A1: Displays the web page to choose the file or image
This page is for selecting the image by clicking choose file button. It will show the path which we
specified during coding.
After selecting the image from the specified path we predict whether the image is cancerous or non-
cancerous, this snapshot shows that the image which we selected is non-cancerous
Appendix B
The project entitled “Skin Cancer Detection System” has presented in NCSEM 2K21 on 7 th July
2021.
Abstract - Skin cancer is a treacherous sickness for people. probable to categorize the disease founded on images.
The requirement of initial analysis of skin cancer has been According to World Health Organization, 132,000
amplified due to the rapid growth rate of melanoma skin melanoma skin cancer cases are diagnosed globally each
cancer, its huge treatment price, and its death toll rate. These year
cancer cells are sensed physically and it takes a lot of time to
treat them in most of the cases. This research paper proposes A. Our Contribution
a man- made melanoma detection system using image
processing and the machine learning method. The structures We focus on detecting skin cancer on certain skin cancer
of the pretentious skin cells are removed after the separation images with the help of the Convolution Neural Network. We
of the thermoscopic imageries by means of the feature pre-process the data and train the model using CNN and identify
extractiontechnique.Adeep learning-based method the cancerous cell.
convolutional neural network classifier is used for the
stratification of the extracted structures. An accuracy of 81% B.Related Work
and consequently the training accuracy of 97% are attained
after using the real-time data set. Nowadays, there are many ways to predict skin cancer using
different techniques. From the dataset, the images are pre-
Keywords— Skin Cancer, CNN, VGG, RESNET, GUI processed and fed it into CNN. The accuracy of the work using
DEVELOPMENT
CNN on ROI is 93.50%. Rika Rokhana used suggestedsystem
I. INTRODUCTION architecture containing of numerous groups of convolutional
layers and max-pooling layers, succeeded by a drop-out layer
Skin cancer is a clause where there is an anomalous increase and a fully connected layer. From the tentative outcomes, the
of melanocytes cell inside the skin. The best epoch value for the training process is 10, which gives an
malevolentmalignance class of skin cancer is accuracy of 84.76%. Ammirreza Mahbod used three pre-trained
usuallytriggered by the pigment-containing cells known as deep neural networks such as Alex Net, Res Net-18, and
melanocytes. Malignancy is encountered in non-Hispanic VGG16 for feature extraction. The features are used to train
white men and women and outcomes in an almost 75% support vector machines. SVM is trained for each pre-trained
death rate. According to a world cancer report, the reason model and outputs of SVM are combined to get a classification
for skin cancer is ultra violates radiation from the sunlight result. Khalid M. Hosny used a pre-trained Alex Net and a
or from some cosmetic devices such as tanning beds. Skin transfer learning technique. The accuracy of their proposed
cancer can be labelled into three main categories: method is 80% of original images and 98% for augmented
Melanoma, Squamous cell cancer and Basal cell skin images. Tasneem Alkarakatly used four performance measures
cancer. Melanoma is the most harmful and general type of for computing the proposed model and to compare with the
skin cancer and can emerge on eyes or mouth where SCC existing model, their results achieved an accuracy of 94%.
and BCC are less ordinary and do not reach other parts and
are suspected to cause death. Tumour growth can be healed
by clinicalexpurgation if noticedinitially before it passes to II. LITERATURE SURVEY
supplementarybody parts. When malignant melanoma has Youssef Filali, Hasnae El Khoukhi, My Abdelouahed Sabri, Ali
expanded to different tissues, it is tough to handle,thus it has Yahyaouy, and Abdellah Aarab LIIAN put forward to utilize
the highest deathpercentage. It is significant to discriminate the ABCD rule along with the texture study in the year 2016.
between benign and malignant skin cancer as soon as Texture study is usually used to categorize the lesions in
possible to upsurge the possibility of recuperation. Biopsy computer-aided diagnoses. In the segmentation part, Otsu’s
by the medical specialist is commonly needed to algorithm is used in the preprocessed image. Then, the
differentiateamong benign and malignant melanoma. segmented images are anticipated on the texture. These images
Nevertheless, the expansion of computational knowledge, will be fed into a convolutional neural network (CNN) to learn
particularly machine learning and computer vision made it these features and then categorize the cancerous cell.
1
Skin Cancer Detection System
Pomponio et al proposed a classifier which uses the compute the blunder value of the network. This feed-forward
convolutional neural network as a feature extractor. He made and back-propagation process is repeatedly done until the end of
use of only 400imageries from the publicly available dataset for the epoch iteration or until the error value is changed. Once the
the sorting of melanoma and benign. Initially, we perform epoch iteration is done, we get the accurateness value and defeat
preprocessing and data augmentation. Afterwards, a pre-trained value for training and testing.
Alex Net was used for the abstraction of features. The lesion
was later categorised with a k-nearestneighbor classifier using STEPS IN METHODOLOGY:
cosine distance metrics. The algorithm was not verified with an We describe the subsequent steps of our methodology. DCNN
independent test dataset; only cross-validation was and used for the classification task between 10 categories. We
accomplished. The procedure got a sensitivity of 93.1%, a
use some models like ResNet, VGG-16 on this same dataset for
specificity of 96.18%, and an accuracy of 90.64%. Additionally,
to the lacking of an autonomous dataset, it is equally serious to the performance comparison.
know that the section of attention for each skin cancer cell must
be physically interpreted.
III. ORGANIZATION OF THE PAPER
We introduce the relevant concepts and give an overview of the
problem that we are facing due to skin cancer. We illustrate the
methodology that is used to training and building the model. We
build another to compare our model with the accuracy that we
have obtained with the new model. With the help of the GUI we
have built a front end, where it is helpful for everyone to access
easily.
IV. BACKGROUND
Based on convolutional neural networks (CNNs), we
categorizeimageries of skin cancer and that might permitsaving
lives and quick detection, even outside the hospital through the
setting up of applications on mobile phones or through websites.
There are many skin cancer cases in America, Australia where
there it is time-consuming to check whether it is a melanoma Fig.1 proposed methodology
cancerous that may lead to a delay in the treatment. This project
is based on dermoscopic images using a convolutional neural
network where we classify the images and identify whether it is A. Dataset. Dataset is the set of different type of skin
a melanoma cancerous cell. In this project, the accuracy value cancer metaphors from real-time hospital data and the
will show whether it is a cancerous cell if the accuracy is high it ISIC dataset. It is better to use a huge number of data
is a cancerous cell. There are many other models like VGG16, to provide a fine result. The images in the dataset are
RESNET which are used for identifying the cancerous cell, so it dermoscopy images.
will be helpful to quickly identify the melanoma and without any
delay, a dermatologist can treat the patient.
V. METHODOLOGY:
The Melanoma images are obtained from the ISIC dataset and
hospital dataset. We have ten categories of skin cancer images.
We perform data pre-processing and split the images as training
images and testing images. The training set and the testing set
consists of some images among the ten categories. We perform
an autoencoder process to remove the unwanted elements in the
image like hairs in the skin. To classify the melanoma images,
we probable applying convolutional neural network (CNN)
method. It is the improvement of neural network algorithm
which is used for image classification. In the feed-forward
development, the systems try to forecast the category of the B. Data pre-processing. Data pre-processing is the first
image by using the reproduction process throughout abundant step in preparing the data for building the model. The
filters or kernels whose first values are as subjective values. The main objectives of pre-processing are to augment the
conjecture result is then compare among the real category to original image by removing the noise. The input feature
2
Skin Cancer Detection System
dimension is 60X60X3. There are three channels of Batch size (100): We specify the batch size to
image, RGB. The data set image are extremely iterate so that the accuracy increases as we
enormous in width and height. The width of the images train the model
is 1002 and the height of the images is 667 which is Optimizer (Adam): Adam is used for
enormously large to progression and noticeably more minimizing the loss value while training
time-consuming and surplus of memory. We have to Loss function: set up a binary or cross entropy
resize input image; thus we can develop the image with classification problem.
fewer memory. The pre-processed images are saved Number of epochs (100): Epochs iterate based
along with their classes. Feeding the pre-processed on the batch size and give proper accuracy.
data into a Convolutional neural network for
classification. CNN has three layers, the hidden layers This model was implemented in anaconda
have three well-designed convolutional layers, ReLU jupyter notebook. Here we divide the dataset
layers, pooling layers, and fully connected layers. into two categories as training and testing.
Convolutional layers are appropriate a convolution After training the model we get the training
process to input dermoscopy images. These give the accuracy as 97% and the testing accuracy as
information to the subsequent layer. Pooling combines 81%
the outputs of cluster of neurons hooked on a separate Precision: It gives the positive outcomes which was predicted
neuron in the subsequent layer. Fully connected layers by the classifier
link every neuron in one layer to every neuron in the
next layer. In a fully connected layer, all neuron obtains 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = 𝑇𝑃 / 𝑇𝑃 + 𝐹𝑃
images from all aspect of the preceding layer A This Recall: It is the quantity of correct certain outcomes divided by
eliminates the guide feature extraction. These features the no. of every conjugate sample (all samples that ought to have
are not trained. They are well-read when the network been identified as sure).
trains set of images. Compared to other classification
algorithms, CNN uses incredibly modest pre- 𝑅𝑒𝑐𝑎𝑙𝑙 = 𝑇 𝑃 /𝑇 𝑃 + 𝐹 𝑁
processing. CNN is encouraged by biological F1-score: It is also called a weighted harmonic mean that
processes. A CNN begins with an input image, applies measures to seek a balance between precision and recall. It takes
several unusual filters to generate a characteristic map, both false positive values and false negative values for the
apply a ReLU function, pooling layer to every calculation and performs well on an unfair dataset.
characteristic map, and flatten the pooled images into
F1-𝑠𝑐𝑜𝑟𝑒 = 2𝑇 𝑃 /2𝑇 𝑃 + 𝐹 𝑃 + 𝐹 N
long vector. It also inputs the long vector into a fully
connected neural network. The fully connected layer Accuracy: It gives the correct prediction or outcomes to all the
provides the classes and trains during forwarding images after comparing the original images with the predicted
propagation and back propagation for various epochs. images during training the model
This will repeat until we get good accuracy. 𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = 𝑇𝑃 + 𝑇𝑁/𝑇𝑃 + 𝑇𝑁 + 𝐹𝑃 + 𝐹𝑁
C. Normalization of data: Normalization plans the VI. CNN ARCHITECTURES AND RESULT:
database that reduces data redundancy. There are some
This section specifics each network architecture, choice of
methods of normalization they are min-max,
optimizers, loss function, hyper-parameters, no of epochs,
normalization, z-score normalization, and decimal
learning rate, and model schema.
scaling normalization.
A. 3-layer Convolutional Neural Network
Dataset is normalized by separating 255 known as the
This is a traditional CNN with 3 convolutional layers and 2 fully
gray scale value of an image. We normalized as per the
connected layers. Every convolutional layer is followed by a
given formula: max-pooling layer with a pool size of 2 to deliver invariance to
z=x-min(x)/max(x)-min(x) shifts in position and improve generalization performance. We
The values are in the range of [0 − 1] and shows that are using Adam optimizer to get improvement in performance.
the data is stored logically. We applied dropout as a regularization technique to the fully
connected layers to prevent overfitting and found the rectified
D. Training and performance: We train our model linear unit (RELU) activation function to work best for this
using the following layers model. Since we have two classes, our loss function is a binary
MaxPooling2D is used for decreasing the size cross-entropy calculated as: -
of the images, so the training will be much (ylog(p) + (1 - y) log (1 - p).
faster
The architecture was initialized with random weights and
trained for 70 epochs. After every epoch, the model learns new
3
Skin Cancer Detection System
Loss Accuracy
CNN 0.035 98.08%
Fig.2. Convolutional neural network with its multiple layers VGG16 1.415 48.06%
B. VGG 16
VGG19 0.545 9.7%
The VGG16 network was developed by the visual geometry
Resnet50 0.249 41.93%
group from where its name was invented and was the winner at
ILSVRC (ImageNet Large-Scale Visual Recognition
Competition) 2014 localization task and 2nd best in the Table 3. Result of the test set
classification task. It is a very deep, 16- convolutional-layer Loss Accuracy
network with an unchanging architecture. The model was
initially trained on millions of images in a data store called CNN 1.012 81.5%
ImageNet. It uses only 3x3 same convolutions with an VGG16 1.626 47.06%
increasing no. of filters. The architecture contains 5
convolutional blocks (a total of 13 convolutional layers) and a VGG19 0.518 12%
fully connected classifier (a total of 3 fully connected
Resnet50 0.278 29%
layers).Pooling layers are not calculated as formal layers as they
do not have trainable parameters or weight matrices. We Training and testing results for each model in Tables 4 and 5
instantiated the pre-trained VGGNet from the 1st convolutional
block up to the last and loaded its weights. We then pre-
calculated the bottleneck features since that is where most of the
computation time is. Once we pre-computed them, the activation
maps were benefited to train a small fully connected model on
top of the bottleneck features. Rectifier linear unit layer was
used as our activation function for the hidden layers and sigmoid
at the output layer.
Max(0,Z) RELU
σ(X) = 1 (1 + 𝜀(−X)) SIGMOID
The trained top model was then added on uppermost of the
convolutional model in order to perfect the last convolutional
block and our trained classifier. We compiled the final model Fig.3. Training and Validation accuracy graph of VGG16
using adam optimizer with a learning rate of 0.001. The model
achieved an accuracy of 14% for 5 epochs of training.
4
Skin Cancer Detection System
Fig.4. Training and Validation loss graph of VGG16 Fig.8. Training and Validation loss graph of resnet50
Fig.6. Training and Validation loss graph of VGG19 VII. GUI DEVELOPMENT
GUI is mainly developed for easy access. As we depend on the
doctors or a dermatologist to find our problem that we are facing
due some skin allergy it may take time to diagnosis. With the
help of the GUI we can immediately get the result whether that
allergy lead to cancer or not. The proposed system can also be
used by the doctors in the hospital to start the treatment as soon
as possible. This System is mainly for the rural people where the
doctors may not be available for the emergencies in the hospital,
with the help of this GUI system they can analyze the problems
related to the skin, so that the doctors can start the treatment
immediately. This GUI accepts the image of the patient and
gives the result whether it is a cancerous cell or non-cancerous
cell.
Fig.7. Training and Validation accuracy graph of resnet50
5
Skin Cancer Detection System