A Farmland Yield Prediction Method and System Based on Heterogeneous Graph Neural Networks

By constructing a multi-source heterogeneous graph structure and introducing a spatiotemporal dependency reinforcement mechanism and a knowledge-guided reasoning mechanism, the problems of information fusion difficulties and insufficient generalization ability in existing farmland yield prediction methods are solved, achieving stronger environmental adaptability and interpretability.

CN121146219BActive Publication Date: 2026-03-06CHINA TOWER CO LTD

Patent Information

Application Number
CN202511705077.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-20
Publication Date
2026-03-06
Estimated Expiration
2045-11-20

AI Technical Summary

Technical Problem

Existing methods for predicting farmland yield based on heterogeneous graph neural networks struggle to balance the triple coupling of spatial dependence, temporal evolution, and semantic association. Furthermore, they lack a unified feature embedding standard and a dynamic adjustment learning strategy, leading to difficulties in information fusion, limited generalization ability, and unstable prediction results.

Method used

A heterogeneous graph structure containing multiple semantic relationships is constructed, node features are updated using a heterogeneous graph neural network, and information on multiple types of neighbor nodes is dynamically aggregated by combining a spatiotemporal dependency reinforcement mechanism and a knowledge-guided reasoning mechanism. Finally, the regression prediction results of farmland yield are output through a prediction module.

Benefits of technology

It improves the environmental adaptability and generalization ability of farmland yield prediction, and enhances the interpretability of the model and its adaptability to actual agricultural production conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121146219B_ABST
    Figure CN121146219B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of agricultural information processing and artificial intelligence, specifically to a method and system for predicting farmland yield based on heterogeneous graph neural networks. The method includes: acquiring multi-source farmland data and extracting initial feature vectors from farmland plot nodes; constructing a heterogeneous graph structure containing multiple semantic relationships based on the initial feature vectors; updating node features of the heterogeneous graph structure using a heterogeneous graph neural network, dynamically aggregating information from multiple types of neighbor nodes through a relationship-aware message passing and edge propagation gating mechanism; enhancing node features using a spatiotemporal dependency reinforcement mechanism and a knowledge-guided reasoning mechanism; and outputting regression prediction results for farmland yield through a prediction module based on the enhanced node features. The aim is to achieve modeling and intelligent yield prediction based on multi-source heterogeneous data in agricultural systems, improving the environmental adaptability, prediction generalization ability, and interpretability of farmland yield prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of agricultural information processing and artificial intelligence, specifically to a method and system for predicting farmland yield based on heterogeneous graph neural networks. Background Technology

[0002] As modern agriculture transforms towards digital, intelligent, and refined management, equipment such as satellite remote sensing, drone monitoring, multispectral imaging, soil sensors, and agricultural meteorological stations have enabled the efficient collection of multi-dimensional data on crop growth status, environmental conditions, and agricultural operations, providing a rich data foundation for crop yield prediction. Traditional methods, primarily based on statistical regression or classical machine learning algorithms such as linear regression and random forests, are effective under structured data conditions but struggle to characterize the complex spatiotemporal relationships and semantic dependencies among multiple elements in agricultural systems. With the development of deep learning technology, convolutional neural networks and recurrent neural networks have been used to process remote sensing imagery and meteorological sequence data, respectively, improving feature extraction capabilities to some extent. However, they still lack the ability to structurally model the complex relationships between heterogeneous entities such as farmland plots, environmental factors, and agricultural operations. Therefore, graph neural networks, due to their natural ability to express relational data, have been gradually introduced into the agricultural field. Heterogeneous graph neural networks further support the modeling of multiple types of nodes and edges, providing a new technical path for constructing multi-dimensional relationships and are gradually being applied to tasks such as pest and disease prediction and agricultural recommendation.

[0003] Currently, existing methods for predicting farmland yield based on heterogeneous graph neural networks are still in their early stages and struggle to meet the needs of actual agricultural production. Firstly, graph structure construction lacks a standardized paradigm; existing solutions are mostly based on experience or single rules, focusing only on certain types of relationships and failing to consider the triple coupling of spatial dependence, temporal evolution, and semantic association, leading to a disconnect between the graph structure and actual agricultural scenarios. Secondly, the heterogeneity of multi-source farmland data results in a lack of unified standards for feature embedding; semantic differences and varying quality of features from different sources make information fusion difficult, thus affecting the effectiveness of node feature representation. Thirdly, existing methods often employ fixed propagation depth and rigid weight allocation strategies, failing to dynamically adjust learning strategies based on the sparse or dense structure of heterogeneous farmland graphs. This limits generalization ability and lacks agricultural knowledge guidance mechanisms. Model training relies excessively on data volume, leading to unstable prediction results in small-sample, low-label scenarios. The black-box nature of these methods makes it impossible to explain the causal logic of yield prediction, hindering support for actual agricultural production decisions. Summary of the Invention

[0004] To achieve modeling and intelligent yield prediction based on multi-source heterogeneous data in agricultural systems, and to improve the environmental adaptability, prediction generalization ability, and interpretability of farmland yield prediction, this invention provides a farmland yield prediction method and system based on heterogeneous graph neural networks. The specific technical solution adopted is as follows:

[0005] The first aspect of the present invention provides a method for predicting farmland yield based on heterogeneous graph neural networks, the method comprising:

[0006] Acquire multi-source farmland data and extract the initial feature vectors of farmland plot nodes;

[0007] Based on the initial feature vector, a heterogeneous graph structure containing multiple semantic relationships is constructed;

[0008] The heterogeneous graph structure is updated with node features using a heterogeneous graph neural network, and information of multiple types of neighbor nodes is dynamically aggregated through a relation-aware message passing and edge propagation gating mechanism.

[0009] The node features are enhanced using spatiotemporal dependency enhancement mechanisms and knowledge-guided reasoning mechanisms;

[0010] Based on the enhanced node features, the regression prediction results of farmland yield are output through the prediction module.

[0011] Furthermore, multi-source farmland data is acquired and initial feature vectors of farmland plot nodes are extracted, including:

[0012] Acquire multi-temporal remote sensing data and extract remote sensing feature vectors representing crop growth status through a spatiotemporal convolutional network;

[0013] Meteorological time series data are acquired, time series are segmented using a sliding window, and meteorological feature vectors representing dynamic changes in meteorology are extracted through statistical aggregation and a time neural network.

[0014] Acquire knowledge graph data in the agricultural field and extract knowledge feature vectors that represent semantic information using graph embedding algorithms;

[0015] Acquire spatial geographic data and combine it with a GIS system to quantitatively extract spatial feature vectors that characterize the spatial geometry of farmland plots;

[0016] The remote sensing feature vector, meteorological feature vector, knowledge feature vector, and spatial feature vector are concatenated to generate the initial feature vector of the farmland plot node.

[0017] Furthermore, based on the initial feature vector, a heterogeneous graph structure containing multiple semantic relationships is constructed, including:

[0018] Spatial adjacency relationships are constructed based on the geographical distance between farmland plots, and a spatial adjacency matrix is ​​established according to a preset distance threshold;

[0019] A time series relationship is constructed based on the state continuity of the same farmland plot at different time points, and a time adjacency matrix is ​​established;

[0020] The matching distance of meteorological time series of different farmland plots is calculated based on the dynamic time warping algorithm, and a meteorological similarity matrix is ​​established according to the preset meteorological similarity threshold.

[0021] Semantic associations are constructed based on the semantic similarity of agricultural knowledge graphs, and a semantic adjacency matrix is ​​established according to a preset semantic similarity threshold.

[0022] Furthermore, the heterogeneous graph structure is updated with node features using a heterogeneous graph neural network, including:

[0023] Attribute-aware processing is performed on each edge in the heterogeneous graph structure to extract edge attribute information, and relevant attributes are extracted according to edge type;

[0024] Extract the local structural features of the neighboring nodes of each edge, including degree centrality and clustering coefficient;

[0025] The attribute information of each edge is fused with the local structural features of the neighboring nodes to generate a weight score for each edge in the current propagation round, which is used to measure the importance of different propagation paths.

[0026] By utilizing the edge propagation gating function, the propagation trust degree is dynamically calculated based on the path context and node features of the edge, which is used to control the flow of information in heterogeneous graphs;

[0027] Based on weighted scores and propagation gating values, the features of multiple types of neighbor nodes are weighted and aggregated to achieve iterative updates of node features.

[0028] Furthermore, the expression for the iterative update of the node features is:

[0029]

[0030] In the formula, Farmland plot nodes In the The updated feature representation of the layer; It is a non-linear activation function; A set of relation types in a heterogeneous graph; Farmland plot nodes In relation types The set of neighboring nodes; For relation type Next, neighboring nodes To farmland plot nodes Attention weights are used to measure the importance of propagation along the path; Let be a learnable weight matrix, representing the first... For relation types in layer graph convolution The transformation parameters are used to map information from different types of neighbors to the target space; Neighboring nodes In the The feature vector of the layer; This is a gate function for edge propagation, used to determine whether information is allowed to travel from neighboring nodes. Propagation to farmland plot nodes ; This is a set of relation types.

[0031] Furthermore, spatiotemporal dependency enhancement mechanisms are used to enhance node features, including:

[0032] Identify nodes with time attributes in heterogeneous graph structures, convert discrete timestamps into continuous vector representations based on positional encoding using sine and cosine functions, and calculate the time-encoded vector of crop growth cycle for farmland plot nodes;

[0033] The time-encoded vector is linearly fused with the original features of the node;

[0034] A spatial similarity matrix is ​​constructed based on the geometric spatial distance, geographical adjacency, and shared resource network structure of farmland plots;

[0035] A spatiotemporal multi-head self-attention mechanism is introduced, which performs weighted aggregation of the features of multi-source neighbor nodes of the target node within a preset time window based on the spatial similarity matrix and the linearly fused temporal encoding vector.

[0036] Furthermore, a spatiotemporal multi-head self-attention mechanism is introduced. Based on the spatial similarity matrix and the linearly fused temporal encoding vector, the features of the target node's multi-source neighbor nodes within a preset time window are weighted and aggregated, including:

[0037] Based on the current state features and time-encoded vectors of the target farmland plot nodes, a query vector is generated by inputting a preset mapping matrix;

[0038] Generate the key vector and value vector of the neighboring nodes based on the feature sequence of the neighboring nodes within a preset time window;

[0039] Calculate the similarity between the query vector and the key vector of each neighbor node to obtain the original attention score;

[0040] A spatial similarity matrix is ​​introduced as an attention guiding factor, and the original attention score is adjusted based on the comprehensive similarity value between the target farmland plot node and each neighbor node in the spatial similarity matrix.

[0041] The adjusted attention scores are normalized to obtain the final attention weights of each neighbor node's value vector;

[0042] The value vectors of the corresponding neighbor nodes are weighted and summed according to the final attention weights to generate a single-head attention aggregation result.

[0043] Repeat the above steps to generate a preset number of independent attention aggregation results. After concatenating all the independent attention aggregation results, process the input-output mapping matrix to obtain the enhanced feature representation of the target farmland plot node after spatiotemporal multi-head self-attention aggregation.

[0044] Furthermore, the node features are enhanced using a knowledge-guided reasoning mechanism, including:

[0045] Construct an agricultural knowledge graph to store agricultural expert rules, crop growth principles, and agricultural operation dependencies in the form of triples;

[0046] The agricultural knowledge graph is embedded as an auxiliary subgraph into a heterogeneous graph structure;

[0047] We use a large language model to process unstructured agricultural text, generate structured triples through named entity recognition and relation extraction, and complete missing edges and weak associations in heterogeneous graph structures.

[0048] Based on prior rules in knowledge graphs, a rule-gating function is constructed to impose logical constraints on the information propagation process of heterogeneous graph neural networks, allowing only paths that conform to agricultural laws to participate in node feature updates.

[0049] Furthermore, based on the enhanced node features, the prediction module outputs regression prediction results for farmland yield, including:

[0050] The enhanced node feature vectors are input into a multilayer perceptron for nonlinear transformation to obtain preliminary yield predictions.

[0051] During model training, a joint optimization strategy is adopted to simultaneously optimize prediction error loss, knowledge consistency loss, and attention sparsity regularization loss.

[0052] The model parameters of the heterogeneous graph neural network and the multilayer perceptron are adjusted based on the joint loss function using the gradient descent algorithm until the joint loss function value converges to a preset range.

[0053] The node features of the farmland plot to be predicted, enhanced by the spatiotemporal dependency reinforcement mechanism and the knowledge-guided reasoning mechanism, are input into the prediction module with adjusted parameters. The final crop yield regression prediction result of the farmland plot is then output through a multilayer perceptron.

[0054] The second aspect of the present invention provides a farmland yield prediction system based on heterogeneous graph neural networks, used to execute the farmland yield prediction method based on heterogeneous graph neural networks described in the first aspect of the present invention, the system comprising:

[0055] The feature extraction module is configured to acquire multi-source farmland data and extract the initial feature vectors of farmland plot nodes;

[0056] The heterogeneous graph construction module is configured to construct a heterogeneous graph structure containing multiple semantic relationships based on the initial feature vector;

[0057] The graph neural network module is configured to use a heterogeneous graph neural network to update the node features of the heterogeneous graph structure and dynamically aggregate information of multiple types of neighbor nodes through a relation-aware message passing and edge propagation gating mechanism.

[0058] The enhancement processing module is configured to enhance node features using a spatiotemporal dependency enhancement mechanism and a knowledge-guided reasoning mechanism;

[0059] The yield prediction module is configured to output regression prediction results of farmland yield based on the enhanced node features.

[0060] The present invention has the following beneficial effects:

[0061] This invention provides a farmland yield prediction method based on heterogeneous graph neural networks. By acquiring multi-source farmland data and constructing a heterogeneous graph structure that integrates multiple semantic relationships, it achieves a unified representation of spatial, temporal, and semantic multi-dimensional relationships in the farmland system, thus possessing stronger environmental adaptability and prediction generalization ability. Furthermore, by employing a heterogeneous graph neural network combined with a relationship-aware message passing and edge propagation gating mechanism, it dynamically aggregates information from multiple types of neighbor nodes to update node features, effectively capturing the complex interactive relationships between farmland elements and solving the problems of rigid structure and lack of targeted information aggregation in existing models. By introducing a spatiotemporal dependency enhancement mechanism and a knowledge-guided reasoning mechanism to perform dual enhancement processing on node features, it not only solves the deficiency of existing methods that cannot model the dynamic changes in farmland node states over time based solely on static feature methods, but also improves the model's adaptability to dynamic environmental changes and logical reasoning ability in agricultural scenarios. Finally, based on the enhanced node features, the prediction module outputs regression prediction results for farmland yield. Compared with existing technologies, this method has stronger generalization, interpretability, and adaptability to actual agricultural production conditions. Attached Figure Description

[0062] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 This is a flowchart illustrating a method for predicting farmland yield based on heterogeneous graph neural networks, as provided in an embodiment of the present invention.

[0064] Figure 2 This is a schematic diagram of the architecture of a farmland yield prediction method based on heterogeneous graph neural networks provided in an embodiment of the present invention.

[0065] Figure 3 A line graph of statistical data for a prediction module provided in one embodiment of the present invention;

[0066] Figure 4 A scatter plot of statistical data for a prediction module provided in one embodiment of the present invention;

[0067] Figure 5 This is a statistical data kernel density plot of a prediction module provided in one embodiment of the present invention;

[0068] Figure 6 This is a schematic diagram of the structure of a farmland yield prediction system based on heterogeneous graph neural networks, provided in an embodiment of the present invention. Detailed Implementation

[0069] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a farmland yield prediction method and system based on heterogeneous graph neural networks proposed according to the present invention. In the following description, different "one embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0070] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0071] The following description, in conjunction with the accompanying drawings, details the specific scheme of a farmland yield prediction method and system based on heterogeneous graph neural networks provided by this invention.

[0072] Please see Figure 1 and Figure 2 This document illustrates a flowchart and architectural diagram of a method for predicting farmland yield based on heterogeneous graph neural networks, according to an embodiment of the present invention. The method includes:

[0073] Step S100: Obtain multi-source farmland data and extract the initial feature vectors of farmland plot nodes;

[0074] Step S100 specifically includes:

[0075] Step S110: Acquire multi-temporal remote sensing data, and extract remote sensing feature vectors representing crop growth status through a spatiotemporal convolutional network; for multi-temporal remote sensing data, first determine the geographical location range of the target farmland plot, and based on this range, acquire a multi-temporal remote sensing image sequence covering the complete crop growth cycle; The remote sensing image sequence of each farmland plot is represented as follows: , Indicates the first A plot of farmland in Remote sensing images at any given time; This represents the total number of data acquisitions. Multi-temporal remote sensing image sequences are input into a spatiotemporal convolutional network to extract static image features characterizing crop growth status during the crop growth period, such as vegetation indices NDVI and EVI, spectral features, and texture patterns, generating a remote sensing feature vector. , For the first Remote sensing feature vectors of individual farmland plots The vector dimension is preset based on the number of extracted remote sensing features; the remote sensing feature vector can effectively reflect the growth status of farmland plots at different growth stages.

[0076] Step S120: Acquire meteorological time series data, segment the time series using a sliding window, and extract meteorological feature vectors representing dynamic changes in meteorology through statistical aggregation and a time neural network; for meteorological information, collect the first... The meteorological time series data corresponding to the geographical location of each farmland plot are represented as follows: , Indicates the first A plot of farmland in The system collects a set of meteorological indicators for each time period, including daily average temperature, precipitation, wind speed, and radiation intensity. A sliding window approach is then used to segment the time series data, and statistical aggregation and a temporal neural network (LSTM) are employed to extract the dynamic patterns of these changes, encoding them into meteorological feature vectors. , For the first Meteorological feature vectors of individual farmland plots The vector dimension is preset based on the number of extracted meteorological features;

[0077] Step S130: Obtain agricultural knowledge graph data, and extract knowledge feature vectors representing semantic information using graph embedding algorithms; transform the semantic information related to the target farmland plots in the agricultural knowledge graph, such as crop types, soil categories, fertilization and irrigation management strategies, into low-dimensional embedding vectors using graph embedding algorithms. This is used to represent the agricultural semantic features possessed by the node. For the first The knowledge feature vector of each farmland plot The vector dimension is preset based on the number of extracted knowledge features;

[0078] Step S140: Acquire spatial geographic data and combine it with a GIS system to quantitatively extract spatial feature vectors representing the spatial geometry of farmland plots; collect the latitude, longitude, elevation, slope, and water accessibility of farmland plots, and combine them with a GIS system to quantify and extract spatial geometric feature vectors. , For the first Spatial feature vectors of farmland plots The vector dimension is preset based on the number of extracted spatial features;

[0079] Step S150: Concatenate the remote sensing feature vector, meteorological feature vector, knowledge feature vector, and spatial feature vector to generate the initial feature vector of the farmland plot node, represented as:

[0080]

[0081] In the formula, This represents a vector concatenation operation, where the initial feature vector of the node has a dimension of . ; For the first Initial feature vectors of each farmland plot; This is a remote sensing feature vector; This is a meteorological feature vector; For knowledge feature vectors; For spatial feature vectors;

[0082] This embodiment addresses the challenge of directly integrating diverse farmland data from multiple sources—multi-temporal remote sensing, meteorological time series, agricultural knowledge graphs, and spatial geography—by employing feature extraction methods tailored to their respective data characteristics. The extracted multimodal features are then concatenated into a unified-dimensional initial feature vector for farmland plot nodes. This approach resolves the issue of significant structural differences in multi-source farmland data, ensuring that the initial feature vector comprehensively covers four core pieces of information: crop growth status, dynamic environmental changes, agricultural semantic relationships, and spatial geographic conditions. This provides a high-quality data foundation for constructing heterogeneous graphs with multiple semantic relationships and achieving accurate node feature updates, thus avoiding subsequent yield prediction biases caused by incomplete information from a single data source.

[0083] Step S200: Based on the initial feature vector, construct a heterogeneous graph structure containing multiple semantic relationships; specifically, the heterogeneous graph is represented as follows: , where the node set Includes all farmland plots, relation type set This includes spatial relationships, temporal relationships, meteorological similarities, and semantic associations. Each relationship corresponds to... Define the adjacency matrix The following conditions must be met: Based on geographical proximity, if two farmland plots share a common edge, are adjacent, or have a spatial distance less than a preset threshold, then a spatial adjacency edge is established.

[0084] Step S200 specifically includes:

[0085] Step S210: Construct spatial adjacency relationships based on the geographical distance between farmland plots, and establish a spatial adjacency matrix according to a preset distance threshold; based on geographical proximity, if two farmland plots share an edge, are adjacent, or have a spatial distance less than a preset threshold, then establish a spatial adjacency edge; specifically, for any two plot nodes... and , , This represents the i-th farmland plot node. Let j be the node representing the j-th farmland plot. After converting latitude and longitude to radians using the Haversine formula, calculate the shortest geographical distance between the two plots. Then, construct an N×N dimensional binary space adjacency matrix, with matrix elements defined as follows:

[0086]

[0087] in, For nodes and Geographical distance; A preset spatial adjacency threshold is used to define the effective range of spatial interaction between plots; For nodes and Spatial adjacency relationship;

[0088] Step S220: Construct a time series relationship based on the continuity of the state of the same farmland plot at different time nodes, and establish a time adjacency matrix; for the state of the same plot at different time nodes, construct cross-time self-connecting edges to represent the temporal changes in crop growth, and the time adjacency matrix is ​​represented as follows:

[0089]

[0090] In the formula, Let represent the temporal relationship between the i-th farmland plot node at time t and time t+1;

[0091] Step S230: Calculate the matching distance of meteorological time series of different farmland plots based on the dynamic time warping algorithm, and establish a meteorological similarity matrix according to a preset meteorological similarity threshold; specifically, for each plot node... Extract complete meteorological time series , For plot nodes The set of meteorological indicators at time t includes daily average temperature, cumulative precipitation, and relative humidity, where T is the total number of data collections; for any two plots... meteorological sequence The DTW (Time-Divergence Wave) algorithm is used to match the meteorological sequences of any two plots. DTW uses dynamic programming to non-linearly stretch the two sequences along the time axis to minimize the overall matching distance, which is represented as the meteorological time series similarity. Finally, plot pairs with a DTW matching distance below a set threshold are considered to have similar meteorological trends, and meteorological similarity edges are added to the graph. The meteorological similarity matrix is ​​represented as follows:

[0092]

[0093] In the formula, For nodes and Meteorological similarity; For nodes and Meteorological time series similarity; The preset meteorological similarity threshold can be adjusted according to regional meteorological fluctuations.

[0094] Step S240: Construct semantic associations based on the semantic similarity of the agricultural knowledge graph, and establish a semantic adjacency matrix according to a preset semantic similarity threshold; the semantic adjacency matrix establishes semantic edges based on the agricultural semantic relationships existing in the knowledge graph, similar planting schemes, and similar fertilization strategies, and the semantic similarity matrix is ​​defined as follows:

[0095]

[0096] In the formula, For nodes and Semantic relationships; Represents a node and The semantic similarity between them is calculated using cosine similarity. and The semantic similarity is such that a larger value indicates that the two plots of land are more similar in semantic attributes. This is the semantic similarity threshold;

[0097] In some embodiments, to avoid feature shifts caused by differences in node degree during subsequent information propagation in heterogeneous graph neural networks, this embodiment performs symmetric normalization on the adjacency matrices of the above four types of relationships. The specific process is as follows:

[0098] For each relation r∈{spatial,temporal,weather,semantic}, construct an adjacency matrix. Same-dimensional angle matrix Its diagonal elements are represented as:

[0099]

[0100] In the formula, For the adjacency matrix The sum of all elements in the i-th row represents the degree of connection of node i under relation r, or the number of spatial neighbors of node i under spatial relation.

[0101] Then, calculate the degree matrix. inverse square root matrix Then, perform symmetric normalization on the adjacency matrix using the following formula to obtain the normalized adjacency matrix. , represented as:

[0102]

[0103] This operation can eliminate the impact of node degree differences on information propagation weights, ensuring that nodes with higher degrees do not excessively dominate the feature updates of their neighbors during the subsequent learning process of heterogeneous graph neural networks.

[0104] In summary, step S200, based on the initial feature vectors of farmland plot nodes generated in step S100, constructs adjacency matrices for four core relationships—spatial adjacency, temporal evolution, meteorological similarity, and semantic association—through steps S210 to S240, respectively. Combined with symmetric normalization, this ultimately forms a structurally complete heterogeneous graph G=(V,E,R). On one hand, this achieves the transformation of multi-source heterogeneous farmland data into node-relationship structured graph data, solving the problem of information bias caused by traditional graph construction relying solely on a single relationship. On the other hand, by adapting the construction methods to the characteristics of each relationship, it ensures that the heterogeneous graph can accurately depict the complex interaction logic of multiple elements in the farmland system. Simultaneously, the symmetric normalization process provides stable input for subsequent node feature updates in the heterogeneous graph neural network, avoiding model bias caused by differences in node degree. Ultimately, this lays a structured data foundation for the environmental adaptability and prediction accuracy of the overall yield prediction method.

[0105] Step S300: Update node features of the heterogeneous graph structure using a heterogeneous graph neural network, and dynamically aggregate information of multiple types of neighbor nodes through a relation-aware message passing and edge propagation gating mechanism. After completing data modeling and heterogeneous graph construction through the above steps, this embodiment introduces a heterogeneous graph neural network modeling method suitable for the fusion of multi-source heterogeneous information in farmland, to adapt to the heterogeneous graph structure in farmland scenarios. Considering the characteristics of multiple types of nodes and edges in the graph, a multi-hop propagation mechanism based on edge type, node type, and path information control is designed to establish a heterogeneous graph neural network. Step S300 specifically includes:

[0106] Step S310: Perform attribute-aware processing on each edge in the heterogeneous graph structure, extract edge attribute information, and extract relevant attributes according to edge type; based on the relation type set defined in step S200, establish a correspondence between edge type and attribute information, extract the geographical distance calculated in step S210 as an edge attribute, extract the difference of continuous time steps in step S220 as an edge attribute, extract the meteorological similarity calculated in step S230 as an edge attribute, and extract the semantic similarity calculated in step S240 as an edge attribute. Then, convert the extracted edge attribute values ​​into fixed-dimensional vectors through linear mapping. That is, the edge In relationship The attribute embedding vector ensures that the attributes of different types of edges can be processed uniformly by the model.

[0107] Step S320: Extract the local structural features of the neighboring nodes of each edge, including degree centrality and clustering coefficient;

[0108] In some embodiments, degree centrality characterizes the density of connections of a neighbor node u under relation r, and can be calculated based on the degree matrix obtained in step S200. During calculation, the degree matrix corresponding to the relation in step S200 is first obtained, and the number of connections of the neighbor node is read from it, i.e., the value of the corresponding neighbor node on the diagonal of the degree matrix, representing the total number of neighbors of that node under the current relation. Then, the maximum number of connections of all nodes under the current relation is counted, and the ratio of the number of connections of the neighbor node to the maximum number of connections is calculated to obtain the normalized degree centrality, with a value ranging from 0 to 1. If the degree centrality is close to 1, it indicates that the neighbor node has more connections to other nodes under the current relation and is a core node within the region.

[0109] In some embodiments, the clustering coefficient characterizes the connection density between the neighbors of a neighboring node u, reflecting the structural consistency of the local region where node u is located. During calculation, first, the total number of neighbors of the neighboring node is determined; then, using the adjacency matrix of the corresponding relationship in step S200, the number of actual edges between these neighbors is counted, i.e., whether there is a connection under this relationship between the neighbors' neighbors; then, the theoretically maximum number of edges that can exist between these neighbors is calculated, i.e., the number of possible connections between any two neighbors; finally, the ratio of the actual number of edges to the maximum number of edges is calculated to obtain the normalized clustering coefficient, which ranges from 0 to 1. If the clustering coefficient is close to 1, it indicates that the neighbors of the neighboring node are closely connected, and the structural consistency of its local region is strong.

[0110] In some embodiments, the calculated degree centrality of neighboring nodes is combined with the clustering coefficient to form a local structural feature vector containing two dimensions, which can ensure subsequent fusion processing with the edge attribute vector.

[0111] Step S330: Fuse the attribute information of each edge with the local structural features of the neighboring nodes to generate a weight score for each edge in the current propagation round, which is used to measure the importance of different propagation paths;

[0112] In some embodiments, for each edge under each type of relationship, the attribute embedding vector of the edge obtained in step S310 is combined with the local structural feature vector of the neighboring node obtained in step S320 to form a fused feature vector; ensuring that the attribute information of the edge and the structural information of the neighboring node are fully integrated, providing a basis for the subsequent weight scoring calculation.

[0113] In some embodiments, the fused feature vector is input into a single-layer fully connected network for processing: first, the fused feature vector is linearly transformed using the dedicated weight parameters corresponding to the current relationship in the network, and then dedicated bias parameters are superimposed; subsequently, the LeakyReLU nonlinear activation function is used to process the transformation result to ensure that the output weight score is non-negative. The final weight score directly represents the importance of the current edge in this round of information propagation. If the weight score is high, it indicates that the edge has a high attribute matching degree (such as high meteorological similarity, strong semantic association) and the local structure of the neighboring nodes is excellent (such as core nodes, strong local consistency), and its corresponding propagation path is more valuable.

[0114] Step S340: Utilize the edge propagation gating function to dynamically calculate the propagation trust degree based on the edge path context and node features, used to control the flow of information in the heterogeneous graph; in this embodiment, for the edge (u,v) under relation r, concatenate the feature vector of the target node v at layer l. The feature vector of neighbor node u at layer l and the edge attribute embedding vector generated in step S310 The gated input vector is obtained; the gated input vector is then mapped to the propagation confidence level through a gating function. , can be represented as:

[0115]

[0116] In the formula: Representation and relation The relevant gating weight vector; express transpose; This represents a vector concatenation operation; Representing an edge In relationship The attribute embedding vectors (such as edge distance, causal strength, etc.) are used. Indicates the activation function; for In relationship The propagation gate value below, A higher value indicates a higher level of trust in the message.

[0117] Step S350: Based on the weighted scores and propagation gate values, perform weighted aggregation of the features of multiple types of neighbor nodes to achieve iterative update of node features;

[0118] In some embodiments, the normalized attention weights, propagation trust, and relation-specific learnable weight matrices are combined to perform weighted aggregation of neighbor features, ultimately updating the node features of the target node v. The iterative update expression is:

[0119]

[0120] In the formula, Farmland plot nodes In the The updated feature representation of the layer; It is a non-linear activation function; A set of relation types in a heterogeneous graph; Farmland plot nodes In relation types The set of neighboring nodes; For relation type Next, neighboring nodes To farmland plot nodes Attention weights are used to measure the importance of propagation along the path; Let be a learnable weight matrix, representing the first... For relation types in layer graph convolution The transformation parameters are used to map information from different types of neighbors to the target space; Neighboring nodes In the The feature vector of the layer; This is a gate function for edge propagation, used to determine whether information is allowed to travel from neighboring nodes. Propagation to farmland plot nodes .

[0121] This embodiment achieves dynamic updates of farmland plot node features through a relationship-aware message passing and edge propagation gating mechanism. On the one hand, by differentiating edge types to extract attributes and fusing neighbor structures to generate weights, it solves the rigid problem of traditional heterogeneous graph neural networks' indiscriminate processing of multiple types of relationships, enabling the model to accurately capture the differentiated impact of different relationships, such as spatial adjacency and meteorological similarity, on node features. On the other hand, by dynamically controlling information propagation through gating functions, invalid or contradictory information in propagation paths that do not conform to agricultural logic can be filtered out, improving the effectiveness of feature updates. At the same time, multi-round iterative aggregation ensures that node features can gradually integrate key information from multiple types of neighbors, providing a high-quality feature foundation for the spatiotemporal dependency reinforcement and knowledge-guided reasoning in the subsequent step S400, ultimately laying the feature support for improving the accuracy and generalization ability of overall yield prediction.

[0122] Step S400: Enhance node features using a spatiotemporal dependency enhancement mechanism and a knowledge-guided reasoning mechanism; based on heterogeneous graph neural networks, to further explore key temporal change trends and spatial dependencies in farmland maps, this embodiment proposes a spatiotemporal dependency enhancement mechanism based on multi-scale dynamic perception. Step S400 specifically includes:

[0123] In some embodiments, a spatiotemporal dependency enhancement mechanism is used to enhance node features, including:

[0124] Step S410: Identify nodes with time attributes in the heterogeneous graph structure, convert discrete timestamps into continuous vector representations based on positional encoding using sine and cosine functions, and calculate the time-encoded vector of the crop growth cycle for farmland plot nodes. Since agricultural production activities are highly dependent on time and space factors, sowing time, fertilization frequency, and weather changes all have a dynamic impact on crop yield. Therefore, this embodiment introduces a knowledge-guided spatiotemporal attention mechanism on top of the heterogeneous graph modeling and propagation mechanism to effectively integrate the time-series information of agricultural activities with the spatial associations between plots.

[0125] In some embodiments, nodes with time attributes in the heterogeneous graph mainly include: meteorological nodes, such as the meteorological record of a plot on a certain day, including temperature, precipitation, and humidity; agricultural operation nodes, such as the time of agricultural activities such as sowing, fertilizing, irrigating, and harvesting; remote sensing nodes, such as features extracted from remote sensing images at a certain time point; and plot status nodes, such as the growth status or stage label of a plot at a certain stage. To enable the model to accurately capture the temporal and periodic patterns of agricultural activities, this invention introduces a positional encoding mechanism based on sine and cosine functions, transforming the original discrete timestamp information into a continuous vector representation that the model can perceive.

[0126] First, nodes containing explicit time information in the heterogeneous graph are selected, such as meteorological nodes recording "temperature on May 10, 2023" with timestamp t=20230510, and agricultural nodes recording "sowing on June 1, 2023" with timestamp t=20230601. The discrete timestamp corresponding to each node is then determined. The timestamp is mapped to a sine-cosine function. 2D continuous vector The values ​​of each dimension can be calculated using the following formula:

[0127]

[0128] In the formula, , The preset encoding dimension; Time-coded vector The Each dimension is calculated using a sine function; Time-coded vector The Each dimension is calculated using the cosine function; This is a dimension index, with values ​​ranging from 0 to... Ensure coverage of all One dimension; The scaling factor varies with the dimension index. The increasing size allows different dimensions to capture the time characteristics of different periods; the encoding uses the periodicity of trigonometric functions to make the vectors of similar timestamps close together and the vectors of timetamps with intervals similar, thus adapting to the seasonal patterns of agricultural production.

[0129] Step S420: Linearly fuse the temporal encoding vector with the original node features; the resulting temporal encoding vector... Combined with the original attributes and characteristics of the node Linear fusion is performed by concatenating vectors and performing linear transformations. The fused feature vector retains the original attributes of the nodes and embeds time information.

[0130] Step S430: Construct a spatial similarity matrix based on the geometric spatial distance, geographical adjacency, and shared resource network structure of farmland plots; in terms of spatial dimension, in order to accurately model the spatial correlation between plots, this embodiment comprehensively considers the following three types of spatial factors:

[0131] Geometric spatial distance: Based on the latitude and longitude coordinates of the center point of the plot, the spatial proximity between different plots is quantified by calculating the Euclidean distance;

[0132] Geographic adjacency: Based on the GIS vector map data of the plot boundaries, determine whether there are direct adjacencies or shared boundaries;

[0133] Shared resource network structure: Analyze whether the plots of land share the same irrigation system, water source access, or agricultural machinery route;

[0134] The above three factors are uniformly encoded to construct a spatial similarity matrix. Each element Indicates land parcel With the plot of land The overall spatial similarity score indicates that a higher value signifies a higher degree of similarity between land parcels. With the plot of land The stronger the spatial correlation, the more it will serve as a guiding factor for subsequent attention mechanisms; this matrix will serve as a guiding factor for graph attention mechanisms, used to dynamically adjust the weight distribution of neighboring nodes during the information propagation stage.

[0135] Step S440: Introduce a spatiotemporal multi-head self-attention mechanism. Based on the spatial similarity matrix and the linearly fused temporal encoding vector, perform weighted aggregation of the multi-source neighbor node features of the target node within a preset time window. Specifically, this includes:

[0136] Based on the current state features and time-encoded vectors of the target farmland plot nodes, a query vector is generated by inputting a preset mapping matrix, as follows:

[0137]

[0138] In the formula, The query vector of the land parcel node v at the current time t is usually composed of its current state vector and time embedding. To query the mapping matrix; This is the temporal embedding vector of the plot node, used to encode the agricultural cycle (sowing period, growing period, harvesting period, etc.) at that moment. : Represents vector concatenation operation; For the plot node v in The feature vector at time step;

[0139] Generate key vectors and value vectors for neighboring nodes based on their feature sequences within a preset time window. The key vector is represented as... , representing the set of neighboring nodes In recent The key vector within the time window is used to calculate attention weights; the value vector is represented as... : Represents the value vector of the same neighbor set within the same time window, used for feature aggregation;

[0140] Calculate the similarity between the query vector and the key vector of each neighbor node to obtain the original attention score;

[0141] A spatial similarity matrix is ​​introduced as an attention guiding factor, and the original attention score is adjusted based on the comprehensive similarity value between the target farmland plot node and each neighbor node in the spatial similarity matrix.

[0142] The adjusted attention scores are normalized to obtain the final attention weights of each neighbor node's value vector;

[0143] The value vectors of the corresponding neighbor nodes are weighted and summed according to the final attention weights to generate a single-head attention aggregation result.

[0144] Repeat the above steps to generate a preset number of independent attention aggregation results. After concatenating all the independent attention aggregation results, process the input-output mapping matrix to obtain the enhanced feature representation of the target farmland plot node after spatiotemporal multi-head self-attention aggregation.

[0145] In the specific node representation update process, this invention introduces a spatio-temporal multi-head attention (ST-MHA) mechanism based on spatio-temporal dependency awareness, which integrates the temporal encoding and spatial similarity of land parcel nodes to achieve weighted modeling of different spatio-temporal segments.

[0146] The entire spatiotemporal modeling process can be expressed by the following formula:

[0147]

[0148] In the formula: Represents land parcel nodes In time The feature vector is the core representation of the current prediction task; For neighboring nodes in the time window The set of key vectors within; For neighboring nodes in the time window The set of value vectors within; This represents the multi-head attention mechanism, used to extract important neighbor features from different spatiotemporal contexts. Its expression is:

[0149]

[0150] In the formula, To focus on the number of heads, It is the dimension of each head. It is the output mapping matrix; The query vector for plot node v at the current time t is typically composed of its current state vector and time embedding. For nodes The set of neighbors includes nodes such as spatially adjacent plots, related crops, weather or agricultural operations; Let i be the query submatrix of the i-th attention head; Let be the transpose of the key matrix of the i-th attention head; This is the submatrix of the values ​​of the i-th attention head;

[0151] Steps S410 to S440 enhance the spatiotemporal expressive power of node features through a spatiotemporal dependency enhancement mechanism: First, discrete timestamps are transformed into continuous vectors using sine and cosine time encoding, accurately capturing the periodicity and temporal sequence of agricultural production; the linear fusion in step S420 enables node features to simultaneously contain attribute information and time identifiers, overcoming the shortcomings of traditional features that ignore temporal dynamics; furthermore, by constructing a spatial similarity matrix, the limitations of single spatial relationship modeling are overcome, making it more consistent with the actual spatial relationships in farmland; finally, based on a spatiotemporal multi-head self-attention mechanism, combined with spatial similarity guidance and multi-time window feature aggregation, nodes can dynamically focus on key spatiotemporal neighbors, strengthening the capture of complex spatiotemporal dependencies. This embodiment injects accurate spatiotemporal contextual information into node features, significantly improving the feature's ability to represent the dynamic process of agricultural production, and providing a more reliable feature foundation for subsequent yield prediction.

[0152] In some embodiments, to enhance the reasoning ability of farmland graph neural network models in weakly supervised and data-sparse scenarios, and to strengthen their structured representation of agricultural patterns and expert experience, this invention introduces a knowledge graph-guided logic propagation mechanism and a Large Language Model (LLM)-assisted structural completion strategy to construct a unified knowledge-enhanced reasoning system. The knowledge-guided reasoning mechanism is used to enhance node features, specifically including:

[0153] Step S450: Construct an agricultural knowledge graph, storing agricultural expert rules, crop growth principles, and agricultural operation dependencies in the form of triples; First, by formalizing knowledge such as agricultural expert rules, crop growth principles, and agricultural operation dependencies into sets of triples, an agricultural knowledge graph is constructed. Agricultural expert rules include fertilization rules, irrigation rules, and pest and disease control rules. Crop growth principles describe the stages and influencing factors of crop growth, mainly including crop growth stages such as sowing, seedling, vegetative growth, and reproductive growth; the influence of key environmental factors such as temperature, light, soil nutrients; and the dependence of agricultural operations, such as fertilization after tillage, adjusting irrigation frequency according to fertilization timing, and pest and disease control operations depending on monitoring results; all three elements are categorized by entity. -relation - Tail body The indexed storage method ensures that the relationships between entities can be quickly queried later, providing data support for subgraph embedding and rule gating.

[0154] Step S460: Embed the agricultural knowledge graph as an auxiliary subgraph into the heterogeneous graph structure; specifically, transform the triples of the knowledge graph into edge relationships of the auxiliary subgraph and merge them with the adjacency matrix of the main heterogeneous graph, so that the edges of the knowledge graph can participate in subsequent information propagation.

[0155] Step S470: Use a large language model to process unstructured agricultural text, generate structured triples through named entity recognition and relation extraction, and complete missing edges and weak relationships in the heterogeneous graph structure. To address issues such as missing edges, unknown relationships, or incomplete structures in the graph structure, this embodiment proposes a structure completion strategy based on a large language model and a rule-guided edge constraint gating propagation mechanism to enhance the structural completeness and logical consistency of the graph neural network in agricultural knowledge scenarios.

[0156] In terms of structural completion, unstructured text resources containing domain knowledge are first collected, including agricultural logs such as field management records, sensor texts such as weather station logs, and agricultural technical documentation such as planting manuals and local agricultural standards. Natural language processing (NLP) is then performed on these texts using a large language model (ChatGLM), primarily including named entity recognition (NER), relation extraction (RE), and entity alignment. This automatically identifies agricultural entities, such as crops, pests and diseases, operational behaviors, and types of agricultural inputs, as well as the relationships between them, such as "dependence," "impact," "applicable to," and "occurring in," thereby generating structured triplet data.

[0157] In some embodiments, entity recognition employs a prompt engineering approach, guiding the language model to generate relational triples with causal or attribute semantics in a format such as "What crop management behaviors and their corresponding conditions are mentioned in the given text?". For example, from the statement "Corn developed leaf spot disease in mid-July, and improved after three days of treatment with chlorothalonil": (corn, disease, leaf spot), (leaf spot disease, treatment method, chlorothalonil), (chlorothalonil, duration of action, three days). This structured knowledge is mapped as new nodes or edges in the graph and integrated into the original farmland graph structure.

[0158] In some embodiments, for the alignment of triples into new nodes or edges in the main heterogeneous graph, if the entity is a new type, such as "leaf spot disease" in the text not being modeled in the main graph, then a "disease and pest node" is added; if the entity already exists but the relationship is missing (such as "reduced sowing after continuous rainfall in June"), then edge relationships are added and the adjacency matrix of the main graph is updated.

[0159] Step S480: Construct a rule-gating function based on prior rules in the knowledge graph to impose logical constraints during the information propagation process of the heterogeneous graph neural network, allowing only paths that conform to agricultural principles to participate in node feature updates. This embodiment introduces a rule-guided edge constraint gating propagation mechanism during the information propagation stage. This mechanism is based on existing prior rules in the agricultural knowledge graph, such as "fertilization should occur after sowing" and "weeding has a positive impact on yield," to construct a propagation constraint template and transform it into an edge gating function in the graph neural network. In graph convolution, each edge is matched with the rule set according to its type, direction, timestamp, and other attributes. Only edges that conform to specific agricultural logic are assigned positive propagation weights; non-matching edges are assigned inhibitory weights or completely masked. This explicit restriction on the propagation path of the graph neural network guides the model to reason along logically meaningful paths.

[0160] This reasoning mechanism can be expressed by the following formula:

[0161]

[0162] In the formula, Represents a node The feature update vector, guided by the knowledge graph, serves as the final representation used for prediction. Represents a node The set of neighbors, including the original heterogeneous graph neighbors and the new neighbors introduced by the knowledge graph; For nodes To the node The attention weight of the information being disseminated reflects the neighbor's... The contribution is defined as:

[0163]

[0164] In the formula, edge type The weight matrix corresponding to (such as "suitable for planting", "growth dependence", "weather effect") is used to model the propagation mode of different semantic relationships; Neighboring nodes The current feature representation; For attention weight vectors, for transpose; This is a weight matrix specific to relation r, used to weight the current features of target node v. Current features of neighbor node u Mapped to the same space;

[0165] Here, the rule-gating function is a logical filtering function extracted from the knowledge graph rule set or LLM structure, defined as follows:

[0166]

[0167] For example, if the knowledge rule base contains the rule "When the temperature is >30℃, fertilization is not considered", then this rule will be triggered when predicting the "high temperature day + fertilization" path. This avoids the dissemination of ineffective or contradictory information.

[0168] Furthermore, if the graph contains missing edges or unmodeled semantic relationships, such as "a farmer's record mentions 'reduced sowing after continuous rainfall in June'", the large language model can extract entities (rainfall, sowing) and actions (reduction) to form new edge relationships and add them to the graph, i.e., construct:

[0169]

[0170] Where h represents the head entity, which is Rain; r represents the relationship between entities, which is Reduces; and t represents the tail entity, which is Sowing. This triple represents the semantic relationship in the agricultural domain: Rain Reduces Sowing. (Adding an edge...) It transforms triples into the edge structure of a heterogeneous graph: the head entity Rain is the starting point of the edge, the tail entity Sowing is the ending point of the edge, and the relation Reduces is the type of the edge. In this way, the semantic relations extracted by the large language model are embedded into the heterogeneous graph, which completes the original missing rainfall-reduction-sowing association in the graph, thereby enhancing the ability of the heterogeneous graph to express agricultural knowledge.

[0171] This embodiment addresses the shortcomings of traditional heterogeneous graph neural networks, such as lack of agricultural priors, incomplete structure, and weak reasoning logic, through a knowledge-guided reasoning mechanism. Structured triples provide interpretable reasoning basis for the model; embedding the knowledge graph as an auxiliary subgraph into the main heterogeneous graph achieves deep integration of "farmland data structure" and "agricultural knowledge structure"; using a large language model to complete missing edges and weak connections in the graph solves the problem of incomplete graph structure caused by data sparsity in real-world scenarios; and rule-based gating functions constrain information propagation paths through agricultural logic, avoiding interference from invalid or contradictory information, while attention weights ensure the contribution of important knowledge neighbors. This embodiment further integrates agricultural knowledge into node features based on spatiotemporal information, significantly improving the model's prediction stability and interpretability in small-sample, low-label scenarios, providing knowledge-enhanced feature support for accurate yield prediction.

[0172] Step S500: Based on the enhanced node features, the regression prediction results of farmland yield are output through the prediction module;

[0173] Step S500 specifically includes:

[0174] Step S510: The enhanced node feature vectors are input into a multilayer perceptron for nonlinear transformation to obtain preliminary yield predictions. To achieve high-precision prediction of crop yields for a plot, this embodiment, after updating the node embeddings in the heterogeneous graph neural network, uses a prediction module based on a multilayer perceptron (MLP) to perform regression modeling on the plot nodes. This prediction module fully utilizes the multi-source information such as agricultural, meteorological, and soil data integrated in the aforementioned heterogeneous graph structure, and combines the embedding vectors obtained through knowledge graph propagation and spatiotemporal attention mechanisms. This vector integrates spatial correlations, temporal dynamics, meteorological influences, semantic attributes, and agricultural knowledge rules of land parcels to deeply model the spatiotemporal characteristics, causal paths, and semantic correlations of yield changes. This approach effectively overcomes yield estimation errors caused by information fragmentation, shallow modeling, and poor generalization ability in traditional models.

[0175] The expression for predicting farmland yield is:

[0176]

[0177] In the formula, For plot nodes Preliminary production forecasts; It is a multilayer perceptron structure containing several nonlinear activation layers, which can effectively learn high-dimensional embedding vectors. The complex nonlinear relationship between output and production volume; For nodes The representation vectors learned in heterogeneous graph networks have incorporated multiple influencing factors such as graph structure propagation, edge type attention, time series modeling, and agricultural knowledge rules. This is a random error term used to model biases caused by unobservable factors, such as extreme weather or recording errors.

[0178] Step S520: During model training, a joint optimization strategy is adopted to simultaneously optimize the prediction error loss, knowledge consistency loss, and attention sparsity regularization loss. To improve prediction accuracy and enhance model structural constraints, this embodiment designs the following joint loss function:

[0179]

[0180] In the formula, This is a joint loss function; it comprehensively considers prediction error, knowledge graph consistency, and attention distribution regularization, thereby improving the model's prediction stability and accuracy from multiple dimensions. For nodes The actual output value is used for supervised learning; This is the first equilibrium hyperparameter; The first and second balancing hyperparameters are used to control the weights of knowledge constraints and attention regularization in the optimization process, and their optimal values ​​can be obtained by tuning the verification set. For the set of farmland plot nodes; joint objective function It consists of the following three parts:

[0181] Prediction error term The value is used to measure the difference between the predicted value and the actual output, and is the core objective of the regression task.

[0182] Knowledge consistency loss item The rationality of the constraint graph embedding in the knowledge graph logic is defined as follows:

[0183]

[0184] In the formula, To traverse all triples in the knowledge graph of step S450; This refers to the head entity, relation, and tail entity triplet in a knowledge graph. For relation type The mapping matrix is ​​used to map the head entity features to the tail entity feature space; For the head entity of the triplet Tail-end entity The embedding vector;

[0185] Attention sparsity regularization This is used to encourage focus and interpretability of attention during graph propagation, and is defined as:

[0186]

[0187] in: Indicates from node to neighboring nodes Attention weights; For nodes The set of neighboring nodes.

[0188] Through the design of the loss function described above, this embodiment can integrate various potential relationships, explicit patterns and temporal factors in farmland structure into a unified prediction framework, which significantly improves the accuracy, stability and interpretability of yield prediction. It is particularly suitable for agricultural yield prediction tasks in multi-plot, multi-crop, and heterogeneous environments.

[0189] Step S530: Using the gradient descent algorithm, adjust the model parameters of the heterogeneous graph neural network and the multilayer perceptron based on the joint loss function until the joint loss function value converges to a preset range. In this embodiment, the parameters to be optimized include the weight matrices and attention mapping matrices of various relationships in the heterogeneous graph neural network, the mapping matrix of relationships in the knowledge graph, the weights and biases of the multilayer perceptron, and the balancing weights in the joint loss function. During the optimization process, the influence of the joint loss on each parameter is first calculated using the backpropagation algorithm, and then the optimizer is used to adjust the parameters according to the influence, gradually reducing the loss value. When the change in loss over multiple consecutive iterations is less than a preset threshold, or when the maximum number of iterations is reached, the model is considered to have converged, and parameter adjustment is stopped.

[0190] Step S540: The node features of the farmland plot to be predicted, enhanced by the spatiotemporal dependency reinforcement mechanism and knowledge-guided reasoning mechanism, are input into the parameter-adjusted prediction module. The final crop yield regression prediction result of the farmland plot is output through a multilayer perceptron. Step S540 uses the converged model to output the final yield prediction result of the farmland plot. First, the feature extraction in step S100, the heterogeneous graph construction in step S200, the graph neural network feature update in step S300, and the spatiotemporal and knowledge enhancement processing in step S400 are repeated for the farmland plot to generate corresponding enhanced features. Then, the enhanced features are input into the parameter-optimized multilayer perceptron, and the final predicted value is obtained through network forward propagation. After being converted into actual yield units, it is output. The prediction results can be found in [reference needed]. Figures 3 to 5 As shown, according to Figure 3 Understandably, the overall fluctuation trend of the predicted yield by the gray line closely matches that of the actual yield by the red line, indicating that the prediction method based on heterogeneous graph neural networks can effectively capture the macroscopic variation of farmland yield with field distribution. This demonstrates the model's accurate ability to identify yield trends at multiple field scales and verifies the effective characterization of spatial, temporal, and semantic relationships of farmland by the heterogeneous graph structure. Figure 4Understandably, the black diagonal line serves as a reference line for the predicted yield equaling the actual yield, used to determine the theoretical boundary of the agreement between the predicted and actual values. If the scatter points fall entirely on this line, the prediction is considered completely accurate. The red fitted line is a linear regression line between the actual and predicted yields, reflecting the linear trend relationship between the two. Its slope and direction reflect the strength of the linear correlation between the predicted and actual values. The scatter points are distributed around the red fitted line and the black diagonal line, indicating a recognizable linear correlation between the predicted and actual yields. This demonstrates that the heterogeneous graph constructed by this method can effectively integrate multi-source information such as spatial adjacency, temporal evolution, semantic association, and agricultural knowledge of farmland, providing structured feature support for yield prediction. The root mean square error (RMSE) is 208.1872; the coefficient of determination (R²) is only 0.2197. Combined with the distribution logic of the scatter plot, this further demonstrates that this method can effectively model yield after integrating multi-source heterogeneous farmland data, proving the role of heterogeneous graph neural networks in learning the complex relationship between multiple factors and yield. Figure 5 Understandably, the high-density blue areas are concentrated in the range of "predicted yield ≈ actual yield ≈ 5200-5400", indicating that the predicted and actual yields for most fields are highly consistent within this range, and the model demonstrates good consistency in yield predictions for most farmland plots. Therefore, Figures 3 to 5 From the perspectives of capturing macro trends and ensuring consistency in predictions across multiple farmland plots, this study verifies that the farmland yield prediction method based on heterogeneous graph neural networks can effectively integrate multi-source heterogeneous information from farmland, accurately depict the macro trends of yield changes, and demonstrate good consistency in yield predictions for most farmland plots. This fully reflects the modeling advantages of heterogeneous graph structures for complex farmland relationships and the learning capabilities of neural networks, providing effective technical support for intelligent farmland yield prediction. This method significantly improves the accuracy, reliability, and interpretability of yield prediction, and is particularly suitable for precise yield prediction tasks in multi-plot, multi-crop, and complex agricultural environments.

[0191] In summary, the farmland yield prediction method based on heterogeneous graph neural networks provided by this invention achieves a unified representation of spatial, temporal, and semantic multidimensional relationships in the farmland system by acquiring multi-source farmland data and constructing a heterogeneous graph structure that integrates multiple semantic relationships. This results in stronger environmental adaptability and predictive generalization ability. Furthermore, by employing a heterogeneous graph neural network combined with a relationship-aware message passing and edge propagation gating mechanism, it dynamically aggregates information from multiple types of neighbor nodes to update node features, effectively capturing the complex interactive relationships between farmland elements and solving the problems of rigid structure and lack of targeted information aggregation in existing models. By introducing a spatiotemporal dependency enhancement mechanism and a knowledge-guided reasoning mechanism to perform dual enhancement processing on node features, it not only solves the deficiency of existing methods that cannot model the dynamic changes in farmland node states over time based solely on static feature methods, but also improves the model's adaptability to dynamic environmental changes and logical reasoning ability in agricultural scenarios. Finally, based on the enhanced node features, the prediction module outputs regression prediction results for farmland yield. Compared with existing technologies, this method has stronger generalization, interpretability, and adaptability to actual agricultural production conditions.

[0192] Please see Figure 6 This illustrates a farmland yield prediction system based on heterogeneous graph neural networks provided by an embodiment of the present invention, used to execute the farmland yield prediction method based on heterogeneous graph neural networks provided by the present invention. The system includes:

[0193] The feature extraction module is configured to acquire multi-source farmland data and extract the initial feature vectors of farmland plot nodes;

[0194] The heterogeneous graph construction module is configured to construct a heterogeneous graph structure containing multiple semantic relationships based on the initial feature vector;

[0195] The graph neural network module is configured to use a heterogeneous graph neural network to update the node features of the heterogeneous graph structure and dynamically aggregate information of multiple types of neighbor nodes through a relation-aware message passing and edge propagation gating mechanism.

[0196] The enhancement processing module is configured to enhance node features using a spatiotemporal dependency enhancement mechanism and a knowledge-guided reasoning mechanism;

[0197] The yield prediction module is configured to output regression prediction results of farmland yield based on the enhanced node features.

[0198] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0199] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A method for crop yield prediction based on a heterogeneous graph neural network, characterized in that, The method comprises: acquiring multi-source farmland data and extracting an initial feature vector of a farmland plot node; based on the initial feature vector, constructing a heterogeneous graph structure containing multiple semantic relationships; using a heterogeneous graph neural network to update the node features of the heterogeneous graph structure, dynamically aggregating the information of multiple types of neighbor nodes through a relationship-aware message passing and edge propagation gating mechanism; enhancing the node features using a spatiotemporal dependency reinforcement mechanism and a knowledge-guided reasoning mechanism, including: identifying nodes with time attributes in the heterogeneous graph structure, converting discrete timestamps into continuous vector representations based on the position encoding of the sine-cosine function, and calculating the time encoding vector of the crop growth cycle of the farmland plot node; linearly fusing the time encoding vector with the original node features; constructing a spatial similarity matrix according to the geometric spatial distance of the farmland plot, the geographical adjacency relationship and the shared resource network structure; introducing a spatiotemporal multi-head self-attention mechanism, and according to the spatial similarity matrix and the linearly fused time encoding vector, weighting and aggregating the features of the multi-source neighbor nodes of the target node within the preset time window; constructing an agricultural knowledge graph to store agricultural expert rules, crop growth principles and agricultural operation dependency relationships in the form of triples; embedding the agricultural knowledge graph as an auxiliary subgraph into the heterogeneous graph structure; processing unstructured agricultural text using a large language model, generating structured triples through named entity recognition and relationship extraction, and supplementing missing edges and weakly related relationships in the heterogeneous graph structure; based on the prior rules in the knowledge graph, constructing a rule gating function to perform logical constraints during the information propagation process of the heterogeneous graph neural network, and only allowing paths that comply with agricultural laws to participate in node feature updating; based on the enhanced node features, outputting a regression prediction result of farmland yield through a prediction module. 2.The crop yield prediction method based on the heterogeneous graph neural network according to claim 1, wherein, acquiring multi-source farmland data and extracting an initial feature vector of a farmland plot node, including: acquiring multi-temporal remote sensing data, extracting remote sensing feature vectors representing crop growth states through a spatiotemporal convolutional network; acquiring meteorological time series data, dividing the time series using a sliding window, and extracting meteorological feature vectors representing dynamic changes in the weather through statistical aggregation and a time neural network; acquiring agricultural knowledge graph data, extracting knowledge feature vectors representing semantic information through graph embedding algorithms; acquiring spatial geographic data, and quantitatively extracting spatial feature vectors representing the spatial geometry of farmland plots in combination with GIS systems; concatenating the remote sensing feature vectors, meteorological feature vectors, knowledge feature vectors and spatial feature vectors to generate the initial feature vector of the farmland plot node. 3.The crop yield prediction method based on the heterogeneous graph neural network according to claim 1, wherein, based on the initial feature vector, constructing a heterogeneous graph structure containing multiple semantic relationships, including: constructing a spatial adjacency relationship based on the geographical distance between farmland plots, and establishing a spatial adjacency matrix according to a preset distance threshold; constructing a time series relationship based on the state continuity of the same farmland plot at different time nodes, and establishing a time adjacency matrix; calculating the matching distance of meteorological time series of different farmland plots based on a dynamic time warping algorithm, and establishing a meteorological similarity matrix according to a preset meteorological similarity threshold; The semantic correlation relationship is constructed based on semantic similarity of an agricultural knowledge graph, and a semantic adjacency matrix is established according to a preset semantic similarity threshold. 4.The crop yield prediction method based on the heterogeneous graph neural network according to claim 1, wherein, The node feature of the heterogeneous graph structure is updated by using a heterogeneous graph neural network, including: Attribute-aware processing is performed on each edge in the heterogeneous graph structure, edge attribute information is extracted, and related attributes are extracted according to the edge type; Local structure features of neighbor nodes of each edge are extracted, including degree centrality and clustering coefficient; The attribute information of each edge and the local structure features of the neighbor nodes are fused to generate a weight score of each edge in the current propagation round, which is used to measure the importance of different propagation paths; A propagation gate function is used to dynamically calculate a propagation trust degree based on the path context of the edge and the node features, which is used to control the flow of information in the heterogeneous graph; The features of the multi-type neighbor nodes are weighted and aggregated according to the weight score and the propagation gate value, and the node feature iterative update is realized. 5.The crop yield prediction method based on the heterogeneous graph neural network according to claim 4, wherein, The expression of the node feature iterative update is: wherein is a farmland plot node is a farmland plot node layer updated feature representation is a nonlinear activation function is a set of relation types in the heterogeneous graph is a farmland plot node is a set of neighbor nodes under the relation type ; is a neighbor node under the relation type ; is an attention weight of the neighbor node to the farmland plot node , used to measure the propagation importance of the path ; is a learnable weight matrix, representing the transformation parameter in the layer graph convolution for the relation type ; is an edge propagation gating function, used to determine whether to allow information to propagate from the neighbor node to the farmland plot node ; is a set of relation types. 6.The crop yield prediction method based on the heterogeneous graph neural network according to claim 1, wherein, A spatio-temporal multi-head self-attention mechanism is introduced, and the multi-source neighbor node features of the target node within a preset time window are weighted and aggregated based on the spatial similarity matrix and the linearly fused time encoding vector, including: A query vector is generated by inputting the current state features of the target farmland plot node and the time encoding vector into a preset mapping matrix; Key vectors and value vectors of the neighbor nodes are generated based on the feature sequences of the neighbor nodes within the preset time window; The similarity between the query vector and each neighbor node key vector is calculated to obtain an original attention score; A spatial similarity matrix is introduced as an attention guide factor, and the original attention score is adjusted according to the comprehensive similarity value of the target farmland plot node and each neighbor node in the spatial similarity matrix; The adjusted attention score is normalized to obtain the final attention weight of each neighbor node value vector; The value vectors of the corresponding neighbor nodes are weighted and summed according to the final attention weight to generate a single-head attention aggregation result; The above steps are repeated to generate a preset number of independent attention aggregation results, which are spliced and input into an output mapping matrix for processing to obtain the enhanced feature representation of the target farmland plot node after spatio-temporal multi-head self-attention aggregation.

7. The crop yield prediction method based on a heterogeneous graph neural network according to any one of claims 1 to 6, wherein, Based on the enhanced node features, a regression prediction result of farmland yield is output by a prediction module, including: The enhanced node feature vector is input into a multi-layer perceptron for non-linear transformation to obtain a preliminary yield prediction value; During model training, a joint optimization strategy is adopted to simultaneously optimize the prediction error loss, the knowledge consistency loss, and the attention sparsity regularization loss; The model parameters of the heterogeneous graph neural network and the multi-layer perceptron are adjusted based on the joint loss function by using a gradient descent algorithm until the joint loss function value converges to a preset range; The node features of the farmland plot to be predicted, which are enhanced by the spatio-temporal dependence reinforcement mechanism and the knowledge-guided reasoning mechanism, are input into the prediction module with adjusted parameters, and the final crop yield regression prediction result of the farmland plot to be predicted is output by the multi-layer perceptron.

8. A farmland yield prediction system based on a heterogeneous graph neural network, characterized by, A system for performing the crop yield prediction method based on the heterogeneous graph neural network of any one of claims 1 to 7, the system comprising: a feature extraction module configured to obtain multi-source farmland data and extract an initial feature vector of a farmland plot node; a heterogeneous graph construction module configured to construct a heterogeneous graph structure containing multiple semantic relationships based on the initial feature vector; a graph neural network module configured to update node features of the heterogeneous graph structure using a heterogeneous graph neural network, dynamically aggregate information of multiple types of neighbor nodes through a relationship-aware message passing and edge propagation gating mechanism; an enhanced processing module configured to enhance the node features using a spatiotemporal dependency reinforcement mechanism and a knowledge-guided reasoning mechanism; a yield prediction module configured to output a regression prediction result of the farmland yield through the prediction module based on the enhanced node features.

Citation Information

Patent Citations

  • Crop yield estimation method based on deep space-time feature joint learning

    CN111027752A

  • Heterogeneous graph embedding method and system based on relation mining

    CN117807275A

Cited By

  • Image recognition and crop yield prediction method for fine management of agriculture

    CN122391900A