Skip to main content
Scientific Reports logoLink to Scientific Reports
. 2026 May 23;16:23092. doi: 10.1038/s41598-026-53396-5

Geospatial multi-scale GNN for urban food security in climate-stressed environments

Geethamani Rajamani 1,✉, Jaganathan Subramani 2
PMCID: PMC13396349  PMID: 42177230

Abstract

The increasing global food insecurity driven by climate-induced natural hazards and soil degradation has made the resilience of alternative agricultural systems a critical focus in risk management. This study presents a geospatially integrated monitoring framework, the Optimized Multi-Scale Adaptive Graph Neural Network (OMSA-GNN), designed to mitigate risks associated with nutrient instability in hydroponic and aeroponic environments. The proposed system leverages a Raspberry Pi–based IoT network to monitor complex interactions among microclimatic variables, plant physiological health, and nutrient concentrations, treating them as localized geospatial data points. To enhance decision-making under environmental uncertainty, an Improved Sparrow Search Algorithm (ISSA) is employed to optimize the predictive performance of the GNN. The OMSA-GNN model incorporates visual plant indices as a proximal remote sensing approach to enable early detection of physiological stress that may lead to crop failure. Evaluated using a lettuce growth dataset, the framework demonstrates superior performance in forecasting growth trajectories and managing resource-related risks compared to conventional static models. The results highlight a scalable approach for improving the reliability of urban food systems, where traditional land-based agriculture is increasingly vulnerable to natural hazards.

Keywords: Early warning systems, Proximal remote sensing, Geospatial monitoring, Graph neural networks, Improved sparrow search algorithm, Food security, Climate change adaptation, Smart farming, Nutrient management

Subject terms: Ecology, Ecology, Environmental sciences

Introduction

The very fast development of smart farming has transformed contemporary agriculture by utilizing IoT, artificial intelligence (AI), edge computing and bio-inspired optimization in crop-growing systems. There has been rapid adoption of hydroponic and aeroponic practices in the past few years, which overcome soil dependence, save water by 70–90% with respect to soil-based traditional agriculture and allow the growth of crops in urban and climate-stressed areas1,2. These soilless systems also improve land-use efficiency by enabling vertical stacking and controlled-environment agriculture, capable of producing up to 10 times greater than open-field agriculture per square meter3,4. Smart farming research now focuses on real-time sensing, adaptive nutrient management, graph-based learning and predictive analytics, which in combination enhance system scalability, increase crop productivity and enhance environmental sustainability. Yet, their efficacy relies heavily on accurate nutrient dosing and adaptive decision-making, which are still problematic in dynamic environments.

In contrast, conventional nutrient management strategies are plagued by inflexible and archaic practices. Static dosing regimens, where predetermined amounts of nutrients are applied regardless of plant growth stages or microclimatic fluctuations that tend to cause 20–30% nutrient loss5. Linear predictive models, which are standard in traditional systems, cannot account for nonlinear relationships between environmental conditions (temperature, humidity, CO2, dissolved oxygen) and corresponding plant physiological responses like nutrient uptake and biomass formation6. For instance, changes in dissolved oxygen levels below 5 mg/L or excursions of pH away from the optimal 5.5–6.5 range can appreciably decrease the efficiency of nutrient absorption, but fixed systems hardly adjust in real-time.

Consequently, conventional systems often yield 10–25% less compared to adaptive intelligent farm systems, stressing their failure to effectively cope with dynamic and complex crop-environment relationships7. Another weakness is the dependence on manual calibration and rule-based systems, which degrades response and decision-making. For instance, farm workers in conventional greenhouse or hydroponic farms dedicate 3–5 h a week on adjusting nutrient solutions, making pump calibrations and monitoring sensor values8. This incurs latency in the compensation for drifts and increases the likelihood of crop stress, especially in leafy crops such as spinach and lettuce that develop quickly and require daily or near-real-time adjustments in nutrient balance9,10.

In order to overcome such inefficiencies, use of Deep Learning (DL) techniques are highly suggested. DL is a subset of Machine Learning (ML) that utilizes neural networks with hidden layers for automatic hierarchical feature learning. It is found to be the best option for tasks related to image recognition, natural language processing and speech processing. Current advances in smart agriculture utilize adaptive models such as graph neural networks (GNNs), multi-scale temporal encoders and bio-inspired optimizers for precise real-time control11,12. For instance, GNN-driven systems for nutrient management have been demonstrated to achieve up to 18% improvement in yield prediction accuracy and 22% better nutrient use efficiency over linear regression-based systems13. Similarly, bio-inspired approaches like improved particle swarm optimization (IPSO) and improved sparrow search algorithm (ISSA) have been reported to reduce nutrient wastage by 25–30% while promoting crop growth stability14. Overall, these developments picture a paradigm shift from rule-based and fixed strategies towards data-driven, adaptive and forecast architectures that can sustain productivity under fluctuating environmental conditions15.

The intended OMSA-GNN (Optimized Multi-Scale Adaptive Graph Neural Network), optimized using the Improved Sparrow Search Algorithm model, takes advantage of these advancements in the form of a cost-saving, intelligent and scalable nutrient management system optimized for aeroponics and hydroponics.

The layered representation of the proposed OMSA-GNN framework in Fig. 1a and b illustrates the hierarchical organization of system components, ranging from physical sensing to intelligent decision-making. Each layer is responsible for a specific function, including data acquisition, contextual integration, feature processing, adaptive learning, and automated control. This modular design enhances system scalability, interpretability and adaptability for deployment in climate-stressed urban agricultural environments.

Fig. 1.

Fig. 1

(a) Layered Architecture of the Proposed OMSA-GNN Framework. (b) System Architecture of the Multi-Scale Adaptive GNN-Based Framework.

This work is structured as follows: Sect. 2 provides a comprehensive review of the latest trends in smart farming and the shortcomings of conventional nutrient management approaches. Section 3 presents the proposed OMSA-GNN with ISSA, including conceptual model as well as comprehensive layer-by-layer mathematical explanations. Section 4 outlines experimental design, dataset properties and assessment protocols, preceded by a performance metric analysis of yield gain, nutrient use efficiency and growth stability. Lastly, Sect. 5 summarizes the conclusion of the study with major findings and provides directions for future research into scaling the framework to commercial-scale hydroponic and aeroponic farming systems.

The Objectives of the current study are:

  • To develop and deploy the OMSA-GNN framework that is efficient at learning spatio-temporal dependencies from multi-sensor data in hydroponic and aeroponic systems accurately.

  • To develop an ISSA-based optimization method for hyperparameter tuning and nutrient dosing vectors, enhancing nutrient-use efficiency, yield stability and dynamic condition adaptability.

  • To include an IoT-enabled Raspberry Pi edge computing module for real-time monitoring, prediction and closed-loop actuation, for autonomous nutrient management in smart soilless agriculture.

Contributions of the paper

The main contributions of this work are summarized as follows:

  • A multi-scale adaptive graph neural network (OMSA-GNN) is developed to model spatio-temporal relationships among multi-sensor data in controlled hydroponic and aeroponic systems for improved nutrient state prediction.

  • An Improved Sparrow Search Algorithm (ISSA) is employed for offline hyperparameter tuning of the GNN model, enhancing prediction stability without affecting real-time operation.

  • An IoT-based sensing framework using ESP32 modules and a Raspberry Pi edge device is implemented for real-time data acquisition, model inference, and closed-loop control of nutrient delivery.

  • Sensor nodes are represented as localized spatial entities, enabling micro-scale geospatial modeling within controlled-environment agriculture systems.

  • The framework is designed with a localized graph structure and inference-only edge deployment to ensure computational efficiency within the sampling interval.

  • The proposed approach is validated on a hydroponic lettuce dataset, demonstrating its applicability for nutrient monitoring and decision support in controlled agricultural environments.

Related works

Smart farming is the process of analyzing plant growth and optimizing it in real-time for supporting farmers for improved productivity. Dahane et al.16, proposed an IoT-based smart farming system integrating AI approaches. Likewise, Ahsan et al.17, developed a hybrid DL model with computer vision techniques for determining the nutrient concentration in hydroponically frown lettuce plants. Also designed to analyze other variants like Rex, Tacitus, Black Seed and Flandria, the authors experimented with four different nutrient concentrations to grow lettuce plants in a greenhouse environment. At the end of evaluation, the developed visual geometry groups VGG16 and VGG19 architectures attained an accuracy of 87.5% and 100% on the four variants.

For the desired growth in plant cultivation, selection of smart manure composition is vital. Ather et al.18, presented a method for selection of manure sort, application time and amount for improved crop growth. The developed Artificial Neural Network (ANN) with NPK supplement levels offered better application timing and fitting composite treatment. Other than factors like soil, manure, environment criteria, lighting impacts the hydroponic variants like lettuces. So, Chen et al.19, analyzed the effect of light on growth of lettuce plant and introduced a Genetic Algorithm-Support Vector Regression (GA-SVR) model for monitoring the adaptation process. Through the use of plant factory with artificial lighting (PFAL), the proposed model attained a RMSE value of 0.0416, R2 score of 0.9710 and a recommended intensity of 140.80 𝞵mol m−2s−1.

Mokhtar et al.20, investigated about lettuce yield prediction using four ML classifiers like Random Forest (RF), Deep Neural Network (DNN), Support Vector Regressor (SVR) and Extreme Gradient Boosting (XGB). The lettuce plants were observed under three hydroponic systems during the year 2018–2019. At the end of evaluation, the DNN model proved promising for large-scale implementation and decision-making in managing crop yield. Astrom et al.21, paved way for a ML technique for non-destructive biomass and relative growth rate estimation in aeroponic cultivation. The developed multi-variate regression and ResNet-50-based neural network was built to learn and forecast plant biomass from temporal images. Evaluated on images of 57 images from different angles during a 5-day period, the ResNet-50 based approach attained a RMSE of 0.0466 g.

Gowtham and Jebakumar22introduced an efficient solution for improving agricultural production called vertical farming. Considered as the most emerging and resource-saving technique for aeroponics, the technique proved to supply fresh and clean food items. Akeem et al.23, reviewed the significance of AI in smart farming by highlighting its scope in crop production and selection. Similarly, Holzinger et al.24, focused on human-centered AI in smart farming – an attempt towards Agriculture 5.0. The author explored the advancements and potential of AI in leading to a sustainable agri-food sector and faster human decision-making.

Rajendiran and Rethnaraj25 optimized lettuce crop yield prediction in an indoor aeroponic vertical farming system using IoT-integrated ML regression models. Unlike Mokhtar et al., the author utilized three classifiers such as XGBoost, RF and linear support vector for estimating the lettuce yield. As the result of validation, high prediction accuracy of 93% was encountered by the XGBoost classifier. Fuentes-Penailillo et al.26, analyzed the new generation sustainable technologies for soilless vegetable production. The author addressed multifaceted challenges that affect the adoption of AI-based monitoring models.

Gourshettiwar and Reddy27explored the recent advancements in hydroponics. Through discussion of machine learning and IoT innovations, the approaches that improve resilience, sustainability and productivity were included as the part of discussion. Similarly, Amuthadevi et al.28, delved into the scope of AI and DL in domain of agriculture. Sharmin et al.29, highlighted the potential of ML in predicting lettuce yield in hydroponic systems. The authors offered an overview of global trends with special reference to lettuce production. Finally, Shalash et al.30, made an investigation on how ML algorithms improve hydroponic farming interms of growth prediction and anomaly detection. Focusing on Batavia lettuce cultivation, the authors employed classifiers like Linear Regression (LR), DNN and Random Forest (RF) for predicting growth rates and detecting anomalies. As a result, the RF classifier outperformed others with an accuracy of 94.45%. The research works discussed in this section is given a glimpse in Table 1.

Table 1.

Overview of research works related to smart farming.

Author Contribution Inference
Dahane et al.16, Proposed an IoT-based smart farming system integrated with AI approaches. Showed the feasibility of combining IoT and AI for real-time crop monitoring and decision-making.
Ahsan et al.17, Developed hybrid VGG16, VGG19 with computer vision to determine nutrient concentration in hydroponically grown lettuce variants. Achieved 87.5%–100% accuracy in visual nutrient assessment.
Ather et al.18, Presented ANN-based method for optimal manure type, application time and quantity using NPK supplement levels. Demonstrated improved crop growth via precise manure selection and nutrient scheduling.
Chen et al.19, Proposed GA-SVR model to analyze effects of artificial lighting on lettuce growth in PFAL systems. Achieved RMSE = 0.0416, R² = 0.9710, optimal light intensity of 140.80 µmol m⁻²s⁻¹ for growth.
Mokhtar et al.20, Investigated lettuce yield prediction using RF, DNN, SVR and XGB on data from three hydroponic systems. Found DNN most promising for large-scale yield prediction and crop management.
Astrom et al.21, Developed ResNet-50 and multivariate regression models for biomass and growth rate estimation in aeroponics. Non-destructive method achieved RMSE = 0.0466 g.
Gowtham & Jebakumar22 Proposed vertical farming solution for aeroponics to improve production efficiency. Highlighted vertical farming as a resource-saving, sustainable method for fresh food supply.
Akeem et al.23, Reviewed AI applications in smart farming with emphasis on crop production and selection. Showed AI’s transformative potential in scaling precision agriculture practices.
Holzinger et al.24, Discussed human-centered AI in Agriculture 5.0 for sustainable agri-food sectors. Emphasized AI’s role in augmenting human decision-making for farming.
Rajendiran & Rethnaraj25 Optimized lettuce yield prediction in aeroponic vertical farming using IoT-integrated ML models. XGBoost achieved 93% accuracy, confirming ML’s strength in yield estimation.
Fuentes-Penailillo et al.26, Analyzed sustainable AI-enabled technologies for soilless vegetable production. Addressed adoption challenges while outlining pathways for smart farming adoption.
Gourshettiwar & Reddy27 Surveyed advancements in hydroponics focusing on ML and IoT approaches. Highlighted innovations that improve resilience and sustainability in hydroponics.
Amuthadevi et al.28, Explored AI and DL applications in agriculture. Identified DL as a powerful enabler for predictive and prescriptive farming.
Sharmin et al.29, Reviewed ML applications for lettuce yield prediction in hydroponic systems. Provided global perspective on lettuce-focused smart farming research trends.
Shalash et al.30, Investigated how ML models improve hydroponic farming by predicting growth and detecting anomalies. Upon comparison of LR, DNN and RF, RF was found better with 94.45% accuracy.

Although prior works have successfully integrated IoT, machine learning and deep learning for crop monitoring and yield protection, most approaches are either limited to single modalities or focus on classification tasks without robust real-time adaptability. Furthermore, optimizations strategies for nutrient closing are often rule-based and rely on conventional algorithms that may converge slowly or fall into local optima. This highlights the gap for a need of hybrid and optimized model that captures complex sensor interdependencies for real-time control.

Materials and methods

The architecture combines IoT-based sensors, edge computing, graph neural networks and optimization techniques to achieve smart crop monitoring and fertilizer management. Data are first obtained from the Sensor Layer which includes environmental and crop parameters like pH, dissolved oxygen (DO), electrical conductivity (EC) and crop health indicators. These data streams are forwarded to the Raspberry Pi + Edge computing module where preprocessing, aggregation and storage occur to allow high-dimensional data to be processed efficiently. A local display for real-time visualization by farmers exists.

The pre-processed data is then fed into the OMSA-GNN module. The module uses a multi-scale temporal encoder, adaptive graph learning and scale fusion mechanisms to learn intricate spatio-temporal patterns between environmental factors and plant growth. The outputs are optimized using the ISSA optimizer that does hyperparameter search as well as optimizes dosing vectors for efficient nutrient delivery. The Prediction & Control layer then predicts crop growth patterns and computes optimized dosing plans for nutrients, which the Actuation Layer implements through pumps, sprayers and dosing systems. The continuous monitoring and feedback loop offers system flexibility and sustainability in real-world agricultural settings. Figure 2 showcases the architecture of OMSA-GNN with ISSA model.

Fig. 2.

Fig. 2

OMSA-GNN architecture with ISSA model.

Sensors supply the raw multi-modal time-series employed in state estimation and control (EC, pH, DO, crop health indices, camera-derived features, etc.). The system employs commercially available electrochemical pH & EC probes, optical dissolved oxygen (DO) sensors and RGB cameras for monitoring crop health. All sensors are calibrated periodically using standard reference solutions (butter solutions for pH and standard conductivity solutions for EC), manufacturer guidelines and routine maintenance for reducing sensor drift and fouling. Sensor measurements are taken at fixed intervals (every 5–10 min) for measuring physiochemical parameters for real-time monitoring.

Each sensor observation is represented as the actual signal degraded by noise and sporadic missing values. Prior to any learning and control, denoising is performed at the outlier rejection and simple imputation at the sample level. Let S= {s1,s2,…,sn} be the sensor measurements and each sensor observes parameters like EC, pH, DO and crop health (CH). The raw data can be written as:

graphic file with name d33e613.gif 1

Where, t represents the measurement timestamp.

The data is pre-processed to eliminate noise and missing values. A dataset Inline graphicis created, where m represents the time samples and n represents the sensor features. Aggregation of data allows for efficient storage by using Eq. (2):

graphic file with name d33e631.gif 2

In the above Equation, Inline graphic represents the aggregation function.

OMSA-GNN Module builds an adaptive graph, Inline graphic, where Vis sensor nodes and E is relations between environmental factors. Adaptive graph learning dynamically updates adjacency weights Aij with feature similarity:

graphic file with name d33e655.gif 3

A multi-scale temporal encoder encodes sequential dependencies with graph convolutions:

graphic file with name d33e661.gif 4

Where, Inline graphic is the hidden state at layer l, Inline graphic is the learnable weight matrix and Inline graphic is the normalized adjacency matrix.

Improved Sparrow Search Algorithm is applied for hyperparameter optimization and dosing vector optimization. If θ is the hyperparameter vector and F(θ) is the objective function (for example, prediction accuracy or nutrient efficiency), ISSA updates solutions in the following way iteratively:

graphic file with name d33e691.gif 5

Here, α is the adaptive step size and Inline graphic is the global best solution.

The optimized model predicts crop growth (Gf​) and nutrient dosing (Nd​) as:

graphic file with name d33e707.gif 6
graphic file with name d33e711.gif 7

In the above Equations, Inline graphic is the prediction function from the GNN output and Inline graphic is the dosing control strategy.

The actuators (sprayers, pumps, dosing systems) implement optimized control signals. Continuous monitoring is done by feedback Fb through sensors:

graphic file with name d33e729.gif 8

Where, Inline graphic ensures closed-loop adjustment for sustainable and adaptive crop management.

Figure 3 illustrates the Operational flow of proposed smart farming approach.

Fig. 3.

Fig. 3

Operational flow of proposed smart farming approach.

OMSA-GNN (optimized multi-scale adaptive graph neural network)

The OMSA-GNN module constitutes the computational backbone of the envisioned approach, which facilitates effective spatio-temporal feature learning from diverse agricultural sensor data. In contrast to traditional neural networks, OMSA-GNN uses graph structures to capture inherent interplay between various environmental and crop-related variables, including pH, EC, DO and crop health indicators. The module utilizes a multi-scale temporal encoder, G, that inspects time-series data at multiple resolutions to enable the system to detect both short-term oscillations and long-term trend patterns. An adaptive graph learning approach builds and updates the adjacency matrix dynamically so that the inter-reliability of varying sensor nodes is learned instead of predefined, making the model environmentally robust. In addition, scale fusion methods combine outputs from various temporal and spatial resolutions into one consolidated representation, improving prediction accuracy. These strengths being imbedded, the OMSA-GNN module converts raw sensor inputs into a structured knowledge representation that can be used directly for growth forecasting and estimation of nutrient requirements, providing accurate and data-based decision-making within the system. Figure 4 showcases the operational flow of the OMSA-GNN Module.

Fig. 4.

Fig. 4

Operational flow of OMSA-GNN.

The multi-scale representation used in OMSA-GNN allows the model to capture both global and local interactions between the components of the model, capturing interactions at the level of the sensor as well as at the level of the entire system.

ISSA (improved sparrow search algorithm) optimization

The ISSA Optimizer is the optimization component of the proposed methodology, optimizing both the hyperparameters of the OMSA-GNN and the nutrient dosing vectors for actuation. Conventional optimization algorithms tend to perform poorly with high-dimensional, non-linear agricultural data, resulting in sub-optimal performance. The ISSA overcomes these issues by inserting adaptive mechanisms into the base Sparrow Search Algorithm, such as dynamic step-size regulation, boundary management techniques and Lévy flight perturbations to improve solution space exploration. Within the system, the ISSA optimizer adjusts key hyperparameters like learning rates, embedding dimensions and scale fusion weights, thus optimizing predictive precision while reducing computational complexity. Further, it optimizes nutrient dosing vectors by testing candidate solutions against growth goals of the crop and safety requirements, such that the dosing mechanism does not lead to over- or under-supply of vital nutrients. Thus, the ISSA optimizer serves two purposes model generalization through efficient hyperparameter search and enhanced control efficiency through optimized dosing commands. Through this, the entire framework remains adaptable, robust and precise in real agricultural conditions.

graphic file with name 41598_2026_53396_Figa_HTML.jpg

Algorithm 1: Improved Sparrow Search Algorithm.

Results and discussion

This section discusses about the dataset, experimental setup and evaluation outcome obtained as the result of validating the model.

Dataset description and significance of geospatial and climate relevance for urban food systems

In terms of applicability of the proposed solution in real-world urban settings beyond laboratory-level testing, an emphasis was made on integrating both geospatial and climate aspects into the analysis at the level of individual sensor nodes. The latter can be perceived as individual micro-spatial geospatial units with varying conditions.

While traditional research involving geospatial context would employ satellite imaging data and study the impact of climate change from above (at a higher altitude), this research focuses on micro-scale spatial intelligence when IoT nodes act as spatially aware sensors. Thus, considering the scope of the problem studied in this paper, micro-spatial intelligence would be more relevant since it refers to CEA practices in urban areas (vertical and rooftop farming). Inclusion of geospatial context into analysis, combined with adaptive modeling of GNNs, improves prediction of nutrient instability and plant stress, which helps make decisions under uncertainty.

For experimenting the proposed OMSA-GNN with ISSA optimizer, a publicly available open-source dataset called “Lettuce Growth Days Analysis” is used31. Collected from hydroponic environments, the dataset goes well with the proposed model as it captures the life cycle of lettuce plants through association of environmental variables and plant growth trajectories. Each record in the dataset corresponds to a plant observation over a daily timescale. The dataset comprises of 7 columns with details like Plant Identifier (Plant_ID), date, temperature (℃ and ℉), humidity (%), total dissolved solids (TDS in ppm), pH level and growth days. OMSA-GNN model was developed based on the PyTorch deep learning library in a regular Python runtime setting on the Raspberry Pi. Such techniques as TorchScript-enabled Just-In-Time compiling, INT8 quantization and weights pruning were not applied, as they would not have reduced inference latency sufficiently enough while maintaining prediction quality.

The dataset is pre-processed for removing incomplete records and normalizing sensor readings into a consistent scale for neural network training. Upon pre-processing, the dataset is split into three subsets for training, validation and testing. From the total count of 2, 000 samples, 1, 400 samples are taken for training, 300 for validation and 300 for testing phase. Likewise, a 5-fold cross-validation scheme is employed for avoiding overfitting and ensuring robustness. In each fold, 80% of training data is used for model fitting and 20% for the validation. Experimental Setup and Model Validation Parameters are depicted in Table 2 and sample data from the dataset is given in Table 3.

Table 2.

System implementation and validation specifications.

Category Parameter Specification
Dataset Crop Type Lettuce (controlled hydroponic system)
Data Source IoT-based experimental setup
Features pH, EC, DO, Temperature, Humidity, Visual Plant Indices
Sampling Rate 5–10 min intervals
Data Type Time-series with node-level spatial tagging
Dataset Size 2,000 samples
Data Processing Preprocessing Removal of incomplete records and normalization
Data Split Training: 1,400; Validation: 300; Testing: 300
Validation Strategy Cross-Validation 5-fold cross-validation
Fold Configuration 80% training, 20% validation (per fold)
Geospatial Context Spatial Representation Sensor nodes treated as localized spatial units
Climate Context Environmental variability based on reference climate ranges
Hardware Controller Raspberry Pi 4 Model B
Sensors pH, EC, DO sensors; DHT22; Camera module
Communication Wi-Fi module (MQTT)
Software Programming Language Python
ML Framework TensorFlow/PyTorch
Model Multi-Scale Adaptive GNN (OMSA-GNN)
Optimization Improved Sparrow Search Algorithm (ISSA)
Data Processing NumPy, Pandas
Visualization Matplotlib
Operating System Raspbian/Linux

Table 3.

Sample dataset details.

Plant
ID
Date Temperature (°C) Humidity (%) TDS Value (ppm) pH Level Growth Days Temperature (F)
1 8/3/2023 33.4 53 582 6.4 1 92.12
1 8/4/2023 33.5 53 451 6.1 2 92.3
1 8/5/2023 33.4 59 678 6.4 3 92.12
1 8/6/2023 33.4 68 420 6.4 4 92.12
1 8/7/2023 33.4 74 637 6.5 5 92.12
1 8/8/2023 32.3 77 478 6.8 6 90.14
1 8/9/2023 32.3 75 682 6 7 90.14
1 8/10/2023 22.7 63 576 6.3 8 72.86
1 8/11/2023 31.9 69 662 6.1 9 89.42
1 8/12/2023 30.2 59 607 6.2 10 86.36
1 8/13/2023 30.1 77 670 6.5 11 86.18
1 8/14/2023 30.1 54 535 6.4 12 86.18
1 8/15/2023 30.1 78 480 6 13 86.18
1 8/16/2023 29.8 56 688 6.4 14 85.64

Experimental arrangement

A cost-effective real-time hydroponic test bench designed for lettuce cultivation is used an experimental setup for the evaluation process. A nutrient film technique (NFT)-based hydroponic system is employed where plants are grown in channels where nutrient solution is recirculated continuously. A Raspberry Pi 4 (4GB) serves as the edge computing device for data aggregation, pre-processing, model interface and interfacing a local display for visualizing crop health and sensor readings. In current implementation, end-to-end latency is governed by local sensor sampling and on-device inference. It is suited for minute-level control decision.

Environmental and nutrient parameters like pH (pH sensor kit from GrayLogix), electrical conductivity, water temperature (PT100 temperature sensor), humidity and total dissolved solids (TDS) are continuously measured using IoT sensors connected through an ESP32 microcontroller. This utilizes a light weight protocol (such as MQTT/HTTP) for effective data communication.

The obtained sensor measurements are sampled at 5-minute intervals. Meanwhile, crop images are captured periodically at 12-hour interval using Official Raspberry Pi camera Module V2 for growth stage monitoring and visual index extraction.

Actuation is achieved by peristaltic dosing pumps for nutrient replenishment & pH correction and relay-controlled LED grow lights operated on fixed photoperiod schedule (16 h ON/8 hour OFF) for lighting and spraying units. The nutrient solution is maintained under a recirculating management scheme and is replaced once every 7 days to avoid ion balance and salt accumulation. The schematic of the proposed model in component view is given in Fig. 5.

Fig. 5.

Fig. 5

Schematic of the proposed system.

Interms of software, the Raspberry Pi is operated on Raspberry Pi OS (64-bit) running on Python-based control scripts. Similarly, PyTorch with PyTorch Geometric is used for training the OMSA-GNN model. NumPy and Pandas are utilized for data handling and pre-processing. This real-time hardware-software configuration enabled with closed-loop adaptive nutrient management cycle is used for validating the feasibility of developed model in practical smart farming applications in aeroponic and hydroponic systems. For the evaluation process, a batch size of 32 is used for stability maintenance. Other details include, learning rate of 0.001, epochs of 100 with early stopping based on validation loss, Adam as basic optimizer and Mean Squared Error (MSE) for regression. Table 4 below displays the run-time characteristics of the system, where emphasis is put on the efficiency of the on-device inferencing and off-line optimization of the model.

Table 4.

Real-time execution and model details.

Category Parameter Specification
Real-Time Operation Execution Mode Model inference on Raspberry Pi
Optimization ISSA used offline (before deployment)
Sampling Interval 5–10 min
Response Time Within sampling interval
Model Characteristics Graph Type Local sensor-level connections
Processing Lightweight GNN model

The ISSA hyperparameter tuning algorithm is performed offline while training the model. The running model performs only the OMSA-GNN model which is trained to reduce overhead time in order to make decisions in the real time in the sampling period. The inference time of the deployed model is observed to be within the sampling interval, confirming the feasibility of real-time implementation in a closed-loop agricultural system.

The physical placement of the hydroponic system can be modeled as a graph whereby each sensor forms a node in the network based on its location on the nutrient path. The adjacency matrix for such a graph will then take the form of a constant graph based on the physical topology. This ensures that dynamic restructuring of the graph does not take place hence minimizing computational complexity.

Results and interpretation

As the part of evaluation process, performance is measured during both training and validation phase interms of accuracy and loss. The results are illustrated in Figs. 6 and 7. In Fig. 6, both learning curves stabilize at around 89–91% showing strong generalization. As the gap between two curves is minimal, there is no significant overfitting issue seen in the methodology. Similarly, upon interpretation of Fig. 7, the loss decreases and converges near 0.08–0.1 indicating good learning ability. Unlike accuracy, validation loss closely follows training loss confirming model robustness.

Fig. 6.

Fig. 6

Training vs. Validation accuracy.

Fig. 7.

Fig. 7

Learning curve of evaluation process.

Likewise, the scatter plot in Fig. 8 shows that the predicted growth days strongly align with actual growth. The points are concentrated along the diagonal confirming high prediction reliability.

Fig. 8.

Fig. 8

Predicted vs. actual crop growth.

The feature correlation heatmap of developed OMSA-GNN with ISSA optimizer is depicted in Fig. 9. Growth days are strongly correlated with TDS (0.79) and temperature (0.68). Humidity shows a moderate positive correlation of 0.62 but negative correlation is observed in pH (−0.5) representing imbalanced growth reduction.

Fig. 9.

Fig. 9

Feature correlation heatmap of OMSA-GNN.

Further, the model is evaluated in 5 different metrics like Root Mean Square Error (RMSE), MAE and R2 score, nutrient use efficiency (NUE) and Biomass Yield Improvement. RMSE, MAE and R2 are computed as a unified predictive model and are particularly linked to regression performance of OMSA-GNN-ISSA model. It helps in estimation of key continuous state variables like nutrient concentration and crop growth indicators across different growth phases. The outcome of analysis is given in Figs. 10 and 11. RMSE is the measure of standard deviation of prediction errors indicating how far predictions deviate from the true values. Similarly, MAE computes average magnitude of absolute prediction errors providing an interpretable view of dosing accuracy. A R2 score explains the proportion of variance in crop growth which the model successfully accounts for. Form the plot in Fig. 10, it can be seen that RMSE value remain consistently low ranging from 0.32 to 0.36 in all three phases. The MAE ranges from 0.21 to 0.25 and R2 score significantly remains high 0.89–0.91 indicating stable predictive performance of general model rather than parameter-specific or subset models.

Fig. 10.

Fig. 10

Performance of developed framing model.

Fig. 11.

Fig. 11

Nutrient efficiency and yield improvement of OMSA-GNN approach.

Likewise, NUE and biomass yield improvement is system-level outcome metrics that are used for accessing effectiveness of control decisions. NUE quantifies how the applied nutrients are absorbed and used by the plants effectively. In the present study, NUE is computed as an aggregate measure averaged across primary macronutrients present in a hydroponic solution. The solution comprises of nitrogen (N), phosphorus (P) and Potassium (K) which are indirectly monitored by TDS and EC measurements. The values remain high (85–87%) in training, validation and testing demonstrating minimal wastage and maximized uptake by the proposed dosing strategy. Also, biomass yield improvement is a measure of percentage increase in fresh biomass weight at harvest compared to baseline rule-based nutrient dosing approach, averaged across multiple growth cycles. The plot in Fig. 11 shows a consistent yield improvement of approximately 14–15% across all three evaluation stages. Through this, positive impact of optimized nutrient control on crop productivity is demonstrated by proposed approach.

In the developed approach, Improved Sparrow Search Algorithm is used for fine-tuning parameters. As the part of evaluation, a convergence analysis is done with other optimizers like PSO, Genetic Algorithm (GA) and SSA. From Fig. 12, it is evident that the employed ISSA algorithm outperformed traditional optimizers by attaining lower error value faster. Also, its faster convergence ability highlights its use in real-time agricultural systems.

Fig. 12.

Fig. 12

Comparison of different optimization techniques.

An ablation study is also performed on the proposed methodology and the result is shown in Fig. 13. The plot gives the contribution of each component used in the approach where compared to individual performance, best results are encountered when the model is considered as a whole. The ablation outcome confirms the superiority of multi-scale modelling and ISSA optimization in improving accuracy and efficiency.

Fig. 13.

Fig. 13

Ablation study results.

Interms of yield distribution, the introduced OMSA-GNN with ISSA optimizer produced higher median biomass yield compared to static dosing and baseline OMSA-GNN alone. Ablation study in Fig. 14 presents the box plot which is constructed from yields obtained over n = 30 plants per method across multiple growth cycles. The plot represents median, interquartile range (IQR) and minimum-maximum values. The overlap observed in distribution is due to natural biological variability. This outcome highlights improved yield consistency and robustness of OMSA-GNN with ISSA model in nutrient management.

Fig. 14.

Fig. 14

Yield distribution analysis of different approaches.

When employing or developing an application or approach for smart farming or agriculture, it is essential to take account of attributes or features that are suited for smoother and reliable operation in real-time scenario. In the developed OMSA-GNN with ISSA technique, attributes like TDS, temperature, pH level, humidity and growth days are taken into account. From the feature importance analysis in Fig. 15, it can be seen that TDS (0.28) and temperature (0.25) are influential factors for nutrient prediction. Next, pH level with 0.22 plays a crucial role followed by humidity and growth days.

Fig. 15.

Fig. 15

Significance of features considered in OMSA-GNN with ISSA.

To further justify and prove the superiority of OMSA-GNN with ISSA optimizer, an assessment is made with the recent models discussed in the literature review: GA-SVR19, DNN20, ResNet-5021 and XGBoost25. The comparison is made on three metrics like RMSE, MAE, & R2 score and the results are illustrated in Fig. 16. The suggested approach dominates other techniques interms of all metrics with low values (RMSE − 0.025, MAE-0.027) and highest value in R2 score (0.985) proving its ability in capturing complex independencies while ISSA fine-tunes nutrient dosing for robustness.

Fig. 16.

Fig. 16

Comparison of proposed with recent models in literature review.

Finally, OMSA-GNN with ISSA is compared with baseline neural architectures such as Convolutional Neural Network (CNN), Graph Neural Network (GNN), ANN, DNN, ResNet-50, VGG16, VGG19, RF and XGBoost based on three pre-dominant metrics. CNN is a specialized type of neural network which is designed for processing grid-like data like images. Through convolutional layers for extracting spatial features, it is widely used for computer vision tasks. Likewise, ANN is a computational model inspired by human brain behavior. It comprises of interconnected neurons in the form of layers for regression and classification tasks. Finally, DNN is a neural model with multiple hidden layers. It helps in learning complex patterns from data.

From results in Fig. 17, it is evident that the proposed hybrid smart farming approach outperformed all the baseline techniques in all three metrics indicating superior error minimization in nutrient and growth prediction. Whereas, models like ANN & CNN show high RMSE demonstrating weaker ability in capturing multivariate dependencies. Followed by OMSA-GNN, VGG16 and ANN yielded high MAE values. Interms of R2 score, classical architectures struggle with low value of 0.91 due to their difficulties in handling hydroponic/aeroponic environment. Whereas, developed model prove superior with 0.985 followed by RF with competitive R2 score of 0.97.

Fig. 17.

Fig. 17

Analysis of OMSA-GNN with different neural networks.

Limitations and Future aspect of OMSA-GNN with ISSA optimizer

At present, the current evaluation uses a lettuce-specific dataset with limited environmental variability. These further needs incorporation of evaluating the model against multi-crop, multi-location datasets pertaining to hydroponic and aeroponic plants for testing the model for robustness against different soilless systems. Similarly, the developed OMSA-GNN with ISSA approach is a complex architecture with high computational overhead that is not optimal for low-resource devices. To overcome this, edge-optimized pruning and quantization techniques can be integrated for latency reduction and real-time deployment. To accomplish this, structured/unstructured pruning of GNN layers and attention weights can be done. Likewise, to make lightweight architecture, heavy GNN layers can be replaced with effective alternatives. However, detailed latency benchmarking and fault-tolerance mechanisms like redundancy and failover are not explicitly employed. Finally, as the current validation is done under a controlled dataset simulation and with preliminary small-scale setup, large-scale validation is yet to be done. Also, future extensions will incorporate systematic latency analysis, recovery & lightweight fault-detection mechanisms and secure communication protocols for robustness improvement in large-scale real-time deployments.

Conclusion

This study successfully developed and implemented the OMSA-GNN framework, a bio-inspired multi-scale adaptive graph neural network designed to address the critical risks of nutrient instability and resource scarcity in controlled-environment agriculture. By integrating IoT-driven data and visual plant indices serving as proximal remote sensing inputs the proposed system establishes a robust early warning mechanism for physiological crop stress. Experimental results demonstrate that the ISSA-optimized GNN model significantly outperforms traditional linear and static dosing models, achieving high accuracy in forecasting growth trajectories even under fluctuating microclimatic conditions.

From a risk management perspective, the OMSA-GNN framework offers a scalable solution to mitigate the impact of natural hazards, such as soil degradation and climate-induced water scarcity, which increasingly threaten urban food system reliability. By transforming raw sensor data into actionable intelligence, the system reduces the vulnerability of urban agricultural systems to environmental shocks. The proposed framework, while validated in a controlled environment, demonstrates potential for extension to geospatially distributed urban agriculture systems under climate variability. Further research may investigate optimization methods, including quantization, weights pruning, and model execution via code generation, for example, through TorchScript, C++, etc. Future work may also consider dynamic graph adaptation to handle sensor failures or changing flow conditions.

Author contributions

All authors are contributed equally to the conception and design of the study, data collection and analysis, implementation of machine learning algorithms, interpretation of results, and drafting of the manuscript.

Data availability

The datasets used and/or analyzed during the current study are available in the Kaggle repository, https://www.kaggle.com/datasets/jurijsruko/lettuce/data.

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.Lakhiar, I. A. et al. Soilless agricultural systems: Opportunities, challenges and applications for enhancing horticultural resilience to climate change and urbanization. Horticulturae11(6), 568 (2025). [Google Scholar]
  • 2.Mahrous, T. & Abd-Elkader, A. M. Soilless Techniques and Innovative. Beyond Rain-The Future of Irrigation in a Changing Climate: The Future of Irrigation in a Changing Climate, 71. (2025).
  • 3.Vatistas, C., Avgoustaki, D. D. & Bartzanas, T. A systematic literature review on controlled-environment agriculture: How vertical farms and greenhouses can influence the sustainability and footprint of urban microclimate with local food production. Atmosphere13 (8), 1258 (2022). [Google Scholar]
  • 4.Verdoliva, S. G. Investigation of new techniques to improve quality and resource use efficiency in soilless protected horticulture. (2021).
  • 5.http://books.irri.org/9810427425_content.pdf
  • 6.Ghiat, I. CO2 Enrichment Driven Model Predictive Control: A Novel Approach for Precision Agriculture in Greenhouses Located in Hyper-Arid Regions (Doctoral dissertation, Hamad Bin Khalifa University (Qatar)). (2023).
  • 7.Shi, Y., Han, L., Zhang, X., Sobeih, T., Gaiser, T., Thuy, N. H., … Ewert, F. (2025).Deep Learning Meets Process-Based Models: A Hybrid Approach to Agricultural Challenges.arXiv preprint arXiv:2504.16141.
  • 8.Reza, M. N. et al. Trends of soil and solution nutrient sensing for open field and hydroponic cultivation in facilitated smart agriculture. Sensors25(2), 453 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Jiang, L., Xu, B., Husnain, N. & Wang, Q. Overview of agricultural machinery automation technology for sustainable agriculture. Agronomy15(6), 1471 (2025). [Google Scholar]
  • 10.Pradhan, S. & Sahoo, B. Enhancing Water Efficiency in Modern Farming: Innovations for Sustainable Agriculture. (2024).
  • 11.Hramov, A. E. et al. Artificial intelligence and complex networks meet natural sciences. Eur. Phys. J. Spec. Top.10.1140/epjs/s11734-025-01844-0 (2025). [Google Scholar]
  • 12.Chapman, A. D. Neural networks (The Autodidact’s Toolkit, 2023).
  • 13.Mienye, I. D. & Swart, T. G. A comprehensive review of deep learning: Architectures, recent advances and applications. Information15 (12), 755 (2024). [Google Scholar]
  • 14.Wan, K., He, J. & Shi, X. Construction of high accuracy machine learning interatomic potential for surface/interface of nanomaterials—a review. Adv. Mater.36(22), 2305758 (2024). [DOI] [PubMed] [Google Scholar]
  • 15.Brunner, D., Legat, C. & Seebacher, U. Towards Next Generation Data-Driven Management: Leveraging Predictive Swarm Intelligence to Reason and Predict Market Dynamics. In Collective Intelligence (152–203). CRC. (2024).
  • 16.Dahane, A., Benameur, R., Kechar, B. & Benyamina, A. An IoT based smart farming system using machine learning. In 2020 International symposium on networks, computers and communications (ISNCC) (pp. 1–6). IEEE. (2020), October.
  • 17.Ahsan, M. et al. Deep learning models to determine nutrient concentration in hydroponically grown lettuce cultivars (Lactuca sativa L). Sustainability14(1), 416 (2021). [Google Scholar]
  • 18.Ather, D. et al. Selection of smart manure composition for smart farming using artificial intelligence technique. J. Food Qual.2022(1), 4351825 (2022). [Google Scholar]
  • 19.Chen, D., Zhang, J., Zhang, Z., Wan, X. & Hu, J. Analyzing the effect of light on lettuce Fv/Fm and growth by machine learning. Sci. Hortic.306, 111444 (2022). [Google Scholar]
  • 20.Mokhtar, A. et al. Using machine learning models to predict hydroponically grown lettuce yield. Front. Plant Sci.13, 706042 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Åström, O., Hedlund, H. & Sopasakis, A. Machine-learning approach to non-destructive biomass and relative growth rate estimation in aeroponic cultivation. Agriculture13 (4), 801 (2023). [Google Scholar]
  • 22.Gowtham, R. & Jebakumar, R. A machine learning approach for aeroponic lettuce crop growth monitoring system. In International Conference on Intelligent Sustainable Systems (pp. 99–116). Singapore: Springer Nature Singapore. (2023).
  • 23.Akkem, Y., Biswas, S. K. & Varanasi, A. Smart farming using artificial intelligence: A review. Eng. Appl. Artif. Intell.120, 105899 (2023). [Google Scholar]
  • 24.Holzinger, A., Fister, I., Kaul, H. P. & Asseng, S. Human-centered AI in smart farming: Toward agriculture 5.0. IEEE Access12, 62199–62214 (2024). [Google Scholar]
  • 25.Rajendiran, G. & Rethnaraj, J. Optimizing lettuce crop yield prediction in an indoor aeroponic vertical farming system using IoT-integrated machine learning regression models. Rev. Intell. Artif. 38 (3), 825–836 (2024).
  • 26.Fuentes-Peñailillo, F., Gutter, K., Vega, R. & Silva, G. C. New generation sustainable technologies for soilless vegetable production. Horticulturae10 (1), 49 (2024). [Google Scholar]
  • 27.Gourshettiwar, P. & Reddy, K. T. V. Advancements in Hydroponics (A Review of Machine Learning and IoT Innovations, 2024).
  • 28.Amuthadevi, C. et al. Aeroponics Techniques for Improved Farming Using Artificial and Deep Learning techniques. In Utilizing Aeroponics Techniques for Improved Farming (81–118). IGI Global Scientific Publishing. (2025).
  • 29.Sharmin, S., Hossan, M. T. & Uddin, M. S. A review of machine learning approaches for predicting lettuce yield in hydroponic systems. Smart Agric. Technol. 11, 100925, (2025).
  • 30.Shalash, O., Métwalli, A., Elhefny, A., Rezk, N., El Gohary, F., El Hennawy, O., …Hassanen, M. Enhancing Hydroponic Farming with Machine Learning: Growth Prediction and Anomaly Detection. Available at SSRN 5079228.
  • 31.Dataset Source. https://www.kaggle.com/datasets/jurijsruko/lettuce/data

Associated Data

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

Data Availability Statement

The datasets used and/or analyzed during the current study are available in the Kaggle repository, https://www.kaggle.com/datasets/jurijsruko/lettuce/data.


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

RESOURCES