Brain Tumor Detection
Brain Tumor Detection
Brain Tumor Detection
2
ABSTARCT
Brain tumor is the growth of abnormal cells in the brain some of which may lead to cancer. The usual
method to detect brain tumors is Magnetic Resonance Imaging(MRI) scans. From the MRI images
information about the abnormal tissue growth in the brain is identified. In various research papers, the
detection of brain tumors is done by applying Machine Learning and Deep Learning algorithms. When
these algorithms are applied to the MRI images the prediction of brain tumors is done very fast and a
higher accuracy helps in providing the treatment to the patients. This prediction also helps the
radiologist in making quick decisions. In the proposed work, a self-defined Artificial Neural Network
(ANN) and Convolution Neural Network (CNN) is applied in detecting the presence of brain tumor and
their performance is analyzed.
3
INTRODUCTION
The brain is the most important organ in the human body which controls the
entire functionality of other organs and helps in decision-making. It is primarily
the control center of the central nervous system and is responsible for
performing the daily voluntary and involuntary activities in the human body.
The tumor is a fibrous mesh of unwanted tissue growth inside our brain that
proliferates in an unconstrained way. From the latest studies, at the age of 15
about 3,540 children get diagnosed with a brain tumor. The right way of
understanding brain tumors and their stages is an important task to prevent
and carry out the steps in curing the illness. To do so, magnetic resonance
imaging (MRI) is widely used by radiologists to analyze brain tumors. The result
of the analysis carried out in this paper reveals whether the brain is a normal
or diseased one by applying deep learning technique.
4
INTRODUCTION
In this project, ANN and CNN are used in the classification and detection of normal and tumor brains. ANN(Artificial
Neural Network) works like a human brain nervous system, on this basis, a digital computer is connected with a
large number of interconnections and networking which makes the neural network trained with the use of simple
processing units applied on the training set and stores the experiential knowledge. It has different layers of
neurons which is connected together. The neural network can acquire knowledge by using a data set applied to the
learning process. There will be one input and output layer whereas there may be any number of hidden layers. In
the learning process, the weight and bias are added to neurons of each layer depending upon the input features
and on the previous layers(for hidden layers and output layers). A model is trained based on the activation function
applied to the input features and on the hidden layers where more learning happens to achieve the expected
output.
5
Brain Tumor Statistics
85+yr
80-84yr
75-79yr
70-74yr
65-69yr
60-64yr
55-59yr
50-54yr
45-49yr
40-44yr
35-39yr
30-34yr
25-29yr
20-24yr
15-19yr
10-14yr
0-4yr
0 5 10 15 20 25 30 35
6
Female Male
OBJECTIVE
7
SYSTEM ARCHITECTURE
8
EXISTING WORK
• In the first stage, there is a computer based procedures to detect tumor blocks and classify the type of tumor using
Artificial Neural Network Algorithm for MRI images of different patients.
• The second stage involves the use of different image processing techniques such as histogram equalization, image
segmentation, image enhancement, morphological operations and feature extraction are used for brain tumor
detection in the MRI images for the cancer-affected patients.
• This work is introduced one automatic brain tumor detection method to increase the accuracy and decrease the
diagnosis time.
• Image Preprocessing: As input for this system is MRI, scanned image and it contain noise. Therefore, our first aim is
to remove noise from input image. As explained in system flow we are using high pass filter for noise removal and
preprocessing.
• Segmentation: Region growing is the simple region-based image segmentation technique. It is also classified as a
pixel based image segmentation technique since it is involve the selection of initial seed points.
9
EXISTING WORK
• Morphological operation: The morphological operation is used for the extraction of boundary areas of the brain
images. This operation is only rearranging the relative order of pixel value, not mathematical value, so it is suitable for
only binary images. Dilation and erosion is basic operation of morphology. Dilation is add pixels to the boundary region
of the object, while erosion is remove the pixels from the boundary region of the objects.
• Feature Extraction: The feature extraction is used for edge detection of the images. It is the process of collecting
higher level information of image such as shape, texture, color, and contrast.
• Connected component labeling: After recognizing connected components of an image, every set of connected pixels
having same gray-level values are assigned the same unique region label.
• Tumor Identification: In this phase, we are having dataset previously collected brain MRIs from which we are
extracting features. Knowledge base is created for comparison.
10
EXISTING WORK
In the first step we can take image as input. In the image we used tumor
in the image and only fat and water tissues in the images.
In the second step convert image to grayscale
Signal to noise
Complexity of the code
Learning image processing
Difficulty of visualization
Then we convert image to binary image by thresholding. Thresholding
is the simplest method of image segmentation and the most common
way to convert a grayscale image to binary image. In thresholding we
select threshold value and then gray level value .below the selected
threshold value is classified as 0.and equal and greater then the
threshold value are classified as 1.
Find the number of connected object .
Find mask by assigning 1 to inside and 0 to outside of the object that
show brain region.
Multiply the mask with T1,T2 and FLAIR MR images to get their skull
stripped MR image 11
PROPOSED WORK
The proposed system has mainly five modules. Dataset, Pre-processing, Split
the data, Build CNN model train Deep Neural network for epochs, and
classification. In dataset we can take multiple MRI images and take one as
input image. In pre-processing image to encoded the label and resize the
image. In split the data we set the image as 80% Training Data and 20%
Testing Data. Then build CNN model train deep neural network for epochs.
Then classified the image as yes or no if tumor is positive then it returns yes
and the tumor is negative the it returns no.
Normal Brain
Tumor Brain
12
LITERATURE SURVEY
13
PUBLICATION YEAR AUTHOR JOURNAL NAME ABSTRACT
14
PUBLICATION YEAR AUTHOR JOURNAL NAME ABSTARCT
Different Entropy functions for tumor
segmentation and its detection from
various MRI images. The different
IEEE International Conference
Devendra Somwanshi , threshold values are obtained depend
on Recent Advances and
2016 Ashutosh Kumar, Pratima on the particular definition of the
Innovations
Sharma, Deepika Joshi entropy. The threshold values are
in Engineering
dependent on the different entropy
function which in turn affects
the segmented results.
15
WORKFLOW
Tumor Presence
Classification
using CNN Tumor Type
Presence
Presence and
and
Training of two Absence
Absence of
of tumor
tumor
modules Tumor Grade
Identification of Prediction of
tumor location Tumor
Data Pre- using CNN
processing
Classification of
brain tumor
Location of tumor
Testing of two
modules Identification of
brain tumor
16
STEPS OF IMPLEMENTATION
Step 1:
Fetch dataset from Kaggle.
Step 2:
Make a workflow on how to implement the brain tumor detection system and make conclusions to
determine the ML & Deep Learning algorithms or techniques that would perfectly fit the problem
with good accuracy.
Step 3:
Next install the required software's like Anaconda ,Jupyter, Python.
Step 4:
After installing the required software’s ,start with Anaconda lunched Jupyter notebook with python 3.
17
STEPS OF IMPLEMENTATION
Step 5:
Import all the necessary libraries like Pandas, Numpy, Sklearn, Matplotlib and all the required
modules.
18
STEPS OF IMPLEMENTATION
Step 6:
Import the Brain Tumor Dataset into Jupyter notebook.
Step 7:
The data needed to be preprocessed in order to get the clear cut image of the brain.
19
STEPS OF IMPLEMENTATION
Step 8:
We call out the original data and preprocessed data.
Step 9:
Load the data.
20
STEPS OF IMPLEMENTATION
Step 10:
Check the structure of the dataset.
Step 11:
Plotting sample images of the tumor brain and non-tumor brain.
21
STEPS OF IMPLEMENTATION
Step 12:
Now spit the data into X_train, X_test, Y_train, Y_test.
22
STEPS OF IMPLEMENTATION
Step 13:
Next we build the model using CNN. After building, we fetch the summary of the model.
23
STEPS OF IMPLEMENTATION
Step 14:
After building the model, next we train the model to the dataset. Multiple models have been run to
identify the best model with the highest accuracy.
24
STEPS OF IMPLEMENTATION
25
STEPS OF IMPLEMENTATION
Step 15:
Plot the loss and the accuracy from the training of the model.
Step 16:
We check the best accuracy model.
26
MODULE
27
MODULE 1: DATA COLLECTION
28
MODULE 2: DATA PREPROCESSING
o Crop the part of the image that contains only the brain (which is the most important part
of the image).
o Resize the image to have a shape of (240, 240, 3)=(image_width, image_height, number of
channels): because images in the dataset come in different sizes. So, all images should have
the same shape to feed it as an input to the neural network.
o Apply normalization: to scale pixel values to the range 0-1.
29
MODULE 3: SPLITTING OF DATA
30
MODULE 4: BUILDING AND
IMPLEMENTATION OF THE MODEL
31
MODULE 5: MODEL SUMMARY
32
MODULE 6: TRAIN THE MODEL
1.
2.
33
MODULE 6: TRAIN THE MODEL
3.
4.
5.
34
OUTPUT
35
RESULTS AND DISCUSSIONS
• From the below snippet we can successfully see the accuracy made by the model.
• Here we were able to approach an accuracy of 97.04% leading to best results among other
models.
36
ADVANTAGES AND DISADVANTAGES
Advantages:
• Early detection and diagnosis of brain tumors.
• Planning and monitoring of treatment for brain tumors.
• Predicting the survival rate of patients with brain tumors.
• Automated segmentation and quantification of brain tumors.
• Classification of brain tumors into different subtypes based on their characteristics.
• Enhancing the accuracy and speed of brain tumor diagnosis.
• Improving the overall quality of life for patients with brain tumors.
Disadvantages:
• Blurry, low resolution images, false positives.
• beginner-level diagnosis, distorted images.
• incomplete scans, incomplete data.
37
SOURCE CODE
import tensorflow as tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.layers import Conv2D, Input, ZeroPadding2D, BatchNormalization, Activation,
MaxPooling2D, Flatten, Dense
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint
from sklearn.model_selection import train_test_split
from sklearn.metrics import f1_score
from sklearn.utils import shuffle
import cv2
import imutils
import numpy as np
import matplotlib.pyplot as plt
38
SOURCE CODE
plt.subplot(1, 2, 1)
plt.imshow(image)
plt.tick_params(axis='both', which='both',
top=False, bottom=False, left=False, right=False,
labelbottom=False, labeltop=False, labelleft=False, labelright=False)
plt.title('Original Image’)
plt.subplot(1, 2, 2)
plt.imshow(new_image
plt.tick_params(axis='both', which='both',
top=False, bottom=False, left=False, right=False,
labelbottom=False, labeltop=False, labelleft=False, labelright=False
plt.title('Cropped Image')
plt.show()
return new_image
ex_img = cv2.imread('yes/Y1.jpg')
41
ex_new_img = crop_brain_contour(ex_img, True)
CONCLUSION
This project provides a new method for detecting brain tumor by deep learning method. The early
detection of cancer helps timely and effective treatment. Kaggle dataset contains good quality of MRI
images for research purposes. Different segmentation algorithms were experimented.
Classifying the brain tumor as normal and abnormal is done using the Multilayer Perceptron (MLP)
which achieves an accuracy of 85% and Support Vector Machine (SVM) which achieves an accuracy of
74%.
Using CNN, we were able to achieve 97.04%. CNN is considered as one of the best technique in
analyzing the image dataset.
The CNN makes the prediction by reducing the size the image without losing the information needed
for making predictions. Deep learning method used for detecting, classification, an location
identification of brain tumors is CNN based models.
This system can be improved to support with a web interface. Detection of different diseases can be
also identified from the MRI images. Apart from the density some other parameters can also
estimated for therapeutic purposes.
42
REFERNCE
• https://www.simplilearn.com/tutorials/deep-learning-tutorial/deep-learning-algorithm
• https://www.sciencedirect.com/science/article/pii/S277252862200022X
• https://ieeexplore.ieee.org/document/9445185
• https://jpinfotech.org/brain-tumour-detection-using-deep-learning/
• Brain Tumor Detection Using Deep Learning - Avigyan Sinha, Aneesh R P , Malavika Suresh , Nitha Mohan R,
Abinaya D, Ashwin G Singerji - 2021 Seventh International conference on Bio Signals, Images, and Instrumentation
(ICBSII) | 978-1-6654-4126-1/20/$31.00 ©2021 IEEE | DOI: 10.1109/ICBSII51839.2021.9445185
• https://www.kaggle.com/datasets/navoneel/brain-mri-images-for-brain-tumor-detection
• Brain tumor detection from MRI images using deep learning techniques – P Gokila Brindha et al 2021 IOP Conf. Ser.:
Mater. Sci. Eng. 1055 012115
• https://en.wikipedia.org/wiki/Convolutional_neural_network
• https://www.geeksforgeeks.org/introduction-convolution-neural-network/
• https://en.wikipedia.org/wiki/Brain_tumor
43