Improved Multiclass Brain Tumor Detection using Convolutional Neural Networks and Magnetic Resonance Imaging

org

INTRODUCTION A brain tumor develops as a result of the overproduction and proliferation of cells in the skull. The body's command center, the brain, can be burdened by tumors, which can also be harmful to a person's health [1]. It has been reported in the study that brain tumors account for between 85% and 90% of all major Central Nervous System (CNS) tumors [2]. Radiologists have extensively used the medical imaging technique for tumor detection [3], [4]. Among the current medicalities, MRI is the method of choice for brain tumors because of its astronomical nature. Radiologists routinely manually detect brain cancers. Depending on the radiologist's level of training and experience, the tumor grading process can take a while. The interpretation is expensive and wrong. The associated challenges are attributed to specific traits, such as the substantial variation in form, dimensions, and magnitude for the same tumor type. Additionally, various diseases have similar appearances [5], [6]. A successful Computer Aided Diagnosis (CAD) system requires the development of feature extraction [7]. This is a challenging process that necessitates prior knowledge of the domain problem because the accuracy of the classification depends on the correctly extracted features.
Since DL is a subset of machine learning, it does not use any manually created features [8]. In several disciplines, the use of DL and ML for segmentation, detection, prediction, classification and early diagnosis using medical data has been promoted [9]- [25]. ML and DL as fields of Artificial Intelligence (AI) find their applications in many others field such as handwritten recognition and natural language processing [26]- [29].
Deep Learning (DL) is a subfield of Machine Learning (ML) that uses artificial neural networks with multiple layers to model complex patterns and relationships in data [30], [31]. Image classification is a task in computer vision where a model is trained to identify and categorize objects in images [32], [33]. In the context of brain tumors, convolutional neural networks (CNNs) are often used for image classification [34]. A CNN is a type of neural network specifically designed for image processing and analysis. It uses convolutional layers to detect local patterns and features in images, allowing it to learn and classify objects within an image [35]. In the case of brain tumor classification, a CNN is trained on a large dataset of medical images of brains, where each image is labeled as containing a tumor or not. The CNN then uses the features it has learned to classify new, unseen images as containing a tumor or not. This can aid for the early diagnosis and treatment of brain tumors.
CNN was initially utilized in 1980 [36], [37]. In essence, it is a disguised Multilayer Perceptron (MLP) network. CNN's computational capacity is based on a model of the human brain. Humans use an object's visual appearance to detect and identify it. Tens of thousands of photos of the same item are used to educate our kids how to distinguish objects. This aids a youngster in recognizing or foreseeing things that they have never encountered before. Similar in operation, CNN is well recognized for processing images.
In this paper, we proposed CNN-based model for medical image analysis, which is a sophisticated algorithm that utilizes DL techniques to categorize brain images into four distinct classes: Normal, Glioma, Meningioma, and Pituitary. These four classes encompass the most common types of brain tumors and are critical in providing accurate and precise diagnosis and treatment. The model's impressive performance www.ijacsa.thesai.org metrics, including a recall rate of 95%, an accuracy of 95.44%, and an F1-score of 95.36%, demonstrate the model's ability to detect brain tumors with high precision and accuracy. The recall rate, which is a measure of the model's ability to correctly identify all positive cases, is at an impressive 95%, indicating that the model has a low false-negative rate. Additionally, the accuracy score, which measures the model's ability to classify the images correctly, is also at a remarkable 95.44%. Finally, the F1-score, which is a combined measure of the model's precision and recall, is at a remarkable 95.36%, indicating the model's overall performance in categorizing brain images. These high-performance metrics are critical in medical image analysis as they help physicians diagnose and treat brain tumors accurately and efficiently. The proposed model is an essential tool for radiologists and physicians, as it reduces the subjectivity involved in manually interpreting medical images and provides a reliable and objective method for diagnosis.
The remainder of this article is structured as follows: Section II explores the related works to the search for brain tumor detection. In Section III, the proposed CNN-based model is presented, including its architecture, training methodology, and evaluation metrics. Section IV provides an overview of the materials and methods utilized in the study. Section V presents the experimental results, and in Section VI, the study's findings and conclusions are discussed.

II. RELATED WORKS
DL and AI play a crucial role in MRI image processing through techniques such as segmentation, recognition, and categorization. They are also employed in the classification and detection of brain cancer. Numerous studies have been conducted on the identification and segmentation of brain MRI images. A review of international literature was conducted to assess the use of DL in identifying and categorizing brain tumors.
In [38], the authors used newly designed CapsNets to allow CapsNet to access neighboring tissues while remaining focused on the core target. As a result, a modified CapsNet architecture for brain tumor classification is presented, with coarse tumor boundaries incorporated as extra inputs into its pipeline to increase CapsNet's focus. The proposed method outperforms its competitors significantly.
The authors in [39] used a convolutional neural network to perform multimodal brain tumor categorization for early diagnosis (CNN). With an accuracy of 92.66 %, the CNN model can categorize brain cancers into 5 types (Normal, Glioma, Meningioma, Pituitary, and Metastatic). The grid search optimization approach is used to automatically define critical hyperparameters in CNN models. The suggested CNN model is compared to popular cutting-edge CNN models such as AlexNet, Inceptionv3, ResNet-50, VGG-16, and GoogleNet. Using huge publicly available clinical datasets, satisfactory classification results are produced. This methodology has a number of drawbacks that may be listed as follows, despite the fact that the recommended methods for classifying brain tumors differ. The accuracy provided by current techniques is unsatisfactory due to the significance of MRI classification in the medical field. Some classification algorithms could not be fully automated since they required a human to manually identify tumor locations.
The authors in [40] described a technique for improving classification performance. To put the suggested method to the test on a big dataset, the authors employ three feature extraction methods: intensity histogram, gray level cooccurrence matrix (GLCM), and bag-of-words model (BoW). Using the enlarged tumor region as the ROI enhances the intensity histogram, GLCM, and BoW model accuracies by 82.31% vs. 71.39%, 84.75% vs. 78.18%, and 88.19% vs. 83.54%, respectively. Ring partitioning can improve accuracy by up to 87.54%, 89.72%, and 91.28% in addition to increasing region. These experimental findings demonstrate that the proposed strategy for classifying brain cancers in T1-weighted CE-MRI is both possible and effective.
In [41], the authors suggested a method for classifying brain tumors utilizing a set of deep characteristics and ML classifiers. In the proposed framework, they get deep characteristics by brain magnetic resonance (MR) pictures using the notion of transfer learning and numerous pre-trained deep convolutional neural networks. The top three deep features for multiple ML classifiers are chosen and concatenated into a deep feature set, which is then fed through multiple ML classifiers to predict the final output.
The authors in [42] proposed a method to improve the segmentation of brain tumors in magnetic resonance imaging (MRI) by incorporating an additional classification network. The segmentation is performed using a convolutional neural network (CNN) which is trained on a dataset of MRI images with corresponding tumor masks. The CNN is then combined with a classification network that is trained to distinguish between different types of tumors. The output of the classification network is used to refine the segmentation results by identifying and removing false positives. The authors evaluate their method on two publicly available datasets and compare it to other state-of-the-art methods. They report that their method achieves higher accuracy and Dice similarity coefficient (DSC) scores than the other methods. They also perform ablation studies to analyze the contribution of the classification network and find that it significantly improves the segmentation results.
In [43], the authors provide an overview of the challenges in brain tumor segmentation and discuss how deep learning techniques have been applied to address these challenges. The survey covers various types of deep learning models, including convolutional neural networks (CNNs), recurrent neural networks (RNNs), and generative adversarial networks (GANs). The authors also discuss the advantages and limitations of these methods and provide insights into future directions for research.

III. THE PROPOSED CNN-BASED MODEL
The structure of a CNN-based model can be customized and optimized by selecting specific hyperparameters. These hyperparameters play a crucial role in determining the overall architecture of the model, including the number of convolutional layers, the activation functions used in each layer, and the number of hidden units per layer. The number of www.ijacsa.thesai.org convolutional layers determines the depth of the neural network and its ability to extract high-level features from the input image. The more convolutional layers the model has, the more complex and sophisticated features it can extract, leading to better performance. However, adding too many layers can also result in overfitting, where the model becomes too specialized to the training data and performs poorly on new data.
The choice of activation functions also affects the model's ability to extract features accurately. Activation functions introduce non-linearities to the model, allowing it to model complex relationships between the input and output. Common activation functions used in CNNs include ReLU, sigmoid, and tanh, among others. The choice of activation function can significantly impact the model's performance, and selecting the right activation function is critical in optimizing the model's accuracy. After extensive experimentation, we arrived at the optimal selection of hyperparameters for the multi-layered model depicted in Fig. 1. This is chosen in: Five layers of convolution2D that differ in the number of filters, so that it doubles as you go deeper, starting with the first layer, which contains 32 filters, and ending with the last layer, which contains 512 filters, all to extract many features; five layers of max pooling in order to extract important information from the previous convolution2D layer; flattening layer, to render the information in one dimension; then a Dense layer with 128 units; finally, the Dance layer with 4 units, due to the number of final classes was used in which the SoftMax function was used because it is the most used function in multi-class models (in our case 4 classes). In all these layers, the ReLU activation function was used because it is the most advanced compared to the other functions. Fig. 2 displays the layout of our proposed CNN architecture.  Brain tumor detection is a critical problem in medical imaging, and a Convolutional Neural Network (CNN) can be used as a detection system. A CNN is a type of DL algorithm that is designed to analyze image data and can be trained to recognize specific features in the images. In the case of brain tumor detection, a CNN is trained using a large dataset of medical images that includes both normal and abnormal scans. The CNN is then used to identify and locate areas of the brain that may contain a tumor. This is done by processing the images and identifying certain patterns and features that are characteristic of brain tumors. The output of the CNN can be used to assist medical professionals in the diagnosis of brain tumors and to guide further testing and treatment. The use of a CNN as a brain tumor detection system has the potential to improve the accuracy and speed of diagnosis, which can be crucial in treating brain tumors effectively.

A. Dataset Collection
The "Brain Tumor MRI Dataset" on Kaggle is a collection of magnetic resonance imaging (MRI) scans of the brain. The dataset includes MRI scans of both healthy individuals and individuals with brain tumors, which have been annotated by medical experts. The annotations indicate the presence, location, and type of brain tumor in the MRI scans. In Figure 3, sample images from the dataset are depicted.
In fact, a publicly available Kaggle database is utilized, as is described in this section, which also provides some information on the database. The following three datasets were combined to generate this one: Figshare1, SARTAJ dataset2, Br35H3. 1 https://figshare.com/articles/dataset/brain_tumor_dataset/1512427 2 https://www.kaggle.com/datasets/sartajbhuvaji/brain-tumorclassification 3 https://www.kaggle.com/datasets/ahmedhamada0/brain-tumor-detection www.ijacsa.thesai.org The 7022 MRI scans of the human brain in this dataset are divided into four classes. The dataset can be used for a variety of research purposes, including developing and evaluating computer vision algorithms for brain tumor detection and classification, as well as for training ML models for medical diagnosis and treatment planning. However, it is important to note that the generalizability of the models developed using this dataset should be carefully evaluated, as it is based on a limited sample of MRI scans.

B. Background on CNN
DL models use a hierarchical framework to learn highlevel abstractions from input images [44]. Due to the availability of large-scale annotated datasets and the fact that CNN has demonstrated to be the most effective DL method for assessing medical pictures. The well-known CNN models [45] ImageNet, AlexNet, VGG16, GoogLeNet, Inception-V3 and ResNet101 have made significant strides in image recognition. However, the area of medical imaging lacks a comparable annotated dataset. Medical image classification using CNN is frequently done using one of two methods [46]. The first is called "learning from the ground up," while the second is called "Transfer Learning." The network layers that make up the CNN include a convolution layer, an activation layer, a Maxpooling layer, and a classification layer. Each of these levels is explained as follows [47], [48].

1) Convolution layer:
The convolutional layer comes first [7]. This layer is in charge of identifying an input word's attributes. This step merely combines the entry neuron by a filter depending on the input and requirement to produce the feature map [49]. A neural activation function is used to introduce nonlinearity. The animal visual cortex served as a model for CNN computing. It decodes visual data and has a fine sensitivity to the input's smallest subregions [50]. The convolutional layer's main elements are its receptive field, stride, dilation, and padding [51]. Fig. 4 displays the application of the convolutional layer. 2) Activation layer: The activation function is a crucial component of a Convolutional Neural Network (CNN) model as it defines the output of a neuron in response to a given input. The activation function determines the range of values that the neuron can output and allows the model to introduce non-linearity into the decision boundary, making it possible to learn complex relationships between the input and output variables. Common activation functions used in CNNs include the Rectified Linear Unit (ReLU), the Sigmoid function, and the Hyperbolic Tangent (Tanh) function. The choice of activation function depends on the specific problem being solved and can have a significant impact on the performance of the CNN. It's important to carefully choose the activation function in a CNN, as the wrong choice can lead to slow training and convergence, or even prevent the network from learning the desired patterns in the data [5].
3) Pooling layer: It comes after the convolution layer. This layer's task is to shrink the feature map, which implies fewer computations and parameters are required to operate the network. Therefore, it can be claimed that a summary of the features is the output of this layer. There are several techniques to pool data; in this instance, max pooling was utilized. The feature map's most objects that are covered by the filters are selected using max pooling [5].
4) Classification layer: In our CNN architecture, the classification layer comes last. This extensively used classifier which is a fully -connected feed-forward network. The neurons in the layers with complete connections are all connected to the neurons in the layer below. By merging the traits of the preceding layers, this layer recognizes the input image and predicts classes based on it. A total number of output classes is based on the number of classes in the source dataset. In this paper, the classification layer uses the "SoftMax" activation function to classify the features created from the input images in the previous layer into separate groups depending on the training data [5].

C. Confusion Matrix and Evaluation Metrics
A confusion matrix is a table used to evaluate the performance of a classification model by summarizing the predicted and actual class labels of a dataset. It displays the number of true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN) for each class. In a binary classification problem, the confusion matrix is a 2x2 table with two rows and two columns representing the actual and predicted classes. The first row represents the actual negative and the second row represents the actual positive. The first column represents the predicted negative and the second column represents the predicted positive. For a multi-class classification problem, the confusion matrix is an n x n table, where n is the number of classes. The rows represent the actual classes and the columns represent the predicted classes. Each cell in the matrix represents the number of instances that belong to a particular actual class and a particular predicted class [52]. Based on the entries in the confusion matrix, several evaluation metrics can be computed to assess the performance of the classifier. Some commonly used evaluation metrics include: The results of a confusion matrix can be used to calculate various performance metrics, such as accuracy, precision, recall, and F1 score. A high number of true positives and true negatives indicate a high accuracy of the model, while a high number of false positives and false negatives indicate low accuracy. Precision indicates the proportion of positive predictions that are actually correct, while recall indicates the proportion of actual positive instances that were correctly predicted. The F1 score is the harmonic mean of precision and recall, and is a good overall indicator of a model's performance. In summary, a confusion matrix provides detailed information about the performance of a model, while evaluation metrics provide a concise, single value representation of the model's performance [53].

A. Algorithms Best Parameters
The main objective of this project is to build a system capable of classifying medical images and giving correct decisions with a large percentage. All this depends on the quality of the existing data, the convolutional neural network, the number of its layers and coefficients, and the layers used to process the data needed to train the network.
Our study proposed a CNN architecture model; we retrieved the input 224×224 MRI image data with RGB color channels having a batch size of 32 by our CNN model. Initially, we added five convolutional layers; in addition, there are five max-pooling layers, one flattening layer, and activation (ReLU). The model develops the capacity to produce hierarchical qualities automatically by use of a succession of hidden layers. A final class label is determined by using a Softmax function on the outputs of this layer. In this proposed model, we have an output layer that generates a quadridimensional vector representing four different classifications of cerebral tumors. Table I displays   This table describes the architecture of a CNN for image classification. The table lists each layer in the network, its type (e.g., Conv2D, MaxPooling2D, Dense, Flatten), the output shape of the layer, and the number of parameters in that layer. The network starts with an input layer that takes in an image of shape (224,224,3), which means the image has a height and width of 224 pixels and 3 color channels (representing RGB values). The next layer is a Conv2D layer with 32 filters, which means it will learn 32 different feature maps from the input image. The MaxPooling2D layer performs down-sampling by taking the maximum value in a region of the feature map and reduces its size. This process is repeated several times with increasing number of filters in the Conv2D layer and reducing the size of the feature map in the MaxPooling2D layer. Finally, the feature maps are flattened into a 1D vector and passed through two dense (fully connected) layers to output the final prediction. The numbers of parameters in each layer, along with the total number of trainable and non-trainable parameters are also listed. The total number of parameters in the network is 7,789,484, and all of them are trainable. To train the model, we need training data and for validation also we need test data. Once we are satisfied with the test result of the model, we can use it to make predictions on new data. In addition, for the properties and parameters of the model starting with the number of epochs =50 (epochs are the number of typical repetitions of the training).
To configure our training model, we need to call the compile method with the loss function we want to use. The type of optimization and the metrics our model should evaluate during training and testing we will use: The Adam optimizer is due to the fact that, as mentioned earlier, it is one of the most widely used optimizers because it is the fastest method and also converges quickly to correct for learning rate latency and high contrast. The categorical cross entropy loss function is used when there are multiple label classes. Metrics is a function used to evaluate the performance of your model.
The best parameters for algorithms in CNNS involve a variety of elements, such as learning size, batch size, optimiser, loss function, activation functions, and epochs. Different parameters have to be tuned based on the network architecture, dataset, and task. Table II presented the best parameters of our proposed model.

B. Training Results
Our experiment was based on a dataset of brain MRI images. We trained a CNN model to detect whether the MRI image contains a tumor (glioma, meningioma and pituitary tumor) or not. Finally, we compared the diagnostic and computational results of our model with the related works. On our training data set, our proposed model has a 95.44% accuracy rate. The graph depicts the accuracy and loss during the construction and validation phases of our proposed CNN model are presented in Fig. 5 and Fig. 6. www.ijacsa.thesai.org The graphs show the performance of the model in terms of accuracy and loss as it is being developed and tested. Accuracy refers to the measure of how well the model is able to correctly predict the outcomes or classes of the input data. It is usually expressed as a percentage, where higher values indicate better performance. Loss, on the other hand, is a measure of how much error there is between the predicted outputs of the model and the actual outputs. Lower values of loss indicate that the model is more accurate in its predictions.  These graphs show the accuracy and loss of the CNN model at different stages of its development. The construction phase likely refers to the phase where the model is being trained on a dataset to learn the patterns and relationships in the data. The validation phase refers to the phase where the model is being tested on a separate set of data to evaluate its performance and generalizability.

C. Testing Results
The proposed model achieved an impressive accuracy of 95.44% in the detection of brain cancers. Table 4 presents the detection performance results of the model with an 80% train and 20% test split, showing the confusion matrix of the classifier model, which displays the number of correctly and incorrectly classified samples in each class. The confusion matrix, depicted in Figure 7, reveals the model's strong performance across all four classes: glioma, meningioma, no tumor, and pituitary. The ROC curve, as shown in Fig. 8, displays the true positive rate, also known as recall, against the false positive rate. The proposed model demonstrated excellent performance on the brain MRI dataset, accurately classifying a high number of samples in each class. For instance, 148 out of 156 samples in the glioma class and 193 out of 195 samples in the no tumor class were correctly classified. Overall, the results demonstrate the model's effectiveness in accurately detecting brain cancers, particularly in the early stages of brain bleeding. However, there are also some misclassified samples, as shown in the entries in the off-diagonal cells of the matrix. For example, five samples from the glioma class were misclassified as meningioma, and 3 samples from the pituitary class were misclassified as no tumor.
Based on this confusion matrix, it is possible to compute various evaluation metrics such as accuracy, precision, recall, and F1-score presented in Table III to quantify the performance of the proposed model. These metrics can provide a more comprehensive understanding of the model's performance and help identify areas for improvement.    This table represents the evaluation metrics of a classifier model that has been trained on a medical imaging dataset with four different classes: Glioma, Meningioma, No tumor, and Pituitary. The metrics shown are precision, recall, F1-score, and support. Precision is the fraction of true positive predictions among all positive predictions, recall is the fraction of true positive predictions among all actual positive cases, F1score is the harmonic mean of precision and recall, and support is the number of samples in each class. The results show that the model performs well in all classes with F1-scores ranging from 0.93 to 0.99, indicating that the model has good precision and recall values.

D. Discussion
The proposed CNN model achieved the highest accuracy rate among other deep neural models for classifying cerebral tumors into four classes on MRI images. This model has the potential to aid medical professionals in diagnosing brain tumors accurately and efficiently. The architecture of the model is designed for optimal performance on medical image datasets, making it a promising tool in the field of medical image analysis. Comparison with other studies that used various techniques, such as capsule networks, data augmentation and partitioning, and feature sets with ML classifiers, showed that DCNNs are the most effective technique for classifying brain tumors based on MRI scans. The accuracy of the models ranged from 90.89% to 95.44%, indicating the effectiveness of deep learning techniques in this domain. However, it is essential to note that the generalizability of these models to other datasets and clinical scenarios should be evaluated with care. As with any ML model, its effectiveness is dependent on the quality and size of the dataset used to train and validate it. Thus, the performance of the proposed model should be assessed on other datasets, and it should be tested under different clinical scenarios before being deployed in real-world settings. The proposed method is also applicable for different MRI classifications, and it can be combined with transfer learning techniques to achieve more accurate classifications in the future. Transfer learning can help reduce the amount of data needed to train a model, and it can improve the accuracy of the model by leveraging the knowledge learned from other datasets.
While the proposed CNN model for classifying cerebral tumors based on MRI images appears to be highly effective, there are several limitations to consider. First and foremost, the model's accuracy and effectiveness may be limited to the specific dataset used to train and validate it. To ensure its generalizability, it is crucial to evaluate the model on other datasets and clinical scenarios. Another limitation of the proposed model is that it may not be suitable for classifying other types of tumors or medical conditions. It is important to recognize that the model was specifically designed and optimized for classifying cerebral tumors based on MRI images, and it may not be effective in other medical image analysis tasks. Moreover, like any deep learning model, the proposed CNN model requires a significant amount of data to be trained effectively. While the model achieved high accuracy rates on the specific dataset used, it may not perform as well on smaller or lower-quality datasets. Additionally, the model may be computationally expensive, which may limit its practical application in certain settings. Table IV shows the comparison of the proposed model's performance with other methods based on classification precision. Our proposed model achieved the highest accuracy of 95.44% compared to previous work in this field, which shows the superior quality of the model.

VI. CONCLUSIONS AND PERSPECTIVES
To summarise, the proposed CNN model for classifying cerebral tumors based on MRI images is a promising tool for aiding medical professionals in diagnosing brain tumors accurately and efficiently. The high accuracy rate achieved by the proposed model compared to other deep neural models indicates the effectiveness of DCNNs in classifying brain tumors based on MRI scans. The proposed model's architecture is designed for optimal performance on medical image datasets, making it a promising tool in the field of medical image analysis. However, it is essential to recognize the limitations of the proposed model, such as the need to carefully evaluate its generalizability to other datasets and clinical scenarios, as well as the potential computational cost and data requirements. Future research should focus on developing more robust and accurate models by exploring alternative approaches and using larger and more diverse datasets.
Additionally, the proposed model's applicability for different MRI classifications and potential incorporation of other types of medical imaging data, such as CT scans, PET scans, or MRS data, offer exciting possibilities for improving the accuracy and effectiveness of medical image analysis. The development of more sophisticated models and techniques will lead to more accurate and efficient diagnosis and treatment of cerebral tumors, ultimately benefiting patients and medical professionals alike.
Our future research will focus on developing more robust and accurate models by exploring alternative approaches and using larger and more diverse datasets. It may also be worth investigating the potential for incorporating other types of medical imaging data.