You are on page 1of 11

Multi-Classification of Brain Tumor Images

Using Convolutional Neural Network


Himanshu Jain Sahil Upgalanwar Grace George
School of Computer School of Computer School of Computer
Engineering and Technology, MIT Engineering and Technology, MIT Engineering and Technology, MIT
World Peace University - 411038 World Peace University - 411038 World Peace University - 411038
Pune, India Pune, India Pune, India
engghjain76@gmail.com sahilupaganlawar9@gmail.com ggh1999@gmail.com

Omkar Temgire Shridevi Karande


School of Computer School of Computer
Engineering and Technology, MIT Engineering and Technology, MIT
World Peace University -411038 World Peace University - 411038 Pune , India
Pune,India
omkartemgire12@gmail.com shridevi.karande@mitwpu.edu.in

Abstract
Brain tumor classification is a crucial task to evaluate
the tumors and make a treatment decision according to I . INTRODUCTION
their classes.A Deep-learning paradigm that has
achieved substantial results in image segmentation and Cancer is the second biggest cause of mortality
classification is the convolutional neural network (CNN). worldwide, according to the World Health
A new CNN architecture for brain tumor classification Organization (WHO)[1]. Cancer can be detected
was presented in this study. The classification was early and prevented, although this is not always
performed using a T1-weighted contrast-enhanced MRI practicable. A tumour, unlike cancer, can be
image database which contains three tumor types benign, pre-carcinoma, or malign. Benign
namely Meningioma , Glioma And Pituitary and images tumours are distinguished from malignant
with no brain tumor . The model has proved to provide tumours in that they do not spread to other organs
an overall validation accuracy and training accuracy by or tissues and can be surgically removed [2].
94.07% and 97.78 % without 5-fold cross validation , Gliomas, meningiomas, and pituitary tumours are
94.98% and 93.676% with 5-fold cross validation. The examples of primary brain cancers. Gliomas are
paper summarizes the importance of different factors tumours that grow from tissues other than nerve
involved in performing Hyperparameter Tuning with the cells and blood vessels in the brain. Meningiomas,
experimentational observations and inferences drawn on the other hand, come from the membranes that
from the same alongwith the purpose of k fold cross protect and surround the brain and central nervous
validation answering to the question that why are we system, whereas pituitary tumours are lumps
performing the same .With good generalization inside the skull [3–6]. The most significant
capability and good execution speed, the new developed distinction between these three tumour forms is
CNN architecture could be used as an effective that meningiomas are usually benign, but gliomas
decision-support tool for radiologists in medical are usually malignant. Unlike meningiomas,
diagnostics. which are slow-growing tumours, pituitary
tumours, even if benign, can induce various
Keywords : Brain Tumor, MRI, CNN, Data medical problems. Because of the preceding facts,
Augmentation, K- fold Cross Validation, it's critical to distinguish between these three
multi-classification
forms of tumours. The exact distinction between
these three types of cancers is a critical step in the robust and accurate model [11]. In CNN
clinical diagnosis process and subsequent architecture, the convolutional filters are acting as
effective patient assessment. Magnetic resonance feature extractors, and as we go deep, we extract
imaging is the most used approach for tumour more and more complex features (spatial and
type differential diagnosis (MRI). However, it is structural information). Feature extraction
vulnerable to human subjectivity, and human happens through convolving small filters with the
observation of a vast amount of data is input patterns followed by selection of the most
challenging. Early brain–tumor identification is distinguishing features and then starting to train
mostly dependent on the radiologist's experience the classification network [12].
[7]. The tumor's diagnosis could not be complete In this paper we intend to present a proper
without determining whether it is benign or working model in order to do multi class
malignant. A biopsy is frequently performed to classification for detecting the type of Brain
determine whether the tissue is benign or tumors (i.e. Meningioma , Glioma , Pituitary and
cancerous. A biopsy of a brain tumour is not No tumor ) Using Deep Learning model based on
routinely acquired before definitive brain surgery, Convolutional Neural Networks. The model was
unlike cancers elsewhere in the body [8]. It is developed using two approaches - by creating a
critical to build an effective diagnostics tool for VGG16 model and by using the 5 fold Cross
tumour segmentation and classification from MRI Validation about which is explained in detail in
images [7] in order to acquire exact diagnostics Section 2. The model performance was tested
and prevent surgery and subjectivity . using the VGG 16 model and in that we have
created different versions of the model in order to
New technologies, particularly artificial build a comparative study which is explained in
intelligence and machine learning, have had a detail in Section 3. We have used 5 fold
considerable impact on the medical sector, Cross-Validation to further increase our model’s
serving as a crucial support tool for a variety of performance so that the model can perform better
medical professions, including imaging. In MRI with unseen data. The details of this have been
image processing, various machine-learning explained in Section 2.3.1 and results are
approaches for image segmentation and discussed in Section 4.
classification are used to give radiologists a
second view. II. METHODOLOGY

Deep Learning (DL) is a subdivision of ML that is A. Image Database


based on learning data representations and
hierarchical feature learning. DL algorithms The Image Database is taken from kaggle [13]
utilize the arrangement of numerous layers of where the dataset is divided into 4 folders namely
nonlinear processing identities for feature Pituitary Tumor , Meningioma Tumor , Glioma
extraction. The output of each sequential layer is Tumor and No Tumor . The number of images
the input of the next one, and that helps in data present in the database for Pituitary Tumor is 926
abstraction as we go deep within the network [9]. images similarly for Meningioma Tumor is 375
Convolutional Neural Network (CNN) is a class images , for Glioma Tumor it is 927 images and
of DL and commonly used in analyzing visual the patient not having any kind of tumor is ( i.e
imagery and designed to require minimal No Tumor ) 433 images . The images present in
preprocessing [10]. It is inspired by biological the database are T1-weighted contrast MRI
processes in the human brain [11] and utilized to images also they are present in three different
handle data that come in multiple arrays [12]. The views namely Axial , Coronal and Sagittal which
main advantages of CNNs are feature learning and is represented by Figure 1 . Figure 2 represents
providing unlimited accuracy rather than the three classes of tumors namely Meningioma ,
traditional machine learning and vanilla neural Glioma and Pituitary Tumor .
networks which may be achieved by increasing
training samples and therefore leads to a more
Figure 1. Pituitary tumor is demonstrated in three different acquisition views (Axial, Coronal, and
Sagittal) from left to right respectively. Tumors are localized inside a red rectangle.

Figure 2. Different three axial brain tumor types as follows; Meningioma, Glioma and Pituitary tumor from
left to right respectively . Tumors are localized inside a red rectangle

B. Image Pre-Processing to the three intensities required for each pixel


in a full colour image. The importance of
In order to perform image preprocessing we Grayscaling lies in the fact that it reduces the
have implemented the following techniques complexity of the model as , consider using
in our model so that the feature extraction RGB images of 10x10x3 pixels to train
involved in the Convolutional Neural neural articles [14] .There will be 300 input
Network becomes uniform and easy . Firstly , nodes in the input layer. For grayscale photos,
Resizing of Brain MRI images is performed on the other hand, the same neural network
as the Magnetic Resonance Images obtained will only require 100 input nodes.
from the database were of different sizes .
These images represent the input layer of the C. K Fold Cross Validation
network so they were normalized using One
Hot Encoding and resized into two respective Due to sample variability between training
image sizes 128 * 128 pixels and 150 * 150 and test set, our model gives a better
pixels and as per the experimentation results prediction on training data but fails to
obtained the validation accuracies are generalize on test data. This leads to a low
monitored about which a detailed description training error rate but a high test error rate. To
is given in Section 3 . Secondly , Grayscaling solve the two issues we use an approach called
is performed on the Brain MRI images . In cross-validation. Cross Validation is a
RGB space, a 'gray' colour is one in which technique which involves reserving a
the red, green, and blue components have all particular sample of a dataset on which you do
the same intensity.As a result, each pixel only not train the model.
requires a single intensity value, as opposed
All of our data is used in testing our model,
Later, you test your model on this sample thus giving a fair, well-rounded evaluation
before finalizing it. Before attempting cross metric.
validation there are few things that need to be
considered . Firstly, we should train the model K-fold cross-validation may lead to more
on a large portion of the dataset. Otherwise accurate models since we are eventually
we’ll fail to read and recognise the underlying utilizing our data to build our model.
trend in the data. This will eventually result in
a higher bias. Secondly, we also need a good
But there are also some disadvantages linked
ratio of testing data points. As we have seen
with it like - The computing power is high.
above, less amount of data points can lead to a
So it may take some time to get feedback on
variance error while testing the effectiveness
the model’s performance in the case of large
of the model. Thirdly, we should iterate on the
data sets.
training and testing process multiple times.
We should change the train and test dataset
distribution. This helps in validating the model Slower feedback makes it take longer to find
effectiveness properly. the optimal hyperparameters for the model.

In our model we have used [15] 5 fold cross D . Proposed CNN Architecture
validation.The steps to perform cross
validation are -

1. Randomly split your entire dataset into


k”folds”

2. For each k-fold in your dataset, build your


model on k – 1 folds of the dataset. Then, test
the model to check the effectiveness for kth
fold

3. Record the error you see on each of the


predictions

4. Repeat this until each of the k-folds has


served as the test set.

5. The average of your k recorded errors is


called the cross-validation error and will serve
as your performance metric for the model.

There are some major advantages when we


apply k fold cross validation on our model like
as mentioned below .

K-fold cross-validation works well on small


and large data sets.

Figure 3. Module Diagram of the system


The system is divided into 3 modules, the input Convolutional Layer - 2D convolutional
after passing through each module gives the layer moves K convolutional filters (kernels)
final output of the model. The first module is the of size (M N) along the input images and
‘Preprocessing Module’ which consists of computes the dot product of the weights
processes involved in making the input image
(kernels weights) and the input.
quality for the model more enhanced than the
initial input fed to the system. This module RELU Layer - Following each convolutional
consists of tasks such as layer is a non-saturated activation function
called ReLU, which is mostly used to reduce
● Data Augmentation - in this the dataset training time as compared to other activation
size is increased by performing functions.
operations such as inverting image,
rotating image etc. Cross Channel Normalisation Layer - A
● Grayscaling and Thresholding - in this cross-channel normalisation layer scales and
grayscaling and thresholding techniques adjusts the related activations to normalise
are used and applied on the images the input layer. It creates a local response
which will in turn increase the overall normalization layer based on a channel-wise
model efficiency. with a specific size window .
● Salt Noise - salt noise modification is
done on the input images so that the Max Pooling Layer - The pooling layer is
problem of overfitting can be handled used to minimise the number of parameters
better. and, as a result, network computations.

The second module is the ‘CNN Module’ which Dropout Layer - In this layer, several
consists of processes which together make our activations (nodes) are dropped out at
CNN model’s complete execution such as random, which speeds up the training
● Train/Test Split - in this the input process considerably.
database is split for training and testing
purposes Fully Connected Layer -This layer connects
● Layer Architecture - in this the complete every neuron in one layer to every neuron in
layer architecture of the system is the layer above and below it.
residing. The details about the layer
structure is explained in Table no 1. Softmax Layer - The Softmax layer is used
● K fold Cross Validation - in our model to squash all expected classes between 0 and
we have taken the value of K as 5.
1, resulting in a total sum of 1 number.
The third and the final module in our system is Classification Layer - Finally, we use a
the performance module, this consists of
classification layer to estimate the
processes which will determine how well the
classification loss and provide the final
model performs such as loss analysis, accuracy
analysis and Hyperparameter Tuning. expected categorical mark for each input
image. This layer is based on cross - entropy
Input Layer - The input layer is responsible loss.
for confirming the scale of input images as
well as applying data normalisation.
Table1. CNN Layer Network . All Layers Listed with Properties

After the Training of the model is completed Training and Validation Accuracy as 97.78
over the layer architecture as shown in Table and 94.076 respectively where all the layers
1 which represents the final version of model are listed along with the noticeable properties
that we created after performing of the respective layer the model is classified
Hyperparameter Tuning which gave us on the four classes namely No_tumor ,
Meningioma_Tumor , Glioma_Tumor and got the validation accuracies as 91.986 ,
Pitiutary_Tumor . 94.076 , 92.728 and 89.895 respectively .
Batch size serves to be an important factor
III . Hyperparameter Tuning Observations in order to do Hyperparameter Tuning for
which we have to carry out multiple
We have carried out an experimentation study experimentations in order to find an optimal
with a mix of conventions that the Deep number which is suitable for your model
Learning practitioner’s follow around the which in our case was 40 [16]. The
world which gives us a good starting point as conclusion we can draw from here is that in
to how the below factors affect the overall general Deep Learning practitioners want
accuracy of the Brain Tumor Multi Class there batch size to be on a higher side like
Classification Model or a general CNN (128 , 256 or 1024 ) so that there model
model where we have kept the version 2 of takes computationally less time to train but
the model as our basis of comparative having a higher Batch Size often leads to
study[18]. asymptotically dropping down of accuracy
and also we do not want to have Batch Size
A. Image Size on the lower side like 16 because that would
take a lot of time in order to train your
With taking Image size into consideration we
model computationally . Deep Learning
have tested our model 2 by taking in two
practitioners use Batch Size - 64 as a good
values as (128 , 128) pixels and (150 , 150)
starting point which later can be tuned to
pixels and we got the validation accuracy as
find the optimal number by multiple
92.728 and 92.6829 respectively . The
experimentations and observations .
conclusion that we can draw from here is that
Image Size as a factor shown by the results
C. Number Of Epochs
mentioned above does not make much of a
difference while training a CNN model . The
With taking Number of Epochs into
only point we need to take care about is that
consideration one of the critical issues while
all the images may it be part of Training set ,
training a neural network on the sample data
Validation set or Test set need to be of similar
is Overfitting. When the number of epochs
size and also while creating a Web
used to train a neural network model is more
application where we are taking input as a
than necessary, the training model learns
image from the end user also needs to be
patterns that are specific to sample data to a
resized on the basis of the image size used so
great extent. This makes the model incapable
as to load that particular Web application .
of performing well on a new dataset.This
model gives high accuracy on the training set
B. Batch Size
(sample data) but fails to achieve good
accuracy on the test set. In other words, the
With taking Batch size into consideration
model loses generalization capacity by
we have tested our model 2 by taking in the
overfitting to the training data.To mitigate
values as 16 , 40 , 64 and 128 for which we
overfitting and to increase the
generalization capacity of the neural network, dedicated for validation of the model, to
the model should be trained for an optimal check the performance of the model after
number of epochs. A part of training data is each epoch of training. Loss and accuracy on
the training set as well as on validation set While taking dropout rate into consideration
are monitored to look over the epoch number the main issue arises when you increase
after which the model starts overfitting. In dropout beyond a certain threshold, it results
our case we monitored the same by using the in the model not being able to fit properly.
Early Stopping callback function provided in Intuitively, a higher dropout rate would result
the keras library where you can provide the in a higher variance to some of the layers,
parameter which you want to monitor that is which also degrades training. Dropout is like
either loss or accuracy. If the loss is being all other forms of regularization in that it
monitored, training comes to halt when there reduces model capacity. If you reduce the
is an increment observed in loss values. Or, If capacity too much, it is sure that you will get
accuracy is being monitored, training comes bad results.The solution is to not use high
to halt when there is decrement observed in dropouts. If you must, lowering the learning
accuracy values. rate and using higher momentum may
help[18].
D. Optimization Function
F. Learning Rate
With taking different Optimization Functions
into consideration we have tested our model 2 While taking Learning rate into
by using Adam Optimizer , RMSprop and consideration we have tested our model 2 by
Stochastic Gradient Descent[17] for which we taking in the value as 0.01 , 0.001 and
got the validation accuracies as 92.728 , 0.0001 for which in case of value as 0.01 as
89.1986 and 39.024 respectively .The we trained the model with using early
conclusion we can draw from here is that stopping and because the loss was not
Adam Optimizer as an optimization function asymptotically decreasing and the accuracy
performs the best in less time and more was not increasing so the process got
efficiently as shown by the above results . terminated in between . In case of 0.001 we
Most deep learning practitioners also use got validation accuracy as 92.728 and for
Adam optimizer as a good starting point for 0.0001 we got validation accuracy as
their model. 87.804[20] . The conclusion we can draw
from here is that the optimal value for
E. Dropout Rate learning rate in order to train our model is
0.001.

Figure 5 . (a) Shows Loss Vs Number of Epochs and (b) Shows Validation Accuracy Vs Number of Epochs ,
for the Final CNN model trained after Hyperparameter Tuning.
IV. Results and Discussion VI. Conclusion

Results of the Final version of the VGG 16 A new CNN architecture for brain tumor
model trained after performing Hyperparameter classification was presented in this study. The
Tuning are visualized using the graphs classification was performed using a
represented in Figure 5 . Where (a) shows the T1-weighted contrast-enhanced MRI image
graph between Loss and the numbers of epochs database which contains three tumor types. As
wherein as the number of epochs increases the input, we used whole images, so it was not
loss decreases . Figure 5 (b) shows the graph necessary to perform any preprocessing or
between Validation Accuracy and the Number segmentation of the tumors. Our designed
of epochs wherein as the number of epochs neural network is simpler than pre-trained
increases the validation accuracy also increases . networks, and it is possible to run it on
Finally the Training and Validation accuracy conventional modern personal computers. In
achieved by training this model is 97.78 % and this project we have automated the diagnosis
94.07 % respectively . Now as we discussed procedure for the brain tumor detection by the
that Normal VGG 16 model in certain cases use of Deep Learning. Apart from several
does not perform well on unseen data as it was existing brain tumor segmentation and
discussed in Section 2.3.1 therefore we applied detection methodology present for MRI of
5 fold cross validation in order to use our brain image our project has proved to provide
training data more efficiently and the final an overall validation accuracy and training
Training and Validation Accuracy we got after accuracy by 94.07% and 97.78 % without
taking mean of the scores of all 5 folds is 5-fold cross validation , 94.98% and 93.676%
93.676 % and 94.982572 % respectively . with 5-fold cross validation. In this paper, we
have proposed a system that can be used for
V. Tools And Time Consumption segmentation of brain MRI Images for
Detection and identification of brain tumors.
The proposed deep neural network structure is
We find a type of tumor that is Meningiomas ,
trained on Intel i5 9th Gen - 9300H CPU (2.4
Gliomas or Pituitary Tumor . The paper
GHz with Turbo Boost Upto 4.1 GHz ),
summarizes the importance of different factors
NVIDIA GTX 1650 Ti With Max-Q (4 GB)
involved in performing Hyperparameter
GPU, 8GB RAM, Jupyter Notebook and
Tuning with the experimentational
Python. For Creating the Diagrams of the
observations and inferences drawn from the
Architecture we used draw.io . The training time
same alongwith the purpose of k fold cross
was 71 minutes approximately incase of training
validation answering to the question that why
the model without 5 fold cross validation and
are we performing the same .
incase of with 5 fold cross validation it took 185
minutes approximately.
VII. References Imaging Cancer Management, 2nd ed.;
Royal College of Radiologists: London,
[1] World Health Organization—Cancer. UK, 2014; pp. 1–20. Available online:
Available online: https://www.rcr.ac.uk/publication/recomm
https://www.who.int/news-room/fact-sheet endations-cross-sectional-imaging-cancer-
s/detail/ cancer. (accessed on 5 November managementsecond-edition (accessed on 5
2019). November 2019).
[2] Priya, V.V. , “An Efficient [9] L. Deng and D. Yu, ‘‘Deep learning:
Segmentation Approach for Brain Tumor Methods and applications ’’, Found.
Detection in MRI.”, Indian J. Sci. Technol. Trends Signal Process., vol. 7, nos. 3–4,
2016, vol 9, pp. 1–6. pp. 197–387, Jun. 2014.
[3] Cancer Treatments Centers of [10] Y. LeCun. (2015). Lenet-5,
America—Brain Cancer Types. Available Convolutional Neural Networks.
online: https://www.cancercenter. Accessed: May 2019. [Online]. Available:
com/cancer-types/brain-cancer/types http://yann.lecun.com/exdb/lenet
(accessed on 30 November 2019). [11] M. Matsugu, K. Mori, Y. Mitari, and
[4] American Association of Neurological Y. Kaneda, ‘‘Subject independent
Surgeons—Classification of Brain facial expression recognition with robust
Tumours. Available online: face detection using a convolutional neural
https://www.aans.org/en/Media/Classificati network,’’ Neural Netw., vol. 16, nos. 5–6,
ons-of-Brain-Tumors (accessed on 30 pp. 555–559, Jul. 2003.
November 2019). [12] Y. LeCun, Y. Bengio, and G. Hinton,
[5] DeAngelis, L.M. , “Brain Tumors”. ‘‘Deep learning,’’ Nature, vol. 521,
New Engl. J. Med. 2001, 344, 114–123. no. 7553, p. 436, 2015 .
[6] Louis, D.N. , Perry, A. , Reifenberger, [13] Kaggle Dataset . Available online:
G. , Von Deimling, A. , Figarella-Branger, https://www.kaggle.com/sartajbhuvaji/brai
M. , Cavenee, W.K. , Ohgaki, H. , n-tumor-classification-mri
Wiestler, O.D. , Kleihues, P. , “ Ellison, [14] Carl F. Sabottke, Bradley M. Spieler.
D.W. The 2016 World Health Organization “The effect of image resolution on Deep
Classification of Tumors of the Central Learning in Radiography”. Available
Nervous System”, A summary. Acta Online:
Neuropathol. 2016, 131, 803–820. https://doi.org/10.1148/ryai.2019190015
[7] Afshar, P. , Plataniotis, K.N. , [15] Daniel Berrar , “Cross Validation”.
Mohammadi, “A. Capsule Networks for Available online:
Brain Tumor Classification Based on MRI https://www.researchgate.net/publication/3
Images and Coarse Tumor Boundaries.”, 24701535_Cross-Validation
In Proceedings of the ICASSP 2019–2019 [16] Ibrahem Kandel, Mauro Castelli.
IEEE International Conference on “The effect of batch size on the
Acoustics, Speech and Signal Processing generalizability of the convolutional neural
(ICASSP), Brighton, UK, 12–17 May networks on a histopathology dataset.”
2019; pp. 1368–1372. Available online:
[8] Byrne J. , Dwivedi R.; Minks D. https://www.sciencedirect.com/science/arti
“Tumours of the brain.” In Nicholson T cle/pii/S2405959519303455
(ed) Recommendations Cross Sectional
[17] Techniques to improve accuracy using 291779/why-accuracy-gradually-increase-t
data redesigning, Hyper Parameter Tuning hen-suddenly-drop-with-dropout
and Model Optimization. Available online: [19] Understanding learning rate and how
https://towardsdatascience.com/the-quest-o it improves performance in deep learning.
f-higher-accuracy-for-cnn-models-42df5d7 Available online:
31faf https://towardsdatascience.com/understand
[18] Importance of Dropout Rate changes ing-learning-rates-and-how-it-improves-pe
in model with respect to change in dropout rformance-in-deep-learning-d0d4059c1c10
Available online:
https://stats.stackexchange.com/questions/

You might also like