Brain Tumor Detection Using Deep Learning and Image Segmentation
Brain Tumor Detection Using Deep Learning and Image Segmentation
Abstract —Brain tumor detection is a critical aspect tumors have high mortality rates, especially when
of neurooncology, where timely and accurate diagnosis is delayed or inaccurate. The symptoms of
diagnosis significantly impacts patient outcomes. brain tumors, such as persistent headaches, dizziness, and
Traditional imaging techniques, while useful, are often cognitive impairments, are often non-specific and may
limited by variations in image quality, illumination overlap with less severe neurological conditions. This
inconsistencies, and the complex nature of brain complicates early diagnosis, necessitating advanced
tumors themselves, which vary widely in size, shape, imaging and diagnostic tools.
and texture. This paper presents a deep learning- Magnetic Resonance Imaging (MRI) is widely used to
based approach to brain tumor detection using visualize brain structures, offering non-invasive insights
Convolutional Neural Networks (CNNs) combined into tissue abnormalities. However, accurate tumor
with advanced image processing methods. Our detection from MRI scans is challenging due to variations
methodology involves preprocessing brain MRI scans in tumor appearance across individuals. Tumors can
using histogram equalization, morphological exhibit diverse
operations, and data augmentation to address
illumination issues and enhance the tumor region. Consequently, traditional image processing techniques,
Following preprocessing, the images are fed into a though useful, fall short in addressing these complexities.
CNN, where transfer learning from the Sequential In recent years, deep learning methods, particularly
model is applied to improve classification accuracy. Convolutional Neural Networks (CNNs), have
Experimental results demonstrate high recall and demonstrated significant potential in medical image
precision rates, affirming the model’s robustness in analysis. CNNs are particularly well-suited for capturing
detecting brain tumors in MRI images. This approach spatial features in images, making them a preferred
not only addresses the challenge of inconsistent MRI choice for classification tasks in medical imaging. In this
scan quality but also reduces the risk of study, we employ a CNN based approach enhanced by
misclassification, showing promise for clinical transfer learning from the Sequential model. Transfer
application. learning leverages pre-trained models that have been
fine-tuned on large-scale image datasets, allowing us to
Keywords— Brain Tumor Detection, Computer-aided
use these learned features on smaller, domain-specific
Diagnosis, Computer Vision, Convolutional Neural
datasets. By applying this transfer learning framework,
Networks, Deep Learning, Image Processing, Transfer
we can effectively detect brain tumors in MRI images
Learning.
despite the challenges posed by limited data and image
variability.
I INTRODUCTION This paper presents a novel CNN-based approach to brain
tumor detection that incorporates specialized
These tumors may be classified as benign or malignant, preprocessing techniques, a fine-tuned Sequential model,
with malignant tumors often posing lifethreatening risks. and data augmentation methods. We aim to demonstrate
Despite being relatively rare, brain how this combined methodology can improve detection
© 2024, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM38964 | Page 1
International Journal of Scientific Research in Engineering and Management (IJSREM)
Volume: 08 Issue: 11 | Nov - 2024 SJIF Rating: 8.448 ISSN: 2582-3930
accuracy, focusing on metrics such as recall to reduce due to their ability to learn spatial hierarchies and features
false negatives, which are critical in a medical context. directly from the data, making them highly effective for
image classification and segmentation tasks. By
Brain tumors represent a significant medical challenge
automatically learning to recognize complex patterns
due to their varied types, aggressive progression, and
within images, CNNs can identify subtle distinctions that
complex morphology. These tumors are caused by the
may not be easily discernible through traditional
abnormal proliferation of cells within the brain tissue,
methods. However, the success of deep learning models
and they can be broadly categorized into two types:
in medical imaging applications is often limited by the
benign and malignant. While benign tumors grow slowly
availability of large, labeled datasets. To overcome this
and may not always require surgical intervention,
challenge, transfer learning has emerged as a practical
malignant brain tumors are highly aggressive, posing a
solution, enabling models pre-trained on large, generic
substantial threat to life. Symptoms associated with brain
datasets to be fine-tuned for specific tasks with limited
tumors, including headaches, muscle weakness, memory
data.
loss, and cognitive impairment, are often nonspecific and
overlap with less severe neurological conditions. This paper explores a CNN-based approach for brain
Consequently, early and accurate diagnosis is essential to tumor detection in MRI images, leveraging the power of
improve treatment outcomes and provide timely transfer learning to address the limitations of small,
intervention. specialized datasets. The model employs Sequential, a
Magnetic Resonance Imaging (MRI) is widely regarded state-of-the-art deep learning architecture known for its
as the standard imaging technique for brain tumor residual connections, which mitigate the vanishing
detection and analysis. MRI scans provide detailed gradient problem commonly encountered in deep
images of brain structures, allowing clinicians to networks. By using Sequential as a base model, we can
visualize abnormalities with high spatial resolution. fine-tune the network to learn features specific to brain
However, despite its advantages, MRI-based tumor tumor detection, enhancing its ability to generalize across
detection faces numerous challenges. Brain tumors vary diverse MRI images.
significantly in terms of shape, size, texture, and location, In addition to transfer learning, the proposed approach
adding complexity to the diagnostic process. incorporates several image preprocessing techniques to
Additionally, MRI images are often affected by improve model performance and robustness. Histogram
inconsistencies in illumination, noise, and patient- equalization is used to normalize the intensity
specific variations, such as differences in brain anatomy distribution across images, thereby addressing
and tissue density. These factors contribute to the illumination inconsistencies and enhancing the contrast
difficulty of accurate tumor detection and segmentation, between tumor and non-tumor regions. Morphological
even for experienced radiologists. operations, including dilation and erosion, further aid in
Traditional image processing techniques have been highlighting the structural features of tumors, facilitating
employed to improve MRI-based tumor detection, better segmentation and feature extraction by the CNN.
including thresholding, segmentation, and morphological Data augmentation is also applied to artificially expand
transformations. While these methods can be effective the dataset, generating new image variations through
under controlled conditions, they often struggle to transformations such as rotation, flipping, and zooming.
account for the variability and complexity of MRI images These techniques not only improve the model's ability to
in real-world clinical settings. As a result, researchers and generalize but also reduce the risk of overfitting, a
clinicians are increasingly turning to advanced common issue when training deep learning models on
computational techniques, particularly deep learning, to limited datasets.
address these limitations. The objective of this study is to develop a robust, CNN-
In recent years, deep learning—specifically based model for the accurate detection of brain tumors in
Convolutional Neural Networks (CNNs)—has shown MRI scans. By integrating transfer learning, image
tremendous potential in the field of medical image preprocessing, and data augmentation, we aim to
analysis. CNNs are especially well-suited for visual tasks demonstrate a comprehensive approach that addresses
the unique challenges of MRI-based tumor detection.
© 2024, IJSREM | www.ijsrem.com DOI: 10.55041/IJSREM38964 | Page 2
International Journal of Scientific Research in Engineering and Management (IJSREM)
Volume: 08 Issue: 11 | Nov - 2024 SJIF Rating: 8.448 ISSN: 2582-3930
This paper also places particular emphasis on recall as a To enhance the dataset, we applied data augmentation
performance metric, prioritizing the minimization of techniques, including rotation, scaling, horizontal
false negatives to ensure that potential tumors are not flipping, and zooming, which simulate variations
overlooked. The experimental results validate the commonly encountered in real-world MRI scans. This
model's effectiveness, with high precision, recall, and F1 process effectively increases the dataset’s variability
scores, underscoring its potential for clinical application without the need for additional images, thereby
as a diagnostic support tool in neuro-oncology enhancing the model’s robustness against common
challenges such as rotation and scaling discrepancies.
The input dataset was mostly made up of a subset of a
II. METHODOLOGY dataset[1] consisting of 3762 tumor images and the
A. Flow Chart subset contained 2297 images. The subset selection was
done based on removing the images which might have
misdirected the model training. Another small dataset of
253 images was added[2]. This dataset has 155 tumor
images and 93 nontumor images. For more non-tumor
images, all 105 non-tumor images from another dataset
were used[3]. The images were preprocessed and then a
70%30% split was performed to get the training and
validation dataset.The resultant dataset was upsampled to
get the final dataset of 4222 images consisting of 1861
training tumor images, 563 training nontumor images,
1463 validation tumor images, and 315 validation non-
tumor images. Upsampling was done as the dataset
should be large enough for the model.
Test Dataset consists of 10 randomly picked images from
the internet out of which 5 had tumors and 5 didn’t.
1.
B. Dataset
Figure 1 and 2: Samples of non-tumor images from Figure 3 and 4: Image Processing on non-tumor
dataset. images
Global Thresholding:
Adaptive Thresholding:
Sobel filter
background which is a tragic effect. So we cannot use this then also it stays a cat. We can create such variants
technique for our task. manually and store them in the dataset but by doing this,
we will require more memory and time.
D. Split the dataset into Train, Validation, and Test ImageDataGenerator creates such variants internally
sets: thereby taking extremely less time and not taking a lot of
memory.
The processed dataset has to be divided into Train and Augmentation applied :
Validation datasets. The training dataset is the one on
which CNN is trained while after each epoch or iteration, All images are resized to 150x150 pixels.
the learned model till that iteration can be tested on a
Rotation of image between -30 degree and +30 degree.
validation set. The validation set becomes a type of test
data as the model was not trained on that; thereby Horizontal shift by 20% of the image width to the left or
becoming unseen data. right. Vertical shift by 20% of the image height to the top
Through the metrics we use on the validation dataset, we or bottom.
can track the progress of the model. Shear – Distort the image along an axis.
Zoom in the image by 20%
A 70% -30% split on the original dataset gave us the train
Apply horizontal flip to the image
and validation set.
Test Dataset:
It has the same folder hierarchy as those of the train and
validation datasets. It contains 20 images downloaded Figure 6-a: Original Image
from the Internet out of which 10 contain tumors whereas
10 do not.
E. Image Augmentation
Image Augmentation is the artificial increase in the image
dataset by applying specified transformations such as
rotation, horizontal flipping, etc. The need for image Figure 6-b : Image
augmentation arises when the existing dataset is not
sufficient for the neural networks or if there is a scope
improvement in the neural net’s performance if more data
is provided. Thus augmentation increases the size of the F. Training
dataset. It also prevents the neural network from We used a convolutional neural network as our model as
memorizing the data by adding some spatial variations to CNNs are the neural networks that are best suited for
the images, thus preventing overfitting. The images.
ImageDataGenerator of TensorFlow makes a generator Transfer learning [15] has been applied which means the
for images that can be fed into the neural network for training our neural network will do will be based on a
training and testing purposes. pretrained network. We have used a pre-trained model
The need for augmentation here becauses becausee that has already learned a lot of complex features. The
neural networks get better when the datasets are large and pre-trained model used is Sequential which will become
since our dataset contains 4222 images, we should our base model on top of which we will fine-tune our
increase it. We can create multiple variants of the image. task to classify tumor and non-tumor images.
Consider a cat image, if we mirror it from left to right or Reason for using Sequential :
top to bottom, it still stays a cat. If we rotate the image,
absence of underfitting which is good. The recall seems Some already existing methods:
to be lower for the test set than on the validation set which While looking at the research papers, we realized that the
can be attributed to the fact that the model was trained on standard pipeline for image processing looked something
a dataset of MRI images of a particular distribution while like greyscaling followed by skull stripping ie. all non-
random images from the Internet might not necessarily brain tissues are removed using contouring or
belong to that distribution so the test data can be segmentation. This is followed by thresholding using
completely foreign to our database. histogram analysis to find out the appropriate valley
We also have the graphs below depicting the metrics region for the threshold value.
values associated with the training and validation sets The grayscale black and white image is then eroded. In
after each epoch. This can show the entire learning some places, Berkeley wavelet transform is applied as an
process of the model and even the presence of overfitting effective segmentation technique. This pipeline was used
or underfitting (if any). by Nilesh Bhaskarrao Bahadure et al. in their paper [4].
A lot of these papers used machine learning techniques
that did not require as many dataset images as deep
learning techniques such as CNN. Hence the
experimentation in these papers was carried out using
very few images.
for its popularity is that it is a robust and accurate
algorithm. In Arakeri et al’s paper [5], the preprocessing
involved rotation correction, image denoising followed
Figure 7-a: Accuracy by shape and
Other papers to use SVM are Mariam Saii et al’s paper
[9], and L. Guo et al’s paper [10]. In the former paper, at
the preprocessing level, an anisotropic diffusion filter is
applied to the image for denoising it. In the latter paper,
the immune algorithm was used to search the optimal
weights and parameters.
Principal Component Analysis (PCA) is also a popular
algorithm that has its use in representing multivariate
Figure 7-b: Precision data tables into sets of smaller variables. This algorithm
is extensively used for feature selection in a lot of
research papers and this brings down the very large
From the graphs, we can observe that the training process feature count to a reasonable one. In Sachdeva J et al’s
was smooth and the less gap between the training and paper [6], 856 regions of interest (SROI) are extracted by
validation lines, indicates high generalization to the the content-based active contour model. 218 intensity and
validation images and absence of overfitting. texture features are extracted from these SROIs. Then
The test images were plotted and we could see which PCA was used for dimensionality reduction and the result
images were correctly labeled and which were not. was fed into an ANN.
Deep learning techniques such as ANN (Artificial Neural
Network) are also used but it is a very basic and
generalized type of neural network and gets combined
with other techniques such as PCA and KNN (K Nearest
Neighbors) to provide good results.
The metric used was Accuracy in most of the cases and
Figure 8: Wrongly Predicted Test Image the best result was observed in D.Sridhar et al’s paper
who performed dimensionality reduction using DCT and
Imaging. 2013 Dec;26(6):1141-1150. DOI: [15] Niklas Donges (2019, June 16). What is transfer
10.1007/s10278-013-9600-0. learning? Exploring the popular deep learning
[7] D. Sridhar and I. Murali Krishna, "Brain Tumor approach. Builtin.
Classification using Discrete Cosine Transform and https://builtin.com/datascience/transfer-learning.
Probabilistic Neural Network," 2013 [16] American Association of Neurological Surgeons.
International Conference on Signal Processing, (n.d.).
Image Processing & Pattern Recognition, “Classification of Brain Tumors”.
Coimbatore, 2013, pp. 9296, doi: https://www.aans.org/en/Media/Classifications-of-
10.1109/ICSIPR.2013.6497966. BrainTumors
[8] Padma Nanthagopal, A., Sukanesh Rajamony, R.
Automatic classification of brain computed
tomography images using waveletbased statistical
texture features. J Vis 15, 363–372 (2012).
https://doi.org/10.1007/s12650-012-0140-3.
[9] Mariam Saii, Zaid Kraitem, Automatic Brain Tumor
Detection in MRI Using Image Processing
Techniques, Biomedical
Statistics and
Informatics. Vol. 2, No. 2, 2017, pp. 73-76. doi:
10.11648/j.bsi.20170202.16.
[10] L. Guo, L. Zhao, Y. Wu, Y. Li, G. Xu and Q. Yan,
"Tumor Detection in MR Images Using One-Class
Immune Feature Weighted SVMs," in IEEE
Transactions on Magnetics, vol. 47, no. 10, pp. 3849-
3852, Oct. 2011, doi:
10.1109/TMAG.2011.2158520.
[11] Nair M, Varghese C, Swaminathan R. Cancer:
Current Scenario, Intervention Strategies and
Projections for 2015.
NCMH Background Papers; 2015. [Google Scholar]
[Ref list]
[12] Yeole BB. Trends in the brain cancer incidence in
India. Asian
Pac J Cancer Prev. 2008;9:267–
70.[PubMed][Google Scholar]
[13] Dasgupta, Archya et al. “Indian data on central
nervous tumors: A summary of published work.”
South Asian journal of cancer vol. 5,3 (2016): 147-
53. doi:10.4103/2278-330X.187589.
[14] Papadopoulos MC, Saadoun S, Binder DK, Manley
GT, Krishna S, Verkman AS. Molecular mechanisms
of brain tumor edema.
Neuroscience. 2004;129(4):1011-20. doi:
10.1016/j.neuroscience.2004.05.044. PMID:
15561416.