AI-Based Early Detection of Brain Tumors
AI-Based Early Detection of Brain Tumors
Faculty of Engineering
Department of Electrical Communication and Electronics
Systems
A Graduation Project
Submitted in Partial Fulfillment of B.Sc. Degree
Requirements in Electrical and Computer Engineering
Part II
Prepared By
Supervised By
Dr. Mohamed Saeed
2022-2023
TABLE OF CONTENTS
Page
TABLE OF CONTENTS I
List of Tables III
List of Figures IV
List of Abbreviations VI
Acknowledgment VII
Abstract VIII
Chapter I 1
INTRODUCTION 1
1.1 Problem Definition 1
1.2 Applied System 2
1.3 Main Objectives 3
1.4 Methodology 4
1.5 Software 5
1.6 Report organization 5
Chapter II 6
Brain Cancer Detection Survey 6
2.1 Introduction 6
2.1.1 Research Challenges 6
2.1.2 Related Problems 8
2.1.3 Data Collection 8
2.1.4 Contribution of this survey 9
2.2 Deep Learning Based Brain Tumor Segmentation Methods 10
2.2.1 Convolutional Neural Network Based Methods 11
2.2.2 Recurrent Neural Network Based 15
2.2.3 Deep Generative Model Based 16
2.3 Object Detection Methods 18
2.3.1 Region-based Convolutional Neural Networks(R-CNN): 19
2.3.2 Faster R-CNN: 20
2.3.3 YOLO(You only Look Once): 21
2.3.4 Single Shot Detector(SSD): 22
Chapter III 24
Proposed Early Detection of Brain Cancer Using AI. 24
I
3.1 Block Diagram 24
3.2 Hardware Tools 25
3.2.1 Nvidia Jetson Xavier NX 25
3.2.2 Raspberry Pi 4 27
3.2.3 Google Coral Dev Board 29
3.2.4 Rock Pi N10 31
3.2.5 HiKey 970 33
3.3 Software Tools 34
3.3.1 Python 34
3.3.2 OpenCV 36
3.3.3 Tensor Flow 37
3.3.4 Py Torch 37
Chapter IV 39
System Design 39
4.1 Top Level Circuit 39
4.1.1 Image processor Module: 39
4.2 Algorithms 39
4.2.1 Training Algorithm 39
4.2.2 Detecting and Recognition Algorithm 41
4.3 Summary 42
Chapter V 44
Implementation and Testing 44
5.1 Hardware implementation 44
5.1.2 Problem encountered 44
5.2 Software implemented 44
5.2.1 Operating System on a Raspberry Pi 44
5.2.2 Brain Tumor Training 47
5.2.2 Brain Tumor Recognition 52
Chapter VI 62
COST ANALYSIS 62
Chapter VII 63
TIME PLAN 63
Chapter VIII 64
CONCLUSION AND FUTURE WORK 64
8.1 Conclusion 64
8.2 Future Work 65
II
List of Tables
Page
Table 2.1 Comparison of CNN Based Methods 15
Table 2.2: Comparison of RNN Based Methods 18
Table 2.3: Comparison of R-CNN Vs Fast R-CNN Vs Faster R-CNN 21
Table 6.1 Cost Analysis 62
Table 7.1 Time Plan 63
III
List of Figures
Page
Fig. 1.1: Detection of Brain Cancer Flow Char 4
Fig. 2.1: Challenges in segmenting brain glioma tumors, glioma tumor
exemplars, statistical information of the training set [11] 7
Fig. 2.2: Data Collection for Brain Tumours [18] 9
Fig. 2.3: A taxonomy of this survey for brain tumour segmentation [20] 10
Fig. 2.4: A sketch comparison brain tumor segmentation algorithms [21] 11
Fig. 2.5: Convolutional Neural Network [20] 11
Fig. 2.6: Fully Convolutional Neural Network Based [25] 12
Fig. 2.7: Fully Convolutional Neural Network Based [26] 14
Fig. 2.8: Recurrent Neural Network Based [27] 16
Fig. 2.9: Generative Adversarial Networks [30] 17
Fig. 2.10: Auto-Encoders [30] 17
Fig. 2.11: Object Detection example [21] 18
Fig. 2.12: R-CNN Architecture 20
Fig. 2.13: Faster R-CNN Architecture 20
Fig. 2.14: YOLO Architecture 22
Fig. 2.15: Accuracy vs speed chart 23
Fig. 2.16: YOLO vs SSD vs Faster-RCNN for various sizes 23
Fig. 3.1: Train and Testing block diagram 24
Fig. 3.2: Nvidia Jetson Xavier NX [32] 26
Fig. 3.3: Raspberry Pi 4 [32] 27
Fig. 3.4: Google Coral Dev Board [32] 29
Fig. 3.5: Rock Pi N10 [32] 31
Fig. 3.6: HiKey 970 [32] 33
Fig. 3.7: Python Logo 34
Fig. 3.8: Open Source Computer Vision Library Logo 36
Fig. 3.9: Tensor Flow Library 37
Fig. 3.10: Py Torch Library 37
Fig. 4.1: Raspberry Pi 4 Image processor Unit 39
Fig. 4.2: Training Algorithm 40
Fig. 4.3: Detecting and Recognition Algorithm 42
Fig. 5.1: Hardware 44
Fig. 5.2: Raspberry Pi Imager 45
Fig. 5.3: Select the OS 45
Fig. 5.4: Raspberry Pi 4 OS view 46
IV
Fig. 5.5: OpenCV integrate with Python 3 47
Fig. 5.6: TensorFlow integrate with Python 3 47
Fig. 5.7: Training images for different types of Brain tumors 48
Fig. 5.8: Glioma Brain Tumor Manual Annotation example 49
Fig. 5.9: Meningioma Brain Tumor Manual Annotation example 49
Fig. 5.10: Pituitary Brain Tumor Manual Annotation example 50
Fig. 5.11: Loss Graph 51
Fig. 5.12: Accuracy Graph 51
Fig. 5.13: Confusion Matrix on Test set 52
Fig. 5.14: Brain Tumour Recognition Result 1 54
Fig. 5.15: Brain Tumour Recognition Result 2 55
Fig. 5.16: Brain Tumour Recognition Result 3 55
Fig. 5.17: Brain Tumour Recognition Result 4 56
Fig. 5.18: Brain Tumour Recognition Result 5 57
Fig. 5.19: Brain Tumour Recognition Result 6 57
Fig. 5.20: Brain Tumour Recognition Result 7 58
Fig. 5.21: Brain Tumour Recognition Result 8 59
Fig. 5.22: Brain Tumour Recognition Result 9 59
Fig. 5.23: Brain Tumour Recognition Result 10 60
Fig. 5.24: Brain Tumour Recognition Result 11 60
Fig. 5.25: Brain Tumour Recognition Result 12 61
V
List of Abbreviations
AD Alzheimers Disease
AEs Auto-Encoders
AI Artificial Intelligence
CAD Computer Aided Diagnostic
CNN Convolutional Neural Network
CNS Central Nervous System
FCM Fuzzy C-means
FCNs Fully Convolutional Networks
GAN Generative Adversarial Network
HGG High-Grade Glioma
I/O Input/Output
ISLES Ischemic Stroke Lesion Segmentation Challenge
KNN K-Nearest Neighbor
LGG Low-Grade Glioma
LSTM Long Short-Term Memory
MCI Mild Cognitive Impairment
MLP Multilayer Perceptron
MRI Magnetic Resonance brain Images
OS Operating System
RNNs Recurrent Neural Networks
SBCs Single-Board Computers
SoC System-on-Chip
SVM Support Vector Machine
WHO World Health Organization
VI
Acknowledgment
VII
Abstract
More than 150 types of brain tumor have been documented on the basis of
an aggravating task when there is a large amount of data present to be assisted. Brain
tumors have high diversity in appearance and there is a similarity between tumor and
normal tissues and thus the extraction of tumor regions from images becomes
unyielding.
In this project, a proposed method is used to extract brain tumor from 2D Magnetic
Resonance brain Images (MRI) by Convolution Neural Network algorithm which was
experimental study will be carried on a real-time dataset with diverse tumor sizes,
locations, shapes, and different image intensities. The project will be able to detect the
brain tumor size and location using the auto encoder technique artificial intelligence
image processing for the MRI. Also, the system will classify the brain tumor type
from three types (Glioma, Meningioma, and Pituitary). The training dataset is
achieved after data collection for 1000 sample for each type for brain tumor. The
detection and recognition for the brain tumor is achieved using OpenCV, and
Tensorflow software tools. Moreover, the project will be delivered using compact
recognition accuracy for the human brain tumor with 92% because it yields to a better
VIII
Chapter I
INTRODUCTION
1
Hence, early detection of brain tumors can play an indispensable role in improving
the treatment possibilities, and a higher gain of survival possibility can be
accomplished. But manual segmentation of tumors or lesions is a time consuming,
challenging and burdensome task as a large number of MRI images are generated in
medical routine. MRI, also known as Magnetic Resonance Imaging is mostly used for
a brain tumor or lesion detection. Brain tumor segmentation from MRI is one of the
most crucial tasks in medical image processing as it generally involves a considerable
amount of data. Moreover, the tumors can be ill-defined with soft tissue boundaries.
So it is a very extensive task to obtain the accurate segmentation of tumors from the
human brain.
2
algorithm successfully and accurately extracted the tumor region from brain MRI
brain images [8].
Roy et al (2012) calculated the tumor affected area for symmetrical analysis. They
showed its application with several data sets with different tumor size, intensity and
location. They proved that their algorithm can automatically detect and segment the
brain tumor. MR images gives better result compare to other techniques like CT
images and X-rays.. Image pre-processing includes conversion of RGB image into
grayscale image and then passing that image to the high pass filter in order to remove
noise present in image [9].
B. Sathya et al (2011), proposed four clustering algorithm; k mean, improved k
mean, c mean and improved c mean algorithm. They did an experimental analysis for
large database consisting of various images. They analyzed the results using various
parameters.
Hui Zhang et al (2008), compared subjective and supervised evaluation
methodology for image segmentation. Subjective evaluation and supervised
evaluation, are infeasible in many vision applications, so unsupervised methods are
necessary. Unsupervised evaluation enables the objective comparison of both
different segmentation methods and different parameterizations of a single method
[10].
Martial Heber et al (2005), presented an evaluation of two popular segmentation
algorithms, the mean shift-based segmentation algorithm and a graph-based
segmentation scheme.
3
8. Evaluate the tumor classification for benign, and malign.
1.4 Methodology
The Detection of Brain Cancer Flow Chart in Figure 1.1 will start by:
• Importing the MR image of the human brain to the image processing board.
• Apply Image preprocessing for the human brain MR image.
• Apply image segmentation for different human brain MR image.
• Apply feature extraction and selection for the human brain MR images.
4
• Decide in the tumor Classification either the human brain MR image:
o The image is benign
o The image is Malign
• Finally display the result over the image imported.
• The flow chart end.
1.5 Software
1 Raspberry Pi 4
2 OpenCV
3 TensorFlow
4 Jupiter Notebook
5 Deep learning
6 Spyder IDE.
In Chapter 3, proposed system, and the main components are presented and
illustrated to define the functionality of these component in the project.
In Chapter 4, discuss the cost analysis of the project prototype that will be built.
Finally, the main conclusions of this project and the future work plan are discussed
in Chapter 6.
5
Chapter II
Brain Cancer Detection Survey
2.1 Introduction
This introduction, will present the research challenges, Related Problems, Data
Collection, and Contribution of this survey.
Location Uncertainty:
Glioma is mutated from gluey cells, which is a kind of supportive cell surrounding
nerve cells. Due to the wide spatial distribution of gluey supportive cells, either High-
Grade Glioma (HGG) or Low-Grade Glioma (LGG) can appear at any location inside
the brain.
Morphological Uncertainty:
Differ from a rigid object, the morphology, e.g. shape and size, of different
patients’ brain tumors can vary with large uncertainty. As the external layer of a brain
tumor, or edema tissues, show different fluid structures, which barely provide any
prior information for describing the tumor shapes. The subregions of a tumor may
also vary in shape and size.
6
classified. This limits the automated algorithms to extract sufficient information for
further processing.
Annotation Bias:
Imbalanced Issue:
As the examples are shown in Fig. 2.1 (b) and (c), there exists an unbalanced
number of voxels in different tumor regions. For example, the NCR/ECT region is
much smaller than the other two regions. The imbalanced issue can affect the learning
algorithm as well, as the extracted features may be highly dominated by large tumor
regions.
Fig. 2.1: Challenges in segmenting brain glioma tumors, glioma tumor exemplars,
statistical information of the training set [11].2
7
2.1.2 Related Problems
There are a number of unsolved problems in brain tumor segmentation. Brain
tissue segmentation or anatomical brain segmentation aims to label each voxel or
pixel into a unique brain tissue class. This segmentation assumption is that the brain
image does not contain any tumor tissue or other anomalies [12], [13]. The goal of
white matter lesion segmentation is to segment the white matter region from the
normal tissue. The white matter lesion itself does not contain sub-regions such as
necrotic and cores, where segmentation may be achieved based on binary
classification methods. Tumor detection aims to detect abnormal tumors or lesion
tissues and report the predicted class of each tissue.
This returns the bounding box as the detection result and the label as the classified
result [14], [15], [16]. It is worth mentioning that some research works with the words
“brain tumor detection” only return the bounding box of the tumor tissue as the
detection result. Some research methods return the single label segmentation mask or
the center of the tumor core as the point of interest without performing further
reasoning and segmentation. In this chapter, we focus on glioma tumor segmentation
and sub-region voxel (or pixel) level segmentation. Disorder diagnosis is to extract
pre-defined features from brain scan images and then classify feature representations
into pre-specified disorders such as High-Grade-Glioma (HGG) vs Low-Grade-
Glioma (LGG), Mild Cognitive Impairment (MCI) [17], Alzheimers Disease (AD)
[18] and Schizophrenia [19]. Disorder diagnosis relies on classification algorithms
that do not normally need segmentation masks. Survival Prediction concerns
identifying tumors’ patterns and activities [20] in order to predict the survival rate of a
patient [21]. Survival prediction normally returns a survival rate as a supplementary
of the clinical diagnosis, which can be regarded as the down-stream regression task of
tumor segmentation or disease diagnosis.
(3) discuss the challenges, open issues and potential working perspectives for deep
learning-based brain tumor segmentation.
Fig. 2.3: A taxonomy of this survey for deep learning-based brain tumour segmentation
[20].4
10
Fig. 2.4: A sketch comparison between traditional and deep learning based brain tumor
segmentation algorithms [21].5
11
2.2.1.1 Single-Path and Multi-Path CNN:
Single path neural networks contain a Single path neural networks contain a single
flow of data processing where the network starts to sample the input image with
convolutional layers. This is followed by the pooling layer and non-linear rectifier
layers [22]. In [23] use single-path networks due to computational efficiency.
Compared with single-path networks, multi-path convolutional neural networks can
extract different features from different processing pathways with different scales.
The extracted features are then combined or concatenated together for further
processing. A common interpretation is that the path with a large scale kernel can
learn features from a larger reception field known as global features.
2.2.1.2 Fully Convolutional Based:
In the early stage of using CNNs for image classification, the final layer is a fully
connected layer that produces a single value. The output of the final fully connected
layer can be interpreted as the predicted label with the highest probability. Long et al.
[24] introduced fully convolutional networks which use a deconvolutional layer to
replace the final fully connected layer and predict segmentation masks directly. In the
fully convolutional networks, the final fully connected layer is replaced by the
deconvolutional layer for up-sampling that transforms the down-sampled feature map
back to the original spatial size. FCNs therefore can be trained in an image-to-
segmentation map fashion and have computational efficiency over the CNN patch
classifiers. One well recognized variant of FCNs, known as U-Net [25] and its related
usage on brain tumor segmentation will be discussed later.
12
2.2.1.3 Cascaded CNN:
13
Fig. 2.7: Fully Convolutional Neural Network Based [26].8
2.2.1.4 Summary:
14
training a single end-toend network. Selected CNNs based methods comparison is
shown in Table 2.1.
15
Fig. 2.8: Recurrent Neural Network Based [27].9
16
Fig. 2.9: Generative Adversarial Networks [30].10
2.2.3.2 Auto-Encoders:
2.2.3.3 Summary:
As you can see that the object can be of varying sizes. To solve this problem an
image pyramid is created by scaling the image.Idea is that we resize the image at
multiple scales and we count on the fact that our chosen window size will completely
contain the object in one of these resized images. Most commonly, the image is
downsampled(size is reduced) until certain condition typically a minimum size is
reached. On each of these images, a fixed size window detector is run. It’s common to
have as many as 64 levels on such pyramids. Now, all these windows are fed to a
18
classifier to detect the object of interest. This will help us solve the problem of size
and location.
19
Fig. 2.12: R-CNN Architecture.13
20
To handle the variations in aspect ratio and scale of objects, Faster R-CNN
introduces the idea of anchor boxes. At each location, the original paper uses 3 kinds
of anchor boxes for scale 128x 128, 256×256 and 512×512. Similarly, for aspect ratio,
it uses three aspect ratios 1:1, 2:1 and 1:2. So, In total at each location, we have 9
boxes on which RPN predicts the probability of it being background or foreground.
We apply bounding box regression to improve the anchor boxes at each location. So,
RPN gives out bounding boxes of various sizes with the corresponding probabilities
of each class. The varying sizes of bounding boxes can be passed further by apply
Spatial Pooling just like Fast-RCNN. The remaining network is similar to Fast-
RCNN. Faster-RCNN is 10 times faster than Fast-RCNN with similar accuracy of
datasets like VOC-2007. That’s why Faster-RCNN has been one of the most accurate
object detection algorithms. Here is a quick comparison between various versions of
RCNN.
YOLO divides each image into a grid of S x S and each grid predicts N bounding
boxes and confidence. The confidence reflects the accuracy of the bounding box and
whether the bounding box actually contains an object(regardless of class). YOLO also
predicts the classification score for each box for every class in training. You can
combine both the classes to calculate the probability of each class being present in a
predicted box.
So, total SxSxN boxes are predicted. However, most of these boxes have low
confidence scores and if we set a threshold say 30% confidence, we can remove most
of them as shown in the example below.
21
Fig. 2.14: YOLO Architecture.15
Notice that at runtime, we have run our image on CNN only once. Hence, YOLO
is super fast and can be run real time. Another key difference is that YOLO sees the
complete image at once as opposed to looking at only a generated region proposals in
the previous methods. So, this contextual information helps in avoiding false
positives. However, one limitation for YOLO is that it only predicts 1 type of class in
one grid hence, it struggles with very small objects.
That’s a lot of algorithms. Which one should you use? Currently, Faster-RCNN is
the choice if you are fanatic about the accuracy numbers. However, if you are
strapped for computation(probably running it on Nvidia Jetsons), SSD is a better
recommendation. Finally, if accuracy is not too much of a concern but you want to go
super fast, YOLO will be the way to go. First of all a visual understanding of speed vs
accuracy trade-off:
22
Fig. 2.15: Accuracy vs speed chart.16
SSD seems to be a good choice as we are able to run it on a video and the accuracy
trade-off is very little. However, it may not be that simple, look at this chart that
compares the performance of SSD, YOLO, and Faster-RCNN on various sized
objects. At large sizes, SSD seems to perform similarly to Faster-RCNN. However,
look at the accuracy numbers when the object size is small, the gap widens.
23
Chapter III
Proposed Early Detection of Brain Cancer
Using AI.
3.1 Block Diagram
The block diagram of training and testing phase are presented in Figure 3.1, the
training phase will be built by importing the train images for the brain MRI. The
second block will operate preprocessing task to equalize the histogram of the gray
image. The third block will get the feature extraction that are in the MRI images of
the human brain. The fourth block will operate a classification task for Glioma,
Meningioma, Pituitary.
The other phase is testing phase, the first block is used to import the test images of
the human brain MRI, then the second block will be used to operate preprocessing of
the image, the third block will operate feature extraction to get the features to identify
in the last block the image of the MRI.
24
3.2 Hardware Tools
In this section, the hardware that can be used in our project will be presented .
Where once artificial intelligence (AI) was relegated to supercomputers, now makers
at home may dabble with AI applications. The likes of Google AIY Vision and Voice
kits enable do-it-yourselfers (DIYers) and hobbyists to create artificial intelligence
applications from the comfort of their own homes. Similarly, single-board computers
(SBCs) have become increasingly powerful, to the point where many development
boards are capable of AI use such as machine learning and natural language
processing. Check out the best single-board computers for artificial intelligence!
25
Fig. 3.2: Nvidia Jetson Xavier NX [32].19
Pros:
• AI-capable - handles machine learning, natural language processing, and
more
• Great for robotics
• Excellent for desktop use
• Fantastic for high-end retro gaming emulation
• Great I/O - Wi-Fi, Bluetooth, USB 3.1, GPIO, HDMI/DisplayPort
• Up to 21 TOPS of computer power
• 4K video output
• Small form factor
Cons:
• Expensive
• Larger than Raspberry Pi and its alternatives
26
Nvidia Jetson Xavier NX specs:
• CPU: 6-core NVIDIA Carmel 64-bit ARMv8.2 @ 1400MHz* (6MB L2 +
4MB L3)
• GPU: 384-core NVIDIA Volta @ 1100MHz with 48 Tensor Cores
• Dual NVIDIA Deep Learning Accelerator (NVDLA) engines
• 8GB 128-bit LPDDR4x @ 1600MHz | 51.2GB/s
• 16GB eMMC
• x DisplayPort 1.4, eDP 1.4, HDMI 2.0 @4Kp60
• 10/100/1000 BASE-T Ethernet
• USB 3.1, 3 x USB 2.0
3.2.2 Raspberry Pi 4
27
What's more, a slew of third-party accessories transforms the Pi 4 into an excellent
AI device. The Intel Neural Compute Stick 2 can be plugged into the Raspberry Pi 4
and provides an artificial intelligence framework via USB connectivity. Alternatively,
the Coral Edge TPU USB accelerator pairs well with the Pi. And Google offers its
AIY Vision and Voice kits that enable at-home makers to tinker with artificial
intelligence, building neat projects ranging from object identification systems to
autonomous vehicles. With an ultra-affordable price tag and a plethora of AI
accessories such as the Intel Neural Compute Stick and Google AIY kits, the
Raspberry Pi 4 is the best single-board computer for artificial intelligence for most
makers.
Pros:
• Versatile
• Affordable
• Several different RAM options
• Easy to use
• Excellent price-to-performance ratio
• Small footprint
• Low power draw
• Great OS compatibility - Linux, Android, Chrome OS, non-Linux OSes
Cons:
• Not a true desktop replacement
• More powerful SBCs available
Raspberry Pi 4 specs:
• Broadcom BCM2711, Quad-core Cortex-A72 (ARM v8) 64-bit SoC @
1.5GHz
• 1GB, 2GB, 4GB, or 8GB LPDDR4-2400 SDRAM (depending on model)
• 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE
• Gigabit Ethernet
• USB 3.0 ports; 2 USB 2.0 ports.
• Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with
previous boards)
• × micro-HDMI ports (up to 4kp60 supported)
• 2-lane MIPI DSI display port
28
• 2-lane MIPI CSI camera port
• 4-pole stereo audio and composite video port
• H.265 (4kp60 decode), H264 (1080p60 decode, 1080p30 encode)
• OpenGL ES 3.0 graphics
• MicroSD card slot for loading operating system and data storage
• 5V DC via USB-C connector (minimum 3A*)
• 5V DC via GPIO header (minimum 3A*)
• Power over Ethernet (PoE) enabled (requires separate PoE HAT)
• Operating temperature: 0 – 50 degrees C ambient
The Google Coral Dev Board is a nifty SBC for quick, easy edge computing
prototyping. There's a removable system-on-module and two tera operations per
second 9TOPS) per watt, both of which make the Coral Dev Board suitable for low-
cost AI DIYing. At its core is an NXP i.MX 8M system-on-a-chip (SoC) with an
integrated GC7000 Lite GPU. And of course, there's the Google Edge TPU co-
processor, 8GB of eMMC flash storage, 1GB of LBDDR4 RAM, plus Wi-Fi and
Bluetooth. The Google Coral Dev Board functions for industrial AI applications, and
with a low power draw, it's easily scalable. Documentation of the Coral Dev Board as
well as its Mendel operating system (OS) is top-notch. You'll find ample official and
29
third-party resources such as help documents and sample projects. Plus, add-ons such
as the Coral Camera allow for a modular experience. However, it's probably best for
artificial intelligence enthusiasts with an intended purpose rather than curious
newcomers. If you're merely interested in learning more about AI through hands-on
experience, a Raspberry Pi 4 plus the Google Coral USB TPU accelerator is a better
starting spot.
Pros:
• On-device machine learning with Edge TPU
• Powerful quad-core Cortex A-53 SoC
• 1GB DDR4
Cons:
• Expensive
• Not capable of desktop use
Google Coral Dev Board specs:
• CPU: NXP i.MX 8M SOC (quad Cortex-A53, Cortex-M4F)
• GPU: Integrated GC7000 Lite Graphics
• Onboard Google Edge TPU
• 1GB LPDDR4
30
3.2.4 Rock Pi N10
32
3.2.5 HiKey 970
33
• Great connectivity - Gigabit Ethernet, GPS, PCIe gen2
• Dedicated NPU for AI
• Capable of AI, deep learning, robotics, and more
Cons:
• Expensive
Hikey 970 specs:
• Dimensions - 100 mm x 85 mm x 10 mm
• ARM Cortex A53, ARM Cortex A73
• Operating Supply Voltage - 12 V
• Tool Is For Evaluation Of - Kirin 970 SoC
• 6GB LPDDR4 RAM
• 64GB UFS storage
• Gigabit Ethernet
• GPS
• PCIe gen2
• Dedicated NPU
3.3 Software Tools
In this section we will discus the software that can be used in the project such as
Python, Opencv, TensorFlow, and Pytorch.
3.3.1 Python
Python is an object-oriented programming language that is designed in C. By
nature, it is a high-level programming language that allows for the creation of both
simple as well as complex operations. Along with this Python comes inbuilt with a
wide array of modules as well as libraries which allows it to support many different
programming languages like Java, C, C++, and JSON.
34
1. Easy Language
Python is an easy language. It is easy to read, write, learn and understand. Python
has a smooth learning curve. It is easy to learn. Python has a simple syntax and
Python code is easy to understand. Since it’s easy to understand, you can easily read
and understand someone else’s code. Python is also easy to write because of its
simple syntax. Because it is an easy language, it is used in schools and universities to
introduce students to programming. Python is for both startups and big companies.
2. Readable
The Python language is designed to make developers life easy. Reading a Python
code is like reading an English sentence. This is one of the key reason that makes
Python best for beginners. Python uses indentation instead of curly braces, unlike
other programming languages. This makes the code look clean and easier to
understand.
3. Interpreted Language
Python is an interpreted language. It comes with the IDLE (Interactive
Development Environment). This is an interpreter and follows the REPL structure
(Read-Evaluate-Print-Loop). It executes and displays the output of one line at a time.
So it displays errors while you’re running a line and displays the entire stack trace for
the error.
4. Dynamically-Typed Language
Python is not statically-typed like Java. You don’t need to declare data type while
defining a variable. The interpreter determines this at runtime based on the types of
the parts of the expression. This is easy for programmers but can create runtime
errors.
5. Object-Oriented
Python is object-oriented but supports both functional and object-oriented
programming. Everything in Python is an object. It has the OOP (Object-oriented
programming) concepts like inheritance and polymorphism.
6. Popular and Large Community Support
Python has one of the largest communities on StackOverflow and Meetup. If you
need help, the community will answer your questions. They also already have many
answered questions about Python.
7. Open-Source
35
Python is open-source and the community is always contributing to it to improve
it. It is free and its source code is freely available to the public. You can download
Python from the official Python Website.
8. Large Standard Library
The standard library is large and has many packages and modules with common
and important functionality. If you need something that is available in this standard
library, you don’t need to write it from scratch. Because of this, you can focus on
more important things. You can also install packages from the PyPI (Python Package
Index) if you want even more functionality.
9. GUI Support
You can use Python to create GUI (Graphical User Interfaces). You can use
tkinter, PyQt, wxPython or Pyside for this. Python features a huge number of GUI
frameworks available for it to variety of other cross-platform solutions. It binds to
platform-specific technologies.
3.3.2 OpenCV
OpenCV is written in C++ and its primary interface is in C++, but it still retains a
less comprehensive though extensive older C interface. All of the new developments
and algorithms appear in the C++ interface. There are bindings in Python, Java and
MATLAB/OCTAVE. The API for these interfaces can be found in the online
documentation. Wrappers in several programming languages have been developed to
encourage adoption by a wider audience. In version 3.4, JavaScript bindings for a
selected subset of OpenCV functions was released as OpenCV.js, to be used for web
platforms.
36
3.3.3 Tensor Flow
TensorFlow is Google Brain's second-generation system. Version 1.0.0 was
released on February 11, 2017. While the reference implementation runs on single
devices, TensorFlow can run on multiple CPUs and GPUs (with optional CUDA and
SYCL extensions for general-purpose computing on graphics processing units).
TensorFlow is available on 64-bit Linux, macOS, Windows, and mobile computing
platforms including Android and iOS.
Its flexible architecture allows for the easy deployment of computation across a
variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters of servers to
mobile and edge devices.
TensorFlow computations are expressed as stateful dataflow graphs. The name
TensorFlow derives from the operations that such neural networks perform on
multidimensional data arrays, which are referred to as tensors. During the Google I/O
Conference in June 2016, Jeff Dean stated that 1,500 repositories on GitHub
mentioned TensorFlow, of which only 5 were from Google.
3.3.4 Py Torch
PyTorch is an open source machine learning library based on the Torch library,
used for applications such as computer vision and natural language processing,
primarily developed by Facebook's AI Research lab (FAIR). It is free and open-source
software released under the Modified BSD license. Although the Python interface is
more polished and the primary focus of development, PyTorch also has a C++
interface.
38
Chapter IV
System Design
4.1 Top Level Circuit
In this chapter, we will introduce the top-level circuit diagram of the proposed project
Early Detection of Brain Cancer Based on Artificial Intelligence. In Figure 4.1, shows
the circuit Model of the raspberry pi 4 image processor unit in which will be the
hardware that will be used to operate the image processing for classifying the brain
tumor.
4.2 Algorithms
This section will present the brain tumor detection Training for the different brain
tumor classification that used the Raspberry pi 4 image processing unit.
39
• Define the learning rate to build the classifier from 0.1 to 0.99
• Check the call back using the validation steps to get the accuracy of the CNN network
classifier.
o If the accuracy decreased, the algorithm loop back to get the new entered data
set.
o the accuracy increase as it is needed, the algorithm will plot confusion matric
for the CNN classifier.
40
4.2.2 Detecting and Recognition Algorithm
The algorithm of the Detection and Recognition Algorithm starts by:
• Importing library for Opencv and Tensorflow to get the lite tensor flow pre trained
model.
• Importing the MRI image to the Raspberry pi 4.
• Then capture frame with RGB gripper to get the image from the MRI image without
coding for speed communication.
• Apply preprocessing for the MRI image lightening for better brightness and
contrast and apply auto encoder.
• Then the code will load the lite tensor flow pretrained model to classify the
brain tumor as an object.
• Then the system will decide either there are any brain tumor in the MRI image
is classified in the frame.
o If No, the system will loop back to get the image with different
preprocessing conditions.
o If Yes, the system will draw a bounding box for the Brain detected and
its type label with the percentage of true detection.
o Then the system will display this over the screen.
• Finally, the system will loop back again to continuously operate for multiple
MRI images.
41
Fig. 4.3: Detecting and Recognition Algorithm 30
4.3 Summary
This chapter presents the top level circuit for the image processing unit (Raspberry pi
42
4). Furthermore, the algorithm of Early Detection of Brain Cancer Based on Artificial
Intelligence is illustrated. The algorithm of Training algorithm and detecting
algorithm for Convolution Neural Network is illustrated and presented. The samples
of data used, results, and the software implemented will be presented in the next
chapter.
43
Chapter V
Implementation and Testing
5.1 Hardware implementation
Figure 5.1, shows the hardware implementation for our project Early Detection of
Brain Cancer Based on Artificial Intelligence prototype where it has compact size and
consume low energy. The Raspberry pi 4 will operate as separate computer board to
perform all the tasks for image processing and preprocessing algorithms as well as the
training and detection different brain tumor classifications.
44
• Many operating systems are available to run on your Raspberry Pi. These include the
recommended Raspberry Pi OS (and its Lite alternative), Ubuntu, along with OSs for
Kodi, RetroPie, and many other projects.
2-Extract the image file
3-Insert the SD card into your SD card reader
4-Download the Raspberry Pi Imager utility
5-Extract the executable from the zip file and run the Raspberry Pi Imager utility
6-Select the image file you extracted above.
45
9- Next, click Choose Storage to select the SD card
10- Click Write
11- With Raspberry Pi OS installed, you'll need to login with the following
credentials:
• Username: pi
• Password: pi
12-Updating and enabling Raspberry pi
13- Install Raspbian Bullseye linux operating system
14-sudo apt-get update
15-sudo apt-get upgrade
16-Coneccting through VNC viewer to the Rpi address.
46
Fig. 5.5: OpenCV integrate with Python 335
47
Fig. 5.7: Training images for different types of Brain tumors37
48
Fig. 5.8: Glioma Brain Tumor Manual Annotation example38
49
Fig. 5.10: Pituitary Brain Tumor Manual Annotation example40
The above Figure 5.8, 5.9, and 5.10 shows the steps of training the different
three brain tumors (glioma, meningioma, pituitary) using label Image tool for
3000 MRI image dataset, then by using google colab we eill train over the
google drive to get the tensorflow model.
4- Then implement the packages over the board
pip install -q tflite-model-maker
pip install -q tflite-support
import numpy as np
import os
from tflite_model_maker.config import ExportFormat, QuantizationConfig
from tflite_model_maker import model_spec
from tflite_model_maker import object_detector
from tflite_support import metadata
import tensorflow as tf
assert tf.__version__.startswith('2')
tf.get_logger().setLevel('ERROR')
from absl import logging
logging.set_verbosity(logging.ERROR)
train_data = object_detector.DataLoader.from_pascal_voc(
'test1/train',
'test1/train',
[['glioma','meningioma','pituitary'])
val_data = object_detector.DataLoader.from_pascal_voc(
'test1/test',
'test1/test',
['glioma','meningioma','pituitary'])
spec = model_spec.get('efficientdet_lite0')
model = object_detector.create(train_data, model_spec=spec, batch_size=20,
train_whole_model=True, epochs=100, validation_data=val_data)
50
model.evaluate(val_data)
Figure 5.11 demonstrate the loss graph for the training and validation loss over
different epochs, where it shows that the loss is decreasing over 15 epochs to 30
epochs, and we cannot increase more than to avoid over fitting lite tensor flow model.
7- After exporting the loss graph, we will export the accuracy graph
Figure 5.12 demonstrate the accuracy metrics graph for the training and validation
accuracy over different epochs, where it shows that the accuracy is increased over 20
epochs to 30 epochs, then the accuracy is increase and stabilized in the region over 20
51
to 30 epochs.
In Figure 5.13 shows the confusion matrix using the trained and test folder for glioma,
meningioma, and pituitary brain tumor and shows high true detection with a zero false
detection between the different brain tumor classes.
import os
import torch
import cv2 as cv
import torch.nn as nn
import numpy as np
from PIL import Image
from torchvision import transforms, models
print('Library Importing....')
device_name = "cuda:0:" if torch.cuda.is_available() else "cpu"
device = torch.device(device_name)
print('Device Type....')
resnet_model = models.resnet50(pretrained=True)
for param in resnet_model.parameters():
param.requires_grad = True
n_inputs = resnet_model.fc.in_features
print('Model Loading ....')
resnet_model.fc = nn.Sequential(nn.Linear(n_inputs, 2048),
52
nn.SELU(),
nn.Dropout(p=0.4),
nn.Linear(2048, 2048),
nn.SELU(),
nn.Dropout(p=0.4),
nn.Linear(2048, 4),
nn.LogSigmoid())
for name, child in resnet_model.named_children():
for name2, params in child.named_parameters():
params.requires_grad = True
resnet_model.to(device)
#resnet_model.load_state_dict(torch.load('bt_resnet50_model.pt'))
resnet_model.load_state_dict(torch.load('bt_resnet50_model.pt',map_lo
cation ='cpu'))
print('Model Loaded')
resnet_model.eval()
transform = transforms.Compose([transforms.Resize((512, 512)),
transforms.ToTensor()])
LABELS = ['None', 'Meningioma', 'Glioma', 'Pitutary']
img_name = input("Enter path to the image: ")
if not os.path.exists(img_name):
print("File does not exits. Exiting...\n")
exit()
img = Image.open(img_name)
print('import test image')
img = transform(img)
img = img[None, ...]
print(device)
with torch.no_grad():
#y_hat = resnet_model.forward(img)
y_hat = resnet_model.forward(img.to(device))
print(y_hat)
predicted = torch.argmax(y_hat.data, dim=1)
print(LABELS[predicted.data],'\n')
img = Image.open(img_name)
Img = np.array(img)
curImg = np.array(img)
gray = cv.cvtColor(np.array(img), cv.COLOR_BGR2GRAY)
grayr = cv.resize(gray, (250, 250))
cv.imshow('Gray Image',grayr)
cv.waitKey(0)
ret, thresh = cv.threshold(gray, 0, 255, cv.THRESH_BINARY_INV +
cv.THRESH_OTSU)
kernel = np.ones((3, 3), np.uint8)
opening = cv.morphologyEx(thresh, cv.MORPH_OPEN, kernel,
iterations=2)
curImg = opening
curImgr = cv.resize(curImg, (250, 250))
cv.imshow('Negative Image',curImgr)
cv.waitKey(0)
# sure background area
sure_bg = cv.dilate(curImg, kernel, iterations=3)
# Finding sure foreground area
dist_transform = cv.distanceTransform(curImg, cv.DIST_L2, 5)
ret, sure_fg = cv.threshold(dist_transform, 0.7 *
dist_transform.max(), 255, 0)
# Find unknown region
sure_fg = np.uint8(sure_fg)
unknown = cv.subtract(sure_bg, sure_fg)
# Marker labelling
ret, markers = cv.connectedComponents(sure_fg)
53
# Add one to all labels so that sure background is not 0, but 1
markers = markers + 1
# Now mark the region of unknown with zero
markers[unknown == 255] = 0
markers = cv.watershed(Img, markers)
Img[markers == -1] = [255, 0, 0]
tumorImage = cv.cvtColor(Img, cv.COLOR_HSV2BGR)
tumorImager = cv.resize(tumorImage, (250, 250))
cv.imshow('Detected Region',tumorImager)
cv.waitKey(0)
curImg = tumorImage
Figure 5.14 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test1.jpg) and the output of
Meningioma with -0.1267 score. Also, the code successfully recognize the type and
the region of the brain tumor in approximately 213 ms.
Figure 5.15 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
54
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test2.jpg) and the output of
Meningioma with -0.4367 score. Also, the code successfully recognize the type and
the region of the brain tumor in approximately 228 ms.
55
Figure 5.16 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test3.jpg) and the output of
Pituitary with -3.2631 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 191 ms.
Figure 5.17 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test4.jpg) and the output of
Pituitary with -0.0241 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 201 ms.
Figure 5.18 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test6.jpg) and the output of
Pituitary with -0.0594 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 214 ms.
56
Fig. 5.18: Brain Tumour Recognition Result 5 48
Figure 5.19 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test7.jpg) and the output of
57
Glioma with -0.9454 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 232 ms.
Figure 5.20 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test8.jpg) and the output of
Glioma with -1.1543 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 198 ms.
Figure 5.21 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test9.jpg) and the output of
Glioma with -0.4038 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 212 ms.
58
Fig. 5.21: Brain Tumour Recognition Result 8 51
Figure 5.22 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test10.jpg) and the output of
59
Meningioma with -0.07192 score. Also, the code successfully recognizes the type and
the region of the brain tumor in approximately 199 ms.
Figure 5.23 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
60
libraries, model, and the image needed to be analyzed (test11.jpg) and the output of
Meningioma with -0.04428 score. Also, the code successfully recognizes the type and
the region of the brain tumor in approximately 211 ms.
Figure 5.24 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test12.jpg) and the output of
Meningioma with -5.9e-3 score. Also, the code successfully recognizes the type and
the region of the brain tumor in approximately 210 ms.
Figure 5.25 results shows the output of the python code over terminal and images for
the original brain MRI, processed MRI image using edge detection, and the final
image with the region of the brain tumor. The result shows the importing of the
libraries, model, and the image needed to be analyzed (test14.jpg) and the output of
Glioma with -3.2759 score. Also, the code successfully recognizes the type and the
region of the brain tumor in approximately 221 ms. Finally it shows the region of the
tumor with extreme color mapping showing the enlargement part of the Glioma brain
tumor.
61
Chapter VI
COST ANALYSIS
Table 6.1 Cost Analysis4
Item Cost
Raspberry Pi 4 3000
Total 3000
62
Chapter VII
TIME PLAN
Task Task
Task Description Exact Execution Time
No. Holder
1 Micheal Installing tensorflow over Python 2 weeks
2 Saad Installing Pytorch over Python 2 weeks
3 Micheal Glioma Brain tumor Training 1 week
4 Saad Meningioma Brain Tumor Training 1 week
5 Micheal Pituitary Brain Tumor Training 2 weeks
6 Saad Testing by detecting MRI 2 weeks
Micheal Final Preparation 1 week
7
Saad
63
Chapter VIII
CONCLUSION AND FUTURE WORK
8.1 Conclusion
Image segmentation plays a significant role in medical image processing as medical
images have different diversities. For brain tumor segmentation, we used MRI and CT
scan images. MRI is most vastly used for brain tumor segmentation and classification.
In this project, clustering for tumor segmentation which can predict tumor cells
accurately. The segmentation process was followed by classification using traditional
classifiers and Convolutional Neural Network. In the traditional classifier part, then
the results will be applied and compared to different traditional classifiers such as K-
Nearest Neighbor, Logistic Regression, Multilayer Perceptron, Naïve Bayes, Random
Forest, and Support Vector Machine
Further, for better results, we will implement CNN to achieve high accuracy above
97.87% with a split ratio of 80:20 of 50 images, i.e. 80% of training images and 20%
of testing images.
64
8.2 Future Work
The Early Detection of Brain Cancer Based on Artificial Intelligence can be upgraded
by using the following operations:
• Adding more MRI images for eah class for better detection and recognition.
• Making a website that the user upload the MRI to get the results over the
internet without any delivery.
• Apply the project to differentiate between brain tumor and other brain
diseases.
65
References
[1] Kasban, Hany & El-bendary, Mohsen & Salama, Dina. (2015). “A Comparative
Study of Medical Imaging Techniques”. International Journal of Information
Science and Intelligent System. 4. 37-58.J. Clerk Maxwell, A Treatise on
Electricity and Magnetism, 3rd ed., vol. 2. Oxford: Clarendon, 1892, pp.68–73.
[2] D. Surya Prabha and J. Satheesh Kumar, “Performance Evaluation of Image
Segmentation using Objective Methods”, Indian Journal of Science and
Technology, Vol 9(8), February 2016.
[3] Brain Tumor: Statistics, Cancer.Net Editorial Board, 11/2017 (Accessed on 17th
January 2019)
[4] Kavitha Angamuthu Rajasekaran and Chellamuthu Chinna Gounder, Advanced
Brain Tumour Segmentation from MRI Images, 2018.
[5] General Information About Adult Brain Tumors". NCI. 14 April 2014. Archived
from the original on 5 July 2014. Retrieved 8 June 2014. (Accessed on 11th
January 2019)
[6] M. Young, The Technical Writer’s Handbook. Mill Valley, CA: University
Science, 1989.
[7] K. Bhagwat, D. More, S. Shinde, A. Daga, Assistant Prof. Rupali Tornekar, “
Comparative Study Of Brain Tumor Detection Using K Means ,Fuzzy C Means
And Hierarchical Clustering Algorithms ” International Journal Of Scientific &
Engineering Research , Volume 2, Issue 6, June 2013, 626-632.
[8] A. Sivaramakrishnan And M. Karnan “A Novel Based Approach For Extraction
Of Brain Tumor In MRI Images Using Soft Computing Techniques”,
International Journal Of Advanced Research In Computer And Communication
Engineering, Vol. 2, Issue 4, April 2013.
[9] S. Roy And S. K. Bandoyopadhyay, “Detection And Qualification Of Brain
Tumor From Mri Of Brain And Symmetric Analysis”, International Journal Of
Information And Communication Technology Research, Volume 2 No.6, June
2012, 584-588.
[10] H. Zhang, J. E. Fritts, S. A. Goldman,“Image Segmentation Evaluation: A
Survey Of Unsupervised Methods”, Computer Vision And Image
Understanding, Pp. 260-280, 2008.
66
[11] W. Liu, D. Anguelov, D. Erhan, C. Szegedy, S. Reed, C.-Y. Fu, and A. C. Berg,
“Ssd: Single shot multibox detector,” in European conference on computer
vision. Springer, 2016, pp. 21–37.
[12] B. Patenaude, S. M. Smith, D. N. Kennedy, and M. Jenkinson, “A bayesian
model of shape and appearance for subcortical brain segmentation,”
Neuroimage, vol. 56, no. 3, pp. 907–922, 2011.
[13] A. de Brebisson and G. Montana, “Deep neural networks for anatomical brain
segmentation,” in Proceedings of the IEEE Conference on Computer Vision and
Pattern Recognition Workshops, 2015, pp. 20–28.
[14] M. Ghafoorian, N. Karssemeijer, T. Heskes, M. Bergkamp, J. Wissink, J. Obels,
K. Keizer, F.-E. de Leeuw, B. van Ginneken, E. Marchiori et al., “Deep multi-
scale location-aware 3d convolutional neural networks for automated detection
of lacunes of presumed vascular origin,” NeuroImage: Clinical, vol. 14, pp. 391–
399, 2017.
[15] Q. Dou, H. Chen, L. Yu, L. Zhao, J. Qin, D. Wang, V. C. Mok, L. Shi, and P.-A.
Heng, “Automatic detection of cerebral microbleeds from mr images via 3d
convolutional neural networks,” IEEE transactions on medical imaging, vol. 35,
no. 5, pp. 1182–1195, 2016.
[16] Q. Dou, H. Chen, L. Yu, L. Shi, D. Wang, V. C. Mok, and P. A. Heng,
“Automatic cerebral microbleeds detection from mr images via independent
subspace analysis based hierarchical features,” in Engineering in Medicine and
Biology Society (EMBC), 2015 37th Annual International Conference of the
IEEE. IEEE, 2015, pp. 7933– 7936.
[17] H.-I. Suk, C.-Y. Wee, S.-W. Lee, and D. Shen, “State-space model with deep
learning for functional dynamics estimation in resting-state fmri,” NeuroImage,
vol. 129, pp. 292–307, 2016.
[18] H.-I. Suk and D. Shen, “Deep ensemble sparse regression network for
alzheimers disease diagnosis,” in International Workshop on Machine Learning
in Medical Imaging. Springer, 2016, pp. 113–121.
[19] W. H. Pinaya, A. Gadelha, O. M. Doyle, C. Noto, A. Zugman, Q. Cordeiro, A.
P. Jackowski, R. A. Bressan, and J. R. Sato, “Using deep belief network
modelling to characterize differences in brain morphometry in schizophrenia,”
Scientific reports, vol. 6, p. 38897, 2016.
67
[20] Y. Yoo, L. W. Tang, T. Brosch, D. K. Li, L. Metz, A. Traboulsee, and R. Tam,
“Deep learning of brain lesion patterns for predicting future disease activity in
patients with early symptoms of multiple sclerosis,” in Deep Learning and Data
Labeling for Medical Applications. Springer, 2016, pp. 86–94.
[21] H. K. van der Burgh, R. Schmidt, H.-J. Westeneng, M. A. de Reus, L. H. van
den Berg, and M. P. van den Heuvel, “Deep learning predictions of survival
based on mri in amyotrophic lateral sclerosis,” NeuroImage: Clinical, vol. 13,
pp. 361–369, 2017.
[22] D. Zikic, Y. Ioannou, M. Brown, and A. Criminisi, “Segmentation of brain
tumor tissues with convolutional neural networks,” Proceedings MICCAI-
BRATS, pp. 36–39, 2014.
[23] G. Urban, M. Bendszus, F. Hamprecht, and J. Kleesiek, “Multi-modal brain
tumor segmentation using deep convolutional neural networks,” MICCAI BraTS
(Brain Tumor Segmentation) Challenge. Proceedings, winning contribution, pp.
31–35, 2014.
[24] J. Long, E. Shelhamer, and T. Darrell, “Fully convolutional networks for
semantic segmentation,” in Proceedings of the IEEE conference on computer
vision and pattern recognition, 2015, pp. 3431–3440.
[25] O. Ronneberger, P. Fischer, and T. Brox, “U-net: Convolutional networks for
biomedical image segmentation,” in International Conference on Medical image
computing and computer-assisted intervention. Springer, 2015, pp. 234–241.
[26] G. Wang, W. Li, S. Ourselin, and T. Vercauteren, “Automatic brain tumor
segmentation using cascaded anisotropic convolutional neural networks,” in
International MICCAI Brainlesion Workshop. Springer, 2017, pp. 178–190.
[27] A. Graves and J. Schmidhuber, “Offline handwriting recognition with
multidimensional recurrent neural networks,” in Advances in neural information
processing systems, 2009, pp. 545–552.
[28] W. Byeon, T. M. Breuel, F. Raue, and M. Liwicki, “Scene labeling with lstm
recurrent neural networks,” in Proceedings of the IEEE Conference on Computer
Vision and Pattern Recognition, 2015, pp. 3547–3555.
[29] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair,
A. Courville, and Y. Bengio, “Generative adversarial nets,” in Advances in
neural information processing systems, 2014, pp. 2672–2680.
68
[30] P. Luc, C. Couprie, S. Chintala, and J. Verbeek, “Semantic segmentation using
adversarial networks,” in NIPS Workshop on Adversarial Training, 2016.
[31] X. Chen, N. Pawlowski, M. Rajchl, B. Glocker, and E. Konukoglu, “Deep
generative models in the real-world: An open challenge from medical imaging,”
arXiv preprint arXiv:1806.05452, 2018.
[32] Best Artificial Intelligence Boards and Single Computer Board, Electro Maker
articles, 2021 https://www.electromaker.io/blog/article/best-sbc-for-ai-single-
board-computer-for-artificial-intelligence.
69
70
الملخص
تم توثيق أكثر من 150نوعًا من أورام المخ على أساس الخصائص النسيجية المرضية .يعد تجزئة ورم الدماغ
أحد أكثر المهام أهمية وشاقة في مجال معالجة الصور الطبية حيث يمكن أن يؤدي التصنيف اليدوي بمساعدة
اإلنسان إلى التنبؤ والتشخيص غير الدقيقين .عالوة على ذلك ،إنها مهمة مشددة عندما يكون هناك كمية كبيرة
من البيانات للمساعدة .تتميز أورام الدماغ بتنوع كبير في المظهر وهناك تشابه بين الورم واألنسجة الطبيعية ،
وبالتالي فإن استخراج مناطق الورم من الصور يصبح صعبًا.
يشير التصوير الطبي إلى عدد من التقنيات التي يمكن استخدامها كوسائل غير جراحية للنظر داخل الجسم .تشمل
الصورة الطبية طرائق وعمليات صور مختلفة لتصوير جسم اإلنسان ألغراض العالج والتشخيص ،وبالتالي
دورا أساسيًا وحاس ًما في اتخاذ اإلجراءات لتحسين صحة الناس.
تلعب ً
يعد تجزئة الصورة خطوة حاسمة وأساسية في معالجة الصور والتي تحدد نجاح مستوى أعلى من معالجة
الصور .الهدف األساسي من تجزئة الصورة في معالجة الصور الطبية هو بشكل أساسي الكشف عن الورم أو
اآلفات ،والرؤية الفعالة لآللة وتحقيق نتيجة مرضية لمزيد من التشخيص .أصبح تحسين حساسية ونوعية الورم
أو اآلفة مشكلة أساسية في الصور الطبية بمساعدة أنظمة التشخيص بمساعدة الكمبيوتر (.)CAD
في هذا المشروع ،يتم استخدام طريقة مقترحة الستخراج ورم الدماغ من صور الدماغ بالرنين المغناطيسي
ثنائي األبعاد ( ) MRIبواسطة خوارزمية الشبكة العصبية االلتفافية والتي أعقبتها المصنفات التقليدية والشبكة
العصبية التالفيفية .سي تم إجراء الدراسة التجريبية على مجموعة بيانات في الوقت الفعلي مع أحجام ورم متنوعة
ومواقع وأشكال وكثافة مختلفة للصورة .في جزء المصنف التقليدي ،سيتم تطبيقه على ستة مصنفات تقليدية
وهي :آلة المتجهات الداعمة ( ) ، )K-Nearest Neighbor (KNN ،SVMمتعدد الطبقات Perceptron
، )(MLPاالنحدار اللوجستي Naïve Bayes ،و Random Forestالتي تم تنفيذها في . scikit-Learn
بعد ذلك ،سيتم تنفيذ الشبكة العصبية التالفيفية ( )CNNباستخدام Kerasو Tensorflowألنها تؤدي إلى أداء
أفضل من تلك التقليدية.
جامعة أكتوبر للعلوم الحديثة واآلداب
كلية الهندسة
إعداد
سعد محمد سعد ابوفرو
مايكل نبيل سالمة ذكي
إشراف
د/محمد سعيد
2023-2022