CNN-Based Skin Cancer Detection System
CNN-Based Skin Cancer Detection System
A Project Report
submitted by
JASEEL M V (EVD18I030)
I, Jaseel M V, with Roll No: EVD18I030 hereby declare that the material presented
in the Project Report titled Skin Cancer Detection Using CNN represents original
work carried out by me in the Department of Electronics and Communication Engi-
neering at the Indian Institute of Information Technology, Design and Manufacturing,
Kancheepuram.
With my signature, I certify that:
• I have not committed any plagiarism of intellectual property. I have clearly indi-
cated and referenced the contributions of others.
• I have understood that any false claim will result in severe disciplinary action.
• I have understood that the work may be screened for any form of academic mis-
conduct.
Jaseel M V
Place: Chennai
Date: 13.05.2025
CERTIFICATE
This is to certify that the report titled Skin Cancer Detection Using CNN, submit-
ted by Jaseel M V (EVD18I030), to the Indian Institute of Information Technology,
Design and Manufacturing Kancheepuram, for the award of the dual degree of BACH-
ELOR OF TECHNOLOGY AND MASTER OF TECHNOLOGY is a bonafide
record of the work done by him/her under my supervision. The contents of this report,
in full or in parts, have not been submitted to any other Institute or University for the
award of any degree or diploma.
Place: Chennai
Date: 13.05.2025
ACKNOWLEDGEMENTS
I am sincerely grateful to Prof. Binsu J Kailath for providing me with this excep-
tional opportunity to undertake my design project under her esteemed mentorship. Her
continuous encouragement and valuable feedback have improved my problem solving
and understanding in different areas. Even though there was engaged in a lot of work,
she always finds time to answer all of my doubts and queries, and I appreciate her for
all the support of her during this project and other points of my degree.
I would like to add the support that my family and friends have given me throughout
this project and their role played an integral part of my life journey. Whose presence
and love made me an improved student and a human being throughout this time period.
i
ABSTRACT
Skin cancer is one of the most prevalent types of cancer, and its early detection is crucial
for successful treatment and improved patient outcomes. In recent years, deep learning
techniques, particularly Convolutional Neural Networks (CNNs), have demonstrated
exceptional performance in various computer vision tasks, including medical image
analysis. This project aims to develop a skin cancer detection system using CNNs to
assist dermatologists in accurate and efficient diagnosis.
The proposed skin cancer detection system using CNNs offers the potential to assist
dermatologists in accurate and timely diagnosis, leading to improved patient outcomes.
By leveraging the power of deep learning and advancements in medical image anal-
ysis, this project contributes to the ongoing efforts in leveraging technology for the
early detection and management of skin cancer, thereby promoting proactive healthcare
practices.
ii
TABLE OF CONTENTS
ACKNOWLEDGEMENTS i
ABSTRACT ii
LIST OF TABLES v
LIST OF FIGURES vi
ABBREVIATIONS vii
NOTATION viii
1 INTRODUCTION 1
1.1 LITERATURE REVIEW . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 MOTIVATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 METHODOLOGY 5
2.1 PROBLEM STATEMENT . . . . . . . . . . . . . . . . . . . . . . 5
2.2 EXISTING SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 PROPOSED SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . 6
3 WORK DONE 7
3.1 DERMATOLOGICAL IMAGES AND DATASETS . . . . . . . . 7
3.1.1 Dermatological Images . . . . . . . . . . . . . . . . . . . 7
3.1.2 Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.3 Benign vs Malignant . . . . . . . . . . . . . . . . . . . . . 8
3.1.4 Data Collection . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.5 Digital Image Processing . . . . . . . . . . . . . . . . . . . 9
3.1.6 Study Selection . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 CONVOLUTIONAL NEURAL NETWORK . . . . . . . . . . . . 10
iii
3.2.1 CNN Architecture . . . . . . . . . . . . . . . . . . . . . . 10
3.2.2 Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.3 Operations of CNN . . . . . . . . . . . . . . . . . . . . . 15
3.2.4 CNN vs Neural Networks . . . . . . . . . . . . . . . . . . 19
3.2.5 Benefits of using CNNs for deep learning . . . . . . . . . . 19
3.2.6 Applications of Convolutional Neural Network . . . . . . . 20
3.3 SYSTEM REQUIREMENTS and LIBRARIES . . . . . . . . . . . 23
3.3.1 Hardware requirements (Recommended) . . . . . . . . . . 23
3.3.2 Software requirements . . . . . . . . . . . . . . . . . . . . 23
3.3.3 Libraries Used . . . . . . . . . . . . . . . . . . . . . . . . 25
4 RESULT 31
4.1 IMPLEMENTATION AND TESTING . . . . . . . . . . . . . . . . 31
4.1.1 Proposed Architecture . . . . . . . . . . . . . . . . . . . . 31
4.1.2 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.1.3 Working . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1.4 Results and Findings . . . . . . . . . . . . . . . . . . . . . 34
v
LIST OF FIGURES
vi
ABBREVIATIONS
vii
NOTATION
λ wavelength
viii
CHAPTER 1
INTRODUCTION
This project aims to develop a skin cancer detection system using CNNs, which can
assist dermatologists in accurate and efficient diagnosis. By leveraging the power of
deep learning, the proposed system aims to automate the process of skin lesion classi-
fication, improving the speed and accuracy of detection. This can potentially enhance
the overall effectiveness of dermatologists’ diagnostic capabilities, leading to timely
interventions and improved patient outcomes.
maximize performance. Evaluation of the developed CNN model is carried out using
standard metrics, helping dermatologists gain insights into the model’s decision-making
process and increasing trust in its predictions.
There have been related works done in the past to detect skin diseases using machine
learning and deep learning. Catarina Barata and Jorge S. Marques [Barata2019] con-
ducted a study on using deep learning for diagnosis of skin cancer by employing hier-
archical architectures. They discovered that skin lesions are organized in a hierarchical
way, which is taken into account by dermatologists when diagnosing them. However,
automatic systems do not make use of this information, performing the diagnosis in a
one-vs.-all approach, where all types of lesions are considered. In the survey they pro-
posed to mimic the medical strategy and train a deep-learning architecture to perform a
hierarchical diagnosis. Their results highlight the benefits of addressing the classifica-
tion of dermoscopy images in a structured way. Additionally, they provide an extensive
evaluation of criteria that must be taken into account in the development of diagnostic
systems based on deep learning.
Le Thu Thao and Nguyen Hong Quang [Thao 2017] conducted a study on auto-
matic skin lesion analysis towards melanoma detection. Deep learning methods for
image analysis have shown impressive performance in recent years. The survey pre-
sented deep learning based approaches to solve two problems in skin lesion analysis us-
ing a dermoscopic image containing skin tumor. The proposed models are trained and
evaluated on standard benchmark datasets from the International Skin Imaging Collab-
oration (ISIC) 2017 Challenge, which consists of 2000 training samples and 600 testing
samples. The result shows that the proposed methods achieve promising performance.
1.2 MOTIVATION
Skin cancer is an alarming issue and it must be detected as early as possible. The
diagnostic is a manual process that is time consuming as well as expensive. But, today’s
world science has become advanced by using machine learning and it can be helpful in
many ways. Hence, machine learning can make easy for detecting cancerous cells and
that is why machine learning specially convolutional neural network is used to detect
Melanoma incidence rates have risen dramatically in recent decades, and although
the majority of people diagnosed with skin cancer have a better chance of being cured,
melanoma survival rates are lower than non-melanoma skin cancer survival rates. Melanoma
skin cancer (MSC) can develop on any skin surface and been on the increasing in many
parts of the globe for the past two decades. Men’s heads, necks, and between the hips
and shoulders are the most common spots, while women’s lower legs or between the
shoulders and hips are most popular spots. When it does occur in dark skinned people,
it is usually found under the toe nails, toenails, palms, or toes.
METHODOLOGY
The current system is a time-consuming process that is difficult to identify in its early
stages because signs do not occur until the later stages. Implementation of a method to
simplify the classification process in order to detect skin cancer early.
• Biopsy: A skin biopsy involves removing a small sample of skin for laboratory
analysis. There are several types of skin biopsy, including punch biopsy, shave
biopsy, and excisional biopsy. Biopsy is the most accurate way to diagnose skin
cancer and determine its type and stage.
It’s important to note that no single method is fool proof, and a combination of
methods may be used to achieve the most accurate diagnosis. Regular skin checks
and seeking medical attention for any suspicious changes in your skin can also greatly
increase the likelihood of detecting skin cancer early, when it is most treatable.
CHAPTER 2. METHODOLOGY Enter roll number here
Here for skin lesion/cancer classification, dermoscopic images were employed to Deep
CNN architecture to extract deep features for classification of melanoma into can-
cer/malignant type and benign/non- cancerous type.
The perception of skin disease is accomplished through two phases. Phase I involves
collection and preprocessing of dataset and the training phase and the testing phase of
the developed Deep CNN model. Phase II includes real time implementation and visu-
alization of result in GUI. Since one of the factors that determines the accuracy of pre-
diction is the database, we combined at least six different databases (available online)
which is collected by different physicians / researchers / medical students / pathologists
/ competitions. Also, for each image in the database, the manual segmentation and
the clinical diagnosis of the skin lesion as well as the identification of other important
dermoscopic criteria is available. These dermoscopic criteria include the assessment
of the lesion asymmetry, and also the identification of colors and several differential
structures, such as pigment network, dots, globules, streaks, regression areas and blue
whitish veil. There are several datasets like International Skin Imaging Collaboration
(ISIC) 2018 Challenge, HAM10000, Benign vs. Malignant and PH2. The images col-
lected from dataset Benign vs. Malignant was divided into training and testing set in
the ratio 8:2. Each image in the dataset undergoes a preprocessing part, which involves
rescaling of image and labeling of image. Label ’0’ is assigned for benign class and ‘1’
is assigned for malignant class.
WORK DONE
High-quality images of skin diseases are important for both dermatologists and auto-
mated diagnostic systems. On the one hand, dermatologists rely on high-resolution
(HR) images to make diagnoses when direct observation is impossible. This is espe-
cially common in telemedicine, medical consultations, and regular clinics. On the other
hand, training reliable algorithms has always necessitated the use of high-quality data.
In particular, deep learning algorithms always need a vast volume of labeled data for
a better accuracy. As a result, high-quality dermatological images are critical for both
clinical diagnosis and the design of new algorithms. In this section, we go over three
different types of images commonly used in skin cancer diagnosis, as well as some
public datasets.
The three main types of image modalities used to diagnose skin diseases are clini-
cal images, dermoscopy images, and histopathological images (see Figure 1). Clinical
images are frequently captured by mobile devices for remote diagnosis or as medical
records. Dermoscopy images and histopathological images are commonly utilized in
clinical diagnosis to assess the severity of the illness. In the next part, we introduce
them separately.
3.1.2 Dataset
To create a trustworthy and robust skin cancer classification system, a variety of datasets
with all kinds of dermatological images are required. As the need for medical imaging
CHAPTER 3. WORK DONE Enter roll number here
resources in academia grows, more and more datasets are becoming publicly available.
To provide readers with a reference, we introduce several commonly used skin disease
datasets in the next part, along with the works based on these datasets.
In order to effectively classify images, the choice of dataset is crucial. We have carefully
selected the Benign vs. Malignant Dataset due to its comprehensive nature, containing
a total of 3300 images. This dataset is divided into two classes, benign and malignant,
with a split of 8:2 for training and testing respectively. As part of our preprocessing
stage, each image is rescaled and labelled for ease of classification. The benign class
is assigned a ’0’ label, while the malignant class is labelled with ’1’. These measures
ensure accurate classification and improve the overall efficiency of the training process.
Digital image processing involves manipulating and analysing digital images using var-
ious algorithms and techniques. It involves applying mathematical operations and al-
gorithms to enhance their quality, extract useful information, or perform specific tasks.
This process can be performed on images captured by digital cameras, scanned doc-
uments, medical images, and satellite images. The process typically involves several
steps, including image acquisition, pre-processing, image enhancement, restoration,
compression, segmentation, feature extraction, object detection and recognition, and
image analysis.
Digital image processing finds applications in various fields, such as medical imag-
ing, remote sensing, surveillance, robotics, quality control, forensic analysis, and more.
It plays a crucial role in extracting meaningful insights and facilitating decision mak-
ing processes from visual data. Techniques like template matching, machine learning
algorithms, and deep learning methods are used to achieve these tasks.
In conclusion, digital image processing plays a crucial role in various fields, such
as medical imaging, remote sensing, surveillance, robotics, quality control, and foren-
sic analysis, by enhancing the quality, extracting useful information, and facilitating
decision making processes.
We limited our review to skin lesion classification methods. In particular, methods that
apply a CNN only for lesion segmentation or for the classification of dermatoscopic
patterns are considered in this paper. Furthermore, only papers that show a sufficient
scientific proceeding are included in this review. This latter criterion includes presenting
the approaches in an understandable manner and discussing the results sufficiently.
A key difference between this architecture and the neural net architectures is that inputs
to CNNs are 2-D arrays (images), while inputs to the fully connected neural networks
are vectors. However the computations performed by both networks are very similar
a sum of products is formed, a bias value is added, the result is passed through an
activation function, and the activation value becomes a single input to a following layer.
There are some basic differences between the two, beyond their input formats being
2-D versus vectors. An important difference is that CNNs are capable of learning 2-D
features directly from raw image data, a system that can learn image features from raw
image data is a crucial advantage of CNNs. Another major difference is in the way
in which layers are connected. In a fully connected neural net, we feed the output of
every neuron in a layer directly into the input of every neuron in the next layer, while in
CNN we feed into every input of a layer, a single value, determined by the convolution
(hence the name convolutional neural net) over a spatial neighbourhood in the output of
the previous layer. Another difference is that the 2-D arrays from one layer to the next
are subsampled to reduce sensitivity to translational variations in the input.
• A convolution tool that separates and identifies the various features of the image
for analysis in a process called as Feature Extraction. The network of feature
extraction consists of many pairs of convolutional or pooling layers.
• A fully connected layer that utilizes the output from the convolution process and
predicts the class of the image based on the features extracted in previous stages.
This CNN model of feature extraction aims to reduce the number of features present
in a dataset. It creates new features which summarises the existing features contained
in an original set of features. There are many CNN layers as shown in the CNN archi-
tecture diagram.
3.2.2 Layers
There are three types of layers that make up the CNN which are the convolutional
layers, pooling layers, and fully-connected (FC) layers. When these layers are stacked,
a CNN architecture will be formed. In addition to these three layers, there are two more
important parameters which are the dropout layer and the activation function which are
defined below
1. Convolutional Layer : This layer is the first layer that is used to extract the various
features from the input images. In this layer, the mathematical operation of convolution
is performed between the input image and a filter of a particular size MxM. By sliding
the filter over the input image, the dot product is taken between the filter and the parts
of the input image with respect to the size of the filter (MxM). The output is termed as
the Feature map which gives us information about the image such as the corners and
edges. Later, this feature map is fed to other layers to learn several other features of the
input image.
The convolution layer in CNN passes the result to the next layer once applying the
convolution operation in the input. Convolutional layers in CNN benefit a lot as they
ensure the spatial relationship between the pixels is intact.
In Max Pooling, the largest element is taken from feature map. Average Pooling
calculates the average of the elements in a predefined sized Image section. The total
sum of the elements in the predefined section is computed in Sum Pooling. The Pooling
Layer usually serves as a bridge between the Convolutional Layer and the FC Layer.
This CNN model generalises the features extracted by the convolution layer, and
helps the networks to recognize the features independently. With the help of this, the
computations are also reduced in a network.
3. Fully Connected Layer : The Fully Connected (FC) layer consists of the weights
and biases along with the neurons and is used to connect the neurons between two
different layers. These layers are usually placed before the output layer and form the
last few layers of a CNN Architecture.
In this, the input image from the previous layers are flattened and fed to the FC
layer. The flattened vector then undergoes few more FC layers where the mathematical
functions operations usually take place. In this stage, the classification process begins to
take place. The reason two layers are connected is that two fully connected layers will
perform better than a single connected layer. These layers in CNN reduce the human
supervision.
4. Dropout : Usually, when all the features are connected to the FC layer, it can
cause overfitting in the training dataset. Overfitting occurs when a particular model
works so well on the training data causing a negative impact in the model’s performance
when used on a new data.
To overcome this problem, a dropout layer is utilized wherein a few neurons are
dropped from the neural network during training process resulting in reduced size of
the model. On passing a dropout of 0.3, 30 percentage of the nodes are dropped out
randomly from the neural network.
5. Activation Functions : One of the most important parameters of the CNN model
is the activation function. They are used to learn and approximate any kind of contin-
uous and complex relationship between variables of the network. In simple words, it
decides which information of the model should fire in the forward direction and which
ones should not at the end of the network.
It adds non-linearity to the network. There are several commonly used activation
functions such as the ReLU, Softmax, tanH and the Sigmoid functions. Each of these
functions have a specific usage. For a binary classification CNN model, sigmoid and
softmax functions are preferred an for a multi-class classification, generally softmax us
used. In simple terms, activation functions in a CNN model determine whether a neuron
should be activated or not. It decides whether the input to the work is important or not
to predict using mathematical operations.
filter. If f is defined on a spatial variable like x rather than a time variable like t, we call
the operation spatial convolution. Convolution lies at the heart of any physical device
or computational procedure that performs smoothing or sharpening. Applied to two
dimensional functions like images, it’s also useful for edge finding, feature detection,
motion detection, image matching, and countless other tasks. convolution computes a
sum of products between pixels and a set of kernel weights. This operation is carried
out at every spatial location in the input image. The result at each location (x, y) in the
input is a scalar value. Value is the output of a neuron in a layer of a fully connected
neural net. If we add a bias and pass the result through an activation function, we have
a complete analogy between the basic computations performed by a CNN and those
performed by the neural nets.
In CNN terminology, the neighbourhoods are called receptive fields. All a receptive
field does is select a region of pixels in the input image. The first operation performed
by a CNN is convolution, whose values are generated by moving the receptive field
over the image and, at each location, forming a sum of products of a set of weights and
the pixels contained in the receptive field. The set of weights, arranged in the shape of
the receptive field, is a kernel. The number of spatial increments by which a receptive
field is moved is called the stride. In CNNs, an important motivations for using strides
greater than one is data reduction. For example, changing the stride from one to two
reduces the image resolution by one-half in each spatial dimension, resulting in a three-
fourths reduction in the amount of data per image. Another important motivation is
as a substitute for subsampling which is used to reduce system sensitivity to spatial
translation.
To each convolution value (sum of products) we add a bias, then pass the result
through an activation function to generate a single value. Then, this value is fed to
the corresponding (x, y) location in the input of the next layer. When repeated for all
locations in the input image, the process just explained results in a 2-D set of values
that we store in next layer as a 2-D array, called a feature map. This terminology is
motivated by the fact that the role performed by convolution is to extract features such
as edges, points, and blobs from the input. The same weights and a single bias are
used to generate the convolution (feature map) values corresponding to all locations
of the receptive field in the input image. This is done to cause the same feature to be
detected at all points in the image. Using the same weights and bias for this purpose
is called weight (or parameter) sharing. The other feature maps are generated using a
different set of weights and bias for each feature map. Because each set of weights and
bias is different, each feature map generally will contain a different set of features, all
extracted from the same input image. The feature maps are referred to collectively as a
convolutional layer.
The process after convolution and activation is subsampling (also called pooling),
which is motivated by a model of the mammal visual cortex proposed by Hubel and
Wiesel [1959]. Their findings suggest that parts of the visual cortex consist of simple
and complex cells. The simple cells perform feature extraction, while the complex cells
combine (aggregate) those features into a more meaningful whole. Pooling is a way
of modelling of reduction in dimensionality. When training a CNN with large image
databases, pooling has the additional advantage of reducing the volume of data being
processed. You can think of the results of subsampling as producing pooled feature
maps. In other words, a pooled feature map is a feature map of reduced spatial reso-
lution. Pooling is done by subdividing a feature map into a set of small (typically 2×2
) regions, called pooling neighbourhoods, and replacing all elements in such a neigh-
bourhood by a single value. We assume that pooling neighbourhoods are adjacent (i.e.,
they do not overlap). There are several ways to compute the pooled values; collectively,
the different approaches are called pooling methods.
1. Average pooling, in which the values in each neighborhood are replaced by the
average of the values in the neighborhood;
3. L2 pooling, in which the resulting pooled value is the square root of the sum
of the neighborhood values squared. There is one pooled feature map for each feature
map. The pooled feature maps are referred to collectively as a pooling layer. The use of
receptive fields, convolution, parameter sharing, and pooling are characteristics unique
to CNNs.
Because feature maps are the result of spatial convolution they are simply filtered
images. It then follows that pooled feature maps are filtered images of lower resolution.
The pooled feature maps in the first layer become the inputs to the next layer in the
network.
But, whereas we showed a single image as an input to the first layer, we now have
multiple pooled feature maps (filtered images) that are inputs into the second layer. To
see how these multiple inputs to the second layer are handled, focus for a moment on
one pooled feature map. To generate the values for the first feature map in the second
convolutional layer, we perform convolution, add a bias, and use activation, as before.
Then, we change the kernel and bias, and repeat the procedure for the second feature
map, still using the same input. We do this for every remaining feature map, changing
the kernel weights and bias for each.
Then, we consider the next pooled feature map input and perform the same proce-
dure (convolution, plus bias, plus activation) for every feature map in the second layer,
using yet another set of different kernels and biases. When we are finished, we will
have generated three values for the same location in every feature map, with one value
coming from the corresponding location in each of the three inputs. The question now
is: How do we combine these three individual values into one? The answer lies in the
fact that convolution is a linear process, from which it follows that the three individual
values are combined into one by superposition (that is, by adding them). In the first
layer, we had one input image and three feature maps, so we needed three kernels to
complete all required convolutions.
In the second layer, we have three inputs and seven feature maps, so the total number
of kernels (and biases) needed is 3×7=21 . Each feature map is pooled to generate a
corresponding pooled feature map, resulting in seven pooled feature maps. So these
seven pooled feature maps are the outputs of the last layer.
filtered images of reduced resolution), whereas the inputs to a fully connected net are
vectors.
Therefore, we have to vectorize the 2-D pooled feature maps in the last layer. We do
this using linear indexing. Each 2-D array in the last layer of the CNN is converted into
a vector, then all resulting vectors are concatenated (vertically for a column) to form a
single vector. This vector propagates through the neural net . In any given application,
the number of outputs in the fully connected net is equal to the number ofpattern classes
being classified. The output with the highest value determines the class of the input.
The biggest problem with regular neural networks (NNs) is a lack of scalability. For
smaller images with fewer color channels, a regular NN may produce satisfactory re-
sults. But as the size and complexity of an image increases, the need for computational
power and resources also increases which necessitates a larger and more expensive NN.
Moreover, the problem of overfitting also arises over time, wherein the NN tries to
learn too many details in the training data. It may also end up learning the noise in the
data, which affects its performance on test data sets. Ultimately, the NN fails to identify
the features or patterns in the data set and thus the object itself.
In contrast, a CNN uses parameter sharing. In each layer of the CNN, each node
connects to another. A CNN also has an associated weight; as the layers’ filters move
across the image, the weights remain fixed – a condition known as parameter sharing.
This makes the whole CNN system less computationally intensive than an NN system.
Deep learning is a subset of machine learning that uses neural networks with at least
three layers. Compared to a network with just one layer, a network with multiple layers
can deliver more accurate results. Both RNNs and CNNs are used in deep learning,
depending on the application.
For image recognition, image classification and computer vision (CV) applications,
CNNs are particularly useful because they provide highly accurate results, especially
when a lot of data is involved. The CNN also learns the object’s features in successive
iterations as the object data moves through the CNN’s many layers. This direct (and
deep) learning eliminates the need for manual feature extraction (feature engineering).
CNNs can be re-trainedd for new recognition tasks and built on pre-existing net-
works. These advantages open up new opportunities to use CNNs for real-world appli-
cations without increasing computational complexities or costs. As seen earlier, CNNs
are more computationally efficient than regular NNs since they use parameter sharing.
The models are easy to deploy and can run on any device.
Convolutional Neural Networks (CNNs) have found numerous applications across var-
ious domains. Here are some elaborations on the applications of CNNs:
fying objects within images. They learn to automatically extract relevant features from
images through convolutional layers, enabling accurate classification of objects, scenes,
or patterns.
2. Object Detection: CNNs can be used to detect and localize objects within images.
They provide bounding box coordinates around objects, allowing for applications like
autonomous driving, surveillance systems, and facial recognition.
6. Natural Language Processing (NLP): CNNs have been applied to NLP tasks,
such as text classification, sentiment analysis, and named entity recognition. CNNs
can capture local patterns within sequences of words, providing valuable insights for
language processing. 7. Speech Recognition: CNNs have been employed for speech
recognition tasks, where audio signals are processed to convert spoken language into
text. CNNs help in identifying phonetic patterns and improving speech-to-text accuracy.
8. Medical Diagnosis: CNNs have shown great potential in medical imaging for di-
agnosing diseases, such as cancer detection from mammograms or identifying anoma-
lies in MRI scans. They help automate the interpretation of medical images, assisting
healthcare professionals in diagnosis.
10. Robotics: CNNs are used in robotics for object recognition, grasping, and ma-
nipulation. They enable robots to perceive the environment, recognize objects, and
make informed decisions based on visual input.
These are just a few examples of the wide range of applications where CNNs have
demonstrated their effectiveness. CNNs continue to advance and find applications in
various fields, driven by their ability to extract meaningful features from complex data.
• 2GB GPU
Visual Studio Code is a Microsoft source-code editor based on the Electron Framework,
available for Windows, Linux, and macOS. It offers features such as debugging, syntax
highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.
Users can customize themes, keyboard shortcuts, preferences, and install extensions
to enhance functionality. Visual Studio Code is the most popular tool for developing
environments among 71,010 respondents, with 74.48 percentage using it. It supports
various programming languages, including C, C, C++, Fortran, Go, Java, JavaScript,
[Link], Python, Rust, and Julia.
Out of the box, Visual Studio Code includes basic support for most common pro-
gramming languages, including syntax highlighting, bracket matching, code folding,
and configurable snippets. It also includes IntelliSense for JavaScript, TypeScript,
JSON, CSS, and HTML, as well as debugging support for [Link]. Additional lan-
guages can be added through freely available extensions on the VS Code Marketplace.
Visual Studio Code is language-agnostic, allowing users to open directories and save
them in workspaces for future reuse. It can be extended via extensions available through
a central repository, including support for new languages, themes, debuggers, static
code analysis, and code linters using the Language Server Protocol.
Source control is a built-in feature, allowing users to access version control settings
and view changes made to the current project. It requires linking to a supported version
control system, allowing users to create repositories and push and pull requests directly
from the program. Visual Studio Code supports multiple FTP extensions, allowing
users to set the code page, newline character, and programming language for active
documents.
Visual Studio Code collects usage data and sends it to Microsoft, but this can be dis-
abled. The open-source nature of the application allows the public to see the collected
data.
Python
Developed by Guido van Rossum in the late eighties and early nineties at the Na-
tional Research Institute for Mathematics and Computer Science in the Netherlands,
Python is derived from various languages, including ABC, Modula-3, C, C++, Algol-
68, SmallTalk, and Unix shell. It is copyrighted and is maintained by a core develop-
ment team at the institute.
OpenCV
OpenCV is a popular Python library for computer vision and image processing, offer-
ing a wide range of functions and algorithms for various tasks. It includes computer
vision algorithms for object detection, feature extraction, image segmentation, opti-
cal flow, and camera calibration. OpenCV supports various image formats, such as
JPEG, PNG, and BMP, and supports image transformation and geometric operations. It
also provides feature detection and description algorithms, such as Harris corner detec-
tion, SIFT, SURF, and ORB. OpenCV integrates with other libraries and frameworks,
enabling tasks like image classification, object detection, and semantic segmentation
using trained models.
The library also provides a graphical user interface (GUI) for creating windows, dis-
playing images or videos, handling mouse and keyboard events, and drawing shapes or
annotations. OpenCV is designed for efficiency and can take advantage of multi-core
processors, leveraging CPU capabilities for faster execution and hardware accelera-
tion with frameworks like CUDA. The large and active community of OpenCV users
provides support and examples for various computer vision tasks, making it a popular
choice for image processing and computer vision applications in Python.
import cv2 as cv
Numpy
tical functions, and linear algebra. It also supports array broadcasting, allowing oper-
ations between arrays of different shapes. NumPy also offers powerful indexing and
slicing capabilities for accessing and manipulating array elements.
NumPy has a large and active community, with extensive documentation, tutorials,
and resources available. It serves as the foundation for many other scientific comput-
ing libraries in Python, such as SciPy, pandas, and scikit-learn, forming a powerful
ecosystem for data analysis and scientific computing. Overall, NumPy is a fundamen-
tal library for numerical computing in Python, offering versatile and efficient tools for
various scientific and data-related tasks.
import numpy as np
Tensorflow
Google’s open-source TensorFlow machine learning package is used to create and train
neural networks. It provides a robust framework for building and refining neural net-
works, with tensors serving as the main data structure. A huge developer community,
pre-trained models, automatic differentiation, GPU acceleration, eager execution, and
pretrained models are all supported by TensorFlow. While TensorBoard is a web-based
tool for visualising and analysing TensorFlow operations, TensorFlow Hub offers pre-
trained models for a variety of workloads. Additionally, TensorFlow provides a number
of deployment options, such as exporting models to platforms like TensorFlow Saved-
Model or TensorFlow Lite for mobile and embedded devices, as well as integrating
with TensorFlow Serving for scalable model serving in production settings. Tensor-
Flow is a well-liked option for both research and production applications because of its
import tensorflow as tf
Keras
Keras is a popular open-source deep learning library written in Python, offering a user-
friendly API for building and training neural networks. It supports various neural net-
work architectures, including feedforward networks, convolutional neural networks,
and recurrent neural networks. Keras also allows easy model customization, with pre-
trained models and transfer learning options. Model training and evaluation are straight-
forward, with optimizers, loss functions, and metrics to configure the training process.
Keras supports callbacks to customize the training process. It seamlessly integrates with
deep learning libraries like TensorFlow and Theano, enabling faster model training and
inference.
Model deployment is made easier with model export to various formats, such as
TensorFlow SavedModel, TensorFlow Lite, and ONNX. Keras integrates with Tensor-
Flow, combining the high-level simplicity of Keras with the low-level flexibility of Ten-
sorFlow.
Keras has a large and active developer community, offering documentation, tutori-
als, and resources to support learning and development. It also integrates with popular
libraries and frameworks in the Python ecosystem, such as NumPy and scikit-learn,
providing a rich set of tools for deep learning and data analysis. Overall, Keras is a
powerful and user-friendly deep learning library for Python, making it a popular choice
for both beginners and experienced practitioners.
Matplotlib
represent the overall plot and individual subplots, modify colors, line styles, marker
types, and sizes, and annotate plots with text, arrows, and shapes. Matplotlib also al-
lows for multiple subplots within a single figure, allowing for side by side or grid layout
visualizations.
Matplotlib saves and exports plots as image files in various formats, including PNG,
JPEG, PDF, and SVG. It seamlessly integrates with NumPy, a popular library for nu-
merical computing in Python, and supports different backends for plotting. Matplotlib
also integrates with Pandas, a powerful data manipulation and analysis library, allowing
users to directly plot Pandas DataFrames and Series using Matplotlib.
Sklearn
Scikit-learn is an open-source machine learning library for Python that offers a variety
of tools and algorithms for various tasks, including classification, regression, cluster-
ing, dimensionality reduction, and model selection. It provides a unified interface for
accessing and using various machine learning algorithms, data preprocessing and fea-
ture engineering, model selection and evaluation, pipelines and workflow simplifica-
tion, integration with NumPy and Pandas, handling imbalanced data, text mining and
natural language processing (NLP), and a large and active community. Scikit-learn is
widely used in academia and industry, and integrates well with other popular Python
libraries like NumPy, Pandas, and Matplotlib, creating a comprehensive ecosystem for
data analysis and machine learning. The library’s simplicity, consistency, and extensive
functionality make it a powerful tool for both beginners and experienced practitioners
in the field of machine learning and data analysis.
import sklearn
Tkinter
Tkinter is a Python library designed for creating graphical user interfaces (GUIs) with a
user-friendly interface. It offers a wide range of widgets, including buttons, labels, text
entry fields, check buttons, radio buttons, list boxes, and more, which can be arranged
and organized using layout managers. Tkinter is cross-platform compatible, allowing
applications to run seamlessly on Windows, macOS, and Linux without additional in-
stallations. Tkinter follows an event-driven programming paradigm, allowing for the
association of functions or methods with events. Customization and styling options al-
low users to change properties, colors, fonts, sizes, and alignments to match the desired
appearance and feel of their application.
Pillow
Pillow is a popular Python library for image processing and manipulation, offering var-
ious functions and methods for various operations on images. It supports image han-
dling, basic image operations, image filtering and enhancement, image manipulation,
geometric transformations, image analysis, image file metadata, and integration with
NumPy. Pillow allows users to open, create, save, and display various image file for-
mats, such as JPEG, PNG, BMP, TIFF, and GIF. It also supports image filtering and
enhancement techniques, such as blurring, sharpening, edge detection, and noise reduc-
tion.
RESULT
Fig.4.1 shows that the architecture is based on a sequential model, in which thein-
put layer is of RGB type, passing the images through three convolutional blocks, using
small 3 by 3 filters, including a 2D convolution operation for each block and swapping-
between them. The activation function layer as well as the other layers are equipped
with a ReLU, being a nonlinearity operation and including spatial clustering through
the use of a maximum clustering layer. This network ended with a classifier block that
consists of a single layer. When the final output layer is fully connected, it performs a
binary categorization and a sigmoid activation function.
Here the complete system is divided into two phases where: Phase-I is for training
and testing of the model. Pre-processed images from the training set and features ex-
tracted through convolution, pooling, and ReLU layers. The network has three hidden
layers, with global average pooling and three dense layers. The neural network archi-
tecture consists of three main layers: Convolutional Layers, Pooling Layers, and Dense
Layer. Testing the model involves inserting test data, preprocessing it, and feeding it to
the trained CNN model. The model is trained using Tensor Flow, and Keras.
In Phase-II, The interface introduces a user-friendly interface for live image upload-
ing, allowing users to upload images from device focusing on a skin patch or lesion.
The image is pre-processed and then processed using CNN architecture. The sys-
tem’s training phase runs out the results, which are displayed on a GUI. The GUI is
created using Tkinter package for creating custom pages/windows in Python.
4.1.2 Procedure
Skin cancer detection using CNN (Convolutional Neural Network) algorithm involves
the following steps:
• Data Collection: Collect a large number of images of skin lesions from different
sources such as open medical datasets, online resources or by capturing images
using a camera.
• Data Preprocessing: Pre-process the data by resizing, normalizing and applying
data augmentation techniques like rotation, flipping, and zooming to increase the
diversity of the dataset.
• Data Labeling: Label the images into categories such as benign or malignant
lesions.
• Data Splitting: Split the dataset into training, validation, and test sets to avoid
overfitting and evaluate the model’s performance.
• Model Architecture: Define the architecture of the CNN model by specifying the
number of layers, filters, activation functions, and optimizer.
• Model Training: Train the CNN model on the training dataset using the back-
propagation algorithm to adjust the weights and biases of the model.
• Model Evaluation: Evaluate the performance of the trained model on the vali-
dation dataset by calculating metrics such as accuracy, precision, recall, and F1-
score.
• Model Testing: Test the performance of the trained model on the test dataset by
predicting the labels of the test images.
Overall, the above steps form a general framework for developing a skin cancer de-
tection system using CNN algorithm. However, the specific implementation of these
steps can vary depending on the dataset, model architecture, and application require-
ments.
4.1.3 Working
In this study, the dataset used is Benign Vs Malignant. The total no of images is 3300
images consisting of 1800 images for Benign class and 1500 images for Malignant
class. The distribution of training data, validation data and testing data were 75 per-
centage, 20 percentage and 5 percentage so that the training data used were 2475 im-
ages, validation data used were 660 images and the testing data used were 165 images.
Based on architecture and table , the resolution of skin images is changed to 128 × 128
pixels as an input of the CNN model which consists of 3 hidden layers. The image is
convoluted using 3 × 3 filters on each hidden layer with the number of output channels
on each layer is 16, 32, 64 respectively. At each layer, the activation process uses ReLU
activation and Max pooling. The result of Maxpooling reduces the size of the image as
can be seen in architecture (fig.4.1) and Table.4.1 . After that, the flatten process will
change image features from 3 dimensions became 1 dimension.
The last, softmax activation function will be used to classify the condition of skin
image into two classes namely, Benign and Malignant. Here an epoch value of 100 is
provided, so that the entire training and validation set will be looped 100 times. The
first feed forward will be done by assigning random weights, and after first iteration, on
the time of back propagation weights are assigned to neurons by neglecting the neurons
that doesn’t have values (dropout) . and repeats it until epoch limit reaches. Higher the
no of Input data and epoch value. The result will be much better, with high accuracy.
Upon completion of the earlier steps, we successfully set up the model, which means
that all the necessary processed data is now available for use. Furthermore, the imported
model has been integrated into the GUI code, thus enabling us to have an entry box and
a button that facilitates the loading of an image into the interface page. This image is
tested for the existence of cancer, and the trained model that has been imported does
the evaluation. The evaluation involves a determination of whether the image contains
either malignant or non-cancerous cells.
The model summary provides a summary of the model architecture, including the
number of trainable parameters in each layer:
In this study, 2475 training images and 660 validation images were used in the train-
ing model. The images obtained from the Benign Vs Malignant, consist of 2 classes;
Benign (normal) cells and Malignant (cancer) cells. These images were trained using
the CNN model with Adam optimizer method with a learning rate of 0.001, and use
loss categorical cross-entropy. The performance parameters measured in this study are
validation accuracy, training accuracy, validation loss and training loss. After training
with 100 iterations (epoch), it can be seen the comparison of the accuracy and loss
performance of the proposed model with Adam optimizer used in Figure 4.2.
Based on the results shown in Figure 4.2, it shows, the accuracy performance and
loss performance. This is indicated by the appearance of many spikes on the accuracy
and the loss graph. Whereas, the system continues to show an increase in accuracy at
each iteration (epoch) and the difference in accuracy between the training data and the
validation data is not much different, as well as for the system loss continues to decrease
at each iteration. This condition shows that the proposed model is not overfitting and the
system model used can recognize the condition of skin lesions with the best accuracy
performance of 99 percentage and loss of 0.0346. Confusion Matrix for system model
can be seen in Figure 4.3.
It can be seen that from 165 test images used, 130 images were successfully clas-
sified according to their class. The error occurs in 19 images on Malignant(cancer)
detected as Benign(Normal) and 16 images on Benign(Normal) detected as Malig-
nant(cancer).
After the training of images, we save the model and call the model into a code
for GUI. The detection of skin cancer is done in real-time and figure 6.4 show the
screenshot of GUI to load the image. By processing these images, there may be either
Benign cells or Malignant cell. If the image fed was found to be Benign it is shown the
figure 6.5. If it was Malignant, the result will be shown as in the figure 6.6. It is said to
be diagnosed immediately, to cure it in early stages.
5.1 CONCLUSION
Clinical images, dermoscopic images, and histopathological images are three com-
mon types of images used for skin disease diagnosis. Among them, the most common
forms of images are dermoscopy images. With the growing need for medical imaging
resources in academia, more and more datasets are becoming publicly available. We
list several popular datasets for skin-disease images along with works based on these
datasets.
However, compared with natural image datasets, the diversity and quantity of skin-
disease datasets are still very limited, which also brings great challenges to the auto-
matic diagnosis of skin cancer (refer to chapter 3 for more information). We choose
CNN algorithm for several existing deep learning techniques. CNNs are useful for
image recognition, classification, and computer vision applications due to their high
accuracy and ability to learn features in successive iterations. They can be retrained
CHAPTER 5. CONCLUSION AND FUTURE SCOPE Enter roll number here
for new tasks and built on pre-existing networks, making them more computationally
efficient than regular NNs. CNNs are easy to deploy and run on any device. A user can
design suitable architecture very easily and in understandable manner (refer to chapter
4 for more information).
Here the complete system is implemented on a laptop with Ryzen 5 processor, 6GB
RAM and 2GB of GPU. Only a single dataset was used to train the model. Due to the
lack of high performance computer. Around 2500 images were used to train the model.
It took 3 minutes to complete a single iteration, 5 hours 10 minutes to complete 100
iteration. Here validation accuracy of 80 ,percentage is obtained. Testing images were
also predicted correctly.
Higher the no. of iteration and the images. better the result obtained. Further re-
search and development can focus on expanding the dataset, including more diverse
skin lesion types and incorporating clinical data. Additionally, the integration of ad-
vanced techniques, such as transfer learning and ensemble methods, can enhance the
performance and generalization capabilities of the CNN model.
In conclusion, the skin cancer detection system developed using CNNs offers a
promising approach to assist dermatologists in accurate and timely diagnosis. By har-
nessing the potential of deep learning and image analysis, this project contributes to
the ongoing efforts in leveraging technology for the early detection and management of
skin cancer, ultimately improving patient outcomes and advancing proactive healthcare
practices.