1 Introduction

The Internet of things (IoT) is now commonly used in a variety of applications, and its significance in our daily lives is growing dramatically. IoT technology is also evolving in the healthcare system to provide patients with efficient services [1]. The brain tumor is one of the most challenging health care issues, and hence, it requires the use of modern technologies in the detection and classification processes. Classifying a brain tumor requires an accurate and prompt diagnosis of the tumor type because the selection of successful treatment methods depends mostly on the pathological type. However, the conventional method for the identification and classification of magnetic resonance imaging (MRI) brain tumors is through human observation that relies heavily on the expertise of radiologists who study and interpret image characteristics and usually give a non-accurate diagnosis. Computer-aided diagnostic methods are highly desirable for these issues [2].

A brain tumor is an undesirable mass of aberrant brain cells. There are two types of brain tumors: noncancerous tumors and malignant tumors [3]. Noncancerous (benign) tumors do not extend to surrounding tissue or organs and grow more slowly than malignant tumors [4]. Furthermore, cancerous tumors (malignant) are divided into two types: primary tumors that originate inside the brain and secondary tumors known as brain metastasis tumors that move from elsewhere. Accurate and timely detection of brain tumor grade has a serious influence not only on earlier stage brain tumor diagnosis but also on treatment decisions and tumor growth evaluation for the patient. The classification of the tumor is one of the more complicated jobs due to the variances in size, shape, contrast, and location of tumor cells. Tumors are classified according to their grade, which ranges from I to IV to distinguish between benign and malignant tumors. MRI, ultrasound, computed tomography (CT), X-rays, and other medical pictures play a significant part in disease diagnosis and therapy. CT and MRI are the most often utilized modalities for evaluating and diagnosing brain malignancies. MRI is considered the primary modality due to its higher level of resolution, especially in brain imaging [5].

1.1 Related work

The most important issue in brain tumor disease is the early diagnosis of the brain tumor so that adequate therapy could be implemented. The most appropriate therapy, whether radiation, surgery, or chemotherapy, can be determined based on this information. As a result, a tumor-infected patient’s odds of survival can be greatly improved if the tumor is detected appropriately in its early stages. Many researchers have discussed various methods for detecting tumor areas in MRI scans based on traditional ML and DL methods as illustrated in Table 1. Zacharaki et al. [6] suggested a system to identify different grades of glioma using support vector machines (SVMs) and K-nearest neighbors (KNN), in addition to a binary classification for high and low grades. The accuracy for multi-classification is \(85\) percent, while the accuracy for binary classification is \(88\) percent. Cheng et al. formed a method to enhance brain tumor identification performance by expanding the tumor area through picture dilatation and then separating it into subspaces [7], ultimately hitting the highest accuracy of 91.28 percent by combining ring form splitting in addition to tumor region expansion. In [8], Shree and Kumar classified brain MRIs as normal or abnormal, they used GLCM to extract features, while a probabilistic neural network (PNN) classifier was used to classify the brain MR image and achieved 95% accuracy. Deep learning techniques have grown in relevance among artificial intelligence approaches for all computing applications. Deep convolutional neural networks (DCNNs) are one of the most extensively utilized deep learning networks for any practical purpose. The accuracy is generally great, and the human feature extraction method is not required in these networks.

Table 1 State-of-the-art summary table of previous brain tumor classification techniques

However, excellent accuracy comes at a considerable computational expense. Researchers employed various CNN models such as Google Net, Inception V3, DenseNet-201, Alex Net, and ResNet-50 and obtained good accuracies.

Deep CNN architecture was developed by M. K. AbdEllah et al. to detect brain tumors in MRI images [9]. They enhanced their model by developing a new CNN architecture obtaining an accuracy of 97.79%. Deepak and Ameer [10] employed deep CNN and a pre-trained Google Net to extract features from brain MR images and classify three types of brain tumors with 98 percent accuracy. In [11], Saxena et al. utilized Inception V3, ResNet-50, and VGG-16 models with transfer learning approaches. The ResNet-50 model achieved the best accuracy rate of 95%. Hemanth et al. [12] used a modified DCNN. They made a change to the fully connected layer of the traditional DCNN. Then they determined the weights in the fully connected layer through an allocation mechanism. Researchers changed a pre-trained ResNet-50 CNN by eliminating its last 5 levels and adding new 8 layers, and this model achieved 97.2 percent accuracy [13]. Khwaldeh et al. [14] suggested a CNN model for classifying the brain MR images, as well as high-grade and low-grade glioma tumors. They adapted the Alex Net CNN model and used it as the foundation of their network design, achieving 91 percent accuracy. The authors of [15] successfully applied transfer learning for several variant architectures of CNN to the classification of MRI images with and without tumors, and an accuracy of 92%, 91%, and 88% was achieved for MobileNetV2, InceptionV3, and VGG19, respectively.

In summary, the accuracy gained by utilizing deep learning with CNN network design to classify brain MRI is substantially greater than that obtained by using old traditional techniques, as shown in the research above. Deep learning models, on the other hand, require a vast quantity of data to train to outperform typical machine learning techniques.

1.2 Motivations and contributions

Most of the researchers focused on finding solutions to detect brain tumors in medical MRI images to predict whether the medical images contain cancer or not. However, an effective system for the early detection of brain tumors has not been suggested before. Various domains exploit IoT while collecting data from modern platforms such as clinics and cities. Due to the faster growth of IoT-based medical tools, many developers focus on this application. Accordingly, the early detection of brain tumors requires establishing a system that exploits the IoT network devices to detect tumor cells. As IoT and cloud computing (CC) are interconnected with each other, this combination will be more applicable for monitoring patients residing in remote areas by providing analytical support from physicians as well as caretaking volunteers. The motivation behind the IoT-based framework was to get a fine-tuned CNN model with more information.

In this work, we present a detailed investigation of several existing approaches for brain tumor detection. Furthermore, two distinct scenarios for detecting brain cancers are suggested, whereas the first scenario relies on applying DCNN directly to the images, it is based on the presence of the patient in the same place where the data center performs a direct diagnosis of images, while the second scenario relies on an IoT-based framework that adopts a multiuser detection system based on CNN architecture for the early detection of tumors, which makes the system accessible to anyone and anywhere for accurate brain tumor categorization. First, images of the brain are collected using MRI devices. Then, it is transmitted to the cloud where these images are processed to fit the proposed CNN model. Finally, the patient can access his database to see the classification results. The second scheme helps the radiologist to achieve an efficient and fast automated brain tumor diagnosis and thus helps in reducing the time and efforts taken. The suggested CNN model is a revised version from ResNet18 CNN and is called OMRES. Moreover, a proper selection of optimizing techniques is accomplished using different learning rates and different batch sizes. Also, the impact of changing the dropout rate is tested. Lastly, substantial computer simulations are used to compare the OMRES model to various pre-trained models in terms of precision, accuracy, f1-score, sensitivity, and specificity. Based on simulation results, the RMSProp optimizer validates the best results with a dropout rate of 0.5 over the other algorithms, with the OMRES model achieving superior improvement with the highest rating accuracy of 98.67% when compared to traditional CNNs.

The primary contributions of this paper can be summarized as follows:

  • Present a detailed study on different brain tumor detection techniques.

  • Perform two different scenarios for detecting tumors; the first relies on applying deep CNN directly to brain images, while the second one relies on multiple access detection systems based on CNN architecture (IoT system).

  • Propose an effective model for detecting tumors that are based on CNN, this model is considered a modified version of ResNet18 called OMRES, in which we adjust the CNN parameters such as optimization algorithm, learning rate, and mini-batch size and study the effect of changing dropout out rate on the performance of the model.

  • Investigate the proposed model performance using extensive simulations.

  • Make a comparative study of our proposed model with some recent models in terms of techniques used and evaluation measures.

The remainder of this paper is structured as follows: Sect. 2 refers to the categorizations of different detection techniques. Section 3 explains the proposed system architecture. Section 4 investigates the proposed deep CNN methodology, and Sect. 5 presents the simulation results. Finally, in Sect. 6, conclusions and future work are presented.

2 Classification of brain tumor detection techniques

The detection system of brain tumors comprises image acquisition, preprocessing, segmentation process, feature extraction stage, classification algorithm, and finally, the performance analysis and the module testing as shown in Fig. 1. These systems can be categorized under one of the two main categories, which are traditional techniques and emerging techniques as illustrated in Fig. 2.

Fig. 1
figure 1

Brain tumor detection system

Fig. 2
figure 2

Categorization of detection techniques

The traditional techniques can be divided into image processing-based algorithms and machine-based algorithms, while the emerging techniques are categorized into deep learning-based and hybrid algorithms between the traditional and the emerging methods.

2.1 Image processing-based techniques

  1. 1.

    Region-Based Techniques In region-based techniques, similar feature regions (pixels) are grouped. Region growth is considered the most straightforward region based as introduced in [16, 17].

  2. 2.

    Thresholding-Based Techniques Using these methods, pixels are partitioned based on their intensity values based on comparing their intensity values with one or more predefined intensity value(s). Various types of thresholding methods are presented in [18, 19].

  3. 3.

    Edge-Based Techniques These strategies rely on determining the boundaries of the Region of Interest. Watershed Segmentation [20] is an example of an edge-based approach.

2.2 Machine learning-based techniques

Machine learning techniques are categorized as unsupervised (clustering) and supervised (classification). In supervised techniques, there is a relationship between the labels and the features derived from the use of the labeled information during the training. Then, unlabeled information becomes labeled information based on the estimated features during the testing process. Several studies have utilized learning for brain tumor identification such as self-organized maps (SOM) [21], fuzzy c-means (FCM) [22], K-means [23], support vector machine (SVM), and artificial neural networks (ANN) [24], which are illustrated as follows:

  1. 1.

    One of the easiest grouping techniques is the K-nearest neighbor (KNN). It is used to achieve high stability and accuracy for MR image data, but it is noted that a high execution time is needed.

  2. 2.

    The artificial neural network (ANN) creates an image by connecting a network of neurons, which are referred to as pixels. ANN views detection as an energy-minimization problem and aims to estimate not only connection but also weights between nodes during training.

  3. 3.

    Clustering is the classification of brain tissues as regions with the same label. Fuzzy c-means, self-organized map (SOM), and K-means are some well-known clustering techniques.

  4. 4.

    Support Vector Machine (SVM) is a supervised learning model that analyzes data in regression and classification analysis.

2.3 Deep learning-based techniques

DL is considered a subset of machine learning with high performance. The complicated features are extracted from the query image using this learning model. There are different deep learning techniques, namely convolutional neural networks (CNNs) [25], deep neural networks (DNN), and deep convolutional neural networks (DCNNs) [26, 27]. Recently, DL has shown significant performance in the medical image classification process by using DCNN [28]. CNNs are unusually multilayer neural networks. Its most applications are in image classification and object recognition. It includes a parameter sharing a property that reduces the parameter numbers needed for the model compared to ANN (Artificial Neural Network). There are many state-of-the-art powerful network architectures such as GoogleNet, AlexNet, Residual Network (ResNet) 50, Inception V3, and ResNet 18.

2.4 Hybrid techniques

These methods combine two or more techniques to produce better outcomes by contrasting them with those obtained by individual techniques. Three key categories for the term ‘hybrid’ about detection systems are presented, segmentation-segmentation, classification-classification, and segmentation-classification. A technique that combines wavelets separately with SVM and SOM is presented in [29] to identify brain MR images. [30] proposes a hybrid approach for classifying brain tumors as normal, benign, or malignant utilizing a genetic algorithm (GA) and SVM. Enhanced possibilistic fuzzy c-means (EPFCM) is a region-based technique for resolving initialization and bad boundary constraints [31]. FKM is combined with SOM to provide a tumor detection method [32, 33] proposed brain tumor segmentation based on morphological operations and hybrid clustering, which consists of adaptive Wiener filtering for DE noising and morphological operations for removing no cerebral tissues.

3 The proposed system architecture

This section presents two different Scenarios for the early detection of brain tumors, whereas the first scenario is based on the presence of the patient in the same place as the data center where a direct diagnosis of images is made by applying the images directly to the DCNN.

The second scenario is done by sending the brain images to the cloud where the data center is existed to detect the tumor cells, this scenario enables multiusers to make the diagnosis of their images anywhere in the same city as shown in Fig. 3.

Fig. 3
figure 3

The architecture flow for brain tumors detection

3.1 Scenario I: deep CNN architecture

Scenario I is based on deep CNN for extracting image features. First, most brain datasets contain images of varying sizes, so the image is loaded and resized to 224 × 224 pixels to ensure that all images in the dataset have the same size to be inserted into CNN. After that, the preprocessing procedure raises the picture quality of brain tumor MR images and prepares them for further analysis by clinical experts or imaging modalities. It also aids in the enhancement of MR image characteristics. Improving the signal-to-noise ratio and visual appearance of MR images, removing irrelevant noise and unwanted background portions, smoothing internal portion areas, and preserving relevant edges are among the essential parameters in the image preparation process. Then, the process of obtaining quantitative information from an image, such as color properties, texture, shape, and contrast, is known as feature extraction. Here, the deep feature extraction method is then carried out using CNNs. Finally, the classification algorithm determines whether the input image is normal or abnormal based on the final feature descriptor. The input data are converted into a 1D vector by the fully connected layer. The SoftMax layer then computes the class scores.

3.2 Scenario II: proposed IoT system architecture

Scenario II is based on an IoT system where the brain images are transmitted to the cloud to be classified as shown in Fig. 4. This architecture is considered a multiuser access system, in which multiple people can access the cloud at the same time. For all users, there is only one common receiver. For the categorization of brain tumors, an IoT system with cloud management was developed. The cloud is the greatest answer for a medical system that allows doctors to access data more readily because it is a distributed environment [34]. Our proposed IoT framework aims to reduce mortality rates through early detection of tumor cancers and consists of four main phases: (1) data collection, (2) image processing and classification, (3) Diagnosis, and (4) user interface.

Fig. 4
figure 4

Proposed IoT system architecture

The proposed IoT system is an integrated system that starts by collecting brain images that are done at the phase of data collection using MRI devices. Then, these images are transmitted via the WIFI module to the cloud where the preprocessing and classification phase is in which the MRI images are processed and scaled to fit the proposed CNN model (OMRES) that extracts features from the processed images and uses a SoftMax classifier to detect brain cancers. In the analytics phase, the patient can access his database to determine the classification results. A radiologist can detect a tumor type (if there is one) simply by uploading an MRI and obtaining classification findings in a matter of seconds. In the final phase, the report is forwarded to the patient’s doctor, who will decide on the best course of action.

For each user, the system consists of the transmitter and the receiver part. The transmitter is responsible for preparing the scanned image of the patient to be transmitted over the could, while the receiver is responsible for decoding the received image and extracting its features for early detection of brain tumors.

At the transmitter, the patient’s brain image is firstly scanned using a magnetic field and computer-generated radio waves to create high-quality images. Then, it is converted into binary data for transmission. After that, the binary data vector is created by adding the patient Identifier (ID) as a header. After that, the data frame is encoded to be transmitted using convolutional codes with a code rate \(r\) of \(2/3\). The code rate r can be defined as follows [35]:

$$r = {\raise0.7ex\hbox{$k$} \!\mathord{\left/ {\vphantom {k n}}\right.\kern-\nulldelimiterspace} \!\lower0.7ex\hbox{$n$}}$$
(1)

where \(k\) is the number of the parallel input bits and \(n\) is the number of the parallel output encoded bits at a one-time interval. The data flow of the transmitter part is shown in Fig. 5.

Fig. 5
figure 5

Proposed system data flow

At the receiver, there are two modes which are the “Registration mode” and the “Operation mode” as shown in Fig. 6.

Fig. 6
figure 6

Receiving mode flowchart

Registration Mode The registration mode is used once for any new user. As the patient is firstly registered, so that he/she can easily access his/her account in the system using his/her ID number.

Operation Mode In this mode, the authentication process is first applied to identify the registered user. After that, image preparation is performed to prepare the image for the next stages. The Weiner filter is used to reduce noise. The data are then scaled to fit the suggested CNN model. Following that, the suggested CNN model extracts feature from the processed images, and the SoftMax classifier is used to detect brain cancers. Finally, the patient can use his or her database to identify the classification results.

4 The proposed CNN model approach

4.1 Residual network (ResNet18)

He et al. have developed a deep resident network (ResNet) model, based on deep architectures that demonstrate good affinity and accuracy. ResNet was designed by several of the remaining stacked units and has been formed with different layers numbers: 18, 34, 50, 101, 152, and 1202. Though the number of operations can vary based on the various architectures, ResNet 18 is a good compensation between performance and depth. Table 2 demonstrates the architecture of Resent 18.

Table 2 ResNet 18 architecture

4.2 The OMRES model architecture

The suggested model is considered a modified version of ResNet18 architecture and is called OMRES. The OMRES network architecture consists of a preparation module, six blocks of Module A, three blocks of Module B, and an output module distributed as shown in Fig. 7.

Fig. 7
figure 7

Schematic representation of proposed architecture

The preparation module is made up of a convolutional layer, a batch normalization layer, a ReLU activation layer, and a max-pooling layer with a size of 3 × 3 and a stride of 2. Module A is made up of a convolutional layer, a batch normalization layer, and a ReLU activation layer. Then, the output of the ReLU is entered into another convolutional layer and finally added with the previous max-pooling through an additional layer. Module B is recommended to improve network accuracy and prevent over-fitting. In this module, the Dropout layer [36] is added to produce a more generalized output with an increased regularization. This layer is used to substitute the batch normalization and to perform better in generalization. Additionally, a convolutional process is added followed by a ReLU activation layer and a batch normalization layer.

The proposed network architecture consists of a preparation module, six blocks of Module A, three blocks of Module B, and an output module distributed as shown in Fig. 7. Finally, the additional layer is used to merge the two outputs. The classification block is made up of two layers: a fully connected (FC) layer and a SoftMax layer. The whole network architecture consists of 82 layers. Table 3 shows the configuration in detail of the proposed architecture.

Table 3 Proposed CNN architecture

4.3 Performance metrics

The system performance is determined using accuracy, confusion matrix, recall, specificity, precision, F1-score, and ROC curve. A Confusion matrix is used to determine the accuracy and correctness of the model. The accuracy measures the percentage of the correctly classified samples as

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

where \({\text{TP }}\) represents the real positive in the case of malignancy and \({\text{TN}}\) represents the real negative in benign tumor cases, while \({\text{FP}}\) and \({\text{FN }}\) represent the inaccurate model predictions. The precision assesses the predictive power of the algorithm, and it shows how “accurate” the model is. It is expressed as

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

The effectiveness of the algorithm can be evaluated using sensitivity (recall) and specificity in one class as demonstrated below

$${\text{Sensitivity }} = \frac{{{\text{TP}}}}{{{\text{TP}} + {\text{FN}}}}$$
(4)
$${\text{Specificity}} = \frac{{{\text{TN}}}}{{{\text{TN}} + {\text{FP}}}}$$
(5)

F1-score is focused on the analysis of the positive classes. It can be calculated as the harmonic average of recall and precision as

$${\text{F}}1\;{\text{Score}} = 2 \times \frac{{{\text{Precision }} \times {\text{Recall}}}}{{{\text{Precision}} + {\text{Recall}}}}$$
(6)

The Receiver Operating Characteristic Curve (ROC) is the true positive rate versus the false positive rate for different breakpoints. The area under the curve (AUC) measures the classifier’s ability to distinguish between classes. For optimum performance, different dropout rates and different optimizers are applied where these optimizers are algorithms that are used to update network parameters and minimize loss function by taking incremental steps in the negative gradient direction (convergence) [37].

For the suggested model, four main optimizers will be tested:

  • Stochastic Gradient Descent with Momentum (SGDM)

    It is one of the most widely used optimizers where the SGD optimizer has been improved. The momentum in each dimension is estimated using the current gradient and previous momentum. It also adds up the gradient of previous steps to determine which way to travel.

  • Adaptive Moment (ADAM)

It is a Stochastic Optimization Method where momentum and RMSprop are combined in ADAM. Exponential weighted moving averages (also called leak averages) are a fundamental component of ADAM, as they estimate both the gradient’s momentum and second-order moment.

  • Root-Mean-Square Propagation (RMSProp)

    The RMSprop is another optimizer that uses the average exponential decay of squared gradients to break the learning rate. To decrease the loss function relatively faster, it is dependent on momentum. The RMSprop, like momentum, uses a different way to reduce oscillations. It adjusts the learning rate automatically by selecting a new one for each parameter. The mean square error is used to determine the running average.

  • Adaptive Scheduling of Stochastic Gradients (ADAS)

ADAS is an adaptive optimization method for scheduling a CNN network’s learning rate during training. ADAS is substantially faster than other optimization techniques at achieving convergence. ADAS showed generalization features (low test loss) comparable to SGD-based optimizers, outperforming adaptive optimizers’ poor generalization characteristics. ADAS adds new polling metrics for CNN layer removal in addition to optimization (quality metrics).

5 Result discussions and analysis

This study experimented with an MRI image dataset which can be found at [38]. The dataset consists of \(253\) images in two categories, normal and abnormal. First, the input images are resized to \(224\times 224\). After that, they are converted to a grayscale image in the preprocessing stage. Then, these images are randomly divided into \(70\mathrm{\%}\) for training and \(30\mathrm{\%}\) for testing. Some samples of brain images are given in Fig. 8.

Fig. 8
figure 8

Dataset samples

5.1 Results of scenario I

As discussed before, the performance of the system is measured in terms of precision, recall, accuracy, and F1-score a. To achieve the optimum performance of the system, two main hyperparameters will be modified, firstly different optimizers will be tested with different learning rates, different batch sizes, and a fixed number of periods. Secondly, the effect of changing dropout rates will be studied.

5.1.1 Optimization algorithms

The impact of utilizing several optimizers will be investigated (ADAM, RMSProp, ADAS, or SGDM) with Mini- Batch sizes \((32\mathrm{ or }64)\), learning rate (LR) (\(0.001\mathrm{ or }0.0001\)), and a maximum number of epochs \(32.\) as illustrated in Table 4.

Table 4 Performance of the OMRES Model for 32 Epochs

As illustrated in Fig. 9, better performance results will be obtained by tuning the hyper-parameters using the RMSProp algorithm for optimization learning rate = \(0.0001\), minibatch size = \(64\), and a number of epochs = \(32)\).

Fig. 9
figure 9

Performance of the OMRES model using different optimizers

5.1.2 The impact of changing dropout rate

The performance of the OMRES model is tested using different dropout rates. As it can be seen in Fig. 10, for a dropout rate of 0.5, the suggested model performs the best. The rest of the experiments are done using a dropout of rate 0.5.

Fig. 10
figure 10

Performance of the OMRES model with changing the dropout rate

5.2 Results of scenario II

  • The transmitter part

First, the MRI image is converted into a binary image as shown in Fig. 11. Then, the binary vector is formatted as a frame including the patient’s ID.

  • The receiver part

Fig.11
figure 11

Image to binary transformation

The received signal is demodulated and decoded where the demodulation quality is defined by the bit error rate (BER), which can be expressed as follows for \(16{\text{ QAM}}\) [39].

$${\text{BER}}_{{16{\text{QAM}}}} { } = { }\frac{\sqrt M - 1}{{\sqrt M \log_{2} \sqrt M }}{\text{ erfc}}\sqrt {\frac{{3\log_{2} M}}{{2\left( {M - 1} \right)}}} \frac{{E_{b} }}{{N_{0} }}{ }$$
(7)

where erfc is the complementary error function, M is the modulation size (\(M = 16 {\text{for}} 16{\text{QAM}}\)) and \(\frac{{E_{b} }}{{N_{0} }}\) is the ratio of power spectral density per bit to noise power. The bit error rate versus \(\frac{{E_{b} }}{{N_{0} }}{ }\) when using a 16-QAM modulation and a rate \(2/3\) convolutional code is shown in Fig. 12.

Fig. 12
figure 12

Bit error rate versus \(\frac{{E_{b} }}{{N_{0} }}{ }\) curve

Figure 13 shows the accuracy progress during the training phase of the two suggested scenarios for the proposed and the Resnet18 networks. It is clear that; the accuracy of the first scenario for the proposed model is higher than the accuracy of the other ones because the first scenario relies on detecting tumors by applying the brain images directly to the CNN model. Where scenario I of the proposed model achieved the best overall accuracy of 98.67%, on the other hand, the proposed model second scenario reaches 95.53% after 100 iterations, while scenario I of ResNet 18 has an accuracy of 96.3% and scenario II of ResNet 18 reaches 94.1%.

Fig. 13
figure 13

Results over the whole training iterations of the study: accuracy curve

Furthermore, the first scenario of the OMRES model presents the lowest loss value compared with the others, according to the validation accuracy, the OMRES network achieves the best accuracy of 98.67% and the minimum loss down to 0 as shown in Fig. 14.

Fig. 14
figure 14

Results over the whole training iterations of the study: loss curve

Figure 15 presents the confusion matrices for the ResNet l8, whereas Fig. 16 illustrates the confusion matrix of Scenario I of the OMRES model. The matrix column represents the expected class, while the row presents the true class, and the diagonal of this matrix includes the correctly classified case by the networks. As analyzed, the probability that the normal class is correctly identified as normal is 37.3%, while the probability of an abnormal class being correctly identified as a is 58.7%. Furthermore, the probability of the normal class being incorrectly identified as abnormal is 2.7% and the probability of an abnormal class being incorrectly identified as normal is 1.3%.

Fig. 15
figure 15

Scenario I for Resnet18 confusion matrix

Fig. 16
figure 16

Scenario I for OMRES model confusion matrix

Similarly, for Scenario I for the OMRES model, the probability of the normal class being correctly identified as normal is 38.7%, while the probability that an abnormal class is correctly identified as abnormal is 60%. Besides, the probability that the normal class is incorrectly identified as abnormal is 1.3% and the probability that an abnormal class is incorrectly identified as normal is 0% which means that scenario I for the proposed model is more efficient in predicting abnormal tumors.

Finally, the OMRES model second scenario is shown in Fig. 17, the probability of the normal class being correctly identified as normal is 27.3%, while the probability that an abnormal class is correctly identified as abnormal is 68.2%. Furthermore, the probability of the normal class being incorrectly identified as abnormal is 4.5% and the probability of an abnormal class being incorrectly identified as normal is 0%.

Fig. 17
figure 17

Scenario II for OMRES model confusion matrix

The ROC curves for both networks are shown in Fig. 18, where the first scenario of the proposed model yields an AUC of 99.48%. Meanwhile, the Resnet18 shows an AUC value of 97.40% but the second scenario had an AUC of 97.1% for the OMRES model, and 94.53% for ResNet18.

Fig. 18
figure 18

Receiving operating characteristic (ROC) Curves

The most significant distinctions between Scenario I and Scenario II are illustrated in Table 5.

Table 5 The main differences between Scenario I and Scenario II

The OMRRES model is compared with other pre-trained models in terms of performance metrics where the summary of the performance metrics is displayed in Fig. 19.

Fig. 19
figure 19

Graphical comparison between OMRES model and pre-trained models (First Scenario)

It is shown that the OMRES scheme is the best one for correct recognition of the tumor cases with accuracy of 98.67%, Recall of 94.66%, Specificity of 100%, and F1-Score 98.3%. Moreover, the ResNet18 has performance of accuracy 96%, Recall 93.23%, Specificity 97.57%, Precision 96.42%, F1-Score 95.51%. Furthermore, the SqueezeNet has the advantage of the proposed that it has the highest Recall value 98.53% but minimum performance in the other parameters (accuracy 94.63%, Specificity 93.75%, Precision 95.17%, F1-Score 93.81%), while AlexNet and VGG16 have the worst performance in all parameters.

5.3 Comparison of results

The performance of the OMRES model in our study will be compared with the most recently published studies that have applied different machine learning and deep learning architectures for brain tumor classification as shown in Table 6. Based on this table, it is easy to see that the proposed model (Scenario I) gave better results in both accuracy and F1-score than other studies with the same subjects. This value showed how the optimized model was efficient at classifying MRI brain images. Although using the same variants of the DCNNs family, the RMSProp optimization function helped to significantly improve the performance of the OMRES system compared to those other systems.

Table 6 Different studies on brain tumor detection techniques

5.4 Discussions

This paper focuses on proposing an IoT-based framework for early diagnosis of tumors for helping patients in residing areas, as well as studying the benefits of using different optimization algorithms to build an efficient CNN model based on the modification of the ResNet 18 model called OMRES and thus enable us to classify brain tumors from MRI images. The test results show that the proposed model is very effective and useful in detecting brain tumors.

Training a fine-tuned CNN with a small dataset is challenging as it may take time to achieve acceptable results. Another essential portion is the ability of the system (Scenario II) to be accessible to anyone and anywhere. In this way, our IoT system can help the radiologist achieve an effective and rapid automated brain tumor diagnosis thus helping to reduce time and efforts taken. So according to the author’s opinion, the proposed framework is very simple and can be useful for real-time diagnosis applications in the future. Therefore, the proposed approach could play a pivotal role in assisting clinicals and radiologists in the early diagnosis of brain tumors. Some improvements can be added to our suggested model as it is based only on tumor detection (tumor or no tumor) and does not detect tumor type or tumor stage. In addition, empirical analysis can be performed on other datasets to study the effectiveness of the OMRES model. Also, adding a multi-channel classifier can improve classification performance more effectively than before.

6 Conclusions and future work

This paper introduced a different study for various brain tumors detection techniques. A deep learning model based on CNN has been accomplished in two different scenarios to detect tumors. This model can be considered a modified version of the ResNet18 network and is called OMRES. Additionally, the first scenario is done by applying the brain image directly to the suggested model. The second scenario presents an IoT-based framework that relies on a multiuser detection system by sending images to the cloud for the early detection of brain tumors. This makes the system accessible to anyone, anywhere for accurate classification of brain tumors. Furthermore, three optimization algorithms have been discussed. Additionally, the proposed model is compared with other pre-trained models in terms of F1-score, precision, recall, specificity, confusion matrix, accuracy, and ROC curve. From simulation results, it is obvious that the RMSProp algorithm with a dropout rate of 0.5 verifies the best results over the other algorithms. In comparison with conventional CNNs, the proposed model (In the first Scenario) offered superior performance by attaining a maximum sensitivity of 100% and accuracy of 98.67%, while the proposed model (In the second Scenario) provided an accuracy of 95.53% and sensitivity of 94.2%. Accordingly, the accuracy attained by the second scenario is a relatively acceptable if we consider the ability of the system to be accessible to anyone, anywhere. Generally, these values clearly portrayed the effectiveness of our proposed model in the detection and classification of MRI brain images.

In future work, we will focus on multi-class categorization for brain cancers. Furthermore, Multistage DL models for feature extraction will also be examined to improve classification performance on huge medical datasets. A single image super-resolution stage can also be tested to improve classification performance.