Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views17 pages

Minor Project Report

The document presents a minor project report on 'Brain Tumor Detection Using CNN' by students at Maulana Azad National Institute of Technology, Bhopal, focusing on the use of Convolutional Neural Networks (CNN) for detecting brain tumors from MRI images. The project involves preprocessing MRI images, utilizing deep learning algorithms, and evaluating the model's performance through various metrics. The report includes sections on literature review, challenges in detection, and the methodology employed for tumor classification.

Uploaded by

aaky30658
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views17 pages

Minor Project Report

The document presents a minor project report on 'Brain Tumor Detection Using CNN' by students at Maulana Azad National Institute of Technology, Bhopal, focusing on the use of Convolutional Neural Networks (CNN) for detecting brain tumors from MRI images. The project involves preprocessing MRI images, utilizing deep learning algorithms, and evaluating the model's performance through various metrics. The report includes sections on literature review, challenges in detection, and the methodology employed for tumor classification.

Uploaded by

aaky30658
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

MAULANA AZAD

NATIONAL INSTITUTE OF TECHNOLOGY


BHOPAL INDIA, 462003

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

BRAIN TUMOR DETECTION USING CNN


Minor Project Report
Semester 5

Submitted by:

Ankit Upadhyay 191112480


Gyanendra Vikram Singh 191112438
Pratishtha Pathak 191112404
V V Mansi 191112401

Under the Guidance of


Dr. Sweta Jain
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Session: 2021-2022
1
MAULANA AZAD
NATIONAL INSTITUTE OF TECHNOLOGY
BHOPAL INDIA, 462003

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

This is to certify that the project report carried out on “BRAIN TUMOR
DETECTION USING CNN” by the 3rd year students:
Ankit Upadhyay 191112480
Gyanendra Vikram Singh 191112438
Pratishtha Pathak 191112404
V V Mansi 191112401

have successfully completed their project in partial fulfilment of their Degree in


Bachelor of Technology in Computer Science and Engineering.

Dr. Sweta Jain


(Minor Project Mentor)
2
DECLARATION
We, hereby declare that the following report which is being presented in the Minor Project
Documentation Entitled as “BRAIN TUMOR DETECTION USING CNN” is an authentic
documentation of our own original work and to the best of our knowledge. The following
project and its report, in part or whole, has not been presented or submitted by us for any
purpose in any other institute or organization. Any contribution made to the research by others,
with whom we have worked at Maulana Azad National Institute of Technology, Bhopal or
elsewhere, is explicitly acknowledged in the report.

Ankit Upadhyay 191112480


Gyanendra Vikram Singh 191112438
Pratishtha Pathak 191112404
V V Mansi 191112401

3
ACKNOWLEDGEMENT
With due respect, we express our deep sense of gratitude to our respected guides
and coordinators Dr. Jaytrilok Choudhary and Dr. Dhirendra Pratap Singh, for
their valuable help and guidance. We are thankful for the encouragement that
they have given us in completing this project successfully.

It is imperative for us to mention the fact that the report of a minor project could
not have been accomplished without the periodic suggestions and advice of our
project guide Dr. Sweta Jain and project coordinators Dr. Dhirendra Pratap Singh
and Dr. Jaytrilok Choudhary.

We are also grateful to our respected director Dr. N. S. Raghuwanshi for


permitting us to utilize all the necessary facilities of the college.

We are also thankful to all the other faculty, staff members and laboratory
attendants of our department for their kind cooperation and help. Last but
certainly not the least; we would like to express our deep appreciation towards
our family members and batch mates for providing the much needed support and
encouragement.

4
ABSTRACT:
A brain tumor, known as an intracranial tumor, is an abnormal mass of tissue in which cells
grow and multiply uncontrollably, seemingly unchecked by the mechanisms that control normal
cells. Imaging tests are generally prescribed by doctors for detecting tumours. Imaging tests
show pictures of the inside of the body. Computer vision is a field of artificial intelligence (AI)
that enables computers and systems to derive meaningful information from digital images,
videos and other visual inputs - and take actions or make recommendations based on that
information. CT scan, MRI, PET are commonly used imaging methods among which MRI is
considered the reliable source. Magnetic resonance imaging (MRI) is used to measure the
tumor’s size as it detects very minute objects. The aim of our project is to detect brain tumours
using various deep learning algorithms. Preprocessing is performed on an MRI image in order to
remove the impulsive noises and resize the image for improving the image quality.We have used
Convolution Neural Network (CNN) segmentation techniques for reliable detection of the tumor
region. We divided our dataset into three parts: training,validation and testing. First the model is
built upon the training set followed by parameter optimization on the valid set and evaluation of
the testing set. Based on our machine, we will predict whether the subject has a brain tumor or
not. The outcome of the project is examined using various performance metrics : accuracy,
precision, sensitivity and specificity. This project is a combination of CNN (to predict brain
tumour) and computer vision (to automate the process of brain cropping through MRI images).

KEYWORDS:
Convolutional neural network, MRI, Brain tumour, Preprocessing, Augmentation,
Segmentation

5
TABLE OF CONTENTS
CERTIFICATE 2

DECLARATION 3

ACKNOWLEDGEMENT 4

ABSTRACT: 5

KEYWORDS: 5

LIST OF FIGURES 7

1. INTRODUCTION 7
1.1 BRAIN TUMOUR AND DIAGNOSIS METHODS 8
1.2 MOTIVATION FOR THE WORK 8
1.3 PROBLEM STATEMENT 9
1.4 SCOPE 9
1.5 PROJECT ORGANIZATION 9

2. LITERATURE SURVEY 10

3. CHALLENGES IN BRAIN TUMOUR DETECTION AND CLASSIFICATION 10


Figure 2.1 location of tumours in different images 10

4. MODULE DIVISION 11
BRAIN MRI DATASET 11
PRE TRAINED MODEL 11
MODULE 1: IMAGE AUGMENTATION 12
Fig 4.1.1 image augmentation 12
MODULE 2: IMAGE PREPROCESSING 12
MODULE 3: IMAGE ACQUISITION AND DISPLAYING THE SAMPLE DATASET 12
MODULE 4: SPLIT THE DATASET 13
MODULE 5: BUILDING THE MODEL 13
Fig 44.5.1 CNN and human brain analogy 13
Sequential 14
Convolution 14
Padding 15
Pooling 15
Flattening 15
Fully connection 15
MODULE 6: COMPILING THE MODEL 16
MODULE 7: TRAINING THE MODEL 16
MODULE 8: MAKING PREDICTIONS 16

5. CONCLUSION AND FUTURE SCOPE 16


CONCLUSION 16
FUTURE SCOPE: 17

6. REFERENCES 17

6
LIST OF FIGURES

Figure 1- 2.1 location of tumours in different images

Figure 2- 3.1.1 image augmentation

Figure 3- 3.5.1 CNN and human brain analogy

1. INTRODUCTION
Medical imaging refers to several different technologies that are used to view the human body
in order to diagnose, monitor, or treat medical conditions. It deals with the interaction of all
forms of radiation with tissue and the design of technical systems to extract clinically relevant
information, which is then represented in an image format. This information helps to determine
whether surgery would be an effective treatment option; locate tumors for treatment and
removal; find blood clots or other blockages.

Medical image processing encompasses the use and exploration of 3D image datasets of the
human body, obtained most commonly from a Computed Tomography (CT) or Magnetic
Resonance Imaging (MRI) scanner to diagnose pathologies or guide medical interventions such
as surgical planning, or for research purposes. Medical image processing is carried out by
radiologists, engineers, and clinicians to better understand the anatomy of either individual
patients or population groups.There are many other technologies used to record information
about the location and function of the body. Those techniques have many limitations compared
to those modulates which produce images.

Generally image processing consists of several stages: image import, analysis, manipulation and
image output.Computer algorithms play a crucial role in digital image processing. Developers
use multiple algorithms to solve different tasks, including digital image detection, analysis,
reconstruction, restoration, image data compression, image enhancement, image estimation and
image spectral estimation.

The main benefit of medical image processing is that it allows for in-depth, but non-invasive
exploration of internal anatomy. 3D models of the anatomies of interest can be created and
studied to improve treatment outcomes for the patient, develop improved medical devices and
drug delivery systems, or achieve more informed diagnoses. It has become one of the key tools
leveraged for medical advancement in recent years.

7
1.1 BRAIN TUMOUR AND DIAGNOSIS METHODS

The brain tumor is one all the foremost common and, therefore, the deadliest brain diseases
that have affected and ruined several lives in the world. Cancer is a disease in the brain in which
cancer cells ascend in brain tissues. Conferring to a new study on cancer, more than one lakh
people are diagnosed with brain tumors every year around the globe. Regardless of stable efforts
to overcome the complications of brain tumors, figures show unpleasant results for tumor
patients. To contest this, scholars are working on computer vision for a better understanding of
the early stages of tumors and how to overcome using advanced treatment options.

The recent advances in brain tumor imaging offer unique anatomical as well as
pathophysiological information that provides new insights on brain tumors, directed at
facilitating therapeutic decisions and providing information regarding prognosis. MRI, CT, PET
scans are some of the advances in this arena. Magnetic resonance imaging (MRI) uses magnetic
fields to produce detailed images of the body. It can be used to measure the tumor’s size. A
special dye called a contrast medium is given before the scan to create a clearer picture. CT scan
takes pictures of the inside of the body using x-rays taken from different angles. A computer
combines these pictures into a detailed, 3-dimensional image that shows any abnormalities or
tumors.It can help find bleeding and enlargement of the fluid-filled spaces in the brain, called
ventricles. Changes to bone in the skull can also be seen on a CT scan, and it can be used to
measure a tumor’s size. PET scan is used at first to find out more about a tumor while a patient
is receiving treatment. It may also be used if the tumor comes back after treatment. It is usually
combined with a CT scan called a PET-CT scan.

Brain tumours can occur at different locations and the size of tumour also varies from person to
person. So it is necessary to sight the abnormalities for the treatment operations in order to
reduce the diagnostic errors. Computer vision is today assisting an increasing number of doctors
to better diagnose their patients, monitor the evolution of diseases, and prescribe the right
treatments. The technology not only helps medical professionals to save time on routine tasks
and give more time to the patients.

1.2 MOTIVATION FOR THE WORK

The main motivation behind the brain tumour detection is the need to classify whether the
tumour is negative or positive. We have used computer based techniques to detect tumour blocks
and classify the tumor using Convolution Neural Network Algorithm for MRI images of
different patients.

8
1.3 PROBLEM STATEMENT

Brain tumour- one of the threatening diseases of the world can be of any shape,size ,location
and intensity which makes it a tedious task to detect and diagnose the tumour. The manual
detection of brain tumour sometimes yields inappropriate results due to the lack of quantitative
measures to detect tumour which raises the need for an automated detection methodology.The
automated system can be used by neurosurgeons and healthcare specialists in an efficient
manner as it incorporates image processing, pattern analysis, and computer vision techniques
and is expected to improve the sensitivity, specificity, and efficiency of brain tumor screening.
The focus of this project is MRI brain images tumor extraction and its representation in simpler
form such that it is understandable by everyone. We detect whether the given MRI brain image
has a tumor or not using the Convolution Neural Network.

1.4 SCOPE

The scope of this project is to detect brain tumors. We have used Convolutional neural network
architecture for detection.

1.5 PROJECT ORGANIZATION

Chapter 2: Literature survey


Chapter 3: Challenges in brain tumour detection and classification.
Chapter 4: overview of existing work for Brain tumor detection and classification that has
been done using CNN.
Chapter 5: contains conclusion about the brain tumour detection using deep learning and
also the future scope of the project.
Chapter 6: references

9
2. LITERATURE SURVEY
[1]T. Hossain, F. S. Shishir, M. Ashraf, M. A. Al Nasim and F. Muhammad Shah, "Brain Tumor
Detection Using Convolutional Neural Network," 2019 1st International Conference on
Advances in Science, Engineering and Robotics Technology (ICASERT), 2019, pp. 1-6, doi:
10.1109/ICASERT.2019.8934561.

SUMMARY OF THE RESEARCH PAPER


A brain tumor detection method has been presented in the research paper which uses mirror
imaging. Fuzzy C-Means clustering for tumor segmentation is used which can predict tumor
cells accurately. Every step of the process has been explained thoroughly using images and
tables.
Several different techniques are discussed in this paper.
SVM, KNN, Multilayer perceptron, naive bayes, random forest classifiers were used first.
But good accuracy rate was not achieved. So the shift was made to CNN which is implemented
using Keras and tensorflow. The accuracy achieved using CNN model is 97.87%.

3. CHALLENGES IN BRAIN TUMOUR DETECTION


AND CLASSIFICATION
Brain tumor segmentation poses several unique challenges. The image quality has a
critical impact on segmentation performance. For example, blurred images result in poor
outcomes. The image pre-processing steps also have an impact on the performance. We need
variations of the images to improve the ability of the fit models to generalize what they have
learned to new images. It is difficult to collect such varied images which raises the need of data
augmentation. The shape, size, location and intensity of brain tumour varies from patient to
patient which makes it even more challenging to perform the classification.

Figure 2.1 location of tumours in different images

10
4. MODULE DIVISION
● Image Augmentation
● Image preprocessing
reading an input image
image enhancement
cropping the image
● Displaying the sample data
● split the dataset
training
validation
testing
● Building the model
● Train the model
● making predictions

The dataset used has been downloaded from kaggle which consists of around 2000 images after
data augmentation. Preprocessing is done on these images to enhance the quality. Segmentation
is performed using thresholding and morphological operations.Finally, the image classification
is done using Convolutional Neural Network to predict whether the tumor is present or not.

BRAIN MRI DATASET

The dataset contains 2 folders: yes and no which contains 253 Brain MRI Images. The folder
yes contains 155 Brain MRI Images that are tumorous and the folder no contains 98 Brain MRI
Images that are non-tumorous.

PRE TRAINED MODEL


Link: https://www.kaggle.com/datauma/brain-tumor-classification-using-cnn/notebook

● Reading the data


● Visualizing the data
● Splitting the data
● Data augmentation
● Modeling
○ Sequential used for building model layer by layer.
○ Flattening
○ fully connected layer (dense)

● Compile the model


● Fit the model.

Performance Summary:
Accuracy: 92%

11
MODULE 1: IMAGE AUGMENTATION

Since this is a small dataset we have used data augmentation to create more images.
To build a powerful image classifier using very little training data, image augmentation is
usually required to boost the performance of deep networks. It artificially creates training
images through different ways of processing or combination of multiple processing, such as
random rotation, shifts, shear and flips, etc.

Fig 4.1.1 image augmentation

MODULE 2: IMAGE PREPROCESSING

Images come in different shapes and sizes. They also come through different sources. Taking all
these variations into consideration, we need to perform some pre-processing on any image data.
RGB is the most popular encoding format, and most “natural images” we encounter are in RGB.
Also, among the steps of data pre-processing is to make the images of the same size. We used
cropping techniques to achieve this.Preprocessing is required to remove impulsive noises and
resize the image for improving the image quality. We need to convert the MRI image into a
grayscale image. So after removal of noises and scaling we can increase the classification
accuracy rate. Thresholding is used where we take all the pixels whose intensities are above a
certain threshold and convert them to ones; the pixels having value less than the threshold are
converted to zero. This results in a binary image. Normalisation is the most crucial step in the
pre-processing part. This refers to rescaling the pixel values so that they lie within a confined
range. So preprocessing helps in overall enhancement of image and increases the classification
accuracy rate.

MODULE 3: IMAGE ACQUISITION AND DISPLAYING THE SAMPLE


DATASET

The image that is acquired is completely unprocessed. Here we process the image using the file
path from the local device. Finally all the images of the dataset are displayed.

12
MODULE 4: SPLIT THE DATASET

To train the model the dataset is split into three parts which are training, validation and testing
dataset. The ratio is 60:20:20

MODULE 5: BUILDING THE MODEL

A Convolutional Neural Network (ConvNet/CNN) is a Deep Learning algorithm which can take
in an input image, assign importance (learnable weights and biases) to various aspects/objects in
the image and be able to differentiate one from the other.A CNN is able to successfully capture
the spatial and temporal dependencies in an image through the application of relevant filters.
So the architecture performs a better fitting to the image dataset due to the reduction in number
of parameters involved and reusability of weights.So the role of the architecture is to reduce the
image into a form which is easier to process, without losing features which are critical for
getting a good prediction.

The architecture of CNN is inspired by the connection of neurons in the human nervous
system.The human brain has a biological neural network which has billions of interconnections.
As the brain learns, these connections are either formed, changed or removed, similar to how an
artificial neural network adjusts its weights to account for a new training example. This is the
reason why it is said that practice makes one perfect since a greater number of learning instances
allows the biological neural network to become better at whatever it is doing. Depending upon
the stimulus, only a certain subset of neurons are activated in the nervous system.

Fig 44.5.1 CNN and human brain analogy

We have used The Keras library in python to build the CNN model. CNN uses edge detection to
identify the features of images where each edge is a group of a certain number of pixels.The
following libraries were imported:-

● Sequential used to initialize the network


● Convolution2D is used to perform the convolution operation. Here activation function

13
ReLu is also used to add non linearity.
● pad_sequences is used to extend the area of which a convolutional neural network
processes an image.
● MaxPooling2D is responsible for reducing the spatial size of the convolved feature and
helps to extract more dominant features of the convolved feature.
● Flatten is the function that converts the pooled feature map to a single column that is
passed to the fully connected layer
● Dense adds the fully connected layer to the neural network.
● Sigmoid activation function is used for classification as it is a binary classification
problem.

Sequential
Sequential is used to build the model layer by layer.
To initialize the neural network an object of the sequential class is to be created.
classifier= Sequential()

Convolution
A convolution converts all the pixels in its receptive field into a single value. For example, if
you would apply a convolution to an image, you will be decreasing the image size as well as
bringing all the information in the field together into a single pixel. The final output of the
convolutional layer is a vector.
To add the convolution layer we call the add function with the classifier object and pass in
convolution2D with parameters.
Arguments:-
● Filters:- number of output filters in the convolution
● Kernel size:- list of two integers specifying the height and width of the 2D convolution
window (if only one integer is provided then the same value for all the spatial
dimensions).
● Strides specifying the number of pixel shift over the input matrix.
● Padding: valid/same ; valid means no padding ; "same" results in padding with zeros
evenly to the left/right or up/down of the input such that output has the same
height/width dimension as the input.
● Dilation rate:- This defines a spacing between the values in a kernel. A 3x3 kernel with
a dilation rate of 2 will have the same field of view as a 5x5 kernel
● Groups:- a positive integer specifying the number of groups in which the input is split
along the channel axis. Each group is convolved separately with filters/groups. The
output is the concatenation of all the groups results along the channel axis. Input
channels and filters must both be divisible by groups.
● Activation function:- specifies the activation function to be used to add non uniformity.
● Use_bias: whether the layer uses a bias vector.
All these parameters are not mandatory

classifier.add (Convolution2D (256, 3, 3, input_shape = (256, 256, 3), activation=’relu’))

14
Padding

This layer can add rows and columns of zeros at the top, bottom, left and right side of an image
tensor.

X = ZeroPadding2D((2, 2))(X_input)

Pooling

The Pooling layer is responsible for reducing the spatial size of the convolved feature. This
reduces the number of computations.

It extracts the dominant features.

Generally a pool of size (2x2) is created for max pooling. This enables us to reduce the
dimensionality of the image without losing some important features.

classifier.add (MaxPooling2D (pool_size= (2,2)))

Flattening

All the pooled feature maps are taken and put into a single vector for inputting it to the next
layer.

The flatten function puts all the feature maps into a single column vector.

classifier.add(flatten())

Fully connection

Now we need to use the vector obtained above as the input for the neural network by using
dense function

Parameter: number of nodes in the hidden layer

classifier.add(Dense(output=64))

Now we need to add the output layer. Since it is a binary classification problem (yes/No) so a
sigmoid activation function will be used. If we expect more than two outcomes a softmax
activation function can be used.

classifier.add(Dense(output=1,activation=’sigmoid’))

Finally our model is created and this instance can be used to train/test the model

15
MODULE 6: COMPILING THE MODEL

model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

Optimizer controls the learning rate. Adam optimizer adjusts the learning rate throughout the
training.
We have used 'binary_crossentropy' for our loss function.

MODULE 7: TRAINING THE MODEL

Training a neural network typically consists of two phases:

1. A forward phase, where the input is passed completely through the network.
2. A backward phase, where gradients are back propagated (backprop) and weights are
updated.

We’ll follow this pattern to train our CNN. There are also two major implementation-specific
ideas we’ll use:

● During the forward phase, each layer will cache any data (like inputs, intermediate
values, etc) it’ll need for the backward phase. This means that any backward phase must
be preceded by a corresponding forward phase.
● During the backward phase, each layer will receive a gradient and also return a gradient.
It will receive the gradient of loss with respect to its outputs (∂L / ∂out) and return the
gradient of loss with respect to its inputs (∂L / ∂in).

MODULE 8: MAKING PREDICTIONS


In machine learning, model testing is referred to as the process where the performance of a fully
trained model is evaluated on a testing set. This is a classification problem which means the
model learns a mapping between input features and an output feature that is a label. In this case,
the output is either yes or no. We will use the previously built model and call model.predict() to
have the model predict on the testing dataset.

5. CONCLUSION AND FUTURE SCOPE


CONCLUSION
We proposed a computerized method for the detection of brain tumors using the Convolution
Neural Network. We used data augmentation to increase the number of images in order to
increase the accuracy of the model. We used the MRI images dataset from kaggle. The first task
was to perform preprocessing on these images. The essential preprocessing steps that we
performed were converting the rgb to grayscale images (thresholding), cropping the image to
extract only the dominant features, noise removal using various filters, normalization to
transform the features to be on the same scale. We used the Keras API to build the CNN model.
Then we used the testing dataset to predict the accuracy of the model. The proposed algorithm
was assessed through various performance metrics:- sensitivity, specificity and accuracy. So a

16
complete computerized algorithm was proposed to detect brain tumour.The proposed model had
obtained an accuracy of __ and yields promising results without any errors and much less
computational time.

FUTURE SCOPE:
● Gathering of medical data is a tedious job; So self-learning algorithms would aid in
enhancing the accuracy of the algorithm and reduce the computational time.
● The proposed model can be used to detect real time cases in the mere future by using
more efficient feature extraction techniques.
● This technique can be used for detection of tumors in the brain or other organs like
lungs, breast, skin, etc in the future.
● This computerized version will be extensively useful in the healthcare sector.

6. REFERENCES
[1]T. Hossain, F. S. Shishir, M. Ashraf, M. A. Al Nasim and F. Muhammad Shah, "Brain Tumor
Detection Using Convolutional Neural Network," 2019 1st International Conference on Advances in
Science, Engineering and Robotics Technology (ICASERT), 2019, pp. 1-6, doi:
10.1109/ICASERT.2019.8934561.

[2] https://towardsdatascience.com/intro-to-deep-learning-c025efd92535

[3]https://medium.com/intro-to-artificial-intelligence/deep-learning-series-1-intro-to-deep-learning-abb1
780ee20

[4] https://www.analyticsvidhya.com/blog/2018/10/introduction-neural-networks-deep-learning/

17

You might also like