Welcome to Smart Agriculture 中文

Smart Agriculture

   

A Greenhouse Temperature and Humidity Prediction Method Based on Adaptive Kalman Filter and GWO-LSTM-attention

CAI Yuqin, LIU Daming(), XU Qin, LI Boyang, LIU Bojie   

  1. School of electronic and electrical engineering, Ningxia University, Ningxia 750000, China
  • Received:2025-06-25 Online:2025-10-13
  • Foundation items:Natural Science Founds, Ningxia University(2024AAC03090)
  • About author:

    CAI Yuqin, E-mail:

  • corresponding author:
    LIU Daming, E-mail:

Abstract:

[Objective] Acquiring valid data is a critical part for establishing accurate greenhouse prediction models. However, simple averaging and weighted averaging are commonly used to process multi-sensor data in current research, but these methods are often ineffective against sensor noise interference. Additionally, greenhouse temperature and humidity exhibit strong coupling characteristics that necessitate coordinated control strategies. Prevailing studies predominantly train separate models for temperature and humidity prediction, which risks generating physically inconsistent results (e.g., simultaneous high temperature and high humidity), using it as the basis for control may lack reliability. Furthermore, the multi-dimensional environmental factor data in greenhouses has the characteristics of large volume and high computational cost. In the training process of the traditional LSTM model, parameters are manually adjusted based on human experience. When dealing with high-dimensional data, the model's convergence is slow and it is prone to getting stuck in local optima. [Methods] To address multi-point data fusion challenges, the traditional Kalman filtering algorithm was improved by dynamically adjusting the process noise covariance (Q) and observation noise covariance (R), while adaptively assigning weights to multiple sensors based on the innovation. This adaptation was achieved by monitoring the innovation sequence—the difference between observed and predicted measurements. Furthermore, the algorithm utilized the innovation covariance to assign adaptive weights to multiple sensors. Sensors with consistently smaller innovations which indicated higher reliability, were assigned greater weights. This mechanism enabled the system to swiftly identify and mitigate the impact of abnormal sensor readings, thereby ensureing robust and accurate fusion of multi-sensor data and providing a reliable foundation for subsequent model training. To address the strong coupling between temperature and humidity and their collaborative control requirements, a multi-output LSTM-attention model was developed for joint temperature-humidity prediction within a unified architecture. This model employed an attention mechanisms to adaptively weight critical environmental factors, thereby resolving physical constraint violations inherent in univariate forecasting approaches. The multi-dimensional nature of greenhouse environmental data often lead to high computational costs during model training. In traditional practices, the hyperparameters of LSTM models were often manually tuned based on experience, a process that was not only inefficient but also prone to suboptimal convergence and local optima traps, especially with high-dimensional data. To overcome this limitation, the grey wolf optimizer (GWO) was integrated to automatically perform hyperparameter optimization search to automatically and efficiently search for the optimal combination of key hyperparameters, such as the number of hidden units, learning rate, and dropout rate. [Results and Discussions] The adaptive Kalman filtering algorithm proposed in this paper achieved mean absolute deviations (MAD) of 1.59℃ and 8.64% for multi-point temperature and humidity fusion, respectively. Compared to the traditional Kalman filter algorithm, these represented reductions of 1.24% and 8.57%. The algorithm enabled swift identification of abnormal sensors and effectively mitigated their impact. When utilizing the fusion results of this algorithm as the model training dataset, the R² values for temperature and humidity predictions reached 98.2% and 99.3%, respectively. This constituted an increase of 4.7 and 4.3 percentage points compared to results obtained using the Kalman filter, demonstrating that the algorithm provided a highly reliable data foundation for model training. Furthermore, the GWO-LSTM-Attention model trained on this data yielded root mean square errors (RMSE) of 0.776 8 and 2.056 4 for temperature and humidity prediction, respectively. Compared to the LSTM and LSTM-Attention time-series prediction models, the temperature RMSE was reduced by 15.6% and 6.6%, while the humidity RMSE saw reductions of 29.2% and 5.7%. This reflects the role of the GWO algorithm in enhancing model generalization capability and convergence efficiency. [Conclusions] The proposed adaptive Kalman fusion algorithm effectively integrates multi-sensor data, demonstrating robustness in handling sensor noise, outliers, and non-stationary environmental fluctuations. For predicting multiple greenhouse environmental factors, the developed GWO-LSTM-attention model provides reliable forecasts across diverse time horizons. This research can provide a highly accurate prediction tool for greenhouse environment control. The combined prediction results could directly support the coordinated control of ventilation and irrigation equipment in the future, thereby reducing energy consumption.

Key words: solar greenhouse, kalman filter, grey wolf optimization algorithm, long short-term memory neural network, attention mechanism

CLC Number: