Brain Tumor Detection

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 43

BRAIN TUMOR DETECTION USING

GUIDE: DEEP LEARNING


MS. RAJESWARY.S Sruthi Suresh (40290097)
MS. AISHWARYA.B Yashini. V (40290115)
CONTENTS

• Abstract • Source Code


• Introduction • Existing System
• Objective • Proposed System
• System Architecture • Conclusion
• Literature Review • Reference
• Workflow
• Module
• Output
• Advantages & Disadvantages

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

• To provide doctors good software to identify tumor and their causes.


• Save patient’s time.
• Provide a solution appropriately at early stages.
• Get timely consultation.

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

PUBLICATION YEAR AUTHOR JOURNAL NAME ABSTARCT

The various techniques that are part of Medical


Image Processing and are prominently used in
discovering brain tumors from MRI Images.
IEEE 7th International
Based on that research this Paper was written
Luxit Kapoor, Sanjeev Conference on Cloud
2017 listing the various techniques in use. A brief
Thakur Computing, Data
description of each technique is also provided.
Science & Engineering
Also of All the various steps involved in the
process of detecting Tumors, Segmentation is
the most significant.
This paper survey of Identifying brain tumors
through MRI images can be categorized into
2017 Praveen Gamage Research gate four different sections; pre-processing, image
segmentation, Feature extraction and image
classification.

13
PUBLICATION YEAR AUTHOR JOURNAL NAME ABSTRACT

Using MR images of the brain, we


segmented brain tissues into normal
tissues such as white matter, gray matter,
cerebrospinal fluid (background), and
Nilesh Bhaskarrao Hindawi International tumor-infected tissues. We used pre-
2017 Bahadure, Arun Kumar Journal of Biomedical processing to improve the signal-to-noise
Ray, and Har Pal Thethi Imaging ratio and to eliminate the effect of
unwanted noise. We can used the skull
stripping algorithm its based on threshold
technique for improve the skull stripping
performance.
Some of the recent research work done on
the Brain tumor detection and
segmentation is reviewed. Different
IEEE International
Techniques used by various researchers to
Conference on
detect the brain Tumor from the MRI
2016 Deepa, Akansha Singh Computing for
images are described. By this review we
Sustainable Global
found that automation of brain tumor
Development
detection and Segmentation from the MRI
images is one of the most active Research
areas.

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

 Module 1: Data Collection


 Module 2: Data Preprocessing
 Module 3: Splitting of Data
 Module 4: Building and Implementation of the Model
 Module 5: Model Summary
 Module 6: Train the Model
 Module 7: Detection

27
MODULE 1: DATA COLLECTION

Data collection has been done from the Kaggle dataset.


Link: https://www.kaggle.com/datasets/navoneel/brain-mri-images-for-brain-tumor-detection

28
MODULE 2: DATA PREPROCESSING

For every image, the following preprocessing steps were applied:

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

The data was split in the following way:

o 70% of the data for training.


o 15% of the data for validation.
o 15% of the data for testing

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

from os import listdir


%matplotlib inline
def crop_brain_contour(image, plot=False):
#import imutils
#import cv2
#from matplotlib import pyplot as plt
# Convert the image to grayscale, and blur it slightly
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (5, 5), 0
# Threshold the image, then perform a series of erosions +
# dilations to remove any small regions of noise
thresh = cv2.threshold(gray, 45, 255, cv2.THRESH_BINARY)[1]
thresh = cv2.erode(thresh, None, iterations=2)
39
thresh = cv2.dilate(thresh, None, iterations=2)
SOURCE CODE

# Find contours in thresholded image, then grab the largest one


cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
c = max(cnts, key=cv2.contourArea)
# Find the extreme points
extLeft = tuple(c[c[:, :, 0].argmin()][0])
extRight = tuple(c[c[:, :, 0].argmax()][0])
extTop = tuple(c[c[:, :, 1].argmin()][0])
extBot = tuple(c[c[:, :, 1].argmax()][0])
# crop new image out of the original image using the four extreme points (left, right, top, bottom
new_image = image[extTop[1]:extBot[1], extLeft[0]:extRight[0]]
if plot:
plt.figure() 40
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

You might also like