Deep Learning Model For Automatic Classification A
Deep Learning Model For Automatic Classification A
Journal of Sensors
Volume 2022, Article ID 3065656, 11 pages
https://doi.org/10.1155/2022/3065656
Research Article
Deep Learning Model for Automatic Classification and
Prediction of Brain Tumor
Sarang Sharma,1 Sheifali Gupta,1 Deepali Gupta ,1 Abhinav Juneja ,2 Harsh Khatter ,2
Sapna Malik,3 and Zelalem Kiros Bitsue 4
1
Chitkara University Institute of Engineering and Technology, Chitkara University, Punjab, India
2
KIET Group of Institutions, Delhi NCR, Ghaziabad, India
3
Maharaja Surajmal Institute of Technology, Delhi, India
4
US AHO, Ethiopia
Received 17 December 2021; Revised 2 March 2022; Accepted 12 March 2022; Published 8 April 2022
Copyright © 2022 Sarang Sharma et al. This is an open access article distributed under the Creative Commons Attribution
License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is
properly cited.
A brain tumor (BT) is an unexpected growth or fleshy mass of abnormal cells. Depending upon their cell structure they could
either be benign (noncancerous) or malign (cancerous). This causes the pressure inside the cranium to increase that may lead
to brain injury or death. This causes excessive exhaustion, hinders cognitive abilities, headaches become more frequent and
severe, and develops seizures, nausea, and vomiting. Therefore, in order to diagnose BT computerized tomography (CT),
magnetic resonance imaging (MRI), positron emission tomography (PET), and blood and urine tests are implemented.
However, these techniques are time consuming and sometimes yield inaccurate results. Therefore, to avoid such lengthy and
time-consuming techniques, deep learning models are implemented that are less time consuming, require less sophisticated
equipment, yield results with greater accuracy, and are easy to implement. This paper proposes a transfer learning-based model
with the help of pretrained VGG19 model. This model has been modified by utilizing a modified convolutional neural network
(CNN) architecture with preprocessing techniques of normalization and data augmentation. The proposed model achieved the
accuracy of 98% and sensitivity of 94.73%. It is concluded from the results that proposed model performs better as compared
to other state-of-art models. For training purpose, the dataset has been taken from the Kaggle having 257 images with 157
with brain tumor (BT) images and 100 no tumor (NT) images. With such results, these models could be utilized for
developing clinically useful solutions that are able to detect BT in CT images.
Citation/
year of Reference Approach Objective Challenges of the approach
publishing
Dataset contained 3064 brain tumor images. It
CDLLC-CNN, To develop brain tumor classification
[1]/2021 FIN implemented binary classification and yielded an
VGG19, VGG16 technique by using CDLLC on CNN.
accuracy of 96.39%.
Dataset contained 1426 brain tumor images. It
SVM-CNN, To distinguish brain tumor from healthy
[2]/2021 JAIHC implemented binary classification and yielded an
VGG16, VGG19 individuals using SVM with CNN.
accuracy of 95.82%.
RNGAP-CNN, Dataset contained 3064 brain tumor images. It
To predict brain tumor from normal
[3]/2021 MMTA DenseNet201, implemented binary classification and yielded an
individual by RNGAP model on CNN.
VGG16 accuracy of 97.08%.
3DCNN, Dataset contained 1074 brain tumor images. It
To detect brain tumor on CT scans using
[4]/2021 MRT DenseNet201, implemented binary classification and yielded an
3DCNN technique.
VGG 16 accuracy of 92.67%.
MSMCNN, To automatically classify CT images into Dataset contained 374 brain tumor images. It
[5]/2021 NCA DenseNet121, brain tumor and normal individuals by implemented binary classification and yielded an
VGG19 using MSMCNN. accuracy of 96.36%.
HSANN, Dataset contained 3064 brain tumor images. It
To classify BT by using HSANN
[6]/2019 BS VGG19, implemented binary classification and yielded an
architecture.
DenseNet201 accuracy of 97.33%.
ELM-CNN, Dataset contained 1074 brain tumor images. It
To develop an ELM system to early
[7]/2017 SIVP DenseNet201, implemented binary classification and yielded an
diagnose BT individuals.
VGG16 accuracy of 97.8%.
Dataset contained 1074 brain tumor images. It
3DCNN,
[8]/2020 JDI To classify BT analysis by using 3DCNN implemented binary classification and yielded an
DenseNet201
accuracy of 96.49%.
Deep-CNN, Dataset contained 121 brain tumor images. It
To develop Deep-CNN system that can
[9]/2021 JCS DenseNet121, implemented binary classification and yielded an
determine BT by using CT scans.
DenseNet201 accuracy of 94.58%.
CNN, VGG16, Dataset contained 3064 brain tumor images. It
To diagnose BT by using an ensemble
[10]/2021 WMPBE VGG19, implemented binary classification and yielded an
system of CNN.
DenseNet201 accuracy of 84.19%.
tumors which are usually benign and are located near the Depending upon the location, type, and size of the tumor,
pituitary glands; pineal gland tumors which could be either different methods are employed to treat different tumors.
malignant or benign; lymphomas located at central nervous Surgery is the most widely recognized treatment of tumor
system which is malignant; and meningiomas and schwan- and has no adverse effects [9]. Grade 4 tumors can also lead
nomas, both of them occur in people in the age group in to neurodegenerative disease such as Alzheimer’s disease,
between 40 and 70 and mostly are benign. Parkinson’s disease, and Huntington’s disease which lead
According to World Health Organization (WHO), there to inability of basic cognitive and motor functions of the
exist four grades of brain tumors [6]. Grading is the process body and may lead to dementia.
of segmenting the brain tumor cells on the basis of their To detect the progress in modelling process, computed
identification. The more the abnormal the cells represent, tomography images of the brain are used. Computed tomog-
the higher the grade is detected. Grades I and II depict the raphy (CT) is not only an alternate method for the detection
lower level tumors whereas grade III and IV tumors com- of tumor but also provides more data about the given med-
prise the most extreme ones [7]. In grade 1, the cells appear ical image [10].
to be normal, hence less likely to infect other cells. In grade This paper encloses a novel CNN-based model that clas-
2, cells appear to be slowly growing into the adjacent neigh- sifies BT in two categories, i.e., BT and NT. Moreover, the
boring brain tissue. In grade 3, cells appear to be more CNN model is trained and developed for a large dataset.
abnormal and start spreading to other parts of the brain The accuracy of the proposed model has been enhanced by
and central nervous system. In grade 4, cells exhibit more implementing preprocessing techniques like normalization
abnormality and start growing into tumors and spread these and data augmentation on the dataset. Thus, automated sys-
to other parts of the brain and spinal cord. A benign tumor tems like these are helpful in saving time and also improve
is of low grade whereas malignant tumor is of high grade [8]. the efficiency in clinical institutions.
Journal of Sensors 3
Table 2
Name of model Size of input layer Size of output layer Number of layers Trainable parameters (millions)
VGG16 (224, 224, 3) (4,1) 16 138
VGG19 (224, 224, 3) (4,1) 19 143
DenseNet121 (224, 224, 3) (4,1) 121 8
DenseNet201 (224, 224, 3) (4,1) 201 10.2
DENSENET121:
DENSENET201:
VGG16:
VGG19:
Table 3: Brain tumor dataset description. DenseNet121 comprises one convolutional layer (CL),
one max pooling layer (MPL), three transition layers (TL),
Brain Number of training Number of validating one average pooling layer (APL), one FCL, and one Softmax
S.no.
tumor images images layer (SML) with 10.2 million trainable parameters. It has also
1 BT 125 32 four dense block layers (DBL) in which the third and fourth
2 NT 79 21 dense blocks have one CL of stride 1 × 1 and stride 3 × 3,
respectively [14]. DenseNet201 comprises one CL, one MPL,
three TL, one APL, one FCL, and one SML with 10.2 million
But, it can be noticed that these studies have worked on trainable parameters. It has also four DBL in which third
mostly binary classification. and fourth DBL have two CL of stride 1 × 1 and stride 3 × 3,
The proposed model in this research paper is trained on respectively [15]. VGG16 comprises thirteen CL, five MPL,
a large size of dataset having 1800 images. The proposed three FCL, and one SML with 138 million trainable parame-
model classifies the brain tumor into two categories that is ters [16]. VGG19 comprises sixteen CL, five MPL, two FCL,
with brain tumor (BT) and no tumor (NT). and one SML with 143 million trainable parameters [17].
3. Research Methodology
2.1. Brain Tumor Prediction Using Pretrained CNN Models.
For a wide range of healthcare research and applications, Many studies and research have been conducted on BT but
the convolutional neural network models had always dem- very less work has been implemented and published on
onstrated to acquire higher-grade results. Still, building these comparative analysis of BT using four D.L models which
pretrained convolutional neural network models from are VGG16, VGG19, DenseNet121, and DenseNet201.
scratch had always been strenuous for prediction of this neu- Then, these models results are displayed and compared by
rological disease due to restricted access of computed plotting graphs of accuracy, loss, and learning curves and
tomography (CT) images [11]. These pretrained models determining validation rules [18].
are derived from the concept of transfer learning, in which
a trained D.L model from a large dataset is used to elucidate 3.1. Dataset. For the proposed solution, an open access data-
the problem with a smaller dataset [12]. Due to this, not only set is used which is available on (https://www.kaggle.com/
the requirement for a large dataset is removed but also navoneel/brain-mri-images-for-brain-tumor-detection/)
removes excessive learning time required by various D.L uploaded by Navoneel Chakrabarty on 14th April 2019 and
models. This paper encloses four D.L models such as Dense- is named as ‘Brain MRI images for Brain Tumor Detection.’
Net121, DenseNet201, VGG16, and VGG19. These models The dataset consists of two categories of with brain tumor
were trained on ImageNet and then fine-tuned over BT (BT) and no brain tumor (NT) images which had a total of
images. In the last layer of these pretrained models, the fully 157 and100 images, respectively [19]. All of them are of size
connected layer (FCL) is inserted [13]. The architectural 467 × 586 × 3. This dataset is simply divided into two parts.
description and functional blocks of all architectures are One part is known as the training part, and other is known
shown in Tables 2(a) and 2(b), parameters are shown in as the validation part [20]. Dataset category description is
Table 2(c), and Figure 1 displays the diagrammatic represen- given in Table 1, and the image of dataset samples are shown
tation for these models, respectively. in Table 3 and Figure 2.
Journal of Sensors 5
(a) (b)
Figure 2: Brain tumor dataset: (a) no tumor and (b) brain tumor.
NORMALIZATION
INPUT IMAGE TRANSFER LEARNING PREDICTION
AUGMENTATION VGG16
FLIPPING VGG19 WITH BRAIN TUMOR
ROTATION DENSENER121 NO BRAIN TUMOR
BRIGHTNESS DENSENER201
Figure 4: Flipping data augmentation: (a) original, (b) horizontal flipping, and (c) vertical flipping.
3.2. Proposed Methodology. The proposed BT detection 0 and 255. By normalizing the input images, D.L models
model is depicted in Figure 3. This model classifies BT image can be trained faster [21].
into four categories, namely, NT and BT.
3.2.2. Augmentation. In order to improve effectiveness of a
D.L model, a large amount of dataset is required. However,
3.2.1. Normalization. The dataset underwent normalization accessing these datasets often come along with numerous
preprocessing technique so as to keep its numerical stability restrictions [22]. Therefore, in order to surpass these issues,
to D.L models. Initially, these CT images are in monochro- data augmentation techniques are implemented to increase
matic or in grayscale format having pixel values in between the number of sample images in the sample dataset [23].
6 Journal of Sensors
(a) (b)
(c) (d)
Figure 5: Clockwise rotation data augmentation: (a) original, (b) 90-degree anticlockwise, (c) 180-degree anticlockwise, and (d) 270-degree
anticlockwise.
Figure 6: Brightness data augmentation: (a) original image, (b) with brightness factor 0.2, and (c) with brightness factor 0.4.
Various data augmentation methods such as flipping, rotation, Rotation augmentation technique as shown in Figure 5 is
brightness, and zooming are implemented. Both horizontal implemented in clockwise direction by an angle of 90 degree
flipping and vertical flipping techniques are shown in Figure 4. each.
Journal of Sensors 7
Table 4: Sample images before and after data augmentation. Table 6: Training performance of all models with 16 batch size.
Brain Number of images Number of images after Train Valid Error Valid accuracy
S.no. Class Epoch
tumor before augmentation augmentation loss loss rate (%)
1 BT 157 1100 5 0.083 0.371 0.08 92.13
2 NT 100 700
10 0.075 0.302 0.08 92.34
VGG16
15 0.062 0.223 0.07 93.27
Table 5: Confusion matrix parameters of all models with 16 batch 20 0.067 0.205 0.06 94.83
size.
25 0.052 0.192 0.06 94.22
Precision Sensitivity Specificity Accuracy 5 0.103 0.126 0.06 94.71
Model
(%) (%) (%) (%)
10 0.089 0.105 0.05 95.76
VGG16 88.23 93.75 94.12 94 15 0.072 0.093 0.04 95.41
VGG19 100 94.73 100 98 VGG19
20 0.035 0.083 0.03 96.67
DenseNet121 85.71 100 94.73 96 25 0.026 0.081 0.03 96.71
DenseNet201 93.33 93.33 97.14 96 5 0.042 0.481 0.07 92.13
10 0.035 0.443 0.06 93.57
15 0.029 0.353 0.05 94.3
Brightness data augmentation technique as shown in DenseNet121 20 0.023 0.35 0.05 94.9
Figure 6 is also applied on in image dataset by taking bright- 25 0.021 0.33 0.05 94.92
ness factor values such as 0.2 and 0.4. 5 0.073 0.193 0.04 95.98
Training images before and after augmentation are
shown in Table 4. Further, there is a class imbalance in the 10 0.062 0.081 0.04 96.17
input dataset. In order to resolve this imbalance issue, the 15 0.059 0.071 0.04 96.4
DenseNet201
above data augmentation techniques are applied. After 20 0.045 0.059 0.02 97.98
applying these data augmentation techniques, the sample 25 0.043 0.052 0.02 98.2
dataset in each class was increased to 700 to 1000 images
approximately, and then, the entire sample dataset was
updated to 1800 images. Table 4 represents the number of (a) Accuracy. Accuracy is defined as the ratio of total
newly updated images. number of true predictions to the total number of
observed predictions
(b) Precision. Precision is calculated as the number of
4. Experiments and Results correct positive predictions divided by the total
number of positive predictions
An experimental evaluation for detection of BT from CT
images using four pretrained CNN models such as Dense- (c) Specificity. Specificity is defined as the number of
Net121, DenseNet201, VGG16, and VGG19 is implemented. correct negative predictions divided by the total
The CNN models were implemented using CT images col- number of negatives
lected from the brain tumor Dataset. For training and vali- (d) Sensitivity. Sensitivity is defined as the number of
dating, 432 training images and 104 testing images were correct positive predictions divided by the total
used, respectively. The brain MRI images were initially number of positives
resized from 467 × 586 to 224 × 224. An algorithm was
implemented using FastAI library. For transfer learning,
the models are trained for the batch size 16. Each model 4.2. The Training Performance Comparison for Different
was trained for 20 epochs. Both the batch size and number Models. Various performance parameters in terms of train-
of epochs are determined empirically. Adam optimizer was ing loss, validation loss, and error rate, and validation accu-
used to perform training. The learning rate was also empir- racy are obtained by four different models using different
ically decided. The performance of each model was evalu- epochs and batch size [25]. The four models such as Dense-
ated based on performance metrics such as accuracy, Net121, DenseNet201, VGG16, and VGG19 were evaluated
precision, sensitivity, and specificity. using 20 epochs with 16 batch size, respectively. For training
of all D.L models, Adam optimizer is utilized. From Table 5,
it can be seen that the VGG19 model acquired the highest
4.1. Performance Metrics. The performance metrics are cal- performance in the testing phase with precision of 100%,
culated by various parameters of the confusion matrix such sensitivity of 94.73%, specificity of 100%, and yielded accu-
as true positive (TP), false positive (FP), true negative racy of 98% for batch size 16. Table 6 depicts that during
(TN), and false negative (FN) [24]. These confusion matrix training phase also, and VGG19 outperforms the other
parameters are shown below: models because validation loss is minimum, whereas
8 Journal of Sensors
VGG16 VGG19
30 30
No tumor 15 1 25 No tumor 18 1 25
20 20
Actual
Actual
15 15
2 32 10 0 32 10
Brain tumor Brain tumor
5 5
Predicted Predicted
(a) (b)
Densenet-121 Densenet-201
30 30
No tumor 12 0 25 No tumor 14 1 25
20 20
Actual
Actual
15 15
2 36 10 1 34 10
Brain tumor Brain tumor
5 5
Predicted Predicted
(c) (d)
Figure 7: Confusion matrix of all models with 16 batch size: (a) VGG-16, (b) VGG-19, (c) DenseNet121, and (d) DenseNet201.
validation accuracy is highest in case of VGG19. It has 19 respectively, for batch size 16. From the results, it is analyzed
layers, and 8 million features are comparatively lower than that VGG19 performs better among all the models.
DenseNet121 and DenseNet201 but even then it is outper- From the previous discussion, it is analyzed that VGG19
forming. DenseNet121 and DenseNet201 are almost having performs better for batch size 16 as compared to other
the same performance but DenseNet201 has comparatively models. Now, the learning rate curve is drawn for VGG19
more layers than DenseNet121 that will cause more process- and DenseNet201 for batch size 16 in Figure 9. Learning rate
ing time. After 20 epochs, the performance parameters of all curve controls the model learning rate that decides how
the models remain similar. slowly or speedily a model learns. As the learning rate
increases, a point is generated where the loss stops diminish-
4.3. Confusion Matrices of Different Pretrained Models. The ing and starts to magnify. Ideally, the learning rate should be
confusion matrices of all D.L models of batch size 16 are to the left of lowest point on the graph. For example, in
shown in Figure 7. These matrices represent both correct Figure 9(a), learning rate is shown for VGG19 in which
and incorrect predictions. Each and every column is labelled the point with the lowest loss lies at point 0.001, so the learn-
by its class name such as BT and NT. Diagonal values yield ing rate for VGG19 should be between 0.0001 and 0.001.
accurate number of images classified by the particular Similarly, in Figure 9(b) where the learning rate is shown
model. for DenseNet201, lowest loss point lies at 0.00001. Hence,
From these confusion matrix, accuracy of all the models learning rate for Densenet201 should lie between 0.000001
is evaluated for batch size 16. The accuracy for all the models and 0.00001, which is lowest; it is clear that as the learning
is analyzed through the graphs as shown in Figure 8. From rate increases loss also increases.
Figure 8, it is clear that the best performers are VGG19 Loss convergence plot for VGG19 and DenseNet201
and DenseNet201 with accuracy achieved 98% and 96%, CNN models for batch size 16 are shown in Figure 10.
Journal of Sensors 9
Precision Sensitivity
100 100
95 95
90 90
85 85
80 80
1
19
16
en t121
1
en G19
12
20
16
20
G
G
et
et
G
VG
et
VG
VG
N
VG
se
se
se
se
en
en
D
D
D
D
Precision Sensitivity
(a) (b)
Specificity Accuracy
100 100
95 95
90 90
85 85
80 en t121 80
1
se 19
19
VG 6
16
20
12
20
1
G
G
G
G
et
et
et
VG
e
VG
VG
N
N
se
se
se
en
en
en
D
D
Specificity Accuracy
(c) (d)
Figure 8: Graphical representation of confusion matrix parameters for (a) VGG16, (b) VGG19, (c) DenseNet121, and (d) DenseNet201.
1.6
0.9
1.4
0.8
Loss
1.2
Loss
0.7
1.0 0.6
0.8 0.5
1e–06 1e–05 1e–04 1e–03 1e–02 1e–01 1e+00 1e–06 1e–05 1e–04 1e–03 1e–02 1e–01
(a) (b)
Figure 9: Learning rate vs. loss curve for proposed model with 16 batch size: (a) VGG19 and (b) DenseNet201.
0.8 0.8
0.6 0.6
Loss
Loss
0.4 0.4
0.2 0.2
0.0 0.0
0 20 40 60 80 100 120 0 20 40 60 80 100 120
Batches processed Batches processed
Train Train
Validation Validation
(a) (b)
Figure 10: Batches processed vs. loss curve for different CNN architectures with 16 batch size: (a) VGG19 and (b) DenseNet201.
10 Journal of Sensors