1 Introduction

In today's medical practices, the integration of Artificial Intelligence (AI), Information Technology (IT) and E-healthcare procedures to develop an intelligent system to support physicians in providing high-quality health services to patients. Brain tumors are a critical disturbance to the human brain caused by an abnormal increase of cells. This can significantly impair brain function and be life-threatening. Brain tumors are a common form of cancer in humans, and timely detection plays a crucial role in reducing mortality rates. Brain tumors have been identified using medical imaging techniques such as Computed Tomography (CT) scanning and Magnetic Resonance Imaging (MRI) [1]. Due to its capacity to produce improved contrast between MRI images of the brain and malignant tissues, MRI is one of these methods that is regularly employed for the detection of brain cancers [2]. A contemporary method for early brain tumor detection is image analysis using MRI scans. Finding brain tumors in cancer detection relies heavily on feature extraction. The technique of extracting features from segmented MRI images is called feature extraction, and preprocessing is used to remove objects and noise from the image. The tumor region is subsequently divided into segments using non-uniformly distributed histogram and threshold approaches. When segmenting, features are extracted using the GLCM. In this study, Practical Swarm Optimization (PSO) approaches are compared with Whale Optimization Algorithm (WOA) and Social Spider Optimization (SSO) algorithms for selecting the best image features. The DCNN classifier is then used to divide all of the features into tumors and non-tumors. In our research, we have implemented an end-to-end deep learning (DL) approach that utilizes a hybrid model for the brain tumors classification of benign and malignant in MRI scans. Our technique involves a k-means algorithm for segmentation and the utilization of masks to enhance segmentation accuracy, moving beyond solely relying on a boundary-based model. Unfortunately, modern approaches have not effectively addressed this problem. In the past, cancer regions were manually identified for assessment and diagnosis before detection. Existing computer-aided detection (CAD) systems, employing automation algorithms, CNN-based algorithms, and their variants, have not significantly improved the detection of these brain cancers.

Research on the application of the medical imaging techniques for brain tumor segmentation and diagnosis has been attempted several times in the past few years. In medicine, machine learning-based brain tumor segmentation and detection is essential for precise disease detection. Brain tumor segmentation is not much utilized in clinical practice, despite the acknowledged effectiveness of automated tumor segmentation. The aim of the work is to use digital image processing techniques to identify cancer regions from brain MRIs, and to calculate the location of the tumor using symmetry analysis and a totally automated system. Furthermore, there are many shortcomings and challenges observed by medical practitioners in the use of MRI scans for cancer patient surveillance, identification, and therapy such as uneven and complex MRI brain image samples. The purpose of this study is to develop an effective brain tumor recognition strategy using WSSOA-based metaheuristic technique and Deep Convolutional Neural Networks (CNNs)-based model. The major contribution of this research lies in the utilization of statistical and texture features for tumor detection. The proposed approach involves employing cellular-based rough set theory to obtain segments, enabling the identification of cancerous regions. In this study, various features such as mean, entropy, variance, energy, kurtosis, and tumor size features were extracted to aid in the determination of tumors. The Deep CNN is then employed to detection tumors using these extracted features. To optimize the model parameters effectively, Deep-CNN is exerted using the proposed WSSOA-based feature selection algorithm, which inherits the high global merging property from the SSO algorithm. The WSSOA-based Deep CNN has shown promising results, achieving effective accuracy in brain tumor recognition. By integrating the WOA and SSO algorithms, the proposed WSSOA algorithm enhances the training process of the Deep-CNN model, leading to improved performance. Additionally, no measures have been taken to address potential data limitations for training, which is another area of concern. The main contributions of the proposed model are given as follows:

  • A novel optimal feature selection scheme is designed by using the Whale Social Spider-based Optimization Algorithm (WSSOA)based meta-heuristic technique.

  • A hyperparameter-tuned Deep Convolutional Neural Network (DCNN) model is designed for accurate tumor detection tasks.

  • Performance of the proposed model is evaluated and compared with seven latest state-of-art models in terms of accuracy, precision, recall, and F1-score using a well-known benchmark dataset known as Figshare.

There are five sections in this research. Section 1, Introduction, provides an overview of the suggested research project. Section 2, Related Work, defines previous research relevant to this suggested study. Section 3, Techniques and Materials, describes the suggested architecture for detecting brain tumors, which incorporates WSSOA and DCNN. The findings produced by combining a DCNN classifier and WSSOA are presented in Sect. 4, Findings and Discussion, where their performance is assessed created on precision, F1-score, recall, and accuracy. In Sect. 5, Performance evaluation, the accuracy of the planned strategy is compared to previous work. Finally, the conclusion is drawn based on the findings of this research.

2 Related work

Medical professionals continue to struggle with classifying brain tumors in MRI images, prompting researchers to explore novel diagnostic strategies. The growing popularity of deep learning (DL) procedures, including convolutional neural network (CNN) is leading to exciting improvements in the field of medical imaging.

Geetha et al. [3] have used a DBN for the classifier and GWO to identify tumors in MRI pictures with an accuracy of 94.11%. By comparing the results of their model with that of a participating technique and evaluating a number of variables, including accuracy, recall, precision, F1-score, negative predictive significance, they demonstrated the value of their work using the Matthew-correlation-coefficients (MCCs), false discovery (FD), false negative (FN), and false positive (FP) rate. Similarly, Sindhu et al. [4] achieved an accuracy of 96.47% by creating an Adaboost together KNN-SVM method using whale optimization algorithm to identify brain tumors. For image segmentation, they used a based-on saliency k-means clustering used segmentation technique. For feature extraction, they used GLCM with GLRM. For feature selection, they used PSO with WOA. Whale Harris Hawks optimization (WHHO) is a cutting-edge brain tumor detection method proposed by Ramamurthy et al. [5]. The technique retrieves important information from the segmented image, such as cancer size, native optical coordination pattern, mean, variance, entropy, and kurtosis using rough set theory (RST) and cellular automata (CA) for image segmentation. Then, to detect cancers, a deep convolutional neural network is employed, provide impressive outcomes with a 0.816 of accuracy, 0.791 of specificity, and 0.974 of sensitivity Yin et al. [6] presented novel brain tumor categorization technique constructed on an improved description of whale optimization algorithm. Faramarzi et al. [7] employed Equilibrium optimizer: A novel optimization algorithm for brain tumor detection. Mishra et al. [8] utilized DCNN classifiers and Whale-Optimization-Algorithm (WOA), achieved 98% accuracy. The accuracy gained by WOA, Particle-Swarm-Optimization, and Genetic-Algorithm is compared in this paper. Irmak et al. [9] developed a CNN-based system that has a high accuracy rate of 98.7% for identifying brain tumors. Several recent CNN models were used to compare the system, including Inception v3, AlexNet, VGG-16, ResNet-50, and GoogleNet. A real-time medicinal diagnosis system created on knowledge concentration methods would need a larger model, though. Additionally, a single classifier outperforms an ensemble configuration with average results in some circumstances. Zhang et al. [10] presented preclinical identification of magnetic resonance Imaging (MRI) brain images employed Discrete Wavelets Packet Transform (DWPT) feature extraction and the calcifications using Generalized Eigen-value Proximal-based Support Vector Machine (GEPSSVM) achieved accuracy 99.61%. Abdalla et al. [11] Proposed Spatial Grey level Dependency (SGLD) Matrix feature extraction and the calcifications using Artificial Neural Network (ANN) achieved accuracy 99%. Gudigar et al. [12] introduced Wavelets Transform (WT), Curvelets Transform (CT), and Shearlets Transform (ST) for feature extraction and selection for PSO and the classification used SVM attained accuracy 97.38%. Islam et al. [13] presented Superpixeles with Principal-Component-Analysis (PCA) used for the feature extraction with feature selection and calcifications using Generalized Eigenvalue Promimate Support Vector Machine (GEPSSVM) achieved accuracy 95%. Das et al. [14] introduced early tumor identification in brain MRI images through deep convolutional neural network (DCNN) model employed feature extraction and classification by Deep-CNN achieved accuracy 98%. Rai et al. [15] presented Recognition of brain irregularity through an innovative Lu-Net with DCNN architecture from MRI images and achieved accuracy 98%. Kang et al. [16] introduced MRI-based brain tumor classification using together of deep features and machine learning classifiers attained accuracy 96.13%. Sawant et al. [17] presented Brain tumor detection from MRI, using a machine learning approach achieved accuracy 98.60%.

Table 1 provides a quick review of relevant studies employing machine learning (ML) and Deep learning (DL) techniques to identify brain tumors. In conclusion, the typical CNNs models for brain tumor identification largely employ the ML and DL techniques outlined above. On the additional influence, the pre-trained model created by the transfer learnings (TLs) approach requires less computing time, is more accurate, and does not require the maintenance of a huge training dataset.

Table 1 Brief summary of related works ML and DL techniques based brain tumor identification

As can be experimental from related work, designing and implementing an efficient technique for identifying brain cancer from MRI images is a challenging task. While traditional methods such as neural network and deep learning have provided satisfactory results, using met-heuristics can improve the training stage of these networks. In this paper, we propose a combined version of DCNN with WSSOA to improve the speed and accuracy of brain tumor identification.

3 Proposed methods and discussions

This section presents a detailed working model of the proposed methodology.

3.1 Brain tumor dataset

This study has used a publicly available brain MR images dataset known as Figshare [18, 19] for evaluation and analysis of the proposed model. This dataset contains two classes: 'Yes' for tumor images and 'No' for healthy tissue images, total 155 and 98 images, respectively. These MRI scans include T1, T2, and Fluid-Attenuated Inversion Recovery (FLAIR) images [20], each with dimensions of (128, 128) in the axial view. To train our CNN network, we utilized 177 dataset images, reserving 38 for testing and an additional 38 for validation, randomly selected from the pool of 253 images. All images used for validation and testing were chosen randomly from the dataset. It's worth observing that all the images we used in our study are accessible on the dataset's official website.

3.2 Proposed brain tumor classification architecture

Early classification of brain tumors is pivotal in reducing patient mortality rates. The system architecture is built upon deep learning (DL) techniques, specifically employing a Deep Convolutional Neural Network (DCNN) with Whale Social Spider-based Optimization Algorithm (WSSOA) for brain tumor classification. The diagnostic process comprises four key steps: preprocessing, segmentation, feature extraction and selection, and the optimization of a deep learning-based CNN approach for classifying benign and malignant brain tumors. The proposed architecture is depicted in Fig. 1.

Fig. 1
figure 1

The proposed brain tumor detection model

3.2.1 Preprocessing

The MR image processing is a time-consuming procedure. Before processing the image, it is crucial to remove any MR abnormalities/noises. Once unnecessary noise has been eliminated, MRI data can be further processed [20] to enhance the detection and identification accuracy. Preprocessing involves filtering and grayscale translation. After converting to grayscale, additional noise is reduced using filtering techniques. To remove the Gaussian noises from grayscale images, a composite filter is employed which consists of Gaussian, mean, and median filters.

3.2.2 Grayscale conversion

The standard preprocessing method for MRI involves grayscale conversion [21]. RGB MRI provides additional data that is unnecessary for image processing. Grayscale MRI can be used to eliminate this extraneous data instead of using RGB MRI [22]. In RGB MRI, the image is represented in three channels, each with 8 bits: B (blue), G (green), and R (red), resulting in varying proposal levels for each B, G, and R section. This leads to data redundancy in color images, necessitating significant storage and processing capacity. An example of the transformation of an RGB MRI image into a grayscale image is illustrated in Fig. 2a.

Fig. 2
figure 2

a Grayscale conversion image and b filtering image

3.2.3 Filtering

Filtering techniques are employed to reduce additional noise after converting to grayscale. This proposed technique uses a composite filter to remove Gaussian, salt, pepper, and fragment noises from grayscale images. The included filters are the Gaussian filter, mean filter, and median filter. A composite filter has the advantage of preserving the edges and boundaries of MRI images, as demonstrated in Fig. 2b.

3.3 Segmentation

As there are various images generated through scanning, and it takes an extended amount of time for clinicians to manually segment these images, MR image segmentation becomes crucial [22]. Image segmentation involves dividing MR images into distinct, non-overlapping sections, making the image more relevant and evaluable by grouping pixels effectively. Segmentation is employed to classify borders or substances in an illustration, and the resultant structured slices cover the entire image. Segmentation procedures rely on two key properties of image content: intensity, correspondence, and gaps. Numerous segmentation methods are accessible, including threshold and histogram-based techniques, as well as region-based, edge-based, and clustering techniques. The most commonly used method for processing MR images is threshold and histogram-based segmentation. This paper investigates brain cancer and evaluates tumor areas in MRI images using threshold-based segmentation with morphological techniques. Figure 3 provides a detailed example of the segmentation process.

Fig. 3
figure 3

a Original image for input, b morphological operations c threshold for input binary transformation, and d segmented image are diseased region indications dark-white

3.4 Feature extraction

By removing features, a large dataset can be appropriately defined with less resources. When an excessive number of variables are used to explore extensive data, challenges may arise, requiring more memory and processing time, especially in studies with numerous variables. To address these issues and accurately summarize the data, the process of the feature extracted are employed, involving the grouping of variables into clusters. In this proposed study, both statistical and texture-based characteristics are obtained using Grey-Level Co-occurrence Matrix (GLCM) [23]. Similar to the number of grey levels (GLs) in the image, the columns and rows number in the GLCM remains constant. The suggested method utilizing GLCM extracts the following characteristics, as depicted in Table 2.

Table 2 Extracted features of sample MRI images

3.4.1 Mean (M)

The computed image is given as: The calculated image is created by multiplying the average of all the image's pixel values by the total no. of pixels.

$$M=\left(\frac{1}{m\times n}\right)\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} f\left(x,y\right)$$
(1)

A lower number implies that the image appears to have had a substantial amount of noise eliminated, where n and m are sizes of images.

3.4.2 Standard deviation (SD)

The probability distribution of a detected population, which can be used to determine inhomogeneity through the calculation of standard deviation, is defined for the second phase of essential moment computation. A higher value indicates a more saturated image with strong contrast at the image edges.

$${\text{SD}}\left(\sigma \right)=\sqrt{\left(\frac{1}{m\times n}\right)\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} (f(x,y)-M{)}^{2}}$$
(2)

3.4.3 Entropy (E)

Entropy is a measurement of a texture image's uncertainty and is calculated and expressed as:

$$E=-\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} f\left(x,y\right){{\text{log}}}_{2}f\left(x,y\right)$$
(3)

3.4.4 Skewness (\({\mathbf{S}}_{\mathbf{k}}\left(\mathbf{X}\right)\))

Skewness serves as a measure for missing in that place. The random variable X has the following definition:

$${S}_{k}\left(X\right)=\left(\frac{1}{m\times n}\right)\frac{\sum (f(x,y)-M{)}^{3}\mid }{{{\text{SD}}}^{3}}$$
(4)

3.4.5 Kurtosis \({(\mathbf{K}}_{\mathbf{u}\mathbf{r}\mathbf{t}}\left(\mathbf{X}\right))\)

Kurtosis is a parameter used to describe the shape of probability distributions for random variables. It is represented as \({K}_{{\text{urt}}}\left(X\right)\) for a random variables X, and is defined as:

$${K}_{{\text{urt}}}\left(X\right)=\left(\frac{1}{m\times n}\right)\frac{\sum (f(x,y)-M{)}^{4}\mid }{{{\text{SD}}}^{4}}$$
(5)

3.4.6 Energy (En)

Energy is a measured sum of how many times a pair of pixels are repeated, serving as an indicator of how closely two images are related. When defined in terms of Haralick's GLCM function, energy is also referred to as a pointed moment and can be explained as follows:

$${\text{En}}=\sqrt{\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} {f}^{2}(x,y)}$$
(6)

3.4.7 Contrast (Con)

It is defined as the intensity of the pixel and that of its neighbours across an evaluated image.

$${C}_{{\text{con}}}=\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} (x-y{)}^{2}f(x,y).$$
(7)

3.4.8 Homogeneity \((\mathbf{I}\mathbf{D}\mathbf{M})\)

The opposite of this is when an image's moment is taken into consideration along with its limited homogeneity. IDM can have either a single value or multiple values to determine whether an image exhibits texture or not.

$${\text{IDM}}=\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} \frac{1}{1+(x-y{)}^{2}}f\left(x,y\right)$$
(8)

3.4.9 Directional moment (DM)

It is stated as a dimension of the picture's textural irregularities using the position of the image as a metric in relations of position.

$${\text{DM}}=\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} f\left(x,y\right)\left|x-y\right|$$
(9)

3.4.10 Correlation (\({\mathbf{C}}_{\text{orr}}\))

The correlation function, which is denoted as: describes the spatial dependencies between pixels.

$${C}_{\text{orr }}=\frac{\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} (x,y)f(x,y)-{M}_{x}{M}_{y}}{{\sigma }_{x}{\sigma }_{y}}$$
(10)

3.4.11 Coarseness (\({\mathbf{C}}_{\text{ness}}\))

A roughness measure used in image textural analysis is known as coarseness. The coarseness score window size increases as the texture becomes coarser, while fine textures receive lower coarseness ratings. It can be described as follows:

$${C}_{\text{ness }}=\frac{1}{{2}^{m+n}}\sum_{x=0}^{m-1} \sum_{y=0}^{n-1} f\left(x,y\right)$$
(11)

As indicated in Table 2, various GLCM textural properties are determined for each image, including means, standard deviations, entropies, energies, homogeneity, contrast, and correlation among the set of images.

3.5 Feature selection using meta-heuristic optimization algorithm

In this paper, we propose the use optimization algorithms for feature selection in deep learning-based CNN algorithms to identify brain tumors in MR images. The algorithm used is WSSOA (Whale Social Spider-based Optimization Algorithm). The optimization phase aims to select the determined applicable features from the input data, enhancing the classifier's performance in accurately detecting brain tumors. These selected features are then fed into the deep learning-based CNN procedures for further processing [24]. We evaluate the proposed procedure's performance in expressions of precision, recall, and F1-score, and accuracy comparing it with other modern optimization algorithms. Our results illustrate that the planned procedure outperforms the comparison algorithms in accuracy, precision, and recall, demonstrating its effectiveness in selecting the most relevant features for the CNN algorithm in identifying brain tumors. The specifics of the planned optimization technique are shown below:

3.5.1 Whale social spider-based optimization-algorithm (WSSOA)

The Whale Optimization Algorithm (WOA) plans the monitoring actions of humpback whales to maximize problem-solving efficiency. Humpback whales exhibit a consistent feeding strategy [20], where they use their food to create bubbles. This algorithm comprises the following actions: searching for prey, engulfing prey, and humpback whales employing bubble nets for foraging. The data flow diagram of the Whale Social Spider-based Optimization Algorithm (WSSOA) is depiction can be observed in Fig. 4.

Fig. 4
figure 4

Data flow diagram of WOSSA

The WOA, initially planned by Mirjalili and Lewis, was inspired by the bubble-net hunting (BnH) technique of humpback whales (HWs). Humpback whales prefer to hunt small fish near the water's surface, and they create characteristic bubbles in a circular pattern while swimming close to their prey. WSSOA comprises two primary phases: the initial phase involves exploitation, where the algorithm encircles a target and uses a spiral bubble-net attacking technique, while the second phase involves exploration, where it seeks for prey. Below, we provide a mathematical model of the Whale Social Spider-based Optimization Algorithm (WSSOA) [7]. Table 3 shows the details of WSSOA.

Table 3 Proposed whale social spider-based optimization algorithm (WSSOA)

3.5.2 Encircling prey

The humpback whale first locates its prey and then encircles it. The optimal solution is one that closely approximates the authentic solution. Once the best candidate solution is identified, selections or agents use Eqs. (12) and (13) to adjust their positions toward the broker or the best search alternative.

$$D \, = \, \left| {C.X \, * \, \left( {t_{cur} } \right) \, - \, X\left( {t_{cur} } \right)} \right|$$
(12)
$$X\left( {t_{cur} + \, 1} \right) \, = \, X \, * \, \left( {t_{cur} } \right) \, - \, A \, \cdot \, D$$
(13)

where tcur is the current loop, A, Do, and X * are coefficient vectors, X indicates the positioning vector of a solution, and || is the total value. X * is the position vector of the best solution. The following computations are made for the vectors A and C:

$$A \, = \, 2a \, \cdot \, r \, - \, a$$
(14)
$$C \, = \, 2 \, \cdot \, r$$
(15)

where r is an arbitrary digit between [0, 1], and linearly dropped from 2 to 0 during the course of the iteration.

Bubble-net attack technique

Whales use this strategy to attack their prey. It consists of the two techniques:

  1. (i)

    Shrinking Encircling’s Mechanism (SEM)

This approach involves the whale decreasing the value of Eq. (14) and also reducing the value of A from its initial 'a.' Additionally, A is iteratively decreased in each iteration. To initialize A, a random value is selected from the interval [− 1, 1]. The new position of an internet research cause can be anywhere between the agent's initial location and the current best cause's position.

  1. (ii)

    Spirals Updation Position (SUP)

In this approach, a curved procedure is formed among the locations of the whale with prey to imitate the spiral pattern of humpback whales. The spiral formula is defined as follows:

$$D \, \prime \, = \, | X \, * \, \left( {t_{cur} } \right) \, - \, X\left( {t_{cur} } \right)|$$
(16)
$$X\left( {t_{cur} + \, 1} \right) \, = \, D \, \cdot \, e^{b} l \, \cdot \, cos\left( {2\pi l} \right) \, + \, X \, * \, \left( {t_{cur} } \right)$$
(17)

where prey, b is constant and direction D specifies the shape, l is random in the range [1, 1] and is a factor-by-factor exponentiation.

The position of whales must be updated in order to mimic both approaches at once, and it is similarly possible that they will choose either the spiral or the shrinking and encircling course. The following is a mathematical model of these mechanisms:

$${Y \left({t}_{cur}+ 1\right)= \{}_{D \times {e}^{bl} \times cos \left(2\pi l\right) + X* \left({t}_{cur}\right) if rand \ge 0.5}^{\left| X*\left({t}_{cur}\right)-X \left({t}_{cur}\right)\right| if rand < 0.5}$$
(18)

3.5.3 Search for prey

Humpback whales employ the bubble-net method for hunting, as it is uncertain where exactly their prey is located. In the development phase, the search agent can move from a reference point within the range of A in the area [1, 1], and the search demonstrative will be adjusted to select from the search cause instead of the previously identified search broker. Both actions determine the next steps.

$$D \, = \, \left| {C \, * \, X_{rand} - \, X} \right|$$
(19)
$$X\left( {t_{cur} + \, 1} \right) \, = \, X_{rand} {-} \, A*D$$
(20)

where Xrand is a randomly chosen direction of position. Based on the information above, hunt agents refine their location. Because of the placement update process for Whales employing Eq. (20), WSSOA is capable of high-level studying comprehension. Equations (17) and (13) demonstrate that the iterative WSSOA method can support high regional optimum circumvention and merging speed as shown in Fig. 5 process of optimal feature selection.

Fig. 5
figure 5

Process of optimal feature selection

As a result, the search agents (whales) can move along each dimension by swapping between 0 and 1. The primary distinction among the original and binary versions of WSSOA lies in the position update technique. In WSSOA, location updates are indicated by toggling between 0 and 1. Additionally, a probability, calculated based on the helix-shaped association of whales, influences the value of the current bit. To attain this, an applicable transfer-function must be used to convert the association values in the shape of a helix into probabilities for updating positions. The transfer function ensures that the whales are mobile within a binary space. Based on these concepts, a suitable prospect function can be expressed as follows:

$${{\text{C}}}_{{\text{step}}}=\frac{1}{1+{{\text{e}}}^{-10({\text{A}}*{\text{Dist}}-0.5)}}$$
(21)

where \({{\text{C}}}_{{\text{step}}}\) denotes the phase dimension that a sigmoidal function may calculate. Dist measures the separation between a humpback whale and its prey.

The original whale optimization algorithm is suggested to undergo three significant alterations.The shrinking and encircling of the prey phase is altered first. According to the equation below, the whale's position changes.

$${Y \left({t}_{cur} + 1\right)= \{}_{Y \left({t}_{cur}\right) otherwise}^{complement \left(Y\left({t}_{cur}\right)\right), if rand< {C}_{step}}$$
(22)

where \({C}_{step}\) is determined using the formula in Eqs. (21) and (22) A and dist calculated. The second adjustment is made to whales' bubble-net behaviour and uses the following computation:

$${C}_{{step}{\prime}}=\frac{1}{1+{e}^{-10(A\times {Dist}{\prime}-0.5)}}$$
(23)

where A and "Dist" are calculated, respectively, using Eqs. (14) and (17).

According to Eq. (26), the location of the humpback whales' helix-shaped movement is updated. The method for updating a modification in position is then carried out as follows:

$${Y \left({t}_{cur} + 1\right)= \{}_{Y \left({t}_{cur}\right) otherwise}^{complement \left(Y\left({t}_{cur}\right)\right), if rand< {C}_{{step}{\prime}}}$$
(24)

The third updating is complete in the pointed of prey. The calculated formula of \({C}_{{step}^{{\prime}{\prime}}}\) is specified below:

$${C}_{{step}^{{\prime}{\prime}}}=\frac{1}{1+{e}^{-10(A\times {Dist}^{{\prime}{\prime}}-0.5)}}$$
(25)

where A and \({Dist}^{{\prime}{\prime}}\) are calculated using Eqs. (13) and (18), individually. Hence, the location of whale is simplified giving to Eq. (26).

$${Y \left({t}_{cur} + 1\right)= \{}_{Y \left({t}_{cur}\right) otherwise}^{complement \left(Y\left({t}_{cur}\right)\right), if rand< {C}_{{step}^{{\prime}{\prime}}}}$$
(26)

According to Eq. (27) this data is quantified as vibrations that depend on the weight and variation of the spiders:

$$vib_{ij} = W_{j} \times \exp - d_{ij}$$
(27)

where dij stands for the Euclidean distance between spiders i and j. Similar to Wj, Eq. (28) representation of the spider's fitness value determines the spider's weight.

$$Wi = Worst - (xi)/Worst - Best$$
(28)

In Eq. (29) definition of a minimization issue, spider xi's fitness function is given as

$${\text{f}}({\text{xi}}).Best = \min_{i = 1} ...N\;f(x_{i} ),\;Worst = \max_{i = 1} ...Nf(x_{i} )$$
(29)

Each spider (xi) takes into account three vibrations (V ibci, V ibbi, and V ibf t) from another spider. V ibbi: vibration after best male (m) or female (f) spider within the swarm, V ibci: vibration from nearby male (m) or female (f) spider with advanced fitness, and V ibf t: vibration after female spider. The associated spiders are divided into the two gender types: In the whole spider population, female spiders make up between 65 and 90% of the species. Equations (30) and (31) respectively show a male and female spider.

$$Nf = f\;loor\left[ {(0.9 - rand * 0.25) * N} \right]$$
(30)
$$Nm = N - Nf$$
(31)

where N is the overall number of spiders, Nm the number of male spiders, and Nf the number of female spiders. The random function called rand produces random numbers between 0 and 1. Female spider positions have been adjusted as Eqs. (32) and (33).

$$X_{i} = X_{i} - \alpha V\;ib_{ci} \;X_{c} - X_{i} - \beta V\;ib_{bi} \;X_{b} - X_{i} + \delta (rand - 0.{5})\;{\text{with}}\;{\text{probability}} PF$$
(32)
$$X_{i} = X_{i} - \alpha V\;ib_{ci} \;X_{c} - X_{i} - \beta V\;ib_{bi} X_{b} - X_{i} + \delta (rand - 0.{5})\;{\text{with}}\;{\text{probability}} (1 - P)$$
(33)

where P F is referred to as the threshold parameter and rand are random integers. The neighboring spiders of Xi that allocate more weight with maximum separate of the entire population are Xc and Xb.

As indicated in Table 4, bold values denoted  for best by feature selection applying WSSOA are determined, including means, standard deviations, entropies,, contrast, and correlation for each image out of images.

Table 4 Selected features of sample MRI images

3.6 Deep convolution neural network (DCNN)

This section presents the structural configuration of the Deep Convolutional Neural Network (DCNN), as depicted in Fig. 6. The Deep CNN consists of three fundamental types of layers: Convolutional (Conv) layers, Pooling (POOL) layers, and Fully Connected (FC) layers. Each layer has a distinct role in the network's operations. The primary role of the Convolutional layers is to extract intricate features from segmented images [25]. These layers create feature maps by convolving learned weights with input data. Subsequently, the feature plans undergo down sampling and are directed to the Pooling layers, constituting the second layer in the DCNN architecture. Finally, the FC layers handle the classification process, significantly enhancing classification accuracy by incorporating an increased number of Convolutional (Conv) layers. The Convolutional layers are pivotal in generating feature representations and facilitating pattern extraction from segmented objects. These layers' neurons are linked together by trainable weights, which combine with input data to create feature maps. The complicated functional mappings between the input data and the response variables are then reduced using non-linear activation functions on these feature maps. Convolutional layers may successfully learn to recognize complex features and spatial hierarchies in the input data through training and weight optimization. Employing these newly acquired features, interesting feature maps are created that successfully draw attention to important patterns [26]. Classification accuracy is greatly improved by using a large number of convolutional layers in the DCNN architecture. This improvement is attributed to the network's heightened capability to capture and comprehend intricate data features, resulting in improved discrimination between different classes during the classification process.

Fig.6
figure 6

Model of the deep convolution neural network (DCNN)

Convolutional Neural Networks (CNNs) are a type of neural network architecture used for image processing and analysis tasks. CNNs typically consist of several layers, each serving a specific purpose in processing the input image. The following are the main types of layers commonly used in CNNs:

  • Convolutional Layer (CL): The CL serves as the foundation for CNNs. It uses a collection of teachable filters to extract features like edges, corners, and textures from the input picture. Convolutional math is used by the filters as they go over the picture to produce a feature map that shows where the extracted features in the input image were located.

  • Activation Layer (AL): The AL adds nonlinearity to the model by applying activation functions to the output of the CL. Rectified Linear Units (ReLUs), sigmoid activation, and Hyperbolic Tangent (tanh) are frequently used activation functions.

  • Pooling Layer (PL): The PL is used to downsample the feature maps, bringing down their spatial dimensions and improving the model's resistance to slight input fluctuations. Max-pooling layers and Avg-pooling layers are representative of pooling layer.

  • Batch Normalization Layer (BNL): By normalize the output of the layer before it, the BNL increases the stability and effectiveness of the training process. It enhances the generalization of the model and helps to reduce internal covariate changes.

  • Dropout Layer (DL): The DL is employed to prevent overfitting by randomly dropping selected nodes in the previous layer during training. This encourages the model to learn more robust features and reduces reliance on any single node.

  • Fully Connected Layer (FCL): The FCL takes the flattened output from the preceding layers and transforms it into a vector of class scores. This vector represents the probabilities that the input image belongs to each of the possible classes.

These layers can be stacked in various ways to create different CNNs architectures, such as VGG, ResNet, and Inception. The specific configuration of the layers and the number of filters in every layer can be tuned to optimize the performance of the model for a given task.

4 Experiment results and discussion

This section provides details about the experimental setup and model hyperparameters. We implemented our proposed framework using Python and TensorFlow, conducting the training and testing of our model on an Intel Xeon server with 16 GB of RAM. TensorFlow offers a range of machine learning libraries for training and testing deep neural networks (DNN), as illustrated in Fig. 7 confusion matrix. We imported the Keras library and its components to facilitate effective training, conversion, and network construction for image data. Our proposed method demonstrated superior performance compared to existing methodologies. To test and evaluate our proposed system, we utilized 253 MR images as input to distinguish among healthy and brain-infected images. The dataset included features related to whales and wolves, which were applied in both the training and testing phases. To conduct the evaluation, 80% data used for training, whereas the remaining 20% reserved for testing.

Fig. 7
figure 7

Confusion matrix for training and testing deep neural network (DNN)

Precision: Precision is a dimension of the percentage of cancers that the model properly diagnosed out of all the tumors it classified. It is described in mathematical as:

$$Precision=\frac{TP}{TP+FP}$$
(34)

Recall: The ability to correctly determine that an individual does not have a tumor is the recall measurement.

The level of detail is offered by:

$$Recall=\frac{TP}{TP+FN}$$
(35)

Accuracy: The successful classification serves as a gauge of accuracy.

Accuracy is provided by:

$$Accuracy=\frac{TP+TN}{TP+TN+FP+FN}$$
(36)

F1 Score: The F1 score achieves a balance among the two metrics by obtaining the mean of precision and recall.

$$F1 score=2\times \frac{Precision\times Recall}{Precision+Recall}$$
(37)

In evaluating the presentation of the planned system, we employ the following metrics: accuracy, precision, recall, and F1-score, which are calculated using Eqs. (34), (35), (36), and (37), respectively. These metrics are based on the following definitions: TP (True Positive) refers to cases where both the actual and expected values are true; FP (False Positive) refers to cases where the expected assessment is true, but the actual value is false; TN (True Negative) refers to cases where both the actual and predicted values are false; and FN (False Negative) refers to cases where the actual value is true, but the predicted value is false [27].

Table 5 displays the outcomes of our analysis, which clearly indicate that the Whale Optimization Algorithm (WOA) technique outperforms other optimization techniques. Specifically, the accuracy achieved using WOA is the maximum compared to the additional algorithms. Additionally, the WOA approach outperforms other algorithms when evaluating the precision, recall, and F1-score metrics. These results decisively demonstrate that, when compared to other algorithms, the combination of WOA and the CNN algorithm yields the best results.

Table 5 Presentation of the planned technique with state-of-the-art approaches comparisons

Using Python's CNN library, we implemented feature optimization and brain tumor detection. Additionally, our approach counts the number of images with and without tumors. Out of the 253 images in the dataset we collected for analysis, 30 were used for testing, whereas the remaining 70 were used for training. With the WOA and SSO + DCNN algorithm, we achieved an accuracy of 99.29%, the highest compared to other algorithms we tested. A confusion matrix reveals that 98 pictures were correctly recognized as normal, while 155 were found to be infected with tumors. Diagnosing brain tumors typically requires the use of various imaging modalities. To assess the performance of our approach, we conducted a proportional study of accuracy, precision, and F1-score, as shown in Fig. 8. These results confirm that the WOA and SSO with DCNN algorithms outperform other techniques in expressions of accuracy, precision, recall, and F1-score.

Fig. 8
figure 8

a Validation accuracy and b validation loss

4.1 Compared the proposed approach with state-of-the-art approaches

Table 5 provides a comparison of the performance of several optimization techniques used in brain tumor identification, including our proposed system. Geetha et al. [3] achieved 94.11% accuracy using DBN classifiers and GWO. Their approach involved preprocessing steps such as contrast improvement and skull stripping, followed by segmentation using the FCM procedure. For feature extraction and selection, they employed GLCM with GRLM before classifying the images using their model. Radha et al. [4] introduced a hybrid KNN-SVM method that utilized WOA and achieved an accuracy of 98.3%. Their preprocessing steps included HE/ACWM, and they used K-Means clustering for segmentation. Their system comprised pre-processing, segmentation, feature extraction and selection, and classification, incorporating First Order and Second Order classification and GLRM and GLCM statistical features for feature extraction. Mishra et al. [8] achieved 98% accuracy using a DCNN classifier with WOA. Their method included WOA for feature optimization, DL-CNN for classification, histogram configuration, and a median filter (MF) for pre-processing. Image segmentation was performed using Otsu thresholding with morphological techniques, and WOA was used for feature selection. Abdel-Gawad et al. [6] achieved 96.5% accuracy using multilayer perceptron (MLP) neural networks (NNs) classifiers with WOA. Their method involved WAO for feature selection, MICO for pre-processing, and CNN for segmentation, and multi-layer perceptron (MLP) neural networks for categorization. Yina et al. [28] used Ensemble-Learning Classifier (ELC) and WAO techniques attained 96.4% accuracy. Their preprocessing steps included HDWT (Haar Discrete Wavelet Transformations) with Histogram-Oriented Gradient (HOG). They used WAO for the selection of key features and Ensemble Learning (EL) Classifier for tumor categorization. Gong et al. [29] achieved 88.4% accuracy using Radial Basis Function (RBF) and WAO.

The WAO feature selection algorithm, segmentation threshold, Otsu methods, median filter preprocessing, RBF network tumor detection, and feature selection are all used by Ramtekkar et al. [30]. However, Šefčík et al. [31] utilized slices are extracted from the volume as 2D images. They achieved an accuracy of 86%, a specificity of 70% and sensitivity 92. The enhancement process transformed original crisp images into interval-valued intuitionistic fuzzy images, while feature extraction was achieved through kernel principal component analysis by Lavanya et al. [32].  In comparison to the aforementioned approaches, this proposed system's accuracy for identifying brain tumors in MR images using the CNNs classifier and WAO was 98.9%. Our proposed method incorporates Gaussian filter, mean filter, and median filters, threshold with histogram algorithms for segmentation, WAO for a best feature optimization, and DCNNs for tumor diagnosis during the preprocessing of an image and achieving 99.29%. Figure 9 illustrates the comparative graphical performance comparisons accuracy, f1-score, precision, and recall compared to proposed technique with state-of-the-art procedures.

Fig. 9
figure 9

The graphical performance comparisons a accuracy, b precision, c recall, and d F1-score

5 Conclusion and future direction

This research work has proposed an accurate and novel brain tumors detection framework using the WSSOA-based meta-heuristic technique and hyperparameter-tuned Deep-CNN model. The proposed model involves several stages such as pre-processing, segmentation, feature extraction, feature optimization and brain tumor detection and classification. In the preprocessing stage, a composite filter that combines Gaussian, Mean, and Median filters are used to enhance the MRI images. Using threshold and histogram approaches, MRI image segmentation is carried out, and GLCM is used to extract image texture characteristics. WSSOA-based metaheuristic technique is designed for feature optimization. For accurate brain tumor detection and identification, a hyperparameter tuned Deep CNN model is used. Performance of the proposed model is evaluated using a benchmark Figshare dataset and compared with seven state-of-art models in terms of accuracy, precision, F1-score, and recall. The proposed model has achieved an accuracy of 99.29%. In Future work, proposed model is planned to enhance using federated learning model and explanation AI-based techniques.