Skip to main content
Scientific Reports logoLink to Scientific Reports
. 2025 Jul 1;15:21801. doi: 10.1038/s41598-025-06975-x

Environmental risk assessment based on multiscale spatial recurrent neural network algorithm for IoT agriculture area

M Sofiya 1,✉, M Arulmozhi 1
PMCID: PMC12216639  PMID: 40596242

Abstract

In recent years, smart agricultural environments have gained attention for enhancing farming efficiency and productivity. These systems use smart sensors integrated with Internet of Things (IoT) devices to collect data such as temperature, soil moisture, and humidity, helping to improve yield and optimize water usage. However, high data traffic during IoT-based data collection often delays access to vital information. A key challenge is identifying and eliminating redundant traffic. Existing methods fail to analyze the marginal rate of traffic features, leading to reduced performance. This research proposes a Multiscale Spatial Recurrent Neural Network (MSRNNet) to classify IoT traffic and enhance smart agriculture systems. After data collection, Box-Plot Normalization (BPN) is applied for preprocessing. The Exhaustive Traffic Information Rate (ETIR) method evaluates the marginal rate of each feature, and the AntLion Behavior Optimization (ALBO) algorithm selects the most significant features, reducing dimensionality. The optimized dataset is then classified using the MSRNNet. Simulations using Python 3.9 and the Anaconda toolkit show the proposed model achieves 97.08% accuracy, 96.05% precision, 94.25% recall, and a 95.71% F1-score, with a low misclassification rate of 1.25% and a time complexity of 85.49 ms, demonstrating its effectiveness and reliability.

Keywords: Internet of things, Traffic, AntLion behavior optimization, Smart agriculture, Dimensionality, Exhaustive traffic information rate, Box-plot normalization, MSRNNet

Subject terms: Electrical and electronic engineering, Computer science, Information technology

Introduction

The IoT is a growing technology for efficiency, productivity, and everyday life1. Agriculture is a critical sector worldwide, and food consumption will inevitably increase as the population grows2. Smart agriculture uses IoT-based sensors to improve harvest and decrease waste through deployment of real-time field data gathering technologies3. Smart agriculture encompasses a wide range of IoT applications, such as precision farming, which improves both the quality and quantity of agricultural production. The concept of connected farms enabled by IoT presents promising solutions to longstanding agricultural challenges.

However, the global agricultural sector is highly vulnerable to climate variability due to its dependence on rainfall. Furthermore, agriculture faces systemic challenges such as limited access to modern technology, lack of adequate infrastructure, fragmented land allocation, low productivity, and market access issues. Similarly, frequent droughts, landslides, and water shortages create challenges impacting productivity and sustainability. Climate modification is a serious challenge that significantly affects weather patterns, increases extreme measures, and changes temperatures. Consuming natural resources, such as water scarcity and soil degradation, exacerbates farmer’s difficulties. Market access challenges hinder farmers, especially smallholders, from effectively achieving consumers and obtaining fair costs for their produce. Agriculture is vulnerable to external forces, with low productivity due to low levels of technology and lack of market orientation. However, providing knowledge regarding sustainable practices in modern agricultural technologies is essential as they limit farmer’s productivity gains and income options.

This paper’s contribution is to implement an MSRNNet classifier to classify the traffic in the dataset. The approach begins by cleaning the dataset using Box-Plot Normalization (BPN) to remove null values. Next, we use the Exhaustive Traffic Information Rate (ETIR) method to evaluate the marginal impact of each feature. The AntLion Behavior Optimization (ALBO) algorithm is then employed to select the most significant features. Finally, the proposed MSRNNet classifier categorizes traffic patterns, improving the efficiency and reliability of IoT-based smart agriculture systems.

Figure 1 describes the block diagram of the IoT environment in agriculture. Data integrity is a critical issue in the agricultural sector as farmers face significant challenges in traffic prediction. Despite the success of existing methods in traffic forecasting, problems remain, such as the inappropriate use of temporal and spatial traffic information and indirect modeling of traffic data dependencies. Machine Learning (ML) is utilized to detect traffic in an agricultural environment. The existing methods concentrates on traffic prediction of IoT devices4,5. However, the existing techniques have failed to predict traffic accurately and enhance the agricultural environment. To solve the above problems, this research introduces the MSRNNet method for IoT traffic prediction in agriculture.

Fig. 1.

Fig. 1

Block diagram of IoT environment in agriculture.

Literature survey

Several studies have explored IoT-based solutions to enhance precision agriculture (PA). For instance6,7 reviewed PA as a management strategy that integrates information and communication technologies to address challenges such as soil degradation, climate variability, and rising input costs.

Reference8 proposed the integration of IoT and artificial intelligence (AI) for food processing, highlighting future trends and addressing earlier limitations. Reference9 developed traffic flow prediction models using the Improved Gated Recurrent Unit Neural Network (IGRUNN) and Long Short-Term Memory Gated Multi-Perceptron Neural Network (LSTMG-MPNN). However, transmitting data through multiple network layers often incurs high energy consumption, posing significant strain on communication infrastructure3.

To address traffic prediction challenges10, introduced the Asynchronous Dilation Graph Convolutional Network (ADGCN), while the Gated Recursive Deep Neural Network (GRDNN) was designed to identify traffic flow. However, both models exhibited limitations in practical applications. Similarly11, developed Bayesian Neural Network (BNN) and GRU models for traffic flow prediction.

Reference12 emphasized the importance of sowing crops in appropriate seasons to enhance yields and utilized ensemble machine learning techniques in IoT-enabled environments. Their approach also included a two-step Support Vector Machine (SVM) prediction model for classifying crop types.

Reference13 demonstrated how information retrieval in agricultural data transmission strategies can be done in unforeseen circumstances. This approach allows the recovery of information lost due to intentional and network loss of both nodes, thereby significantly enhancing the precision of the farmer’s transmission system. Reference14 proposed a Differential Evolution (DE), including a rapid transformation GRDNN method using an optimization-based design. Reference15 focused on recent IoT and AI technology trends for smart farming. In addition, another author16, concentrated on smart greenhouses and control for sustainable agriculture. It also discussed greenhouse farming security and issues.

Reference17 presented machine learning-based anomaly detection using Multilayer Perceptron (MLP), SVM, and Naïve Bayes (NB), applying their approach to datasets like Dry Beans and Soil Type. Reference18 introduced the Low Energy Adaptive Clustering Hierarchy (LEACH) protocol to optimize node energy usage, while the DV-HOP algorithm was used to enhance network accuracy. Reference19 proposed the AgriSegNet method for anomaly detection and traffic identification in IoT-assisted precision agriculture. Table 1 describes the existing method’s contribution. Table 2 summarizes the various traditional approaches to IoT-based agriculture, highlighting their methodologies, datasets, key features, and limitations. Many prior works struggle with issues such as high false classification rates, inadequate feature margin analysis, and increased processing time for traffic prediction.

Table 1.

Overview of existing methods.

Reference [Citation] Year Classifiers Contributions
Vakili, A21 2024 Grey wolf optimization (GWO) Develop services with the MapReduce framework
D. Javeed 22 2024 Truncated backpropagation through time (TBPTT) method It manages the high amount of data for IDS detection in agriculture
X. Xu23 2024 AHC-ShuffleNetV2 It aims at irrigation level prediction
R. Y. Aburasain24 2024 EBWO-HDLID IoT-based smart farming and IDS detection
K. A. Jani25 2022 SMART IoT Least farmers intervention
Heidari, A26 2024 Reliable spanning tree (RST) This technique measures tree fitness based on the device’s hop counts, residual energy, and mobility probabilities
Kouros Zanbouri27 2024 Glowworm swarm optimization (GSO) algorithm GSO algorithm improves resource allocation and decision-making
A. Heidari28 2023 Convolutional neural network (CNN) Provides an optimal offloading strategy
Indirani, M29 2024 Ensemble learning with optimized pruning model (EnsLOP) Forecasting the climate changes
Ghislain, N.W30 2024 Spatio-temporal behaviour (STB) with regional concentration pathways (RCP) Finds the future rainfall trends

Table 2.

Complexity analysis of traditional approaches.

Author [Citation] Dataset used Methodology Features Issues
Abunadi I et al.31 Agriculture dataset Traffic-aware secured cooperative framework Avoid inefficient usage of communication bandwidth. Enhance the security Increased complexity
Omar Bin Samin et al.32 Edge-I IoT set cybersecurity Naïve bayes (NB) and decision tree (DT) It effectively finds the traffic Unable to consider the feature’s margin
Kethineni et al.33 ToN-IoT and APA-DDoS attack CNN with bi-directional-gate recurrent unit (Bi-GRU) Identify and categorize the DDoS attack It needs huge amount of time for traffic identification
Raghuvanshi, A et al.34 NSL KDD SVM, linear regression, and RF Low cost High false classification
El-Ghamry et al.35 NSL KDD Optimized CNN Gets effective results in the agricultural environment It predicts traffic with less accuracy
Kethineni K et al.36 IoT-Botnet and ToN-IoT Privacy-encoding-based enhanced deep learning framework (PEBEDL) Intrusion identification Unable to locate the intruder

The LEACH algorithm evaluates the proposed algorithm based on the remaining energy and active nodes. The simulation results show that the proposed algorithm utilizes less energy for communication with remote sensory equipment for intelligent agriculture20.

Table 2 presents the complexity of various traditional methods. High rates of innovation categorize the telecoms industry in a rapidly changing technological environment37. The changes results in increasing energy and operational costs, moreover the exploitation of technological advancements for sustainability and their business and environmental benefits also occur. After classifying, the data is given to Enhanced Identity-Based Encryption (EIBE), optimized using Wild Horse Optimizer (WHO) for transmitting the data more safely38. The proposed algorithm was compared with other algorithms, such as ant colony and invasive weed optimization, for performance evaluation39. The results reveal that the proposed algorithm converges more with the neural network coefficient than existing algorithms. While recent models show promise, limitations remain in handling redundant traffic, energy consumption, and real-time adaptability. These gaps underline the need for an efficient and accurate model like MSRNNet, which addresses the challenges of data traffic classification in agricultural IoT environments through advanced feature selection and deep learning techniques.

Proposed methodology

This section details the proposed methodology for IoT traffic prediction using the Multiscale Spatial Recurrent Neural Network (MSRNNet). The proposed system contains four stages there are (i) data pre-processing, (ii) marginal rate estimation, (iii) feature selection, and (iv) classification. Figure 2 illustrates the overall architecture of the proposed approach.

Fig. 2.

Fig. 2

Proposed architecture diagram.

Accumulating data from different IoT-based sensors is the first step. The data acquired from the sensors is processed using the BPN method before being fed for the margin rate analysis. After pre-processing, the ETIR method estimates the marginal rate of each feature. Then, ALBO method is utilized for feature selection, and finally the classifier is used to classify the IoT traffic. The succeeding subsections are briefly described.

Dataset description

The dataset used for this study comprises IoT traffic data collected from a precision agriculture environment. It includes various labels such as email, remote access protocols, storage, communication, scheduling, and web access services. This dataset also contains examples of attacks, including Denial of Service (DoS), Probe, User-to-Root (U2R), and Root-to-Local (R2L).

In total, 125,973 records were used for training, and 22,544 for testing.

As indicated in Table 3, the precision agriculture IoT datasets used to develop predictive models offer valuable insights into network traffic and potential attacks. The dataset includes 85 features such as Fwd IAT min, Fwd IAT max, Flow packets/s, Flow bytes/s, Bwd packet length, and its standard deviation. These features represent traffic behavior and are used to identify and predict malicious or redundant patterns in IoT-based agriculture systems. To create accurate models, it is crucial to preprocess the data to ensure its quality and relevance for analysis.

Table 3.

Collective precision agriculture IOT dataset.

Flow ID Src IP Src Port Dst IP Dst Port Protocol Timestamp Flow duration
10.152.152.11-216.58.220.99-57158-443-6 10.152.152.11 57158 216.58.220.99 443 6 24-07-15 16:09 229
10.152.152.11-216.58.220.99-57159-443-6 10.152.152.11 57159 216.58.220.99 443 6 24-07-15 16:09 407
10.152.152.11-216.58.220.99-57160-443-6 10.152.152.11 57160 216.58.220.99 443 6 24-07-15 16:09 431
10.152.152.11-74.125.136.120-49134-443-6 10.152.152.11 49134 74.125.136.120 443 6 24-07-15 16:09 359
10.152.152.11-173.194.65.127-34697-19305-6 10.152.152.11 34697 173.194.65.127 19305 6 24-07-15 16:09 10778451
10.152.152.11-173.194.65.127-54570-443-6 10.152.152.11 54570 173.194.65.127 443 6 24-07-15 16:10 421362
173.194.33.97-10.152.152.11-443-56254-6 173.194.33.97 443 10.152.152.11 56254 6 24-07-15 16:09 1.2E + 08
10.152.152.11-216.58.216.142-57361-443-6 10.152.152.11 57361 216.58.216.142 443 6 24-07-15 16:09 1.17E + 08
74.125.28.189-10.152.152.11-443-44097-6 74.125.28.189 443 10.152.152.11 44097 6 24-07-15 16:09 1E + 08

As shown in Table 4, the precision agriculture IoT dataset can provide significant network traffic analysis based on the attacks.

Table 4.

Attack types found in the precision agriculture IOT dataset.

IDS IDS types
Probe Mscan, Nmap
R2La Sendmail, Xlock
DoS Worm, Smurf, Pod
U2R Xterm, Rootkit

Box-plot normalization (BPN)

The BPN method is a statistical graph that represents a dataset’s distribution in terms of the median, interquartile range (IQR), and range. It can be used to detect potential outliers within the dataset. Null values are removed from the dataset using IoT agricultural traffic features as part of the data pre-processing step. Additionally, by analyzing attributes such as Fwd IAT Min, Fwd IAT Max, Flow Packets, Flow Bytes, Bwd Packet Length, and Bwd Packet Length Std, the dataset is pre-processed to normalize the data and ensure its quality and relevance. Furthermore, the data is pre-processed by identifying dimensions or features that correlate with outliers using the BPN algorithm and applying it to each source individually. The data is also normalized by removing null values to ensure its quality and relevance for generating accurate measurements. Figure 3. shows the BPN process.

Fig. 3.

Fig. 3

Box-plot normalization process.

The box represents the median Inline graphic 50% of the data, with the lower or first quartile Inline graphic) denoting the 25th percentile and the most elevated or third quartile Inline graphic denoting the 75th percentile. The line in the box shows the median of the data. The IQR contrasts between Inline graphic and Inline graphic. Two whiskers extend from the box; this first line goes from the smallest value to the lower quarter, and the second line goes from the upper quarter to the most significant value.

Algorithm 1 describes the BPN method used to normalize the collective dataset by handling outliers and scaling feature values based on statistical distribution, thereby preparing the data for effective feature evaluation and classification. Here, Inline graphic lies the total records.

Algorithm 1.

Algorithm 1

Box-plot normalization (BPN) for IoT traffic data preprocessing.

Exhaustive traffic information rate (ETIR)

After preprocessing, this section applies the ETIR model to identify the marginal rate of each feature. Each feature is assigned a weight value corresponding to each log attribute, and the attribute with the highest weight is identified from the processed dataset. Features with low weights (below a defined threshold) are considered unimportant and are excluded. The marginal rate is determined using the ETIR model, which estimates the marginal ratio for each feature. Furthermore, the ETIR algorithm analyzes the weight of each feature vector and identifies positive feature flow weights based on their respective flow values. Traffic and non-traffic edge features are distinguished by evaluating the marginal rate of each feature.

graphic file with name 41598_2025_6975_Article_Equ1.gif 1

The above Eq. 1 is used to find the positive traffic weight based on feature traffic weight Inline graphic.

graphic file with name 41598_2025_6975_Article_Equ2.gif 2

The above Eq. 2 is used to find negative traffic weight based on feature weight Inline graphic.

graphic file with name 41598_2025_6975_Article_Equ3.gif 3

Equation 3 is employed to analyze each feature vector weight.

graphic file with name 41598_2025_6975_Article_Equ4.gif 4
graphic file with name 41598_2025_6975_Article_Equ5.gif 5

The above two equations, 4 and 5, are used to find the traffic, and non-traffic marginal features are identified.

AntLion behavior optimization (ALBO)

The ALBO algorithm is employed to select the most relevant features from the dataset. Inspired by the hunting behavior of antlions, this bio-inspired optimization technique simulates random walks, prey capture, and fitness-based selection to identify optimal features.

The steps include:

  1. Initializing populations of ants and antlions.

  2. Simulating random movements and prey trapping behaviors.

  3. Evaluating fitness scores for each feature subset.

  4. Retaining features with fitness above a set threshold.

The algorithm iteratively updates positions and evaluates feature combinations based on their contribution to traffic prediction. This dynamic selection process significantly reduces computational complexity while maintaining model performance.

Figure 4 shows the block diagram representation of ALBO algorithm. Antlion larvae move in circular orbits, excavating conical holes in the sand and spitting out the sand. Once the trap is dug, the antlion hides at the base of the cone, waiting for insects (preferably ants) to fall into the hole. When the antlion detects prey in the trap, it attempts to catch it. However, the prey is often not immediately caught and tries to escape. In response, the antlion cleverly throws sand toward the edge of the hole, causing the prey to slide back down. Once the prey is caught in its jaws, it is pulled underground and consumed. After feeding, the antlion discards the remains and repairs the trap in preparation for the next catch. The ALBO method (e.g., correlation, mutual information) is used to pre-select a subset of promising features. It initializes the population based on domain knowledge or feature importance scores, allowing the search to begin in promising regions of the search space and reducing exploration time. This approach narrows the search space and accelerates convergence.

Fig. 4.

Fig. 4

Block diagram representation of ALBO method.

This method begins with import populations of ants Inline graphic and antlions Inline graphic in dimension Inline graphic and the highest number of iterations Inline graphic. Thus, the location of every Inline graphic and Inline graphic is represented in matrix format, as shown in the equation below.

graphic file with name 41598_2025_6975_Article_Equ6.gif 6
graphic file with name 41598_2025_6975_Article_Equ7.gif 7

Here, Inline graphic, Inline graphic are the locations of ants and antlions respectively, Inline graphic lies the number of ants.

graphic file with name 41598_2025_6975_Article_Equ8.gif 8

Herein, Inline graphic Inline graphic are the minimum and maximum values of random walk of the Inline graphic features. Inline graphic, Inline graphic are the maximum and minimum values of the Inline graphic features at Inline graphic current iteration respectively. We use the above equation to update each ant’s location and let the ants walk randomly within the search area.

graphic file with name 41598_2025_6975_Article_Equ9.gif 9
graphic file with name 41598_2025_6975_Article_Equ10.gif 10

The gliding ant becomes trapped in the antlion’s hole selected by simulating prey sliding toward the chosen antlion. The above equations mathematically illustrate this assumption. Herein,Inline graphic, Inline graphic are features and lowest feature respectively.

Algorithm 2.

Algorithm 2

AntLion behavior optimization (ALBO) for feature selection.

The proposed ALBO method feature selection is described in algorithm 2. In the final stage of predation, antlions hunt ants. To mimic this process, it is hypothesized that ants would capture prey with more incredible energy (entering the sand) than their antlion counterparts. A fixed threshold of 0.7 determines whether a feature should be selected in the evaluation phase. Thus, the antlion state refers to a set of selected features where the dimension is minimized, and the feature is chosen for classification.

Multiscale spatial recurrent neural network (MSRNNet)

This step categorizes traffic and improves the smart agriculture environment after feature selection. The MSRNNet approach determines the highest traffic in an agricultural environment. The proposed MSRNNet technique optimizes and classifies smart agricultural environments based on IoT traffic datasets. Similarly, IoT traffic data are essential for agricultural systems, evaluating input, hidden, and output states to characterize traffic features. A multi-scale enables more suitable selected features by combining low and high-level representations. The smart agriculture environment was studied by analyzing IoT traffic associated with agricultural datasets. These datasets cover critical environmental factors determining soil moisture, such as temperature, relative humidity, precipitation, and wind conditions. The traffic data contains time series logs to provide multiscale feature labels while increasing the number of spatial feature limits that need recurrent classifier units. MSRNNet takes multi-feature labels to reduce the non-relational spatial dimensions to predict accurately. In addition, this method includes the input, hidden, and output states, as depicted in Fig. 5.

Fig. 5.

Fig. 5

Traffic prediction process of MSRNNet.

First, the significant feature set Inline graphic values are trained in the input state, and then this layer estimates each feature weight value. The hidden state evaluates the feature maps to reduce dimension based on the features’ low- and high-level value representation. Finally, the output state produces the output for whether there is traffic or not and improves the smart agriculture environment.

Algorithm 3.

Algorithm 3

Multiscale spatial recurrent neural network (MSRNNet) for traffic classification.

Algorithm 3 describes the proposed MSRNNet approach feature selection. Here, Inline graphic denotes the softmax activation function for accurate traffic outcome through the nodes. Figure 6 explains the flowchart for traffic classification.

Fig. 6.

Fig. 6

Flowchart for MSRNNet for traffic classification.

Experimental result analysis

This section presents the simulation results obtained from evaluating the proposed MSRNNet framework on an IoT-based agriculture dataset. The experiments were conducted using Python (version 3.9) within the Anaconda environment. Numerical experiments were carried out in the optimization process to confirm the suggested model’s performance. Deep learning has shown increasing results when applied to agricultural operations, and it is crucial for enhancing the proposed methods. Deep learning models can attain precision, accuracy, recall, and F1 score values by employing the agricultural environment dataset and the suggested methods.

Table 5 depicts the simulation results for IoT traffic prediction in agriculture. The proposed MSRNNet method is compared against several existing models to highlight its effectiveness. The proposed MSRNNet method is more accurate than the other approaches.

Table 5.

Parameters settings.

Simulation parameters Simulation values
Dataset used Internet of things (IoT) agriculture dataset
Simulation environment Anaconda
Simulation language Python-version 3.9
Number of records 2000
Training data 1200
Testing data 800

Comparison results

The comparison methods are Long Short-Term Memory Gated Multi-Perceptron Neural Network (LSTMG-MPNN), Gated Recursive Deep Neural Network (GRDNN), and Improved Gated Recurrent Unit Neural Network (IGRUNN).

Figures 7 and 8 shows the training and validation curves for accuracy and loss, respectively, confirming the stable and effective learning behavior of MSRNNet. Figure 7 shows the Accuracy curve showing strong training-validation alignment. Figure 8 shows the Loss curve indicating minimal overfitting and steady convergence.

Fig. 7.

Fig. 7

Accuracy curve of MSRNNet method.

Fig. 8.

Fig. 8

Loss curve of MSRNNet method.

Table 6 provides a comparative analysis of MSRNNet versus traditional classifiers across key metrics. The comparison shows that the MSRNNet achieves a 97.08% accuracy, a precision rate of 96.05%, a recall rate of 94.25%, and an F1-score of 95.17% compared to the existing methods. The MSRNNet model significantly outperforms existing techniques across all metrics, achieving high accuracy and a low misclassification rate.

Table 6.

Comparative results of MSRNNet with traditional methods.

Performance in %
Approaches/ metrics Author Accuracy Precision Recall F1-score
PEBEDL Kethineni K et al 79.51 78.36 79.01 80.1
CNN with Bi-GRU Kethineni et al 80.64 80.11 79.33 80.57
IGRUNN W. Shu et al 84.36 86.24 84.27 93.46
MSRNNet Proposed 97.08 96.05 94.25 95.17

Figure 9 presents the proposed MSRNNet’s overall classification performance for both training and validation sets on the agricultural IoT dataset.

  1. Training: Accuracy (97.04%), Precision (96.01%), Recall (94.21%), F1-score (95.15%).

  2. Validation: Accuracy (97.08%), Precision (96.05%), Recall (94.25%), F1-score (95.17%).

Fig. 9.

Fig. 9

Average performance of MSRNNet method on agriculture IoT dataset.

Figure 10 describes the accuracy performance of the proposed MSRNNet with existing methods LSTM-GMPNN, GRDNN, and IGRUNN. Regarding accuracy performance, the proposed method obtained 97.08%, but the existing techniques LSTM-GMPNN, GRDNN, and IGRUNN attained 95.3%, 95.46%, and 84.36%, respectively, which is lower than the proposed one.

Fig. 10.

Fig. 10

Performance of accuracy analysis.

Figure 11 shows the average precision performance comparison plots. These plots reveal that the proposed method outperforms LSTM-GMPNN, GRDNN, and IGRUNN. Precision comparison shows MSRNNet achieves 96.05%, outperforming LSTMG-MPNN (95.13%), GRDNN (92.10%), and IGRUNN (86.24%).

Fig. 11.

Fig. 11

Performance of precision analysis.

Figure 12 shows the average recall performance comparison plots. These plots reveal that the proposed method outperforms LSTM-GMPNN, GRDNN, and IGRUNN. The MSRNNet method scores 94.25%, again ahead of the others.

Fig. 12.

Fig. 12

Performance of recall analysis.

Figure 13 describes the performance metrics analysis of the proposed MSRNNet with existing LSTM-GMPNN, GRDNN, and IGRUNN methods. F1-score and Kappa statistics illustrate MSRNNet’s robustness, scoring 95.17 and 94.35%, respectively which is higher than the other methods.

Fig. 13.

Fig. 13

Performance metrics analysis.

Figure 14 compares the average delay performance. A growth in the frequency of regular packet transmissions induces network traffic and raises average latency. However, the proposed method MSRNNet achieves a low delay of 85.49 ms over 100 iterations, demonstrating its computational efficiency.

Fig. 14.

Fig. 14

Average delay performance.

Figure 15 describes the false classification analysis of the proposed MSRNNet with existing LSTM-GMPNN, GRDNN, and IGRUNN methods. Here, MSRNNet records only 1.25% false classifications, compared to IGRUNN (10.33%), LSTMG-MPNN (7.40%), and GRDNN (5.60%).

Fig. 15.

Fig. 15

Performance of false classification analysis.

The experimental results confirm that the proposed MSRNNet framework provides superior performance in terms of classification accuracy, precision, recall, F1-score, and delay, while maintaining a low misclassification rate. These improvements make it a robust and reliable model for managing IoT traffic in smart agriculture applications.

Conclusions

This study proposed a novel methodology for IoT traffic classification in smart agricultural environments using a Multiscale Spatial Recurrent Neural Network (MSRNNet) combined with AntLion Behavior Optimization (ALBO) for feature selection and classification. The research addressed critical challenges in managing redundant data traffic, real-time prediction, and resource optimization within precision agriculture systems. The process began with data preprocessing using Box-Plot Normalization (BPN) to remove null values and outliers, ensuring a clean and standardized dataset. Next, the Exhaustive Traffic Information Rate (ETIR) method was applied to estimate the marginal contribution of each feature, enabling the identification of highly influential parameters. The ALBO algorithm was then utilized to select the most significant features, reducing dimensionality and improving model efficiency. The final classification was performed using the MSRNNet model, which effectively captured temporal and spatial relationships in multiscale traffic data. The proposed system demonstrated strong performance when evaluated on an IoT agriculture dataset, achieving 97.08% accuracy, 96.05% precision, 94.25% recall, and 95.71% F1 score, with 1.25% false classification rate and 85.49 ms time complexity. These results show that the proposed approach outperforms existing models, including LSTM-GMPNN, GRDNN, and IGRUNN, in all key performance metrics. The model’s ability to process complex IoT traffic data with high accuracy and efficiency makes it a valuable tool for advancing smart farming systems. Future work may involve integrating the model with real-time agricultural monitoring platforms, extending its application to other environmental domains, and exploring hybrid optimization methods for further performance gains.

Author contributions

M.S. and M.A conceptualized and designed the study. M.S. carried out the literature survey and programming using Multiscale Spatial Recurrent Neural Network Algorithm (MSRNNet). The experimental results were analysed and compared with existing models to obtain the Precision, Accuracy and Recall. M.S. wrote the draft of the manuscript and prepared the figures. M.A. reviewed and revised the manuscript. M.A. supervised the project. All authors contributed to the discussion and interpretation of the results and reviewed and approved the final manuscript.

Data availability

The datasets generated and/or analysed during the current study are not publicly available due to privacy concerns but are available from the corresponding author on reasonable request.

Declarations

Competing interests

The authors declare no competing interests.

Footnotes

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

References

  • 1.Somula, R., Cho, Y. & Mohanta, B. K. EACH-COA: An energy-aware cluster head selection for the internet of things using the coati optimization algorithm. Information14(11), 601 (2023). [Google Scholar]
  • 2.Masood, F., Khan, W. U., Jan, S. U. & Ahmad, J. AI-enabled traffic control prioritization in software-defined IoT networks for smart agriculture. Sensors23(19), 8218 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Alharbi, H. A. & Aldossary, M. Energy-efficient edge-fog-cloud architecture for IoT-based smart agriculture environment. IEEE Access.9, 110480–110492 (2021). [Google Scholar]
  • 4.Churcher, A. et al. An experimental analysis of attack classification using machine learning in IoT networks. Sensors21, 446 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Bagaa, M., Taleb, T., Bernabe, J. B. & Skarmeta, A. A machine learning security framework for IoT systems. IEEE Access8, 114066–114077 (2020). [Google Scholar]
  • 6.Singh, R. K., Berkvens, R. & Weyn, M. AgriFusion: An architecture for IoT and emerging technologies based on a precision agriculture survey. IEEE Access9, 136253–136283 (2021). [Google Scholar]
  • 7.Boursianis, A. D. et al. Smart irrigation system for precision agriculture—The AREThOU5A IoT platform. IEEE Sens.21(16), 17539–17547 (2021). [Google Scholar]
  • 8.Misra, N. N. et al. IoT, big data and artificial intelligence in agriculture and food industry. IEEE Internet Things9(9), 6305–6324 (2022). [Google Scholar]
  • 9.Shu, W., Cai, K. & Xiong, N. N. A short-term traffic flow prediction model based on an improved gate recurrent unit neural network. IEEE Trans. Intell. Transp. Syst.23(9), 16654–16665 (2022). [Google Scholar]
  • 10.Qi, T., Li, G., Chen, L. & Xue, Y. ADGCN: An asynchronous dilation graph convolutional network for traffic flow prediction. IEEE Internet Things J.9(5), 4001–4014 (2022). [Google Scholar]
  • 11.Kong, J., Fan, X., Jin, X., Lin, S. & Zuo, M. A variational bayesian inference-based en-decoder framework for traffic flow prediction. IEEE Trans. Intell. Transp. Syst.25(3), 2966–2975 (2024). [Google Scholar]
  • 12.Syed, L. Smart agriculture using ensemble machine learning techniques in IoT environment. Procedia Comput. Sci.235, 2269–2278 (2023). [Google Scholar]
  • 13.Hashmi, A. U. H. et al. Effects of IoT communication protocols for precision agriculture in outdoor environments. IEEE Access12, 46410–46421 (2024). [Google Scholar]
  • 14.Singh, S. P. A new QoS optimization in IoT-smart agriculture using rapid-adaption-based nature-inspired approach. IEEE Internet Things J.11(3), 5417–5426 (2024). [Google Scholar]
  • 15.AlZubi, A. A. & Galyna, K. Artificial intelligence and internet of things for sustainable farming and smart agriculture. IEEE Access11, 78686–78692 (2023). [Google Scholar]
  • 16.Farooq, M. S., Javid, R., Riaz, S. & Atal, Z. IoT based smart greenhouse framework and control strategies for sustainable agriculture. IEEE Access10, 99394–99420 (2022). [Google Scholar]
  • 17.Aldossary, M., Alharbi, H. A. & Hassan, Anwar Ul. Internet of things (IoT)-enabled machine learning models for efficient monitoring of smart agriculture. IEEE Access12, 75718–75734 (2024). [Google Scholar]
  • 18.Xue, D. & Huang, W. Smart agriculture wireless sensor routing protocol and node location algorithm based on internet of things technology. IEEE Sens. J.21(22), 24967–24973 (2021). [Google Scholar]
  • 19.Anand, T., Sinha, S., Mandal, M., Chamola, V. & Yu, F. R. AgriSegNet: Deep aerial semantic segmentation framework for IoT-assisted precision agriculture. IEEE Sens. J.21(16), 17581–17590 (2021). [Google Scholar]
  • 20.Gheisari, Mehdi et al. An efficient cluster head selection for wireless sensor network-based smart agriculture systems. Comput. Electron. Agric.198, 107105 (2022). [Google Scholar]
  • 21.Vakili, A. et al. A new service composition method in the cloud-based Internet of things environment using a grey wolf optimization algorithm and MapReduce framework. Concurr. Comput. Pract. Exp.36(16), e8091 (2024). [Google Scholar]
  • 22.Javeed, D., Gao, T., Saeed, M. S. & Kumar, P. An intrusion detection system for edge-envisioned smart agriculture in extreme environment. IEEE Internet Things J.11(16), 26866–26876 (2024). [Google Scholar]
  • 23.Xu, X., Lakshmi Patibandla, R.S.M., Arora, A., Al-Razgan, M., Mahrous Awwad, E. & Omollo Nyangaresi, V. (2024). An adaptive hybrid (1D-2D) convolution-based shufflenetV2 mechanism for irrigation levels prediction in agricultural fields with smart IoTs. IEEE Access. 12, 71901–71918
  • 24.Aburasain, R. Y. Enhanced black widow optimization with hybrid deep learning enabled intrusion detection in internet of things-based smart farming. IEEE Access12, 16621–16631 (2024). [Google Scholar]
  • 25.Jani, K. A. & Chaubey, N. K. A novel model for optimization of resource utilization in smart agriculture system using IoT (SMAIoT). IEEE Internet Things J.9(13), 11275–11282 (2022). [Google Scholar]
  • 26.Heidari, A., Shishehlou, H. & Darbandi, M. A reliable method for data aggregation on the industrial internet of things using a hybrid optimization algorithm and density correlation degree. Clust. Comput.27, 7521–7539 (2024). [Google Scholar]
  • 27.Zanbouri, Kouros, Darbandi, Mehdi & Nassr, Mohammad. A GSO-based multi-objective technique for performance optimization of blockchain-based industrial Internet of things. Int. J. Commun. Syst.37(15), 1–22 (2024). [Google Scholar]
  • 28.Heidari, A., Jamali, M. A. J., Navimipour, N. J. & Akbarpour, S. A QoS-aware technique for computation offloading in IoT-edge platforms using a convolutional neural network and Markov decision process. IT Prof.25(1), 24–39 (2023). [Google Scholar]
  • 29.Indirani, M. Analysis of climate change for drought forecasting using high-resolution data and ensemble learning with optimized pruning model. Glob. NEST J.26(6), 06002 (2024). [Google Scholar]
  • 30.Ghislain, N. W. Climate projection and future rainfall trends analysis in the Nouhao sub-basin in Burkina Faso. Glob. NEST J.26(3), 1–10 (2024). [Google Scholar]
  • 31.Abunadi, I., Rehman, A., Haseeb, K., Parra, L. & Lloret, J. Traffic-aware secured cooperative framework for IoT-based smart monitoring in precision agriculture. Sensors22(17), 6676 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Samin, Omar Bin & Abdulkhader, Nasir Ahmed. Malicious agricultural IoT traffic detection and classification: A comparative study of ML classifiers. J. Adv. Inf. Technol.14(4), 811–820 (2023). [Google Scholar]
  • 33.Kethineni, K. Intrusion detection in internet of things based smart farming using hybrid deep learning framework. Res. Sq.27, 1–22 (2023). [Google Scholar]
  • 34.Raghuvanshi, A. et al. Intrusion detection using machine learning for risk mitigation in IoT-enabled smart irrigation in smart farming. J. Food Qual.2022(1), 3955514 (2021). [Google Scholar]
  • 35.El-Ghamry, A., Darwish, A. & Hassanien, A. E. An optimized CNN-based intrusion detection system for reducing risks in smart farming. Internet Things22, 100709 (2023). [Google Scholar]
  • 36.Kethineni, K. & Gera, P. Iot-based privacy-preserving anomaly detection model for smart agriculture. System11(6), 304 (2023). [Google Scholar]
  • 37.Hamdoun, H., Alzubi, J. A., Alzubi, O. A. & Mangeni, S. Key economic and environmental perspectives on sustainability in the ICT sector. Middle East J. Sci. Res.21(8), 1341–1345 (2014). [Google Scholar]
  • 38.Yadawad, R., Umakant Kulkarni, P. & Jafar Alzubi, A. Auto-metric graph neural network for attack detection on IoT-based smart environment and secure data transmission using advanced wild horse standard encryption method. Int. J. Comput. Netw. Inf. Secur.16(3), 1–15 (2024). [Google Scholar]
  • 39.Akbar, Ali et al. Artificial neural networks training algorithm integrating invasive weed optimization with differential evolutionary model. J. Ambient Intell. Hum. Comput.14, 6017–602 (2023). [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The datasets generated and/or analysed during the current study are not publicly available due to privacy concerns but are available from the corresponding author on reasonable request.


Articles from Scientific Reports are provided here courtesy of Nature Publishing Group

RESOURCES