Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)

IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

Image Segmentation using Mask R-CNN


for Tumor Detection from Medical Images
T. Padma , Ch Usha Kumari, Dommeti Yamini, Kapilavai Pravallika,
2022 International Conference on Electronics and Renewable Systems (ICEARS) | 978-1-6654-8425-1/22/$31.00 ©2022 IEEE | DOI: 10.1109/ICEARS53579.2022.9751891

Konduru Bhargavi, Mula Nithya

Department of Electronics and Communication engineering ,

GRIET, Hyderabad, Telangana

Abstract- One of the dreadful diseases that the parts of the brain and cause dementia and
world encounters today is brain tumor. When damage the central nervous system [2]. Cancerous
abnormal cells form in the brain, it is called a tumors (Malignant) can be divided into primary
brain tumor. There are lot of variations in sizes tumors and secondary tumors. Primary
and location of tumor, and hence this makes it brain tumors start in the brain and spread from
really hard for a complete understanding of there, whereas the origination of secondary
tumor. Radiologists can easily diagnose the brain tumors are elsewhere. In contrary, a benign
disease with the help of medical image brain tumor is a cluster of cells that develops
techniques, but making this process automatic slowly in the brain. When a tumor grows in the
is obviously useful. Magnetic Resonance brain, the pressure inside it rises, causing brain
Imaging (MRI) is the most effective method for damage and death. As a result, early accurate
detecting brain tumors where, MRI images are diagnosis of brain tumors can help to improve
trained and tested in order to detect the tumor. options for treatment and increase the probability
The automated system would be able to detect of survival. Medical Imaging Techniques such as
and pin-point the exact location of the tumor in MRI, CT scan, Angiography, Skull-Xray, and
an MRI image. In this project, the automated Biopsy are utilised to diagnosis the brain tumor.
system is built using Mask Regional-based The best tool for detecting tumors is Magnetic
Convolution Neural Network (Mask R-CNN) Resonance Imaging (MRI). However, because a
which segments the abnormal tissues in the large number of MRI images are generated in
brain and mask is applied over the segmented medical practise, manual segmentation of
region. Mask R-CNN has the best performance tumors is a time consuming, difficult, and
compared to other methods such as R-CNN burdensome task. As a result, obtaining accurate
(Regional-based CNN), Fast R-CNN and Faster tumor segmentation from the human brain is a
R-CNN. very difficult task. Therefore, an automated
system would be able to detect the tumor in an
Keywords: Tumor Detection, Image MRI and determine its exact location.
Segmentation, MRI Images, Mask R-CNN.
A. Image segmentation
I. INTRODUCTION
Image segmentation [3] belongs to the branch of
The brain tumor [1] is an abnormal grouping of image processing which focuses on dividing an
cells related to the brain. Malignant (cancerous) or image into separate parts usually based on their
benign (non-cancerous) are types of brain tumors.
characteristics and properties. The primary goal of
Malignant brain tumors originate in the brain,
image segmentation is to simplify image such
grow rapidly and quickly infect the surrounding
tissues. It also has the tendency to expand to other that images can be analyzed easily. Digital image

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1015


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

segmentation in processing divides the image into Faster R-CNN consists of two stage architecture
various segments having similar characteristics. as shown below:
Therefore, image segmentation may involve RPN: RPN stands for Regional Proposal Network,
clustering of pixel regions based on similarities in and it is a fully CNN. It generates the proposals
shape or color, or separating foreground from for the objects in an image.
background. Image segmentation is commonly
used in medical imaging to detect tumors in Fast R-CNN: ROI Pooling is used to extract
organs like brain, etc. features from each candidate box and performs
bounding-box regression and classification.
B. CNN
Fast R-CNN works faster than R-CNN because
Convolution Neural Network is an Artificial it is not required to connect 2,000 proposed
Neural Network model used in image processing, regions to CNN every time instead feature map is
recognition and for the classification of images. generated by using convolutional operation only
CNN is a fundamental building block in once per image. Compared to R-CNN, Faster R-
computer vision and also in image segmentation. CNN has improved in computational speed.
CNN consist mainly of three layers that are as
The key difference in Fast and Faster R-CNN is
follows:
Fast R-CNN generates Regions of Interest through
Convolutional Layer: In this layer, the input selective search, whereas Faster R-CNN generates
image is abstracted as feature map with the help ROIs using RPN.
of kernels and filters.
This project shows how a machine learning-based
Pooling Layer: It helps to down sample the approach, specifically a Mask Region-based
feature maps and thus, decreases the Convolutional Neural Network is used to segment
computational power required to process the data. the tumor in brain from medical images.
Fully Connected Layer: Every neuron in each II. LITERATURE REVIEW
layer is connected to every neuron in other layer
with its fully connected layer architecture. H.N.T.K.Kaldera, et al., [4] developed a model
which classified and segmented the brain tumor
By combining these layers in CNN, this Artificial
from MRI images. After data preprocessing,
Neural Network can learn how to identify objects
of interest in any image. Convolutional Neural Network (CNN) was used
for tumor classification and feature extraction.
A. RCNN Faster R-CNN model was used for tumor
RCNN or Regional Based-Convolutional Neural- extraction. The model had an average accuracy of
Network is a family of ML (Machine Learning) 94% for all the classifiers and 94.6% for the tumor
models applied in computer vision and image region extraction. However, contours of the skull
processing tasks, mainly to detect objects. were visible in the final result.
Bounding boxes are used across object regions,
The research paper [5] represents a method to
and CNNs are evaluated on all Regions of Interest
(ROI) to classify multiple regions into proposed extract brain tumor from 2D Magnetic Resonance
brain Images by Fuzzy C-Means clustering
classes.
algorithm which was followed by traditional
classifiers and Convolutional Neural Network
(CNN). Based on texture and statistical features,
normal and abnormal pixels were distinguished.
B. Faster R-CNN The work used a five-layer CNN model, which

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1016


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

was not very significant. Computation time, the will generate mask to each object. Backbone,
complexity of the method batch size and steps Region Proposal Network (RPN), Region of
were immensely high, when there is an increase in Interest alignment layer (ROI Align), object
the layers of CNN model. detection branch and mask generation branch are
building blocks of Mask R-CNN. The Faster R-
In paper [6], the proposed algorithm performed CNN model is made up of the first four. As a
feature extraction, classification, and result, the overall structure can be seen in fig.1.
segmentation. Brain tumor segmentation was
performed using Berkeley Wavelet
Transformation (BWT), and feature extraction for
accuracy and quality rate was performed by
Support Vector Machine (SVM).The experimental
results of proposed technique were 96.51%
accuracy, 94.2% specificity, and 97.72%
sensitivity. They used only a single classifier and
feature extraction technique.

Aye Min and Dr. Zin Mar Kyu [7] proposed a


model for image enhancement and tumor
segmentation. Fusion method was proposed for Fig. 1: Mask RCNN Flowchart
enhancement, combination of Adaptive K-means
clustering and Morphological operations Backbone:
(AKMM) for tumor segmentation. Mask R-CNN's main feature extractor is a
backbone. The Residual Networks (ResNets) with
The research [8] presented an efficient Neural or without the Feature Pyramid Network (FPN)
Network (NN) based technique for tumor can be used as popular choices for this part. As a
detection in brain MRI images. Brain tissues like backbone, ResNet without FPN is used for
CerebroSpinal Fluid (CSF), White Matter (WM), simplicity. Whenever raw images are fed through
Gray Matter (GM) along with the tumor were ResNet backbone, the data are transformed into a
feature map after passing through multiple
segmented. The feature vectors like mean,
residual bottleneck blocks.
variance, entropy and wavelet based energy sub The feature map contains abstract information
bands of the segmented regions were extracted about images, such as different object instances,
and trained using the feed forward NN. The classes, and also spatial properties. The feature
accuracy of the research was 80% with a smaller map is fed to the RPN.
amount of data trained.
RPN:
III. METHODOLOGY RPN’s task is to scan the feature map and
Proposed Mask R-CNN Model propose regions (ROI) where objects might be
found.
Mask R-CNN [9][10] is very popular in areas of
deep learning network in the computer vision field A 3X3 convolutional network layers are used
for instance, in segmentation tasks. Faster R-CNN for scanning image with sliding windows to
is for bounding-box objects detection. The fully generate its relevant anchors which represent
convolutional network added to Faster R-CNN bounding boxes in various sizes, and distributed

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1017


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

across the image. To cover the image, an Class: Class of these objects in ROI.
approximately 20k anchors with different scales
Bounding Box : Its purpose is to refine its location
and sizes corresponding to one another are used.
& size of bounding box which encapsulates the
To check whether anchor contains any object or
background, binary classification is used. object.

ROI Align: Mask Generation Branch:


Mask generation branch is a fully convolutional
The RPN-derived regions could have a variety
neural network. In this, ROI feature map is fed to
of shapes. As a result, ROI Align uses pooling
convolutional layers and mask is generated
layer to transform all of regions into same shape.
accordingly. For each class, a segmentation mask
For the proposed regions, Intersection over is generated.
Union (IoU) is computed based on ground truth
The mask RCNN not only generates bounding
boxes. If IoU is found greater than 0.85, it is
considered as Region of Interest. The results are box and class of the tumor, but also masks the
area of the tumor which helps in easier analysis.
processed by object detection and mask
The mask R-CNN is simple to train. This method
generation blocks to generate class, bounding box,
and mask on objects. is efficient and accurate compared to CNN and
other two stage detectors. CNN models have an
Object Detection Branch: accuracy of 95% whereas mask R-CNN model
has an accuracy of 96.79%.
This stage processes the ROIs proposed by
RPN. For each ROI, two different outputs are
generated:

Fig. 2 : Mask R-CNN Architecture

A. Dataset Fig.3). In which, 200 images are used to train the


model, 60 MRI images are used to validate the
For the current proposed method, only one model, and 40 MRI images are used to test the
dataset is used. The dataset [11] contains 300 MRI model.
images of brain tumors (a sample is shown in

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1018


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

B. Training And Testing


● Download the Mask R-CNN repository and
Brain MRI scan dataset.
The Mask R-CNN repository is downloaded from
GitHub. The repository contains some building
code blocks to implement Mask R-CNN [12].
https://github.com/matterport/Mask_RCNN.git
Brain MRI scan dataset is imported from GitHub
[11].
Fig 3 : Dataset Sample Brain MRI Images https://github.com/rastislavkopal/brain-tumor-
segmentation.git
The dataset images are already pre-processed
and are in grayscale format. Each test train and
validate folders contains a JSON (JavaScript ● Selecting right versions of libraries and
Object Notation) file. JSON is a file containing importing dependencies.
data in the form of x-y coordinates of polygon
It is important to select the right versions to
which represents the custom masked tumors. This
implement Mask R-CNN architecture without any
file is used in training the Mask R-CNN model to errors. In this project, Keras version 2.2.4 and
locate the exact location of the tumor. These
Tensor Flow version 1.14.0 are used.
polygons of tumor in JSON file help to validate
and test the model by comparing our results to Import dependencies are os, sys, matplotlib,
actual ground truth of tumor. json, numpy, and cv2, and the libraries needed for
Mask R-CNN are config, utils, modellib,
visualize, and coco.
● Setting the training configuration of the
brain tumor dataset.
The configurations are set up, which include
properties such as the number of Graphics
Processing Unit(s) or GPUs to use, as well as the
number of images per GPU (here one image per
GPU), and the number of classes, which is set to
two, one for tumor and other to background. The
number of training steps per epoch is set to100,
the learning rate to 0.001, and skip detections ● Setting up the Custom Dataset class.
with less than 85 percent confidence.
Therefore, these are the model training The brain tumors dataset and json annotations are
configurations for the brain tumor dataset. generated [13].
Custom dataset iterates through all the files in
the image and annotations datasets, to add a new
category, image, and annotation, resulting in a
dataset that connects the annotations data to the
image data with the class tumor.

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1019


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

● Initializing the Mask R-CNN model for


training.
An instance of the config that was created
earlier is used to initialize the Mask R-CNN. Then
the weights of previously trained Mask-R-CNN
model is downloaded from the coco dataset
excluding the last couple of layers.
For this training data, the Mask R-CNN head
layers should probably be sufficient. Now the
dataset is loaded into the model and trained for 15
epochs with the assigned learning rate of 0.001.
IV. RESULTS
Fig 5 : Epoch VS Loss Graph
The function “display differences” in Mask R-
CNN implementation, plots the output Mask V. CONCLUSION
Polygon on the given picture. The Mask R-CNN’s
results are then given into the function, and a This project concludes that the best way to
visual representation of the mask’s position, predict brain tumors is to use MRI scanned
where the tumor is placed, can be viewed on top images and then use Mask R-CNN to detect the
of the brain MRI picture. After 15 epochs, there is tumor within them. To implement this proposed
a loss of 0.4597 and a greater accuracy. method, the Mask R-CNN model, as well as
various machine learning techniques and some
The obtained results are shown in figure 4 and the necessary pre-processing steps are used. The
graphical representation of epoch vs loss is method has shown to be quite accurate in
depicted in figure 5. predicting the tumor’s location and size from a
brain MRI scan. This method is highly dependent
on the quality of the brain’s MRI image;
therefore, if the image is incorrect, blurred,
blacked, overexposed to light, low brightness, or
incomplete, it may not yield the precise result. It
may consume some time to train, however it
provides accurate segmentation. This method can
be used to create reports and automate processes.
VI. References
[1]“Brain_Tumor-Types-Risk-factors-Symptoms-Diagnosis-T reatment-
Outlook”-Medically reviewed by Seunggu Han, M.D. — Written
Fig 4 : Results by Verneda Lights — Updated on June 6, 2017

[2] “Brain tumor” From Wikipedia, the free encyclopedia.

[3] Sharma, Pulkit. "Computer Vision T utorial: A Step -by-Step


Introduction to Image Segmentation T echniques." (2019).

[4] Kaldera, H. N. T . K., Shanaka Ramesh Gunasekara, and Maheshi B.


Dissanayake. "Brain tumor classification and segmentation using faster R-
CNN." 2019 Advances in Science and Engineering T echnology
International Conferences (ASET ). IEEE, 2019.

[5] Hossain, Tonmoy, et al. "Brain tumor detection using convolutional


neural network." 2019 1st international conference on advances in science,
engineering and robotics technology (ICASERT ). IEEE, 2019.

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1020


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

[6] Bahadure, Nilesh Bhaskarrao, Arun Kumar Ray, and Har Pal T hethi. [10] Sharma, Pulkit. "Computer Vision T utorial: Implementing Mask R-
"Image analysis for MRI based brain tumor detection and feature extraction CNN for Image Segmentation (with Python Code).(2019)."
using biologically inspired BWT and SVM." International journal of
biomedical imaging 2017 (2017). [11] “Brain Tumor Dataset” By Rastislav Kopal. Available at
https://github.com/rastislavkopal/brain-tumor-segmentation.git
[7] Min, Aye, and Zin Mar Kyu. "MRI images enhancement and tumor
segmentation for brain." 2017 18th International Conference on Parallel
and Distributed Computing, Applications and T echnologies (PDCAT ). [12] “Mask R-CNN for Object Detection and Segmentation” (Github).
IEEE, 2017. Available at

[8] Damodharan, Selvaraj, and Dhanasekaran Raghavan. "Combining https://github.com/matterport/Mask_RCNN#mask-r-cnn-for-object-


tissue segmentation and neural network for brain tumor detection." detection-and-segmentation
International Arab Journal of Information Technology (IAJIT) 12.1 (2015).
[13] “Mask RCNN implementation on a custom dataset!” All incorporated
[9] “ Mask R-CNN: A Beginner’s Guide”-Elisha Odemakinde, March 19,
in a single python notebook!-Dhruvil Shah, Dec 26, 2020.
2021

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 1021


Authorized licensed use limited to: MANIPAL INSTITUTE OF TECHNOLOGY. Downloaded on April 22,2024 at 05:23:57 UTC from IEEE Xplore. Restrictions apply.

You might also like