The brain tumor is the 22nd most common cancer worldwide, with 1.8% of new cancers. It is likely the most severe ailment that necessitates early discovery and treatment, and it requires the competence of neurosubject-matter experts and radiologists. Because of their enormous increases in data search and extraction speed and accuracy, as well as individualized treatment suggestions, machine and deep learning techniques are being increasingly commonly applied throughout healthcare industries. The current study depicts the methodologies and procedures used to detect a tumor inside the brain utilizing machine and deep learning techniques. Initially, data were preprocessed using contrast limited adaptive histogram equalization. Then, features were extracted using principal component analysis and independent component analysis (ICA). Next, the image was smoothed using multiple optimization techniques such as firefly and cuckoo search, lion, and bat optimization. Finally, Naïve Bayes and recurrent neural networks were utilized to classify the improved results. According to the findings, the ICA with cuckoo search and Naïve Bayes has the best mean square error rate of 1.02. With 64.81% peak signal-to-noise and 98.61% accuracy, ICA with hybrid optimization and a recurrent neural network (RNN) proved to better than the other algorithms. Furthermore, a Smartphone application is designed to perform quick and decisive actions. It helps neurologists and patients identify the tumor from a brain image in the early stages.

1. Introduction

A tumor is a mass of tissue that forms as a result of an aggregation of irregular cells. Normally, our body’s cells die and are replaced by new ones as we age. However, brain cancer and other cancers inevitably break this pattern. In reality, tumor cells expand even though our bodies do not need them, and they do not die like normal cells in the body. As a result, the tumor will continue to grow as cells are added to the mass. Tumors are divided into two types: cancerous and noncancerous [1]. A cancerous tumor can start in any part of the body, and it is formed when cancer cells form a lump or growth. It is grown into nearby tissues and spreads to the lymph nodes and different parts of the body via hemoglobin or the lymphatic system.

In contrast, noncancerous tumors do not spread to other parts of the body [2]. Noncancerous tumors do not reappear once they are eliminated and tend to have a regular and smooth shape, with a delimiting border called a capsule [3]. Benign, premalignant, and malignant are the three types of tumor. The benign and premalignant tumors are not cancerous, but premalignant tumors can become malignant. Such tumors are cancerous, and their cells can multiply and migrate to other areas of the body unless a doctor removes them. Likewise, when a brain tumor grows, it becomes malignant and harmful (dangerous) or remains noncancerous. The tumor causes the pressure inside the skull to expand, causing harm to the brain, which is hazardous [3, 4]. Although the mechanisms leading to the development of brain tumors are not always precise, some risk factors are being exposed to the Epstein–Barr virus, also called Human gammaherpesvirus 4, one of the most common viruses in humans. This virus can cause infectious mononucleosis and other illnesses. In addition, such a virus is being exposed to ionizing radiation. It has genetic syndromes such as neurofibromatosis, tuberous sclerosis, and von Hippel–Lindau disease. This rare, inherited disorder causes tumors and cysts to grow in certain parts of the body, brain, spinal cord, eyes, inner ear, etc.

Brain tumors are classified into two types: primary and secondary. A primary brain tumor has its origins in the brain [5, 6]. These tumors are not malignant, but their size and position might cause significant problems and death. They are often referred to as benign brain tumors. Several types of primary tumors include the following: chordomas, craniopharyngiomas, gangliocytomas, glomus jugulare tumors, meningiomas, pineocytomas, pituitary adenomas, and schwannomas [7]. As cancer cells migrate from another organ, such as the lung or breast, to the brain, they form a secondary brain tumor, which is generally referred to as a metastatic brain tumor [8]. Astrocytomas, ependymomas, glioblastomas, medulloblastomas, and oligodendrogliomas are different types of secondary tumors. Other forms of brain tumors include hemangioblastomas and rhabdoid tumors [9]. There are many methods for segmenting and detecting brain tumors. Brain tumor segmentation is aimed at distinguishing tumor tissues from normal cells and assessing the nature and extent of tumor regions, which include active tumor tissue, necrotic (dead) tissue, and edema (swelling near the tumor). This is achieved by contrasting abnormal areas with typical tissues [10].

Since they invade surrounding tissues, certain cancers, such as glioblastomas, are challenging to differentiate from normal tissues. As a solution, several picture modalities with contrasts are often used. Diverse pixel intensities, noisy/ill-defined boundaries, and irregular shapes with significant variability are all critical technological challenges in medical image segmentation. Furthermore, because information about the labels of nearby pixels is not included in the classification, segmentation decreases the method’s performance [11]. Single-photon emission computed tomography (SPECT) scans, MRI scans, and biopsies are methodologies to detect brain tumors [4]. In medicine, MRI of the brain has gained a lot of importance, as it is an imaging modality that uses nonionizing radiation to generate useful diagnostic images.

Additionally, functional MRI detects variations in blood flow that indicate brain activity. FMRI generates pictures or brain maps of how the brain functions by configuring and operating an advanced MRI scanner so that increased blood flow to active regions of the brain is seen on the MRI scans [12]. Multimodal imaging often necessitates picture alignment since the specimen is typically physically transferred from one imaging equipment to another, or certain modifications in the optical path are required, which might alter the geometrical characteristics of images. With the pictures aligned, the various modalities can be utilized to improve observed object segmentation or better understand the specimen’s varied characteristics [13]. A survey conducted by the National Cancer Institute showed that a 10% growth rate could be seen each year in cases related to brain cancer or tumors [14]. The flowchart of the steps followed in brain tumor detection and classification is shown in Figure 1.

The initial stage includes a collection of MRI-based brain image samples that are sent for tumor enhancement. Various filters are used to remove the noise, tumor segmentation using multiple methods such as Otsu and watershed, feature extraction and selection methods to improve classification efficiency using various techniques, and then fusion of all these features for classifying and detecting the tumor in the brain [15]. Different machine and deep learning techniques are capable of recognizing and detecting the tumor inside the brain image. Integrating the Naïve Bayes classifier and recurrent neural networks enhances the accuracy and speed of diagnosis and helps the medical sector have better health outcomes [14]. These techniques are used in diagnostic procedures, treatment protocol development, medication development, personalized medicine, and patient management and care [16]. New methods and technology, such as computational and automated pathology and molecular diagnostics, and many other algorithms, such as firefly and lion optimization, are finding their way into advanced clinical diagnostics, offering some exciting ways to integrate these approaches into healthcare [17].

The key contribution of this work is to detect the tumors inside the brain. Many researchers have already carried out a lot of work in this field using different machine and deep learning techniques, but they have failed due to low accuracy in detecting the tumor. Few studies have used peak signal-to-noise ratio and mean square error as evaluative parameters to see the detection accuracy of tumor inside the brain [18]. They have shown low peak signal-to-noise ratio and a high mean square error, which ultimately affected the accuracy rates of their techniques as a low peak signal-to-noise ratio indicates the lousy quality of image and a high mean square error value indicates the large set of errors. One problem with mean-squared error is that it depends strongly on the image intensity scaling [19]. Suppose a mean-squared error of 100.0 for an 8-bit image (with pixel values in the range 0-255) looks dreadful, but an MSE of 100.0 for a 10-bit image (pixel values in [0,1023]) is barely noticeable [20].

On the other hand, peak signal-to-noise ratio (PSNR) avoids this problem by scaling the MSE according to the image range. PSNR is a good measure for comparing restoration results for the same image so that one image with 20 dB PSNR may look much better than another image with 30 dB PSNR [21]. Hence, we proposed a methodology that used both machine and deep learning algorithms along with different optimization techniques to enhance the accuracy by improving and reducing the peak signal-to-noise ratio and mean square error, respectively. The proposed system also needs some improvement by labeling type of tumor inside the brain so that doctors can easily interpret which type of brain tumor the patient has and start their medications as early as possible [22, 23].

To achieve the goal of recognizing a brain tumor with the best accuracy detection rate, we first preprocessed the picture with contrast limited adaptive histogram equalization (CLAHE) and threshold segmentation to increase picture visibility. Then, various machine and deep learning-based methods were employed to extract features from preprocessed images. Finally, we classified them using principal component analysis, independent component analysis, Naïve Bayes, and recurrent neural networks [24]. The collected results were eventually optimized using cuckoo search, firefly algorithm, lion optimization, and bat optimization techniques [25, 26].

Finally, based on optimal results, we evaluated the improved findings using assessment measures such as peak signal-to-noise ratio, mean square error, and detection accuracy to find the optimum method for discovering a brain tumor. The algorithm with the greatest PSNR, lowest MSE, and best accuracy rate would be chosen among the other algorithms. Furthermore, the contribution above aids us in providing a better understanding of the machine and deep learning in cancer diagnosis by imaging analysis [27].

Given the enormous number of patients determined to have a tumor and the critical measure of information created during tumor treatment, there is a particular interest in utilizing AI to improve oncologic consideration [20, 28]. This paper puts forward a methodical and experimental study on the machine and deep learning techniques and their utilization in different research areas. In this article, we have provided and implemented machine and deep learning-based algorithms to detect and classify brain tumors using various features.

The parts of this paper are summarized in the following order: related work is presented in Section 2, the methodology is presented in Section 3, experimental results and interpretation are presented in Section 4, prospective perspectives of the machine and deep learning in healthcare are presented in Section 5, and the conclusion is presented in Section 6.

Even with the help of IoMT-enabled MRI devices, we explored our research. The Internet of Medical Things (IoMT) combines medical devices and applications that use network technologies to connect to healthcare information technology systems. Benefits can be like unnecessary hospital visits, and the burden on healthcare systems can be reduced. Now patients can be connected to their physicians and allow medical data transfer over a secure network. IoMT devices are connected to different cloud platforms like Amazon Web Services, on which data is being gathered by IoMT devices can be analyzed and stored. But the amount of data handled by the Internet of Medical Things (IoMT) devices is increasing rapidly as sensitive information is being disclosed. So the privacy and security of the data gathered by IoMT devices being stored or transmitted through the cloud is a major concern these days. Therefore, IoMT can also be called healthcare IoT. The IoMT market consists of several smart devices, like medical/vital monitors and wearables, and it is strictly for healthcare use on the body, in the community, in-home, hospital, or clinic settings and associated telehealth, real-time location, and other services [29].

Machine and deep learning have shown a fast change in the clinic by deciding the ideal methods of treatment, the necessary dosages, and the period of delivery during the patient’s medication. A brain tumor is a dangerous condition that necessitates early detection and specific position techniques [30]. Therefore, machine learning and especially deep learning techniques have drawn considerable attention and sparked interest in recent years for their potential to improve our lives. The growing number of patients who are being identified with tumors and the ample amount of data gathered during the treatment process lead to the need for machine and deep learning to improve oncologic care [28, 31]. Hence, to have more information related to the role of the machine and deep learning in oncology, a section has been provided that presents the technique used by the researchers to detect brain tumor, and based on the gaps found in these algorithms, we have proposed a new methodology [32, 33].

In machine learning, brain tumor segmentation has been performed using a Weiner filter with different wavelet bands and statistical methods [34]. They analyzed the results based on pixel and feature accuracy. For pixel-based accuracy, they compared the foreground, background, error rate, and quality with ground truth annotation, whereas for feature-based accuracy, they extracted local binary patterns using Equations (1) and (2).

where is the number of neighborhood pixels, represents the th neighboring pixel, and represents the center pixel.

Another technique to segment the brain was performed using model-based trainable segmentation [34] and a classification system to precisely identify the tumor’s location in the MRI of brain tissue. Similarly, Nazir et al. [35] used wavelet subbands to segment brain images and achieved a classification rate of 99.7%. Wavelet transform-based local binary pattern variant features and antilion optimization were also used to develop computer-assisted brain tumor detection map [36]. Pushpa et al. [37] used preprocessing to filter as well as smoothening the image and carried out the segmentation process by using morphological operations to increase the precision in the classification phase. In addition to this, various phases had been involved in brain cancer recognition and categorization, such as preprocessing, cleavage, characteristics extraction, and classification of brain tumors, by utilizing the SVM algorithm [38]. Pugalenthi et al. [39] evaluated and classified the tumor regions into low/high grades based on the analysis carried out with the brain MRI slices. The machine learning technique implemented a sequence of procedures, such as preprocessing, postprocessing, and classification. At the other end, Manogaram et al. [40] suggested an improved orthogonal gamma distribution-based machine learning method for automatically detecting anomalies in the under- and oversegments of brain tumor areas. The experimental system showed the method of orthogonal gamma distribution using Equation (3). where and are continuous random variables, with the machine learning approach that achieved 99.55% in identifying a brain tumor. Morphological screening, clustering, and Naïve Bayes classifier (NBC) grouping were used to generate clusters of identical and dissimilar patches from the image, which were then classified using the Naïve Bayes classifier by calculating Equation (4). where is the posterior probability, is the likelihood, is the class prior probability, and is the detector prior probability for spotting the tumor portion in the brain from magnetic resonance imaging.

Machine learning algorithms have also been applied to detect the edges of a brain tumor from patients’ MRI scan of brain images by using some noise removal functions and features of medical images for the diagnosis using balance contrast enhancement techniques. Bahadure et al. [41] improved the performance and reduced the complexity involved in the medical image segmentation process using Berkley wavelet transformation. The authors used the method to extract relevant features from each segmented tissue to improve the accuracy and quality rate of the support vector machine- (SVM-) based classifier. Random Forest and K–nearest neighbor classifier had been used to calculate the area of the tumor region and classified it as benign or malignant using Equation (5).

After transforming it into the quantum state and merging it with the hamming distance, they achieved Equation (6).

where is the training set, refers to the total observation, refers to feature vectors where (), and is the corresponding class, based on the majority voting method. The main drawback of support vector machine and KNN classifier is that they cannot be used for large datasets. However, despite flaws, these classifiers are also good in high-dimensional space, simple to understand, and used for classification and regression.

On the other hand, deep learning algorithms also classified brain tumor using deep convolution neural network and achieved an accuracy of 98%. Transfer learning approach has also been used to classify brain tumors in magnetic resonance images. Various networks such as VGG16, VGG19, ResNet50, and DenseNet21 obtained the highest classification score of 99.02% using Adadelta. Deep and Emmanuel [11] worked on a fused feature adaptive firefly back propagation neural network for classification, including preprocessing, feature extraction, selection, and combination, and achieved high arrangement precision. Deep convolution neural network has also been used to develop a fully automated brain tumor segmentation and classification model which analyzed MRI images of three different types of tumors in sagittal, coronal, and axial views: meningioma, glioma, and pituitary tumors. It distinguished the brain tumor using Equation (7). where are functions that are being convoluted, is the real number variable of functions and , is the convolution of the time function, and is the first derivative of the tau function. The precision of the softmax fully connected layer was utilized to classify the pictures and achieved 98.67% accuracy.

Aorora et al. [42] proposed a method to segment and classify the MRI of the brain as normal or abnormal using the Bhattachraya coefficient and achieved 98.01% accuracy whereas Suneetha and Rani [43] proposed optimized kernel probabilistic C-means algorithm, to identify brain tumors. They also used an adaptive double-window modified mean filter to enlarge the preprocessed image and recurrent neural networks to split the image inputs to recognize the tumor in the MR image and separate the tumor area from the picture.

Recurrent neural network [13] has categorized images to localize the region of the tumor of interest and classified them into four categories using a deep neural network classifier: mild, glioblastoma, sarcoma, and metastatic bronchogenic carcinoma tumors. The classifier was paired with the discrete wavelet transform (DWT) and PCA [44]. Sajid et al. [45] proposed a mixed convolutional neural network for brain tumor segmentation and used various MRI modalities. The proposed procedure by the authors has validated on the BRATS 2013 dataset, yielding scores of 0.86, 0.86, and 0.91 in terms of dice score, sensitivity, and specificity, respectively, for the entire tumor area. Tables 1 and 2 represent the datasets, techniques, and limitations of the work proposed by various researchers.

3. Methodology

This section of the article discusses the approach followed for the detection of brain tumor using various machine and deep learning-based models. Figure 2 shows the steps followed for the process;

The following are the steps followed for the implementation.

The dataset was collected from The Cancer Imaging Archive (TCIA) which is an open-access database and hosts a large archive of medical images of tumor in DICOM format [47]. (i)The dataset included 20 patients’ brain MRIs, 40 investigations, and 8798 pictures. It included two MRI tests for each patient, and information on the patient’s clinical performance, imaging results, and therapy or intervention changes(ii)After obtaining the preprocessed image, feature extraction was performed using principal component analysis. It improves visualization, reduces overfitting, and reduces the dimensionality without losing information from any features. Likewise, independent component analysis was used to get rid of unnecessary and redundant data(iii)The extracted features were later optimized using cuckoo search, lion, and bat optimization (Section 3.3) to smoothen the image in order to provide a high classification rate for the high region of interest in the detection scenario(iv)After that, the data was divided into two portions in a 7 : 3 ratio: training and testing sets. The training data was utilized to create machine and deep learning models that were supplied with 11 distinct characteristics. Because we may make as many as we want without impacting the train to test split ratio, the dataset is split in this way. K fold cross-validation, on the other hand, is confined to a small data sample(v)Finally, the data were sent to classification models such as NBC and RNN, with the results being further incorporated with the testing data(vi)At this point, the model was trained, and with the help of testing data, the results were obtained(vii)Metrics such as peak signal-to-noise ratio and mean square error rate were used to measure the quality between the original and compressed images, and detection accuracy was used to analyze the performance (Section 3.6). The compressed image will minimize the size without degrading its quality, and it will be easier for the model to detect brain tumors. These metrics were also used to compare the results obtained from the algorithms to show the best technique

The algorithms that were used to evaluate the performance of the PCA+firefly+NBC, ICA+cuckoo+NBC, and ICA+hybrid optimization+RNN to detect the brain tumor are defined below.

3.1. Preprocessing

Preprocessing optimized the picture data by suppressing unintentional distortions, thus enhancing the image quality for subsequent processing. Contrast restricted adaptive histogram equalization or CLAHE is a technique to improve the visibility level of foggy image. It is distinguished from average histogram equalization. The adaptive process computes several histograms, each equivalent to a particular portion of the region, and uses them to regroup the appearance’s lightness principles. As a result, CLAHE was used extensively in the proposed work to promote local dissimilarity and refine representations of the boundaries of each appearance area. It reconstructs the picture by transforming each unit with a translation function obtained of adjacent regions. To begin with, the mean and standard deviation were determined using Equations (8) and (9), respectively [20, 31]. where and are the points and is the total observation.

where stands for standard deviation [48], for segmenting the image, and threshold segmentation, which separates an object from its background, was used. Thresholding is an image segmentation technique in which the pixels of an image are changed to make the image more straightforward to interpret. Thresholding is transforming a color or gray-scale image into a binary image, which is essentially black and white. This technique can be expressed as given in Equation (10).

where is the threshold value, and are the coordinates of the threshold value point, and points are the gray-level image pixels [49]. If is a threshold version of at some global threshold as shown in Equation (11),

3.2. Feature Extraction

Feature extraction refers to methods that pick and/or merge variables to form functions, thus reducing the amount of data that must be processed while wholly and correctly representing the original data collected. The techniques that were used to remove functionality from the preprocessed images are described below:

3.2.1. Principal Component Analysis

The principal component analysis is a factor analysis method used in image processing to isolate features and apply the characteristics resulting from reducing -dimensional space. The measures for implementing the PCA method are outlined in Equations (12)–(16). The whole dataset is separated into and . The validation set is handled by , while the training set is dealt with by . The data are arranged into the independent variable’s two dimensions. The average of the column is subtracted from each record for each situation [50]. Data standardization is a priority and is calculated using Equation (12).

The covariance of the matrix is calculated using Equation (13).

The eigenvalues and eigenvectors on the diagonal of the matrix are evaluated using Equation (14).

with eigenvalues on the diagonal and zero values on all other locations. In this equation, any value of for which this equation has a solution is known as an eigenvalue of the matrix A. Then, the eigenvalue associated with eigenvector is calculated using Equation (15)

The eigenvector is used as the feature vector until all of the feature values have been arranged. Preprocessing was used first in the suggested approach, followed by PCA to achieve efficient feature extraction from the feature vector found in the mat register. It was calculated by multiplying the transpose of the original dataset by the transpose of the feature vector using Equation (16).

3.2.2. Independent Component Analysis

Another algorithm that was used is independent component analysis, which is used for computing the unknown values of random variables. Independent component analysis was created with multivariate data in mind. Principal component analysis and independent component analysis are related in several ways. Data for independent component analysis research may come from several sources, including finance, digital images, paper databases [51]. It breaks down a large dataset into smaller chunks. It initially transforms data to zero-average and then chooses the number of components. Further, it whitens the data to transform the measured patterns to have a unit variance. Then, on this basis, the random matrix was chosen to implement the orthogonal matrix. Finally, the convergence was carried out, and then, the cycle was repeated. In the ICA model, we used the statistical “latent variables” system and the random variable instead of the time signal by computing the Equations (17) and (18).

The latent variables in the ICs remain unclear. is also undefined in the mixing matrix. As a result, the only observable random vector is used to estimate and , assuming that the number of ICs equals the number of measurable mixtures and that is square and invertible. Then, after estimating the matrix , we can compute its inverse, say , i.e., , and obtain the independent component simply by

Hence, it can be said that principal component analysis and independent component analysis have been used to reduce dimensions by creating new uncorrelated variables that maximize the variance and to reveal hidden factors by using non-Gaussian signals.

3.3. Feature Optimization

Feature optimization is a process in which the number of input variables is reduced so that the computational cost of modeling can be minimized, which will improve the model’s performance. The techniques used for feature optimization are briefly explained in detail.

3.3.1. Firefly Optimization Technique

The firefly approach is used to achieve improvements to reduce the function vector dependent on feature vector extraction [42]. Initially, we needed to initialize the objective function using Equation (20). where is the amplitude at the source and is the observer’s distance from the source. The light intensity in the above equation differs according to the square law. Then, we created the initial population of fireflies using Equation (21).

The first term in the above equation defines the attractiveness for each particle, the second term is due to attraction, and the third term is randomization. Further, the light intensity of each of the fireflies was determined to find out the brightness of every firefly by computing Equation (22). where is the light intensity. Next, we needed to calculate the attractiveness of the fireflies using Equation (23).

Then, the movement of firefly , which is to be attracted to another more attractive firefly , was determined by applying Equation (24).

Finally, the light intensities of the fireflies were updated and ranked. After ranking the fireflies, the current best solution was selected.

3.3.2. Cuckoo Search

Another algorithm that was used is the cuckoo search, which deals with an optimization algorithm inspired by multiple cuckoo species’ brood parasitism, which involves their spawn lying in the shells of other species of birds. Any bird can be engaged in direct combat with intervening cuckoos. Female cuckoos of some populations have evolved to the point that they are now specialized in imitating standards and decorating the spawns of a few chosen host species. Cuckoo search is flawless, similar to the cuckoo’s breeding behavior, and can be used to solve a variety of optimization problems. It is based on the idealized rules that each cuckoo lays one egg at a time and deposits it in a nest selected at random [52].

3.3.3. Lion Optimization

The third algorithm used was lion optimization. Lions are the most socially persuaded of all wild species, with high levels of cooperation and antipathy. Lions are a particular focus due to their long-term erotic dimorphism in both community behavior and presence. The lion belongs to the wild felines, having two kinds of social body—residents and migrants. Residents always act in groups which are called prides. The finest clarification in approved iterations for every lion, i.e., the greatest visited location, is obtained and updated gradually throughout the optimization procedure. A pride ground is a zone that contains each associate’s stay position. In every pride, designated females aimlessly go stalking. Hunters move near the prey to enclose and clasp it. The rest of the females change towards dissimilar positions in the terrain. Male lions, in arrogance, wander in the area. Females mate with some resident male lions. New males are accepted by their parental pride and develop into nomads when they reach maturity, but their power is less than that of local males. The algorithm performs the initialization of the random populations and the initialization of the probes and lions. Then, each lion particle chooses a random female lion for hunting, and each female lion chooses the best position in the pride. In contrast, the weakest lion in the pride is eliminated from the population and becomes the nomad. Then, for each pride, the immigration rate is evaluated. Finally, the fitness function is considered to select the best females and fill the empty places of the female lions that migrated from the territory [53]. In this algorithm, every single solution is called “lion.” In a dimensional optimization problem, a lion is represented as follows in Equation (25).

Cost (fitness value) of each lion is computed by evaluating the cost function, as shown in Equation (26).

The group with the most significant cumulative member penalties is the center, while the other two groups are referred to as the wings. The center of attention for hunters is fake prey (prey). As per Equation (27),

If a hunter improves his or her finesses during hunting, prey will flee from hunter and a new position of prey will be achieved as follows in Equation (28). where prey is the current position of prey, hunter is a new position hunter who attacks prey, and PI is the percentage of improvement in fitness of hunter.

3.3.4. Bat Optimization

The final optimization algorithm used was the bat algorithm. The following summarizes the idealization of micro bat echolocation. Each virtual bat flies in a unique direction and speed, with a unique pitch, wavelength, and volume. As it searches for and locates prey, it alters the frequency, loudness, and rate of pulse emission [54]. It is computed by using Equations (29)–(31).

where is a random vector drawn from uniform distribution and is the current global best solution. A local random walk amplifies the search. Before those criteria are met, the best candidates are selected. The equilibrium between creativity and exploitation can be influenced by adjusting algorithm-dependent parameters in the bat algorithm, using a frequency-tuning technique to manipulate the complex behavior of a swarm of bats.

3.4. Classification

Classification is the method of organizing data into homogeneous categories or classes based on certain common characteristics present in the features. The techniques used for the classification are Naïve Bayes. It easily and quickly predicts the class of the test dataset and recurrent neural network as it remembers each piece of information and is useful in predicting the existence of tumor inside the brain.

3.4.1. Naïve Bayes

The proposed study discussed NBC in the context of supervised learning and achieved high classifying rates to identify pixel units in a testing image in tumor detection [55]. Naïve Bayes shows the probability field that relies on Bayes theorem and is calculated using Equation (32). where is the posterior probability, is the likelihood, is the class prior probability, and is the detector prior probability. These classifiers are simple to use, requiring only complete linear parameters in the number of variables, which is a learning system challenge. Naïve Bayes is concerned with the maximum probability that can be achieved by calculating a closed-form appearance that is often involved with the linear method rather than with exclusive iterative estimation as is used with other forms of classification methods.

3.4.2. Recurrent Neural Network

An RNN is a class of ANN where relationships between nodes form a temporal sequence and show temporal dynamic behavior towards data. RNNs are derived classes of neural networks in a direct form and use memory, an internal state of the network to practice variable-length classifications of inputs. The main and most important feature of RNNs is the hidden state, which remembers some information about a sequence. This applies to various processes such as segmentation, image recognition, or speech recognition [56]. We used a recurrent neural network to implement the approach since it remembers all of the information about the calculations. Moreover, it employs the same settings for each input since it produces the same outcome by performing the same job on all inputs or hidden layers. Unlike other neural networks, this decreases the complexity of the parameters. The formula is shown in Equation (33).

where is the current hidden state, is the previous hidden state, is the current input, and is the parameters of function . In an RNN, there are two broad sessions of networks with a similar general structure: one for finite instinct and the other for infinite instinct. Both groups demonstrate temporal behavior in a complex manner.

An RNN model is comparable to a convolutional neural network (CNN) or another form of artificial neural network in terms of architecture [11]. To simplify this, a recurrent neural network consists of three layers: an input layer, a hidden layer, and an output layer. However, these layers operate in a detectable order as shown in Figure 3.

Each node in the neural network is connected to each other via weights. These assigned weights are the parameters that have been used in recurrent neural network. These weights are learned when we train the network such that it can tune these parameters. To minimize the error by updating the values of weight, we have used learning rate which behaves as a hyperparameter.

While training the network, input layer is responsible for retrieving the data, which are then preprocessed before being passed to the hidden layer. This layer comprises neural networks, algorithms, and activation functions. A hidden layer of ResNet50 was utilized to extract relevant information from the data along with sigmoid activation function using Equation (34).

Finally, whether the tumor is present inside the brain is sent to the output layer, which produces the detected result. The RNN procedure is quite variable. The data that traveled through the architecture are looped. For decision-making, each input is dependent on the prior one. Each layer in the network is assigned the same weight and bias by the RNN. As a result, all independent variables become dependent variables.

During back propagation, the parameters were optimized using stochastic gradient descent, which calculated the derivative of the cost function, i.e., with respect to the parameters of the network such as weight of the input brain image () and its hidden weight matrix (), i.e., and .

The loop in the RNN ensures the information is preserved in its memory. This is possible by none other than its primary component, which is long short-term memory (LSTM). LTSMs are used to classify, identify, or detect output data based on a series of discrete-time input data. They use gradient descent and back propagation algorithms to minimize error. Such measured states are described as gated states or gated memory called LSTM networks. The equations for the gates in LSTM are shown in Equations (35)–(37). where represents the input gate, represents the forget gate, represents the output gate, represents the sigmoid function, is the weight for the respective gate neurons, is the output for the previous LSTM block, is the input at the current timestamp, and stands for the biases for respective gates [30].

3.5. Experimental Setup

The following section provides the details of the dataset used during implementation, parameters used for evaluation, experimental results, and are compared to state-of-the-art strategies.

3.5.1. Dataset Used

This part of the paper discusses the dataset considered for detecting brain tumors using traditional machine and deep learning methods. The dataset under consideration was obtained from The Cancer Imaging Archive (TCIA), an open-access database that houses a vast archive of diagnostic photographs of tumors [57]. TCIA’s primary file format is DICOM, as the bulk of the files in the database consist of DICOM-formatted CT, MRI, and nuclear medicine images. DICOM has superior image quality, supports all 65536 shades of color, and has over 2000 attributes. DICOM (.dcm) image files contain patient data such as name, identification number, gender, date of birth, device settings, and image characteristics such as modality, height, bit depth, and proportions [3]. The DICOM header object is defined as an image pixel, plane, an MR/CT image, and patient details [57]. The TCIA dataset is aimed at gaining access to machine and deep learning techniques for detecting tumors within the brain.

Machine and deep learning approaches have proven their robustness around the board. Therefore, in order to assist medical practitioners, we agreed to identify brain tumors using machine and deep learning algorithms. Table 3 outlines the dataset’s 18 attributes, and Table 4 defines the age and gender-wise statistical analysis of brain tumor.

The most important prognostic detector in all brain tumor groups is age, as is seen in the features of patients with brain tumors. Metastatic brain tumors become more common as people become older. According to studies, brain tumors affect people of all ages, although they are most common in two age groups: children under 15 and adults 65 and older. The second factor is gender, with men having a higher risk of developing a brain tumor than women. Meningioma, for example, is more prevalent in women than in men. Attributes such as image position, pixel spacing, image orientation, slice thickness, and image type in patients are essential, as if a tumor in the brain is medically suspected; then, the location, size, shape, type, and impact of the tumor in the surrounding areas are evaluated by radiological methods.

Further, the best therapy, surgery, radiation, or chemotherapy is decided based on the obtained results. The (time of echo) difference between the delivery of an RF pulse and the reception of an echo signal is denoted by TE. The repetition time (TR) is the time it takes for two continuous pulses to be emitted in the same order. The trigger time refers to how and when the brain tumor is triggered [58]. Deranged blood vessels are common in cancers and tumors, and these can be seen in dye-enhanced MRI images. Magnetic resonance angiograms or MRAs are a common term for this form of imaging. The most popular form of MRI is one that uses gadolinium. In around one out of every three MRI scans, a contrast bolus agent is used to increase the scan’s diagnostic precision [46]. The visibility of inflammation, tumors, blood vessels, and the blood supply of some organs is enhanced by adding contrast to the picture. Features such as size, type, and shape of the tumor are extracted, and the values in the form of pixel spacing, direction, and orientation of the image are used to achieve PSNR, MSE, and detection precision, which are then optimized to realize the best result for brain tumor detection [37].

3.5.2. Simulation Environment

MATLAB 2021a, which allows a screen reader to interact with the command window and build scripts and functions [36], was utilized to apply the proposed approach for detecting the detection of a brain tumor. In addition, MATLAB 2021a includes a statistics and machine learning toolbox for defining, analyzing, and modeling the results, an image processing toolbox for feature extraction, and a deep learning toolbox for developing and applying deep neural networks, including algorithms, pretrained models, and applications, for the execution of machine and deep learning-based algorithms.

3.6. System Evaluation Techniques

Initially, an MRI brain image is taken as an input. After applying the preprocessing technique, the PSNR and MSE values are calculated for different algorithms applied on an input image. PSNR and MSE are used to compare the quality of a reconstructed image based on their values as the higher the PSNR, and the better the image and the lower the MSE, the lower the error. Hence, to test the accuracy of detecting tumor inside the brain, the following parameters are used: (1)Peak Signal-to-Noise Ratio. This is the ratio of the maximum possible power of a signal to the power of corrupting noise that affects the fidelity of its representation. It is calculated by Equation (38)

where MAX is the maximum possible pixel value of the image, is the matrix data of an original image, and MSE is the mean square error [59], while implementing the work using MATLAB, we used the function psnr(img,ref) which calculated the peak signal-to-noise ratio for the brain image (img) with ref as an image reference. Initially, mean square error of an image’s pixel matrix has been calculated using Equation (34) which is further incorporated in PSNR equation. (2)Mean Square Error Rate. The sum of the squares of the deviations, i.e., the average squared variance between the expected and real values, is calculated by the mean squared error (MSE) or mean squared deviation (MSD). It is measured using Equation (39).

where is the square of difference between the actual and the detected value [60]. To obtain the mean square error value of a brain image, we used the function which calculated the mean square error between and using Equation (34). (3)Detection Accuracy. Detection accuracy is characterized as the level of effectively arranged occurrences in which one is used as the grounded truth value to determine the correct output. It is calculated by using Equation (40).

The number of true positives, false negatives, and true negatives is represented as TP, FN, FP, and TN, respectively. To produce an effective classifier, the true positive and true negative rates should be closer to 100% [61]. A confusion matrix has been developed utilizing , where stands for target value and stands for output value, to generate true positive, true negative, false negative, and false-positive values. The accuracy is then calculated using these numbers.

4. Results and Analysis

Various machine and deep learning algorithms have been used for feature extraction, optimization, and classification to calculate the peak signal-to-noise ratio, mean square error rate, and detection accuracy of brain tumors.

4.1. Experimental Results

Based on the algorithms, three cases were taken to compare the outcomes so that we could find out the best technique for brain tumor detection. Initially, the image underwent the preprocessing state by using the CLAHE technique to improve its contrast.

Figure 4 depicts image preprocessing where the proposed solution can obtain a high strength of the image to normalize the pixels. One of the crucial stages is preprocessing. The preprocess output is fed into the principal component analysis or PCA, which extracts features for the optimization process. Firefly and Naïve Bayes are used for optimization and classification, respectively.

4.1.1. Case 1: Principal Component Analysis, Firefly, and Naïve Bayes Classifier

Figure 5(a) depicts the derived attribute values from principal component analysis. In contrast, Figure 5(b) shows the firefly technique to depict the smoothing of the image and NBC for image recognition and classification. It was smoothing the image which smoothed the pixels and image borders, which can be used in future image recognition systems. The picture classification that was used to detect the tumor region is depicted in Figure 5(c).

In the next scenario, the feature extraction was carried out by independent component analysis, which performs the Gaussian process to reduce the noise and independency among the images, which will extract the features having low variance among the neighborhood pixels. Figure 6(a) shows the preprocessing of the training image using threshold segmentation, which is fed into the feature extraction process. This partitions the image into the various segmentations and uses scaling to obtain meaningful insights, which helps locate the multiple curves and objects in the image.

4.1.2. Case 2: Independent Component Analysis, Cuckoo Search, and Naïve Bayes Classifier

Figure 6(b) shows the smoothing of the image and region of interest. The main region of interest, which has a probability of cancer in the image, is evaluated by the cuckoo search. The smoothing of the image will smooth the pixels and the boundaries of the image, which will lead to a high classification rate using NBC for the high region of interest in the detection scenario.

Finally, a hybrid optimization, which is the combination of lion and bat optimization, was applied to see the changes in the results and was later followed by a recurrent neural network. Figure 7(a) shows the contrast level enhancement of the image and feature extraction using CLAHE and independent component analysis, which is a significant step in extracting the feature vectors.

4.1.3. Case 3: Independent Component Analysis, Hybrid Optimization (Lion+Bat), and Recurrent Neural Network

The feature vectors were the independent, robust features that had more minor variance and low standard deviations. Figure 7(b) shows the smoothing of the image and the region of interest where there is a probability of detecting a tumor. The classification was carried out using the recurrent neural network classifier. The recurrent neural network classification performed the detection process using deep learning. The deep network and filtrations were completed, and the system achieved high classifications for the high region of interest.

In cases 1–3, Table 5 summarizes the performance of all machine and deep learning-based approaches utilized for feature extraction, classification, and optimization. These algorithms were tested on a few parameters such as peak signal-to-noise ratio, mean square error rate, and sensitivity to identify brain tumors after being trained on five MRI brain images. Table 4 is divided into three groups of algorithms: principal component analysis+firefly+Naïve Bayes, independent component analysis+cuckoo search+Naïve Bayes, and independent component analysis+(lion+bat) optimization+recurrent neural network, with their respective parameters, to find the best algorithm for detecting brain tumors. From case 1, i.e., the PCA+FF+NB group, we obtained optimum peak signal-to-noise ratio values, mean square error rate, and accuracy of 43.76, 3.05, and 96.71, respectively. When the ICA+CS+NB group was employed, the peak signal-to-noise ratio, mean square error rate, and detection accuracy were 31.85, 1.02, and 90.13, respectively. When the recommended model was implemented using ICA+(lion+bat)+RNN, the ideal peak signal-to-noise ratio, mean square error rate, and detection accuracy were 64.81, 1.40, and 98.61, respectively.

When these data were compiled, it was discovered that ICA+hybrid optimization+RNN produced the greatest PSNR and accuracy values of 64.81 dB and 98.61% for all of the pictures and the lowest mean square error for image 4. In a nutshell, CLAHE and thresholding techniques were used for preprocessing; PCA and ICA were used for feature extraction; cuckoo search, firefly, lion, and bat approaches were employed for optimization; NBC and RNN were used for image recognition. The PSNR of 64.81 has been achieved by the group of independent component analysis, hybrid optimization, and an RNN, the mean square error of 1.02 was conducted by the group of ICA, cuckoo search, and NBC, and the accuracy of 98.61 was achieved by the group of ICA, hybrid optimization, and an RNN.

4.2. Comparison with Past Studies

Table 6 shows the preliminary effects of the work instead of state-of-the-art techniques, showing that the proposed work stands out to be more effective than the state-of-the-art techniques in all brain tumor identification categories.

The suggested technique is unique since it achieves better results with high PSNR values of 64.81 dB and a 98.61% accuracy rate in detecting brain tumors, despite the mean square error being somewhat greater than 1.34. This is because the suggested system’s characteristics were optimized by utilizing several optimization strategies, including firefly, lion, bat, and cuckoo search, to produce the optimum result for reliably identifying brain cancers. We have also related the planned process with the previous work by comparing the current results with the outcomes achieved by the researchers using machine and deep learning algorithms to detect brain tumor (Table 5). When comparing the present and past methodologies, it was discovered that the researchers’ procedures resulted in a low PSNR value and a high MSE value, which limited the detection accuracy rate. As a rule of thumb, a high peak signal-to-noise ratio suggests good image quality, whereas a low peak signal-to-noise ratio suggests bad picture quality. A high mean square error rate, on the other hand, denotes a high error rate, whereas a low mean square error rate denotes a low mistake rate. As a result, we can state that our suggested methodology outperforms the others in terms of PSNR and accuracy.

4.3. Practical Deployment

The suggested model has been linked to a mobile application that allows patients to quickly determine whether or not a tumor is present inside their brain. The proposed mobile application’s architecture is depicted in Figure 8. The mobile app is intended to capture the afflicted region of the brain picture, and the data is securely stored on a distant server using the representational state transfer API. This is because remote online storage (Figure 9) is quicker and more dependable. It offers drag-and-drop, data compression, data transmission, and data encryption functions, as well as easy-to-use interfaces protected by passwords.

No SQL Mongo DB is used for handling massive user-related data, and point to point (P2P) protocol is used to establish a direct connection. Instead, the mobile application is created by using Android Development and is programmed in Java programming language. This apk file can be accessed by any user. Hence, it is open source, and its execution relies on the receiving and transferring of data to an online remote server.

Doctors and clinical laboratory professionals can use the Smartphone application to detect a tumor inside the brain. The user will utilize a mobile device to capture the MRI brain picture and submit it to the mobile application as input. To identify and classify the tumor inside the brain, the input picture is further processed using several learning models, such as independent component analysis, cuckoo search, and recurrent neural network. The user will receive an output stating that a tumor has been discovered as soon as it is detected. Figures 10(a)10(c) depict three displays of the brain tumor app, where the patient’s information is first required, including name, gender, age, phone number, if they have had hypertension, and the neurologist’s name. After correctly filling out their information, the user must click the “Next” button to go to a screen to upload the MRI brain picture. Following the submission of the picture, the suggested technique will begin analyzing the data using learning models to determine whether a brain tumor has been found. The outcome of the user’s MRI brain picture input will be displayed later on the third screen, and a message will be displayed along with the image.

Using this information, doctors can start their diagnosis as soon as possible without wasting time to save the patient’s life. Furthermore, the application will also help the doctors/technicians locate the small size tumor that is not even clearly visible in the image with the help of CLAHE technique, which improves the visibility level of foggy image to restrict it from growing larger. In a word, this application will assist patients in learning about their brain tumor within a short period after receiving their medical lab data. As a result, they will be able to see professional doctors right away and begin therapy. On the other side, this application will bring confidence to patients who do not have a brain tumor and save them time from unnecessarily attending a hospital.

The security of healthcare data is of the utmost importance in our mobile application. SSL technology is used to encrypt the data in the Smartphone device. The secure socket layer employs a cryptographic scheme that encrypts data using two keys: a public key known to all parties and proprietary or hidden key known only to the message’s receiver [62]. The Smartphone application’s protection allows patients a better sense of control over their healthcare data’s privacy, security, and confidentiality. The protection systems also keep our mobile application’s health data protected as well as clean. Though a malicious entity may intercept an app’s data across the network if the app misuses SSL, as a result, servers are generally set up with certificates from well-known issuers known as Certificate Authorities to limit fraud.

In most cases, the host platform has a list of well-known CAs that it trusts [63]. As of Android, there have been over 100 CAs that are updated with each version and did not vary from device to device. A CA has a certificate and a private key, much like a server. When a certificate for a server is issued, the CA signs the certificate using its private key. The client can then check that the server has a certificate from a CA that the platform recognizes [64]. Beyond this, there is one more factor, i.e., response time, that directly affects our developed application’s performance, as a delay can hamper the performance of the system. Hence, at present, we have computed that the response time taken by our application to produce output with proper input and bandwidth is 4-5 seconds.

5. Discussion

The primary goal of this research article is to detect tumors within the brain, for which various techniques such as CLAHE, threshold, ICA, PCA, cuckoo, Naïve Bayes, firefly, bat, cuckoo, and lion have been used throughout the process, from preprocessing to classification. The model has also been integrated into a mobile application to ensure that doctors, clinical technicians, and patients may access it on the go.

On the one hand, identifying brain tumors using mobile applications proves highly beneficial to users. Even so, certain factors such as lens quality, which is responsible for focusing the scattered light that enters the camera onto the sensor, the size of the pixels, which is perhaps one of the most popular specifications of a mobile camera, the aspect ratio, and the size of the sensor, which is critical in determining the quality of a Smartphone image, can all have an impact on the quality of an image. If none of these considerations are taken into account, the patient will receive the incorrect output, potentially fatal to them. Furthermore, the network bandwidth should not be too low for uploading or downloading images and presenting the outcome. Otherwise, it will take longer to identify a brain tumor than the basic technique.

In summary, after collecting it from a mobile device and adequate bandwidth, a clean input image should be addressed for simple access to a mobile application for brain tumor detection to be successful.

6. Future Directions and Limitations of the Research

Machine and deep learning-based techniques deeply optimize the existing methods of anticancer drug research [58]. They have the potential to reduce the cost of care and the ability to merge the large quantity of information collected from the various sources of data to reduce the workload of clinicians, as it is difficult for them to integrate such complex data manually. However, the detections generated by these techniques are evaluated and interpreted by the experts. However, the present research has some limitations [57]. The proposed methodology has been implemented using a single dataset and can be improved by taking multiple datasets, as the paper only focuses on the presence or absence of brain tumor, but it did not detect the type of tumor because of which the current work can also be extended by labeling the type of the tumor that has been seen inside the brain and also by incorporating other techniques of deep learning-based models such as self-defined artificial neural network and convolution neural network can be used to improve the detection rate of a brain tumor. As the mobile application has also been used to detect brain tumors, its main drawback can also be erroneous, which needs to be considered in the future. Moreover, they also have flaws, such as method sophistication, a lack of knowledge about an individual with a specific context, and the possibility that these approaches will include an incorrect diagnosis. As a result, physicians are more likely to administer the wrong care if they lack the experience to spot the error, requiring the use of a vast dataset to train the algorithm and obtain a reliable detection performance.

7. Conclusion

Machine and deep learning are gradually encompassing all phases of our lives, particularly in healthcare. The present work highlights that researchers are quickly gaining a deeper understanding of the challenges and prospects offered by machine and deep learning models as an intelligent system in the area of tumor diagnosis and detection.

Using different learning methods, the potential presence of a tumor, which is a leading cause of death, has been successfully detected. Preprocessing was undertaken for this, and features were removed from the images and then optimized using different techniques. Among all of the methods, the group of independent component analysis, hybrid optimization, and an RNN had the best PSNR of 64.81%, the group of ICA, cuckoo search, and NBC had the best mean square error of 1.02, and the group of ICA, hybrid optimization, and an RNN had the best accuracy of 98.61%.

As healthcare cost is increasing, patients need to keep track of their prescription spending. Since these algorithms are computationally less costly than other approaches, they can be used in hospitals for brain tumor recognition, brain tumor diagnosis, etc. Moreover, the substantial analysis of these algorithms on tumor-based issues supports a strong candidature in controlling a brain tumor at an early stage. When working with medical results, the algorithms used in this work take into account information from a variety of attributes to make a final detection and offer straightforward interpretations of their decisions, making them one of the most valuable tools for assisting physicians in their decisions.


CLAHE:Contrast limited adaptive histogram equalization
PSNR:Peak signal-to-noise ratio
PCA:Principal component analysis
ICA:Independent component analysis
FF:Hybrid optimization
MSE:Mean square error rate.

Data Availability

The data used to support the findings of this study are available from the first author upon request.

Conflicts of Interest

The authors declare no conflict of interest.