Optimization and efficiency analysis of deep learning based brain tumor detection

Brain tumors are spreading very fast across the world. It is one of the aggressive diseases which eventually lead to death if not being detected timely and appropriately. The difficult task for neurologists and radiologists is detecting brain tumor at early stages. However, manually detecting brain tumor from magnetic resonance imaging images is challenging, and susceptible to errors as experienced physician is required for this. To resolve both the concerns, an automated brain tumor detection system is developed for early diagnosis of the disease. In this paper, the diagnosis via MRI images are being done along with classification in terms of its type. The proposed system can specifically classify four brain tumor condition classification like meningioma tumor, pituitary tumor, glioma tumor and no tumor. The convolutional neural network method is used for classification and diagnosis of tumors which has accuracy of about 93.60%. This study is done on a KAGGLE dataset which comprises of 3274 Brain MRI scans. This model can be applied for real time brain tumor detection.


Introduction
One of the most complicated organs of human body is the brain which controls all the actions of human body by receiving information from different senses and send them back for performing the appropriate action [1].An abnormality to this organ can create serious effects on the functionality of the human body, this abnormality is well known as the brain tumor [2].The brain tumor threatens human life directly and arises when the development of tissues in brain grows unnaturally.It is basically a collection, or mass, of abnormal cells in the brain [3].Brain tumor is one of the critical reasons of psychiatric complications and depressions [4], which arises due to multiple reasons like age, gender, inheritance, working environment, physical fitness and mental distress and etc. Due to the brain tumor, the abnormality in brain working creates unnecessary waves movements, reflection and Sensation [5].Brain tumor can either be benign type as non-cancerous or malignant tumor as cancerous type [6].The benign tumors cannot spread to neighboring tissues, they can only spread locally but if these tumors are developed near critical locations they can be problematic and life threatening [7].The malignant tumors, on the other hand, can grow and spread in a way that can result in a cancerous disease which is life-threatening and can extend to the spinal cord or other regions of the brain.The malignant tumors rarely disseminate towards other bodily regions [8].These can also be divided into primary tumors, which originate inside the brain, and secondary tumors, which typically spread from cancers outside the brain and are referred to as brain metastasis tumors.As per [9] in the world, Glioma, meningioma, and pituitary tumors are common primary tumors with occurrence percentage as shown in Fig. 1. [8] The Gliomas tumor is the resultant of glial cells which develops in the supporting tissue of the brain which is a malignant type of tumor and it is recognized as the most aggressive form of tumor and responsible for most death occurring through brain tumor [10].The Meningiomas is a benign tumor that develop gradually and are develops around outer shells of the brain simply under the skull.They are commonly discovered inside the cerebral hemispheres, in the lower region of the brain where the pituitary gland is located, thus it takes many years to be detected [11].Its primary job is to make the hormones needed to regulate the body's different glands, including the thyroid glands [12].The tumor present in the pituitary gland affects the normal operation of glands [13].If the tumor is detected at an early stage, the chance of survival increases significantly as timely treatment of disease is very much possible.For early tumor detection, a major challenge is to define and classify specifically the correct type of brain tumor in the initial phase, and whereas equally depends on the skills, professional experience of the physician, and advance treatment methods for rapid recovery of patients.The untreated or advanced level brain cancer can speedily spread inward in tissues and can cause enduring brain damage which eventually results in death [14].Traditionally, a neurologist can diagnose a brain tumor using a Computer Tomography (CT) scan or MRI, which produce more detailed images.Due to their better resolution and capacity to reveal a lot of information on the structure of the brain and disorders within its tissues, MRI scans have an impactful details of automatic medical image analysis [15].In this work, a highly efficient deep learning based CNN architecture is designed which will take MRI scans as an input and will output the brain tumor detected.The automated system will be able to classify three brain tumor diseases like meningioma, pituitary and glioma and no tumor condition with accuracy rate of 93.60%.

Related Work
In literature review, various researchers have proposed different automated methods for classifying and detecting brain cancers from brain MRI images [16].In modern era, it became possible to scan medical images and diagnose any abnormality, especially in early stages.This is getting more value due to involvement and evolution of Artificial intelligence (AI) in medical science.Previously diagnostics was time taken problem and was totally depending on the expertise of the doctor but nowadays medical diagnostics have become more easier, faster and accurate [17].The Neural Networks (NN) is the most widely used approach for predicting and analyzing the system performance [18].The NN has layers and functions behaves and perform similarly as like human brain does.To learn and gradually increase the accuracy, the NN strongly dependent on data training.Such learning algorithms become more effective if adjusted for accuracy, enabling us to quickly classify and data clustering.Compared to manual identification by physician experts, the simple to complex image recognition can be analyzed quickly in no time compared to hours required to analyze.Despite the fact that NN comes in a variety of forms, CNN is employed for image and pattern recognition.
Using MRI scans, some work is being carried out to identify the brain cancers.Most of the previous studies have target to identify that whether tumor is present or not.Approximately some have detected tumor location.Very less work is reported to classify tumor in its types with higher performance metrics.In [19], authors have proposed an effective way to find a brain tumor in its early stages.Feature extraction, noise removal, segmentation, and Naive Bayes classifier were the few processes of the work.The patient's brain picture is originally obtained, than for acquired image, pre-processing, feature extraction was made and finally feature classification was performed.With an accuracy of 84%, the Naive Bayes classifier approach is used to accurately diagnose brain tumors.The mechanism to detect brain cancers in their early stages was put forth in [20].
The regions containing tumors have been identified in MRI scans, and these regions were categorized into various tumor types.For better image categorization tasks, Tensor Flow library was used to create the CNN based deep learning.In results, using Faster CNN approach an accuracy of 91.66% was claimed.In [21], the classification scheme was proposed which divides A model to identify the type of brain tumor using MRI scans was proposed in [22] by using a 2D CNN for classification of meningioma, glioma, and pituitary cancers each was detected with an overall accuracy of 91.3%.The three most common brain tumor diagnoses were represented in the dataset that was used in the study.

Model Design and Methodology
In this paper, the diagnosis of tumor present in MRI scans of brain is proposed by major steps as shown in Fig. 2.

Dataset
In this step we collected our MRI data from Kaggle [23].The data set of brain images consist of total 3274 MRI scans.From which 936 are glioma tumor images, images, 937 are meningioma tumor images and about 901 are pituitary tumor images and 500 are no tumor images.The images have the resolution of 619x495.

Image Pre-processing
After collecting data from publically available source, we adjust image size to 320x320.Morphological Operation: The next step after resizing is applying minimum filtration value which is selected from neighbouring pixels within the iterative window and assigned to central pixel.We have adjusted the window size to 5 x 5.This step also helps removing the external noises present in brain tumor images.
Image Contrast: Once resultant image is obtained after applying minimum filter, the image quality is enhanced by adjusting the contrast.The brighter and darker regions of the pixels are separated for improved visualization, and the pixel intensities are adjusted to 1.2 using contrast by enhance factor alpha.The quality of the image can be improved by increasing this factor.

Convolutional Neural Network Model
CNN is a type of artificial neural network that works best for the image classification because they efficiently decrease the number of connections by utilizing convolution layers.These convolutional layers apply filters on the input image.These filters are capable of detecting specific features or patterns in image.In this study, a CNN model is designed as shown in Fig. 3 which receives MRI images as input and output the error present.

Image Contrast
The three forms of brain tumors used to train the developed DL model are gliomas, meningiomas, and pituitary tumors.This system will be able to identify all the three tumor types as well as the absence of any tumor.The six main steps involved in creating a CNN model are (i) Convolution, (ii) ReLU, (iii) Pooling, (iv) Flattening, (v) Fully connected layers and (vi) SoftMax function.The first step involves convolution in which convolution filters are applied for activating some features of input image.For faster training, all the negative values are mapped to zero in the ReLU phase, while positive values are kept unchanged.After, ReLU comes the pooling step that simplifies the output by applying nonlinear down sampling, this decreases the parameters quantity that networks need to learn.As each layer requires the detection of a separate set of features, all three actions are repeated over hundreds of layers.After pooling the next step is flattening, in which single linear vector is formed by transforming two dimensional arrays.This process is required to have entirely connected layers.Complete local features of previous convolution are combined in fully connected layers.The last step applied to finish the procedure is SoftMax that provides the final classification output.We have implemented the sequential model and for this we divided the layers into number of bunches as shown in Fig. 4.

Fig. 4. CNN layers connection with respect to bunches
In the first bunch we have the CNN input layer with 64 filters of 3x3 size, the activation layer of ReLU function, and batch normalization layer.In the second bunch, we have convolution layer with 64 filters of 3x3 size, activation layer of ReLU function, max pooling layer with size of 2x2, layer of batch normalization, and then dropout layer.In the third bunch, convolution layer of 64 filters of 3x3 size, the activation layer of ReLU function, and batch normalization layer.In the fourth bunch, we have flattened layer, dropout layer of 0.5, dense layer of value 512, ReLU activation layer, batch normalization, dense layer of value 4, and final activation layer of SoftMax to classify brain tumor.Fig. 4 shows the overall work flowchart for data acquisition, model designing and training, and lastly analysis of predicted results.

Regularization Technique
The regularization techniques help to prevent overfitting and underfitting.In this work, we have conducted several experiments on different types of regularization techniques to extract the best version of model, these are (i) Dropout Regularization, (ii) Early stopping and (iii) L1 and L2 Regularization.
Dropout: In DL, dropout regularization is the preferred type of technique when dealing with large neural network as it helps in avoiding overfitting.It basically selects some random nodes at every iteration and remove them along with their incoming and outgoing connections.
Early stopping: One portion of the training set is retained as validation set in this regularization technique which also known as cross validation strategy.Training is stopped immediately of model when it starts performing worse on validation set.This is referred as early stopping.

L1 and L2 Regularization technique:
The most common type of regularization technique is L1 and L2.In cost function one term is added called regularization term.The reason to add regularization term is to reduce the value of weight matrices because it is assumed that neural network with less value of weight matrices creates simpler models.The cost function can be defined by Eq. 1.
=  +   (1) In L2 or weight decay lambda is known as regularization term which is a hyperparameter whose value is changed for achieving improved results.It forces weight to decay not exactly zero but towards zero, as described in Eq. 2.
In L1 technique the weight may leads to zero as it is useful method when the requirement is to compress the model else L2 is preferred, as described in Eq. 3. Hyperparameters: In this section, several experiments are conducted to make the best version of proposed CNN model.We have performed fine tuning and optimization of hyperparameters.These parameters need to be set before starting the model's training.The DL models including CNN can have few to few hundred hyperparameters.It effects the model's final performance as well as the model's learning rate.Below are the carefully chosen hyperparameters after fine tuning mentioned in Table 1.

Statistical Evaluation of Model
In DL, it is good to have preprocessed and desired clean data for the input of neural network, as it helps in improving the features of image to enhance the image prediction.For larger set of data, the time taken by image preprocessing for neural network training results in delays.Noisy and degraded scans of MRI can be the reason of bad visual assessment.So, in our case we have applied minimum filtering of window size 5x5 and then contrast adjustment (alpha =1.2) sequentially, as shown in Fig. 5.With pre-processed MRI images, several experiments were conducted.These images were concerned with different severity levels, size, position, and shape of brain tumor for assessing the performance of CNN model.Also evaluated the quantification of predicted results against the ground truth.The performance is evaluated based on different performance metrics as mentioned in Table 2.We trained our CNN model by feeding the preprocessed MRI images, where 90% of the data was allocated for the training set while remaining 10% are allocated for validation set.

Automated Recognition of Brain Tumor Diseases
For brain tumor diseases recognition, an efficient CNN model is trained and acquired predictions over different cases of brain tumor as shown in Fig. 7.For each predicted brain tumor results which include different types of brain disorders like pituitary, meningioma, glioma and no tumor, an independent neurologist was asked to validate the results.The brain tumor predication model performance is compared with the respective ground truth.Considering the identification challenges for MRI images, the proposed CNN model performs superiorly even in those conditions and manages to classify it with more accuracy.The confusion matrix of the proposed model is presented in Fig. 8.

Fig. 8. The confusion matrix
For assessing brain tumor diseases classification, the stack of N=100 MRI scans is selected to measure the automated model's performance and its results are monitored to find about the ability of performance metrics to categorize brain tumor disease.For this study we have tabulated precision, recall, accuracy, AUC.Table 3 represents the attained average result of performance metrics.In all brain tumor experiential cases the quantitative measurements within the stack of MRI scans are reliable as well as precise.The results confirms that qualitative similarity and consistency is synchronized with model's performance when predicting the brain tumor cases as compared with the respective ground truth labels.From the results of Table 3, it is quite evident that our presented model perform very well in all major aspects.Table 4 summarized the comparative analysis of one specific parameter i.e., accuracy available in the literature versus on proposed model.Our proposed CNN model has higher accuracy of tumor detection efficiency as compared to all previously available models.

Conclusion
To classify and quantify brain tumor diseases, a reliable CNN model is presented in this study with scores of 94.17, 93.60, 93.60, 98.71, and 24.81 for precision, Recall, Accuracy, AUC, and categorical cross entropy loss for the test images respectively .This deep learning based CNN architecture is classifying all three diseases images along with no tumor condition with higher accuracy.All the hyperparameters and regularization techniques are carefully chosen to increase systems reliability and efficiency.This model has also been validated in a large number of its multiple cases.Additionally, it has been shown that the proposed system's reliability, accuracy, and objectivity include digital analysis of a variety of brain tumor cases and its distribution occurring in the MRI scans.This provides clinicians with an excellent visual experience that is intuitive and helps them monitor the development and detection of the disease.In an area where neuroimaging is heavily reliant DL offers promising technologies for patient management and reliability for disease diagnosis.

Acknowledgement
The Authors acknowledge the service, resources and laboratories used at the Department of Electronic Engineering, Mehran University of Engineering and Technology, Jamshoro, Pakistan.

Fig. 3 .
Fig. 3. Flowchart for data acquisition, CNN model designing and training

Fig. 5 .
Fig. 5. Result of image processing steps (a) Raw image (b) Image with minimum filter (c) contrast Image Note: The Raw Image Brisque score is recorded as 70.46 and Pre-Processed Image Brisque score is 64.50.
While training the CNN model on validation data set the performance of model is monitored based on which performance metrics are evaluated.Attained the optimum value on validation data set at 23rd epoch.This experiment is performed by using two platforms: (i) Lenovo Intel core i5 Vpro Laptop is used with processor range of 1.7GHz to 4.40 GHz, and 6GB memory.Model is run for the time period of one hour, (ii) Google Colab platform is used to train the model.It uses GPU of cloud machines.It provides tesla k80 GPU to user with 12 GB RAM.It has many libraries installed to train the deep learning and machine learning models.It has exceptional processing speed any model could be train in less time.It took only 12 mints to train the CNN model.For visualizing the plots of all performance matrices on training and validation data set against the training epochs the Tensorboard is used.The smoothing factor that is utilized is 0.6 to normalize the charts so that patterns may be seen.The training set is represented by orange curve while validation set is shown by blue curve.They represent the reliability of CNN model, as shown in Fig. 6.

Fig. 6 .Fig. 7 .
Fig. 6.Graphical representation of performance metrics: (a) Accuracy, (b) Precision, (c) Recall, (d) Area under the curve and (e) Categorical cross entropy loss The resizing step is used to scale down all images to a constant image size with 320x320 resolution, as the data with lower dimensions utilizes less memory as compared to the data with actual dimensions and makes the training rate faster.The MRI scans of data set available has different dimensions thus reduced the size and made all images sizes of standard size.The size selected in a way that extra information is reduced, and actual information remains intact.
image.To reduce noise and to improve the quality of MRI images, they need to undergo several steps of image pre-processing like Resizing, Morphological Operation, and Image Contrast.Resizing:The MRI brain tumor image data obtained has random image resolution and diversified in several brain tumor cases.

Table 2
Training and validation results of different performance metrics

Table 4
Comparative analysis of presented work and previous work.