Project Documentation
Project Documentation
Supervisor:
Dr. Hossam Moftah
Eng. Mohammed Gamal
Page | 1
Presented by: Vatican team
Acknowledgment
We would like to express our gratitude for everyone who helped
us during the graduation project, starting with endless thanks for
our supervisor Dr. Hossam Moftah and Eng. Mohammed Gamal
who did any effort in encouraging us to do a great job, providing
our group with valuable information and advices to be better
each time.
Page | 2
Table of Contents
Page | 3
V. System requirements& Designs …….............................. 65
5.1 Functional Requirements ………………………………... 65
5.2 Non-Functional Requirements …………………………... 66
5.3 System Design ...………………………………………… 67
VI. Application Design ………...……................................... 70
VII Testing & Evaluation …………………….....….…….. 105
VII Conclusion & Future work ………………………….. 112
8.1 Conclusion ………………………………………………113
8.2 Future work and other ideas ……………………………..114
VIII. References …………...…………................................ 116
Page | 4
Abstract
Skin diseases are more common than other diseases. Skin
diseases may be caused by fungal infection, bacteria, allergy, or
viruses, etc. The advancement of lasers and Photonics based
medical technology has made it possible to diagnose the skin
diseases much more quickly and accurately. But the cost of such
diagnosis is still limited and very expensive. So, image
processing techniques help to build automated screening system
for dermatology at an initial stage. The extraction of features
plays a key role in helping to classify skin diseases. Computer
vision has a role in the detection of skin diseases in a variety of
techniques.
Finding out the type of cancer can take months for doctors as it
is a very tedious practice and also requires the use of expensive
devices and contraptions. This would waste a good lot of time
for the patient which could have been utilized by the doctors to
treat the patient in time. It is also monetarily very demanding on
the patient’s part, which could pose a problem if the patient is
not financially settled.
Page | 5
Chapter 1
Introduction
Page | 6
1.1 Introduction
Page | 7
Analyzing cancers isn't an easy task. It requires intensive
examining. More than 50% of lesions are confirmed through
histopathology (histo), the ground truth for the rest of the cases
is either follow-up examination (follow-up), expert consensus
(consensus), or confirmation by in-vivo confocal microscopy
(confocal). The lack of experts (radiologists) has always been a
bottleneck. Now there are three things that we have to consider
here:
Given the fact that there are a limited number of experts, how
can we make them more efficient? Can we aid them using state
of the art machine learning techniques? If yes, how?
Training of neural networks for automated diagnosis of
pigmented skin lesions is hampered by the small size and lack of
diversity of available dataset of dermatoscopic images. Labelled
data in healthcare is another bottleneck. With the available
limited data, how much can we do?
As Machine Learning Engineers, if we can't help the doctors and
ultimately the society, then what are we good at? Healthcare is a
complicated field and using Machine Learning in this field has
its own advantages and disadvantages. There is a limit to which
we can do things with ML in healthcare but whatever we can do,
it matters!
Page | 8
The current process takes almost a week or more, starting from
getting a dermatologist appointment to getting a biopsy report.
This project aims to shorten the current gap.
Page | 9
Melanocytic Nevi: these variants can differ significantly
from a dermatoscopic point of view but are usually
symmetric in terms of distribution of color and structure.
Page | 12
Chapter 2
Previous work
Page | 13
2.1 Related work
As we know there are many apps that try to detect skin lesions
much easier. At the start of our project we have inquired about
on some auxiliary assets dependent on this. From these have
access to machine resources sources, we have had the option to
know the current capacities and decided our work plot.
Page | 15
For find suitable doctor we provide feature that help you to find
the nearest doctor or hospital in your local area according to
GPS. Also we try to provide a lot of information about skin
cancer and its symptoms especially for 7 lesions with difference
between benign lesions and malignant lesions.
Page | 16
Chapter 3
Methodology
Page | 17
Brief about the algorithm and its steps
Page | 19
Melanocytic nevi, keratosis, vascular and dermatofibroma are
benign lesions
Melanoma, basal cell carcinoma and actinic keratosis are
malignant lesions
Page | 20
3.1.2 Feature wise study
1) Diagnosis
Its seems from the above plot that in this dataset cell type
melanocytic nevi has very large number of instances in
comparison to other cell types
2) Gender
Page | 21
55/45 distribution, dataset matches industry established
distribution
https://www.cancer.net/cancer-types/melanoma/statistics
Page | 22
3) Age
Page | 23
4) Site
Page | 24
training-set images in Lab-color space before and after
manual histogram changes.
Page | 25
3.1.3 Average Color Information
Here we get and normalize all of the color channel information, the
shape of the image array is (450, 600, 3), 3 are the 3 channels: Red, Blue
and Green! Taking the mean across axis= (0, 1) gives the mean for each
3 channels.
Page | 26
3.2 Data Processing
Page | 27
has null data as shown in and they are replaced by the median
values.
Page | 28
3.2.4 Data Augmentation
Deep neural networks perform better with large amount of data.
Aim of this step is to create images that depict the features of its
class in every possible angle. This makes sure that at whatever
angle the image may be taken, our trained model can predict it
with more precision.
Different techniques used for this are,
1) Randomly rotate the images in the range from 0 to 180
degrees
2) Randomly zoom images
3) Randomly flip images horizontally
4) Randomly flip images vertically
5) Randomly shift the images horizontally
6) Randomly shift the images vertically
Page | 29
Augmentation of images is done to deal with the problem of
skewed classes, overfitting, and training image scarcity. As can
be seen from the frequency table of classes, the NV class
dominates with approximately 67% of images in training data.
Hence, to balance the distribution various augmentation
techniques are implemented to increase the size of each class
Page | 30
3.3 Modeling
Convolutional Neural Networks are currently the most popular
and effective technique for image classification. In this project,
we aim to develop a CNN model for classifying Skin Lesion
images into 7 different classes of lesions. There are various
CNN models developed by companies like Google and
researchers based on ImageNet dataset. We have explored some
of these models by training them on ISIC 2018 Skin Lesion
Image dataset to verify whether they provide expected accuracy.
Moreover, we have developed custom models based on study of
various research papers. In this report, we have described all the
attempts made to develop a robust CNN model for classification.
Page | 31
were able to tweak proposed and pre-implemented models to
train them for our ISIC 2018 dataset.
The following is a detailed description of different attempts
made to develop an efficient model along with limitations of
each model.
Page | 32
Learning rate is initialized at 0.01 and Adam optimizer is used.
Learning rate decay is also used so that the learning rate will
halve whenever the validation accuracy plateaus for 3 epochs.
Baseline model is trained for a total of 30 epochs
Page | 33
The model give training accuracy of 78% with loss 0.56 and test
accuracy around 76% with loss 0.61
Page | 34
Even though there are some spikes in both the validation
accuracy and loss, we can still say that this particular model with
image augmentation is doing well
Training and validation accuracies are much similar now, which
proves that the model is not overfitting
Showing the main classification metrics using classification
report
Page | 35
3.3.2 VGG16
Even though there are many DCNNs model achieving better
result on ImageNet than VGG16, we choose to fine-tune
VGG16 given its simplicity. The best performing VGG16 net is
similar except that the third, fourth and fifth convolutional block
has 4 convolutional layers.
Page | 36
To fine-tune VGG16, the top fully-connected layers are
removed, and new fully-connected layers (consisting of: one
global max pooling layers, one fully connected layer with 512
units, one dropout layer with 0.5 rate, one softmax activation
layer for 7 types of skin lesions) for our classification tasks are
added, First, freeze all layers in VGG16, and perform feature
Page | 37
extraction for the newly added FC layers so that the weights for
these layers aren’t completely random and the gradient wouldn’t
be too large when we start fine-tuning. After 3 epochs of feature
extraction, we unfreeze the final convolutional block of VGG16
and start fine-tune the model for 20 epochs. Throughout the
training process, learning rate of0.001 and Adam optimizer are
used. The same data augmentation and learning rate decay
strategy as in baseline model is used.
The model give training accuracy of 86% with loss 0.36 and test
accuracy around 60% with loss 0.78
Page | 38
Show the changes in accuracy and loss training data and
validation data during training process as the epochs progress
Page | 39
Computing confusion matrix to evaluate the accuracy of a
classification.
3.3.3 Inception V3
The namesake of Inception v3 is the Inception modules it uses,
which are basically mini models inside the bigger model. The
inspiration comes from the idea that you need to make a
decision as to what type of convolution you want to make at
each layer: Do you want a 3×3? Or a 5×5? The idea is that you
don’t need to know ahead of time if it was better to do, for
example, a 3×3 then a 5×5. Instead, just do all the convolutions
Page | 40
and let the model pick what’s best. Additionally, this
architecture allows the model to recover both local feature via
smaller convolutions and high abstracted features with larger
convolutions.
Page | 41
The model give training accuracy of 80% with loss 0.56and test
accuracy around 76% with loss 0.66
Page | 42
Show the changes in accuracy and loss training data and
validation data during training process as the epochs progress
Page | 43
Computing confusion matrix to evaluate the accuracy of a
classification.
Page | 45
The model give training accuracy of 95% with loss 0.1 and test
accuracy around 85% with loss 0.6
Page | 46
We find that the model with image augmentation is doing well
with Training data having high accuracy but we have overfitting
with validation data.
Page | 47
Page | 48
3.4 Results
Test test
Model Accuracy Loss Depth Params
accuracy loss
Baseline 11
78% 0.56 76% 0.61 2,124,839
Model layers
23
VGG16 87% 0.36 78% 0.60 14,980,935
layers
Inception 315
80% 0.56 76% 0.66 22,855,463
V3 layers
Dense 711
95% 0.14 85% 0.62 19,309,127
Net 201 layers
Page | 49
continuing to decrease with epochs and validation loss decreases
and increasing again, where there is an increasing difference
between the training and validation loss. In other words, high
validation and low training error.
Page | 50
Advantages of using a TensorFlow Lite Model for on-device
Machine-Learning:
Page | 51
Power Consumptions: Efficient inference and lack of network
connectivity lead to low power consumption.
Page | 52
(dogs, cats, trees, sky, wood... etc.). We can develop it using
mode data and better algorithm
Page | 54
The accuracy for CNN model 95% in training and 85% in test.
Combination of the patient's metadata prevents the overfitting
that occurs in the CNN model using dermoscopic images only
and achieve better results.
Page | 55
Chapter 4
Deployment
&Technology
Page | 56
4.1.1 Tools
Software
Visual code: frame work of the implemented code
Firebase: cloud services from google used to save data
Languages:
Flutter: used in design user interface in mobile apps
Dart programming language: used in developing mobile apps on
multi platforms
Libraries:
Google maps: Google API to add maps to mobile app
Tflite: Flutter plugin for accessing TensorFlow Lite API.
Supports image classification
Image_picker: A Flutter plugin for iOS and Android for picking
images from the image library, and taking new pictures with the
camera.
Firebase_auth: Flutter plugin to allow use of firebase
authentication to
register and login users
Location: Flutter plugin to get current location of the user
Page | 57
4.1.2 Environment
CPU: We used CPU because the mobile application didn’t focus
on graphics or rendering images orvideos
4.2 Methods
Requirements
Stakeholders conduct an overall project assessment to determine
the time and resources required for the development process. At
the same stage, the owner assesses the risks and prioritizes the
various functions depending on their business value.
Page | 58
Design
The software owner meets with the software development team
and introduces them to the requirements outlined in the first
step. The group then discusses the sequence for introducing
functions and identifies the essential tools – the programming
language, syntax libraries, and basic frameworks. At the same
stage, software development teams can prototype the expected
user interface.
Each cycle includes testing, and the final product must also
undergo final testing. For this phase, you can use Scrum and the
Kanban methodology, the development process based on
individual tasks.
Page | 59
the developers will fix them immediately. At this stage, they
also collected consumer feedback.
Review
That is the last stage of the agile development cycle. After
completing all the previous stages of development, the
development team presents to the owner the result achieved in
meeting the requirements. After that, the agile software
development phases start over – either with a new iteration or
moving to the next stage and scaling Agile.
Page | 61
for a very complicated sales cycle ("Until iteration ends," is
not something clients like to hear)
The product lacks overall design, both from a UX and
architecture point of view, which leads to problems the
more you work on the product
Teams can get sidetracked into delivering new
functionalities at the expense of technical debt, which
increases the amount of unplanned work
Features that are too big to fit into one or even several
cycles are avoided because they don't fit in nicely into the
philosophy
You need a long-term vision for the product and actively
work on communicating it
Products lack cohesion, and the user journey is fragmented
because the design is fragmented. The more time passes,
the more disjointed the software ends up becoming
Short cycles don't leave enough time for the design
thinking process, so designers have to redevelop the
experience over and over due to negative feedback
Page | 63
Chapter 5
System requirements
& Designs
Page | 64
5.1 Functional Requirements
Functional Requirement is a summary of the function that the
program will deliver. Describes the software program or its
portion. Function is the input to the software system, its
behavior and outputs. It can be a measurement, data processing,
business method, user experience, or some other unique feature
that determines what role the program is likely to execute.
5.1.1 Login:
The system provides security features through username-
password matching where only authorized user can access the
system. We use firebase authentication to provide maximum
security.
Input:-Username, Password
Output: - Invalid or successfully logged in
5.1.2 Register:
This allows healthy public to register as donor, seeker or blood
Bank itself.
Input: Name, Email Address. Password, Contact Number
Output: - Successfully Registered.
Page | 65
5.1.3 Make Test
This function is for patient, in this function the user can make
request for making skin cancer test using his personal image and
metadata. Once he click this Tflite library make classification
using model which is pretrained
Page | 66
5.2.1 Availability
The app are available at all times, meaning the user can access it
using application.
5.2.2 Reliability
As the app provide the right tools for problem solving it is made
in such a way that the app is reliable in its operations and for
securing the sensitive details
5.2.3 Performance:
Our App didn’t take more than few seconds if there is a good
internet connection.
Page | 67
L
Page | 68
5.3.2 Activity Diagram:
Activity diagram is structure step-by - step process. Comprising
system flow and user interaction with system is helpful. The
diagram shows how user enters the system interface and
executes actions. This minimizes the risk of in-process
duplication
Page | 69
Chapter 6
Application Design
Page | 70
6.1.1 Splash screen
Page | 71
6.1.2 Signup
Page | 72
6.1.3 Login
Page | 73
6.2.1 Main page
Page | 74
6.2.2 Test main page
Page | 75
6.2.3 Info for using app
Page | 76
6.2.4 Image selection
Page | 77
6.2.5 Display selected image
Page | 78
6.2.6 Select affected area position
Page | 79
6.2.7 Select affected area position
Page | 80
6.2.8 Select affected area size
Page | 81
6.2.9 Select duration of injury
Page | 82
6.2.10 Select if it is itch or no
Page | 83
6.2.11 Select if having fever or not
Page | 84
6.2.12 Select affected area shape
Page | 85
6.2.13 Select affected area color
Page | 86
6.2.14 Select type of tissue damage
Page | 87
6.2.15 Final result
Page | 88
6.3.1 Find doctor
Page | 89
6.3.2 Find doctor
Page | 90
6.3.3 Find doctor
Page | 91
6.3.4 Find doctor
Page | 92
6.4.1 Diseases main page
Page | 93
6.4.2 Skin cancer info page
Page | 94
6.4.3 Benign Keratosis info page
Page | 95
6.4.4 Vascular Lesion info page
Page | 96
6.4.5 Melanoma info page
Page | 97
6.4.6 Melanocytic Nevus info page
Page | 98
6.4.7 Dermatofibroma info page
Page | 99
6.4.7 Actinic Keratosis info page
Page | 100
6.4.8 Basal Cell Carcinoma info page
Page | 101
6.5.1 History page
Page | 102
6.5.2 History page
Page | 103
6.6 About developer’s page
Page | 104
Chapter 7
Testing & evaluation
Page | 105
7.1 Testing & Evaluation
Testing is an essential step in this program as we can find issues
in testing, and our framework in general has problems. We
checked every step in our application, and we would check each
step, as I described before to achieve the project goal, our
strategy was gradual and iterative. There are various check
forms that you can use to ensure that code changes function as
intended. However, not everyone’s testing is the same.
Page | 106
7.1.3 Functional testing
Functional testing rely on the application's market
specifications. You just test the results of an operation and do
not track the system intermediate state during this operation.
Sometimes there is a discrepancy between integration testing
and functional tests, as they both tend to communicate with
multiple elements. The distinction is that an integration test will
only verify whether the database can be queried while a practical
test is required to derive a particular value from the database as
specified by the software specifications.
Page | 107
7.2.1 Login
Test Name Login
Test Scenario Login page form
Test Case Description Empty email or password field
Pre-requisites Email:[email protected]
Password:1234567
Test Input Nothing to write
Execution click on (sign in) button
Message show “please enter
email”,
Password must at least 7 digits
will appear.
check the empty fields in
email
Expected behavior An error toast message
contains “Empty Fields” will
appear
Assumptions Null
Actual Result
Page | 108
7.2.1 Register
Test Name Register
Test Scenario Register page form
Test Case Description Missing fields
Pre-requisites Null
Test Input Nothing to Entered
Execution Click “next” button
Errors on the empty fields will
appear with read text.
Start checking empty fields
and fill them with information
needed.
Expected behavior Focused errors on the empty
fields will
Appear with red labels.
Assumptions Design GUI will be tested in
alone
Scenario or as a test scenario.
Actual Result
Page | 109
7.2.1 Make test
Test Name Make test
Test Scenario Make test page form
Test Case Description Enter an image for no human
skin body
Pre-requisites Valid image for skin
Test Input Nothing to write
Execution - Click on processed
button.
- Warning dialog show
“Please enter an valid
image for human skin
body or continue anyway
”
Expected behavior An error toast message
contains “Invalid image”
Assumptions Null
Actual Result
Page | 110
7.2.2 Find doctor
Test Name Find doctor
Test Scenario Find doctor page form
Test Case Description Enter an invalid location
Pre-requisites Valid location
Test Input Nothing to write
Execution Click on processed button.
Warning dialog show “Please
enter an valid location for”
Expected behavior An error toast message
contains “Invalid location”
Assumptions Null
Actual Result
Page | 111
Chapter 8
Conclusion & Future Work
Page | 112
8.1 Conclusion
This work involved a novel method involving deep learning
algorithm for skin lesion type identification based on image
data. This introduces a new method to identify lesion type
before medical diagnosis and helps the medical staff to diagnose
the type predicted by the model first. This reduces a lot of time
and effort. This model uses a Convolution Neural Network
(CNN) within a Tensor flow framework. For the specific cancer
types the accuracy ranges from 88% to 100%. And the overall
accuracy of the model is 95%.
Compared to traditional medical diagnosis this method is better
in two ways. First. This method will not be influenced by
diagnostic medical instruments that is error in the instruments
can occur during medical diagnosis and this will not have any
effect in this method if the images are of good quality. With
more and more cancer cases our model becomes more and more
powerful unlike medical instruments which has wear and tear.
Second, this method does not depend on stage of cancer and the
cancer can be detected even in an early stage. But some medical
diagnosis can detect some types of skin cancer only when it
reaches advanced stage and this does not occur with this model.
If among seven types, we add one more class which is non-
malignant cancer type and then train the model, our model can
even detect whether it is malignant or not and also tells the type
of cancer.
Page | 113
This model may have some limitations like the prediction
probability cannot be 100%. But it provides a good basis for
further diagnosis and will be very helpful. The CNN model with
metadata can increase the accuracy of classification in skin
cancer detection even with limited data and is promising for
development as a screening device in remote and low resources
health care.
Page | 114
The skin cancer detection app places the control in the palm of
your hand to save lives. To developing our app and make it
accessible and more efficient we target a lot of plans:
1- Connect the application to a cloud database so that we can
see a large amount of data and improve the accuracy
2- Allows you to contact the doctor directly from the
application
3- Sending the patient’s data to the personal doctor on an
ongoing basis
4- Send alerts to the patient to perform a periodic examination
to ensure his safety
5- Make our own application that supports different social
groups
6- Adding more diseases and not just 7 to get better results
Page | 115
References
https://github.com/datascisteven/Melanoma-Image-
Classification
https://github.com/ashishpatel26/Skin-Lesions-Detection-Deep-
learning
https://www.kaggle.com/code/jagdmir/siim-melanoma-
classification-modelling/notebook#Some-insights-about-the-
training-and-testing-data
https://www.kaggle.com/code/sid321axn/step-wise-approach-
cnn-model-77-0344-accuracy#Step-11:-Model-Building
https://www.kaggle.com/code/jagdmir/all-you-need-to-know-
about-cnns
https://github.com/Geeky-star/Skin-Cancer-Detection-App
https://github.com/MoatazMaher1998/Skin-Cancer-Detection-
Mobile-App
https://github.com/DefineDan/ml-skin-cancer-classification-app
https://github.com/datascisteven/Melanoma-Image-
Classification
https://github.com/ruoyzhang/Skin_Cancer_Detection_with_Gra
dCam
https://github.com/Tirth27/Skin-Cancer-Classification-using-
Deep-Learning
https://github.com/sj-singh/DL_Melanoma_Detection
Page | 116
https://github.com/SwagatSBhuyan/Skin-Cancer-Classification-
Using-CNN-Deep-Learning-Algorithm
https://github.com/AakashKumarNain/skin_cancer_detection
https://www.skincancer.org/skin-cancer-information/
https://www.skincancerpractice.com.au/skin-cancer/introduction
https://towardsdatascience.com/building-a-skin-lesion-
classification-web-app-16fd2c422b9d
https://www.medrxiv.org/content/10.1101/2020.05.03.20072454
v1.full.pdf
THANK
VATICAN - 2022
Page | 117