A facility crop water and fertilizer demand prediction method and system based on machine learning

By constructing a multi-source data network and a meta-learning framework, combined with a causal discovery module, dynamic prediction and regulation of water and fertilizer demand for facility crops were achieved. This solved the problems of cross-crop generalization and real-time response in traditional water and fertilizer management, and improved the interpretability and adaptability of the model.

CN123137084APending Publication Date: 2026-11-20YUNNAN HANQIAN AGRI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611644482.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-23
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Traditional water and fertilizer management methods in facility crop production suffer from problems such as difficulty in cross-crop generalization, weak model interpretability, difficulty in parameter calibration, lack of real-time response capability, and lack of rolling optimization capability.

Method used

A multi-source data acquisition network of root zone-canopy-environment was constructed, and a meta-learning framework was used to predict water and fertilizer demand. Combined with causal discovery and counterfactual reasoning modules, a model predictive controller was used to realize the coordinated dynamic regulation of water and fertilizer.

Benefits of technology

It enables the prediction of water and fertilizer demand across crops and environments, improves the interpretability and real-time response capability of the model, and adapts to the dynamic changes in facility environment and crop growth status.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137084A_ABST
    Figure CN123137084A_ABST
Patent Text Reader

Abstract

The application provides a facility crop water and fertilizer demand prediction method and system based on machine learning, relates to the fields of intelligent agriculture and precise irrigation and fertilization technology, and is used for solving the problem that traditional water and fertilizer management depends on experience threshold, EC / pH value or a single crop model; the application acquires crop state characteristics by collecting multi-source data, adopts a deep learning image inversion algorithm, constructs a meta-learning state prediction model, couples a causal module with the prediction model, takes the coupled meta-learning state prediction model as a counterfactual prediction engine, performs counterfactual reasoning on candidate water and fertilizer strategies on a causal graph, outputs yield and water and fertilizer utilization efficiency prediction values under each candidate strategy, constructs a target function according to the prediction values, takes facility environment and water and fertilizer supply capacity as constraint conditions, and solves a water and fertilizer supply sequence of a future preset period in a rolling manner; and the application provides a facility crop water and fertilizer demand prediction method which can fuse multiple data and support dynamic closed-loop regulation and control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of smart agriculture and precision irrigation and fertilization technology, and in particular to a method and system for predicting the water and fertilizer requirements of facility crops based on machine learning. Background Technology

[0002] In greenhouse crop production, water and fertilizer management directly affects yield, quality, and water and fertilizer use efficiency. Traditional water and fertilizer management often relies on empirical thresholds, EC / pH values, or single-crop models, which have the following problems: First, the water and fertilizer requirements vary greatly among different crops, at different growth stages, and under different greenhouse environments, making it difficult for single models to generalize across crops; second, while pure data-driven models have high predictive accuracy, their interpretability is weak, making it difficult to quantify the causal effects of water and fertilizer measures; third, mechanistic models have many parameters, are difficult to calibrate locally, and cannot respond to dynamic changes in the greenhouse environment in real time; fourth, existing systems mostly use open-loop or simple threshold control, lacking rolling optimization and online adaptive capabilities. Summary of the Invention

[0003] The main objective of this invention is to overcome the aforementioned deficiencies in the prior art. This invention provides a machine learning-based method for predicting water and fertilizer demand of facility crops. By constructing a multi-source data acquisition network of "root zone-canopy-environment", a meta-learning framework is adopted to achieve cross-crop water and fertilizer demand prediction. Causal discovery and counterfactual reasoning modules are introduced to quantify the causal effects of water and fertilizer measures. Furthermore, model predictive control algorithms and dual predictors are used to achieve coordinated dynamic regulation of water and fertilizer, adapting to the dynamic changes in facility environment and crop growth status.

[0004] This invention provides a machine learning-based method for predicting the water and fertilizer requirements of greenhouse crops, comprising the following steps: S100: Collect meteorological data, root zone substrate physicochemical data, crop canopy phenotypic images, and water and fertilizer management records within the facility, and preprocess the collected data to construct a standard dataset; S200. A deep learning image inversion algorithm based on a global self-attention mechanism is used to invert and generate crop state features from the collected data. The crop state features include leaf area index, aboveground biomass, and canopy coverage. S300. Construct and train a meta-learning state prediction model. Take the standard dataset and crop state features as input, construct a dynamic spatiotemporal heterogeneous graph according to crop type, growth stage and facility environment, and use leaf area index, aboveground biomass and yield as output for training. At the same time, construct a causal module and complete the coupling between the causal module and the meta-learning state prediction model. S400. The trained meta-learning state prediction model and the crop mechanism model are combined to form a predictor; the model prediction controller uses the coupled meta-learning state prediction model as a counterfactual prediction engine to perform counterfactual reasoning on the causal graph for candidate water and fertilizer strategies, output the predicted values ​​of yield and water and fertilizer utilization efficiency under each candidate strategy, and construct an objective function accordingly. With facility environment and water and fertilizer supply capacity as constraints, the water and fertilizer supply sequence for the future preset period is solved in a rolling manner.

[0005] Specifically, the deep learning image inversion algorithm based on the global self-attention mechanism described in S200 includes: The crop canopy phenotypic image is segmented into multiple image blocks. Linear projection is performed on each image block and positional encoding is added to obtain an image block sequence. The image patch sequence is input into the multi-head self-attention layer. The global dependency between each image patch is calculated through query, key, and value projection matrices. After softmax normalization, the weighted sum is obtained to get the self-attention output. The self-attention output is input into the feedforward neural network, and after residual connection and layer normalization, the crop state features obtained by inversion are output.

[0006] Specifically, the training meta-learning state prediction model in S300 includes: Construct multiple crop-environment combinations of meta-training tasks, each task containing a support set and a query set; The adaptive update of the base model parameters is calculated on the support set to obtain the task-specific parameters; The predictive performance of task-specific parameters is evaluated on the query set, and the meta-learner parameters are optimized by gradient descent. Repeat the above process until the meta-learner converges to obtain the trained meta-learning state prediction model. Then, based on a small number of labeled samples of the target crop, the adaptive predictor is fine-tuned to adapt the model to the specific crop and facility environment.

[0007] Specifically, S300 constructs a causal module and couples the causal module with the meta-learning state prediction model, including: Causal discovery is performed based on the S100 standard dataset. A causal graph is constructed with water and fertilizer management measures as treatment variables, environmental factors as covariates, crop status as mediating variables, and yield and water and fertilizer use efficiency as outcome variables. The causal graph is used as a structural prior to constrain the loss function of the meta-learning state prediction model through causal regularization terms, thus completing the coupling between the causal module and the meta-learning state prediction model. The causal findings include: Water and fertilizer management measures are defined as treatment variables, environmental factors as covariates, crop status as mediating variables, and yield and water and fertilizer use efficiency as outcome variables. A causal discovery algorithm based on a structural causal model is used to identify directed edges between variables in a standard dataset and construct a causal graph. The backdoor or frontdoor criterion is used to identify causal effects and estimate the average treatment effects of water and fertilizer management on crop status and yield.

[0008] Specifically, the loss function for using causal graphs as structural priors to constrain meta-learning state prediction models through causal regularization terms includes: Encode the dependencies between variables in the causal graph as causal regularization terms; The causal regularization term is added to the training loss of the meta-learning state prediction model so that the model learns a representation that conforms to causal relationships. The prediction loss and causal regularization term are jointly optimized until the model converges, thus completing the coupling between the causal module and the meta-learning state prediction model.

[0009] Specifically, the rolling solution of the model predictive controller described in S400 includes: The state variables are defined as leaf area index, aboveground biomass, substrate water content, nitrate nitrogen, available phosphorus, and available potassium; Define the control variables as irrigation amount, nitrogen application amount, phosphorus application amount, and potassium application amount; The objective function is constructed by a weighted combination of maximizing yield and maximizing water and fertilizer use efficiency; With constraints of facility environment and water and fertilizer supply capacity, the optimal water and fertilizer supply sequence within a future preset time period is solved by using quadratic programming or swarm intelligence optimization algorithms. Only the control variables for the first time period are executed, and then re-optimized based on the latest observation data in the next time period.

[0010] Specifically, in S400, the trained meta-learning state prediction model and the crop mechanism model are combined to form a predictor, specifically through weighted fusion, including: Obtain the prediction outputs of the crop mechanism model and the meta-learning state prediction model for the same state, respectively; The fusion weights are adaptively adjusted based on the prediction errors of the two models on the historical validation set. The predicted outputs of the two models are fused using a weighted average method to serve as the future state prediction for the model predictive controller. When the prediction error of a certain model continues to increase, its fusion weight is reduced.

[0011] Another embodiment of the present invention provides a machine learning-based system for predicting the water and fertilizer requirements of greenhouse crops, comprising: Data Acquisition Unit: Collects meteorological data, root zone substrate physicochemical data, crop canopy phenotypic images, and water and fertilizer management records within the facility, and preprocesses the collected data to construct a standard dataset; Data processing unit: Employs a deep learning image inversion algorithm based on a global self-attention mechanism to invert and generate crop state features from the acquired data. These crop state features include leaf area index, aboveground biomass, and canopy coverage. Model building and training unit: Construct and train the meta-learning state prediction model, taking the standard dataset and crop state features as input, constructing a dynamic spatiotemporal heterogeneous graph according to crop type, growth stage and facility environment, and using leaf area index, aboveground biomass and yield as output for training; at the same time, construct the causal module and complete the coupling between the causal module and the meta-learning state prediction model. Prediction Unit: The predictor is composed of the trained meta-learning state prediction model and the crop mechanism model; the model prediction controller uses the coupled meta-learning state prediction model as the counterfactual prediction engine, performs counterfactual reasoning on the causal graph for candidate water and fertilizer strategies, outputs the predicted values ​​of yield and water and fertilizer utilization efficiency under each candidate strategy, constructs the objective function, and solves the water and fertilizer supply sequence for the future preset period under the constraints of facility environment and water and fertilizer supply capacity.

[0012] In another aspect, the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a method for predicting the water and fertilizer requirements of facility crops based on machine learning.

[0013] In another aspect, the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements a method for predicting the water and fertilizer requirements of facility crops based on machine learning.

[0014] As can be seen from the above description of the present invention, compared with the prior art, the present invention has the following beneficial effects: This invention proposes a method for predicting water and fertilizer demand of facility crops based on machine learning. By collecting multi-source data, the method uses a deep learning image inversion algorithm to obtain crop state features, constructs a meta-learning state prediction model, couples the causal module with the prediction model, and uses a model prediction controller to predict the water and fertilizer supply sequence, adapting to the dynamic changes in facility environment and crop growth status. Attached Figure Description

[0015] Figure 1 A flowchart of a machine learning-based method for predicting water and fertilizer requirements of facility crops, provided in an embodiment of the present invention; Figure 2 A structural diagram of a machine learning-based water and fertilizer demand prediction system for facility crops provided in an embodiment of the present invention; Figure 3A schematic diagram illustrating an embodiment of an electronic device provided by an embodiment of the present invention; Figure 4 This is a schematic diagram of an embodiment of a computer-readable storage medium provided in this invention. Detailed Implementation

[0016] The present invention will be further described below through specific embodiments.

[0017] This invention proposes a method for predicting water and fertilizer demand of facility crops based on machine learning. By collecting multi-source data, the method uses a deep learning image inversion algorithm to obtain crop state features, constructs a meta-learning state prediction model, couples the causal module with the prediction model, and uses a model prediction controller to predict the water and fertilizer supply sequence, adapting to the dynamic changes in facility environment and crop growth status.

[0018] like Figure 1 This invention provides a machine learning-based method for predicting the water and fertilizer requirements of greenhouse crops, comprising the following steps: Step S100: Collect meteorological data, root zone substrate physicochemical data, crop canopy phenotypic images and water and fertilizer management records within the facility, and preprocess the collected data to construct a standard dataset; Data collection includes: (1) Meteorological sensors: deployed at representative locations within the facility to collect data such as air temperature, air humidity, light intensity, photosynthetically active radiation, CO2 concentration, and wind speed. The data collection frequency is once every 15 minutes to 1 hour.

[0019] (2) Root zone sensors: Placed in the cultivation substrate or soil, arranged in layers of 0~20 cm, 20~40 cm, and 40~60 cm, to collect data such as water content, electrical conductivity, pH value, nitrate nitrogen, available phosphorus, available potassium, and organic matter content. The sampling frequency is once every 15 minutes to 1 hour.

[0020] (3) Canopy phenotyping camera: Use an RGB camera or RGB-D camera, fixed above the crop canopy, and collect canopy images at preset time intervals. The collection frequency is once every 1 to 3 days, and the image resolution is not less than 1024×1024 pixels.

[0021] (4) Water and fertilizer management records: record irrigation amount, fertilizer amount, fertilizer type, nitrogen, phosphorus and potassium ratio, irrigation method, fertilization date, etc.

[0022] Basic data preprocessing includes: time alignment, outlier removal, missing value imputation, and standardization; Outlier removal: Outliers are removed using the 3σ criterion or the interquartile range method; Missing value imputation: linear interpolation, spline interpolation, or K-nearest neighbor interpolation are used; Time alignment: Resample data from different frequencies to a uniform time step, such as 1 hour or 1 day; Standardization: Use min-max normalization or Z-score standardization; Data augmentation: Performing enhancement operations on image data, such as rotation, flipping, and brightness adjustment.

[0023] In addition, feature selection and dimensionality reduction of the data also include: (1) Using the SHAP value combined with the sequential forward selection method, a subset of features that are strongly correlated with crop water and fertilizer requirements is selected from the original feature set; (2) A recursive variance inflation factor optimization feature selection method is adopted to reduce feature redundancy and multicollinearity; (3) Standardize or normalize the selected features; (4) Use principal component analysis or autoencoder to reduce the dimensionality of high-dimensional features.

[0024] The recursive variance inflation factor optimization feature selection method includes: Calculate the Pearson correlation coefficient among all variables. When the correlation coefficient between two features exceeds 0.9, delete the variable that is more correlated with other variables as a whole. Calculate the variance inflation factor (VIF) for each feature: VIF i = 1 / (1 - R i 2 ); Among them, R i 2 The coefficient of determination is obtained by performing a regression with the i-th feature as the dependent variable and the remaining features as independent variables. Gradually remove the features with the highest VIF and recalculate the VIF values ​​of the remaining features until the VIF of all features is less than 10.

[0025] The processing of the crop canopy phenotypic images includes: (1) Background removal: The background is removed using the Segment Anything model or a threshold segmentation method based on the super green index; (2) Feature extraction: Convolutional neural networks or self-supervised contrastive learning models based on SimCLR are used to extract canopy image features; (3) Feature fusion: The extracted image features are fused with meteorological data, matrix physicochemical data and management records to form a multi-source feature fusion, and then input into the meta-learning framework.

[0026] The formula for calculating the super-green index is as follows: ExG = 2g - r - b Where r, g, and b are the normalized red, green, and blue channel values.

[0027] The self-supervised contrastive learning model can adopt the SimCLR framework, including data augmentation, an encoder, a projector head, and a contrastive loss function. The encoder can be ResNet50, ResNet152, EfficientNetV2, Swin Transformer, or ViT. The fine-tuning structure can employ a single fully connected layer, two fully connected layers, or a fully connected layer plus a multi-head self-attention mechanism.

[0028] Step S200: Using a deep learning image inversion algorithm based on a global self-attention mechanism, crop state features are generated from the acquired data. These crop state features include leaf area index, aboveground biomass, and canopy cover. Specifically, this includes: (1) Image segmentation and embedding: The crop canopy phenotypic image is segmented into multiple image blocks, and each image block is linearly projected and a positional code is added to obtain an image block sequence.

[0029] (2) Multi-head self-attention calculation: The image patch sequence is input into the multi-head self-attention layer. The global dependency relationship between each image patch is calculated through query, key, and value projection matrices. After softmax normalization, the weighted sum is obtained to obtain the self-attention output. The multi-head self-attention mechanism can globally capture the dependency relationship between features of any two image patches and deeply mine the complex nonlinear mapping relationship between image features and crop state attributes.

[0030] (3) Feedforward network and output: The self-attention output is input into the feedforward neural network, and after residual connection and layer normalization, the crop state features obtained by inversion are output.

[0031] Crop state characteristics include leaf area index, aboveground biomass, and canopy cover. In a preferred embodiment, the deep learning image inversion algorithm employs the Vision Transformer image inversion algorithm.

[0032] The processing of crop canopy phenotypic images also includes a background removal step: background removal is performed using the Segment Anything model or a threshold segmentation method based on the supergreen index to improve inversion accuracy.

[0033] The super green index is calculated as follows: after normalizing the RGB image, the super green index image is obtained by subtracting the red and blue channel values ​​from twice the green channel value. Then, the crop canopy and background are separated by threshold segmentation.

[0034] Step S300: Construct and train a meta-learning state prediction model. Take the standard dataset and crop state features as input, construct a dynamic spatiotemporal heterogeneous graph according to crop type, growth stage and facility environment, and use leaf area index, aboveground biomass and yield as output for training. At the same time, construct a causal module and complete the coupling between the causal module and the meta-learning state prediction model. Construct a causal module and couple it with the meta-learning state prediction model, specifically including: Causal discovery is performed based on standard datasets. A causal graph is constructed with water and fertilizer management measures as treatment variables, environmental factors as covariates, crop status as mediating variables, and yield and water and fertilizer use efficiency as outcome variables. The causal graph is used as a structural prior to constrain the loss function of the meta-learning state prediction model through causal regularization terms, thus completing the coupling between the causal module and the meta-learning state prediction model. The task encoder employs a Transformer-based sequence encoding structure. Inputs include crop type, growth stage, facility type, and environmental conditions; outputs a task embedding vector of uniform dimension. Specifically: Crop species are encoded using either one-hot encoding or embedded encoding; The growth stages are divided into seedling stage, vegetative growth stage, reproductive growth stage, and maturity stage, and embedded coding is performed. The facility types and environmental conditions were standardized. The above encodings are concatenated and input into the Transformer encoder to obtain the task embedding vector.

[0035] The adaptive predictor uses a multilayer perceptron or a lightweight gradient boosting tree as the base model. The training of the meta-learning state prediction model includes: (1) Construct multiple crop-environment combinations of meta-training tasks, each task containing a support set and a query set; (2) Calculate the adaptive update amount of the base model parameters on the support set to obtain the task-specific parameters; (3) Evaluate the prediction performance of task-specific parameters on the query set and optimize the meta-learner parameters by gradient descent; (4) Repeat the above process until the meta-learner converges to obtain the trained meta-learning state prediction model. (5) Then, based on a small number of labeled samples of the target crop, the adaptive predictor is fine-tuned to make the model adapt to the specific crop and facility environment.

[0036] The base model can be random forest, support vector regression, XGBoost, LightGBM, CatBoost, multilayer perceptron, etc. The loss function can be mean squared error, mean absolute error, or Huber loss.

[0037] In the application phase, for the target crop, only a small number of labeled samples are needed to quickly fine-tune the base model through the support set, achieving generalized predictions across crops and facility environments.

[0038] The construction of the dynamic spatiotemporal heterogeneous graph includes: constructing a graph structure by spatial location and physical association of sensor nodes, meteorological stations, and image inversion feature grids at different depths. Node features include soil physicochemical data, meteorological data, crop status characteristics, and historical management records. Edges represent the spatial adjacency or physical association between nodes.

[0039] Causal findings include: Water and fertilizer management measures are defined as treatment variables, environmental factors as covariates, crop status as mediating variables, and yield and water and fertilizer use efficiency as outcome variables. A causal discovery algorithm based on a structural causal model is used to identify directed edges between variables in a standard dataset and construct a causal graph. The backdoor or frontdoor criterion is used to identify causal effects and estimate the average treatment effects of water and fertilizer management on crop status and yield.

[0040] The causal discovery algorithm can employ PC algorithm, FCI algorithm, GES algorithm, or a neural network-based causal discovery method. Backdoor adjustment eliminates the influence of confounding factors by introducing a set of adjustment variables that satisfy the backdoor criterion.

[0041] Using causal graphs as structural priors and constraining meta-learning of state prediction models through causal regularization terms, the loss function includes: Encode the dependencies between variables in the causal graph as causal regularization terms; The causal regularization term is added to the training loss of the meta-learning state prediction model so that the model learns a representation that conforms to causal relationships. The prediction loss and causal regularization term are jointly optimized until the model converges, thus completing the coupling between the causal module and the meta-learning state prediction model.

[0042] By using causal regular coupling, the meta-learning state prediction model not only learns the statistical associations in the data, but also learns representations that conform to causal relationships, thereby improving the model's interpretability and generalization ability.

[0043] S400. The trained meta-learning state prediction model and the crop mechanism model are combined to form a predictor; the model prediction controller uses the coupled meta-learning state prediction model as a counterfactual prediction engine to perform counterfactual reasoning on the causal graph for candidate water and fertilizer strategies, output the predicted values ​​of yield and water and fertilizer utilization efficiency under each candidate strategy, and construct an objective function accordingly. With facility environment and water and fertilizer supply capacity as constraints, the water and fertilizer supply sequence for the future preset period is solved in a rolling manner.

[0044] (1) Definition of state space: State variables include leaf area index, aboveground biomass, substrate water content, nitrate nitrogen, available phosphorus, and available potassium; The controlled variables include irrigation amount, nitrogen application rate, phosphorus application rate, and potassium application rate; Disturbance variables include meteorological data, radiation, temperature, etc.

[0045] (2) Construction of objective function: The objective function is constructed by weighted combination of maximizing yield and maximizing water and fertilizer utilization efficiency, while taking into account water and fertilizer costs and environmental risks.

[0046] (3) Constraints: Irrigation volume constraint: 0 ≤ Irrigation volume ≤ Maximum irrigation capacity; Fertilizer application constraints: 0 ≤ nitrogen application rate ≤ maximum nitrogen application rate, 0 ≤ phosphorus application rate ≤ maximum phosphorus application rate, 0 ≤ potassium application rate ≤ maximum potassium application rate; Substrate moisture content constraint: SW min ≤ SW ≤ SW max ; Where SW is the substrate moisture content, SW min It is the set minimum substrate moisture content, SW max It is the maximum set value for the substrate moisture content.

[0047] Environmental constraints: Temperature, humidity, CO2 concentration, etc., must be within suitable ranges.

[0048] (4) Rolling optimization: Using a future preset time period (e.g., 7 days) as the prediction time domain and 1 day or 1 hour as the control step size, the optimal water and fertilizer supply sequence is solved by quadratic programming or swarm intelligence optimization algorithm. Only the control values ​​for the first time period are executed; The system is then re-optimized based on the latest observation data to form a closed-loop control.

[0049] The swarm intelligence optimization algorithm can be particle swarm optimization, genetic algorithm, sand cat swarm optimization algorithm, etc.

[0050] The predictor weighted fusion includes: Obtain the prediction outputs of the crop mechanism model and the meta-learning state prediction model for the same state, respectively; The fusion weights are adaptively adjusted based on the prediction errors of the two models on the historical validation set. The predicted outputs of the two models are fused using a weighted average method to serve as the future state prediction for the model predictive controller. When the prediction error of a certain model continues to increase, its fusion weight is reduced.

[0051] The crop mechanism model can be selected from EU-Rotate_N, WOFOST, DSSAT, APSIM, AquaCrop, etc., to simulate the crop growth process and output leaf area index, aboveground biomass and yield prediction values.

[0052] In addition, the method also includes: executing water and fertilizer supply for the current period and collecting new data, triggering online incremental learning through concept drift detection, updating the meta-learning state prediction model and / or causal graph parameters, and using the updated model for the next round of prediction and regulation.

[0053] Among them, concept drift detection triggers online incremental learning in the following ways: The distribution of prediction error is monitored using a sliding window or exponentially weighted moving average method. Calculate the mean, variance, or divergence of the prediction error; When the statistical characteristics of the prediction error exceed a preset threshold, it is determined that concept drift has occurred. The newly collected samples are added to the training set, and the meta-learning state prediction model is updated online using an incremental learning algorithm. During the update process, flexible weight consolidation or experience replay strategies are used to prevent catastrophic forgetting; The updated model and causal graph parameters are used for prediction and regulation in the next round of S3 to S4.

[0054] like Figure 2 Another embodiment of the present invention provides a machine learning-based system for predicting the water and fertilizer requirements of greenhouse crops, comprising: Another embodiment of the present invention provides a machine learning-based system for predicting the water and fertilizer requirements of greenhouse crops, comprising: Data Acquisition Unit 210: Collects meteorological data, root zone substrate physicochemical data, crop canopy phenotypic images, and water and fertilizer management records within the facility, and preprocesses the collected data to construct a standard dataset; Data processing unit 220: Employs a deep learning image inversion algorithm based on a global self-attention mechanism to invert and generate crop state features from the acquired data. The crop state features include leaf area index, aboveground biomass, and canopy coverage. Model building and training unit 230: Constructs and trains a meta-learning state prediction model, taking standard datasets and crop state features as inputs, constructing a dynamic spatiotemporal heterogeneous graph according to crop type, growth stage and facility environment, and using leaf area index, aboveground biomass and yield as outputs for training; at the same time, it constructs a causal module and completes the coupling between the causal module and the meta-learning state prediction model. Prediction Unit 240: The trained meta-learning state prediction model and crop mechanism model form a predictor; the model prediction controller uses the coupled meta-learning state prediction model as a counterfactual prediction engine, performs counterfactual reasoning on the causal graph for candidate water and fertilizer strategies, outputs the predicted values ​​of yield and water and fertilizer utilization efficiency under each candidate strategy, constructs the objective function, and solves the water and fertilizer supply sequence for the future preset period under the constraints of facility environment and water and fertilizer supply capacity.

[0055] In another aspect, the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a method for three-dimensional reconstruction and monitoring of railway structures using multi-view images from an unmanned aerial vehicle (UAV).

[0056] like Figure 3 As shown, an embodiment of the present invention provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, it implements the steps of a machine learning-based method for predicting the water and fertilizer requirements of facility crops provided in this embodiment of the present invention.

[0057] In practical implementation, when the processor 320 executes the computer program 311, it can achieve... Figure 1 Any of the corresponding implementation methods in the embodiments.

[0058] Since the electronic device described in this embodiment is a device used to implement a data processing device in the embodiment of the present invention, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in the embodiment of the present invention. Therefore, how the electronic device implements the method in the embodiment of the present invention will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of the present invention is within the scope of protection of the present invention.

[0059] Please see Figure 4 , Figure 4 This is a schematic diagram of an embodiment of a computer-readable storage medium provided in this invention.

[0060] like Figure 4 As shown, this embodiment provides a computer-readable storage medium 400, on which a computer program 411 is stored. When the computer program 411 is executed by a processor, it implements a machine learning-based method for predicting the water and fertilizer requirements of facility crops provided in this embodiment of the invention. In practical implementation, when the computer program 411 is executed by the processor, it can achieve the following: Figure 1Any of the corresponding implementation methods in the embodiments.

[0061] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0062] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0063] This invention proposes a method for predicting water and fertilizer demand of facility crops based on machine learning. By collecting multi-source data, the method uses a deep learning image inversion algorithm to obtain crop state features, constructs a meta-learning state prediction model, couples the causal module with the prediction model, and uses a model prediction controller to predict the water and fertilizer supply sequence, adapting to the dynamic changes in facility environment and crop growth status.

[0064] The above are merely specific embodiments of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial modifications made to the present invention using this concept shall be considered as infringing upon the protection scope of the present invention.

Claims

1. A method for predicting water and fertilizer requirements of greenhouse crops based on machine learning, characterized in that, Includes the following steps: S1. Collect meteorological data, root zone substrate physicochemical data, crop canopy phenotypic images, and water and fertilizer management records within the facility, and preprocess the collected data to construct a standard dataset; S2. A deep learning image inversion algorithm based on a global self-attention mechanism is used to invert and generate crop state features from the collected data. The crop state features include leaf area index, aboveground biomass, and canopy coverage. S3. Construct and train a meta-learning state prediction model. Take the standard dataset and crop state features as inputs, construct a dynamic spatiotemporal heterogeneous graph according to crop type, growth stage and facility environment, and use leaf area index, aboveground biomass and yield as outputs for training. At the same time, construct a causal module and complete the coupling between the causal module and the meta-learning state prediction model. S4. The trained meta-learning state prediction model and the crop mechanism model are combined to form a prediction controller. The model prediction controller uses the coupled meta-learning state prediction model as a counterfactual prediction engine to perform counterfactual reasoning on the causal graph for candidate water and fertilizer strategies, and outputs the predicted values ​​of yield and water and fertilizer utilization efficiency under each candidate strategy. Based on this, an objective function is constructed, and the water and fertilizer supply sequence for the future preset period is solved in a rolling manner with the facility environment and water and fertilizer supply capacity as constraints.

2. The method according to claim 1, characterized in that, The deep learning image inversion algorithm based on global self-attention mechanism described in S2 includes: The crop canopy phenotypic image is segmented into multiple image blocks. Linear projection is performed on each image block and positional encoding is added to obtain an image block sequence. The image patch sequence is input into the multi-head self-attention layer. The global dependency between each image patch is calculated through query, key, and value projection matrices. After softmax normalization, the weighted sum is obtained to get the self-attention output. The self-attention output is input into the feedforward neural network, and after residual connection and layer normalization, the crop state features obtained by inversion are output.

3. The method according to claim 1, characterized in that, The training meta-learning state prediction model in S3 includes: Construct multiple crop-environment combinations of meta-training tasks, each task containing a support set and a query set; The adaptive update of the base model parameters is calculated on the support set to obtain the task-specific parameters; The predictive performance of task-specific parameters is evaluated on the query set, and the meta-learner parameters are optimized by gradient descent. Repeat the above process until the meta-learner converges to obtain the trained meta-learning state prediction model. Then, based on a small number of labeled samples of the target crop, the adaptive predictor is fine-tuned to adapt the model to the specific crop and facility environment.

4. The method according to claim 1, characterized in that, In S3, a causal module is constructed, and its coupling with the meta-learning state prediction model is completed. Specifically, this includes: Causal discovery is performed based on the standard dataset of S1. A causal graph is constructed with water and fertilizer management measures as treatment variables, environmental factors as covariates, crop status as mediating variables, and yield and water and fertilizer use efficiency as outcome variables. The causal graph is used as a structural prior to constrain the loss function of the meta-learning state prediction model through causal regularization terms, thus completing the coupling between the causal module and the meta-learning state prediction model. The causal findings include: Water and fertilizer management measures are defined as treatment variables, environmental factors as covariates, crop status as mediating variables, and yield and water and fertilizer use efficiency as outcome variables. A causal discovery algorithm based on a structural causal model is used to identify directed edges between variables in a standard dataset and construct a causal graph. The backdoor or frontdoor criterion is used to identify causal effects and estimate the average treatment effects of water and fertilizer management on crop status and yield.

5. The method according to claim 4, characterized in that, Using causal graphs as structural priors and constraining meta-learning of state prediction models through causal regularization terms, the loss function includes: Encode the dependencies between variables in the causal graph as causal regularization terms; The causal regularization term is added to the training loss of the meta-learning state prediction model so that the model learns a representation that conforms to causal relationships. The prediction loss and causal regularization term are jointly optimized until the model converges, thus completing the coupling between the causal module and the meta-learning state prediction model.

6. The method according to claim 1, characterized in that, The rolling solution of the model predictive controller described in S4 includes: The state variables are defined as leaf area index, aboveground biomass, substrate water content, nitrate nitrogen, available phosphorus, and available potassium; Define the control variables as irrigation amount, nitrogen application amount, phosphorus application amount, and potassium application amount; The objective function is constructed by a weighted combination of maximizing yield and maximizing water and fertilizer use efficiency; With constraints of facility environment and water and fertilizer supply capacity, the optimal water and fertilizer supply sequence within a future preset time period is solved by using quadratic programming or swarm intelligence optimization algorithms. Only the control variables for the first time period are executed, and then re-optimized based on the latest observation data in the next time period.

7. The method according to claim 1, characterized in that, In S4, the trained meta-learning state prediction model and the crop mechanism model are combined to form a predictor, specifically through weighted fusion, including: Obtain the prediction outputs of the crop mechanism model and the meta-learning state prediction model for the same state, respectively; The fusion weights are adaptively adjusted based on the prediction errors of the two models on the historical validation set. The predicted outputs of the two models are fused using a weighted average method to serve as the future state prediction for the model predictive controller. When the prediction error of a certain model continues to increase, its fusion weight is reduced.

8. A machine learning-based system for predicting the water and fertilizer requirements of greenhouse crops, characterized in that, include: Data Acquisition Unit: Collects meteorological data, root zone substrate physicochemical data, crop canopy phenotypic images, and water and fertilizer management records within the facility, and preprocesses the collected data to construct a standard dataset; Data processing unit: Employs a deep learning image inversion algorithm based on a global self-attention mechanism to invert and generate crop state features from the acquired data. These crop state features include leaf area index, aboveground biomass, and canopy coverage. Model building and training unit: Construct and train the meta-learning state prediction model, taking the standard dataset and crop state features as input, constructing a dynamic spatiotemporal heterogeneous graph according to crop type, growth stage and facility environment, and using leaf area index, aboveground biomass and yield as output for training; at the same time, construct the causal module and complete the coupling between the causal module and the meta-learning state prediction model. Prediction Unit: The trained meta-learning state prediction model and crop mechanism model form a prediction controller; the model prediction controller uses the coupled meta-learning state prediction model as a counterfactual prediction engine, performs counterfactual reasoning on the causal graph for candidate water and fertilizer strategies, outputs the predicted values ​​of yield and water and fertilizer utilization efficiency under each candidate strategy, constructs the objective function, and solves the water and fertilizer supply sequence for the future preset period under the constraints of facility environment and water and fertilizer supply capacity.

9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-7.