Fusion spatiotemporal graph network and knowledge enhanced pig farm abortion rate early warning method and system
By constructing a spatiotemporal graph network and using knowledge enhancement methods, combined with multi-source data and graph attention networks, abnormal abortion rates in pig farms can be predicted. This solves the problem of insufficient spatiotemporal correlation and temporal dynamics in existing technologies, and achieves efficient abortion rate early warning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2026-03-31
AI Technical Summary
Existing PRRS risk warning technologies for pig farms fail to effectively capture spatiotemporal correlations, temporal dynamics, and disease specificity, resulting in insufficient accuracy and timeliness of warnings and an inability to effectively predict abnormal abortion rates.
We construct an early warning method that integrates spatiotemporal graph networks and knowledge enhancement. By acquiring multi-source historical data, we build a knowledge graph of PRRS risk, use graph attention networks to learn about risks inside and outside the field, and combine long short-term memory networks to predict abnormal miscarriage rates to generate early warning information.
It enables early warning of abnormal abortion rates in pig farms, improves the accuracy and timeliness of early warning, reduces economic losses, and enhances the efficiency of early warning diagnosis.
Smart Images

Figure CN120996285B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart farming technology, and more specifically, to a method and system for early warning of abortion rates in pig farms that integrates spatiotemporal graph networks and knowledge enhancement. Background Technology
[0002] Porcine reproductive and respiratory syndrome (PRRS), commonly known as blue ear disease, is one of the major diseases threatening the global pig industry. Infection leads to reproductive disorders in sows, particularly causing abnormally high abortion rates and mortality, resulting in significant economic losses for pig farms. Currently, some technologies are attempting to provide early warning and attribution of disease risks in pig farms. For example, some methods use machine learning models to predict the probability or duration of major diseases such as African swine fever and PRRS based on internal production data (such as breeding stock, herd entry, and immunization records), environmental data (such as weather), and historical health data. Other methods introduce knowledge graph technology to construct attribution systems based on biosafety knowledge for tracing virus transmission paths and quantifying risk points, even training large-scale models in small-sample scenarios to improve generalization ability. Further research focuses on the interpretability of risk prediction results, using techniques such as SHAP value analysis to quantify the contribution of various characteristic variables to the risk of disease occurrence.
[0003] However, existing technologies still have significant limitations: First, most methods focus only on data within a single pig farm, neglecting potential risk transmission paths between farms due to geographical proximity or shared management, and lacking modeling of spatial correlations. Second, these methods often emphasize risk assessment at the current or static moment, failing to fully capture the continuity and trends of indicators such as abortion rate over time, while the occurrence and development of PRRS exhibit clear time-dependent characteristics. Third, although knowledge graphs are used for risk attribution, their construction is mostly based on general biosafety frameworks and does not deeply integrate PRRS-specific transmission mechanisms and risk logic, particularly lacking integration with spatiotemporal dynamic changes, resulting in insufficient accuracy and timeliness in early warning scenarios. In summary, existing PRRS risk early warning technologies for pig farms are insufficient in handling spatiotemporal correlations, temporal dynamics, and disease-specific knowledge integration. There is an urgent need for an intelligent early warning method that can simultaneously capture risk transmission relationships inside and outside pig farms, learn historical trend changes, and embed PRRS-related knowledge to achieve more proactive and accurate early warnings of abnormal abortion rates. Summary of the Invention
[0004] To address the aforementioned technical issues, this invention proposes a method and system for early warning of abortion rates in pig farms that integrates spatiotemporal graph networks and knowledge enhancement. This method predicts the probability of abnormal abortion rates due to porcine reproductive and respiratory syndrome (PRRS) in pig farms in the future, provides early warnings for high-risk abortion rates, and reduces the significant economic losses to pig farms caused by abortions resulting from PRRS.
[0005] The first aspect of this invention provides a method for early warning of abortion rate in pig farms that integrates spatiotemporal graph networks and knowledge enhancement, comprising the following steps:
[0006] Acquire multi-source historical data of each pig farm within a preset time step, and construct a knowledge graph of PRRS risk for each pig farm at each historical time t based on the multi-source historical data.
[0007] The knowledge graph of PRRS risk of all pig farms at the same time t is connected according to their respective organizations and geographical locations to form a global spatiotemporal knowledge graph, and the inter-farm relationship topology graph reflecting the relationship between pig farms, organizations and cities is extracted.
[0008] Using a graph attention network, the representation of the internal event subgraph in the knowledge graph of PRRS risk for each pig farm is learned, and an intra-farm embedding with time weights is generated. Using the intra-farm embedding as node features, the graph attention network is used again to learn the representation of the inter-farm relationship topology graph, and an inter-farm embedding with spatial propagation risk is generated.
[0009] After concatenating the inter-farm embeddings of each pig farm with historical abortion rates, the data is input into a long short-term memory network to obtain time-series trends. The output is then simultaneously fed into two parallel task heads to predict the probability of abnormal abortion rate risk and the specific abortion rate value for the next three time windows. When the probability of abnormal abortion rate risk exceeds a threshold, an early warning is triggered.
[0010] In this solution, multi-source historical data of each pig farm within a preset time step is acquired. Based on the multi-source historical data, a knowledge graph of porcine reproductive and respiratory syndrome (PRRS) risk is constructed for each pig farm at each historical time t, including:
[0011] The system presets the early warning date and the time step of the review window. Based on the review window, it extracts multi-source historical data from the pig farm production management system, environmental monitoring system, and laboratory information management system. The multi-source historical data includes production activity data, health performance data, external environment data, and disease monitoring data.
[0012] A preset dynamic time window is used to extract multi-source historical data. Based on the preset dynamic time window, entities and relationships are extracted from the multi-source historical data of the dynamic time window according to the predefined PRRS risk ontology model. For each pig farm, an in-farm event subgraph is constructed at each historical time t. The in-farm event subgraph includes: a subgraph of the introduction of pigs, a subgraph of the herd entry process, a subgraph of the immunization process, a subgraph of the weather process, a subgraph of the historical abortion rate, and a subgraph of the PRRS positive detection.
[0013] Based on the in-field event subgraph, a knowledge graph of PRRS risk is constructed to reflect the risk status within the dynamic time window, and the PRRS risk knowledge graph is stored in a graph database in the form of a graph data structure.
[0014] In this scheme, the knowledge graphs of PRRS risk for all pig farms at the same time t are connected according to their organizational affiliation and geographical location to form a global spatiotemporal knowledge graph, including:
[0015] Obtain the porcine reproductive and respiratory syndrome (PRRS) risk knowledge graph independently constructed by each pig farm at the same historical moment t. Construct the association between pig farms based on organizational affiliation and geographical proximity. Use pig farms, organizational entities, and geographical location entities as nodes. Create two types of edges based on the associations to construct a topology graph consisting of pig farms, organizations, city nodes, and relationships.
[0016] The knowledge graph of PRRS risk for each pig farm is used as a subgraph and attached to the corresponding pig farm node in the topology graph, and then fused to generate a global spatiotemporal knowledge graph.
[0017] This solution extracts an inter-farm relationship topology map reflecting the relationships between pig farms, organizations, and cities, including:
[0018] Pig farm nodes, organization nodes, and city nodes are identified and extracted from the spatiotemporal knowledge graph. The spatiotemporal knowledge graph is then traversed to find and extract all belonging edges pointing from pig farm nodes to organization nodes and all location edges pointing from pig farm nodes to city nodes.
[0019] All extracted pig farm, organization, and city nodes are used as the node set of the new graph. The extracted edges belonging to the relationship and those located on the relationship edges are used as the edge set of the new graph. Based on the bipartite graph structure, an inter-farm relationship topology graph is constructed. Pig farm nodes are connected to organization nodes and city nodes through edges. Organization nodes and city nodes are indirectly associated through shared pig farm nodes.
[0020] In this scheme, a graph attention network is used to learn the representation of internal event subgraphs in the knowledge graph of PRRS risk for each pig farm, generating in-farm embeddings with fused time weights. These in-farm embeddings serve as node features, including:
[0021] Obtain the PRRS risk knowledge graph for each pig farm i at historical time t. For the event subgraph, use a graph attention network to learn the representation of the subgraph nodes, calculate the attention weights between all nodes, and aggregate the information of each node in a weighted manner to generate a node embedding vector A with the importance of its neighboring nodes. t,i,j , is represented as:
[0022] A t,i,j =GAT(g t,i,j ;σ1)
[0023] Where g t,i,j This is a subgraph of events within the field, where σ1 is a learnable parameter.
[0024] The embedding vectors of all non-risk event nodes are selected from the obtained node embedding vectors and summed to generate a subgraph representation vector that represents the overall semantics and risk status of the event subgraph.
[0025] For each subgraph, the time interval between the corresponding time range and the current moment is calculated. This time interval is mapped to a time representation vector. Each subgraph representation vector is concatenated with its corresponding time representation vector to generate an enhanced vector that integrates event content and time information. The enhanced vectors of all subgraphs are then fused by addition to obtain a fixed-dimensional in-farm embedding vector that integrates all internal event information of the pig farm and its time decay effect. Represented as:
[0026]
[0027] Where g t,i,j For the subgraph of in-field events, l t,i,j Let i be the time representation vector, i be the pig farm identifier, j be the subgraph index, j = 0, 1, 2, ..., Linear be the linear transformation layer, Add be the addition operation, and MLP be the multilayer perceptron.
[0028] In this scheme, the intra-field embedding is used as the node feature, and a graph attention network is used again to perform representation learning on the inter-field relationship topology graph to generate inter-field embeddings with spatial propagation risk, including:
[0029] A topological graph of inter-farm relationships is obtained. The intra-farm embedding vector is used as the initial feature vector for each pig farm node. A graph attention network is used to learn the representation of the inter-farm relationship topological graph, and an updated node embedding matrix is obtained, thus yielding the inter-farm embeddings. Represented as:
[0030]
[0031] in This is a topological diagram of the inter-field relationships. Let σ2 be the inter-farm embedding for the i-th pig farm, and let σ2 be a learnable parameter.
[0032] In this scheme, the inter-farm embeddings of each pig farm are concatenated with historical abortion rates, and then input into a Long Short-Term Memory (LSTM) network to obtain time-series trends. The output is simultaneously fed into two parallel task heads to predict the probability of abnormal abortion rate risk and the specific abortion rate values for the next three time windows, including:
[0033] For each pig farm, the inter-farm vector and historical abortion rate observation value are obtained at each time t. For each time t in the retrospective window, the inter-farm vector and the historical abortion rate observation value are concatenated to form a fusion feature vector. Finally, a fusion feature sequence is generated for each pig farm.
[0034] The fused feature sequence is imported into an LSTM network to obtain a hidden state vector, and the hidden state vector is then input into two parallel risk probability prediction heads and miscarriage rate prediction heads.
[0035] The risk probability prediction head predicts the risk probability of abnormal miscarriage rate caused by PRRS within the next three time windows. The Sigmoid function is used as the activation function of the task head to compress the output to the (0,1) interval and obtain the probability values of the three time windows.
[0036] The miscarriage rate prediction header predicts the specific miscarriage rate values for the next three identical time windows. The Softplus function is used as the activation function of the task header to obtain continuous, non-negative miscarriage rate values for the three time windows.
[0037] The second aspect of this invention provides a pig farm abortion rate early warning system that integrates spatiotemporal graph networks and knowledge enhancement. The system includes: a multi-source data acquisition and preprocessing module, a spatiotemporal knowledge graph management module, a risk characterization learning module, a multi-task time series prediction module, and an early warning decision and visualization module.
[0038] The multi-source data acquisition and preprocessing module is responsible for acquiring multi-source historical data from each pig farm within a preset time step, preprocessing the multi-source historical data, and storing the preprocessed data in a spatiotemporal database.
[0039] The spatiotemporal knowledge graph management module constructs a PRRS risk knowledge graph for each pig farm at each historical time t based on a predefined PRRS risk ontology model and preprocessed multi-source historical data. It connects the PRRS risk knowledge graphs of all pig farms at the same time t according to their respective organizations and geographical locations to form a global spatiotemporal knowledge graph and extracts the inter-farm relationship topology graph that reflects the relationship between pig farms, organizations, and cities.
[0040] The risk representation learning module uses a graph attention network to learn the representation of the internal event subgraph in the knowledge graph of PRRS risk for each pig farm, and generates an intra-farm embedding with time weights. Using the intra-farm embedding as node features, the graph attention network is used again to learn the representation of the inter-farm relationship topology graph, and an inter-farm embedding with spatial propagation risk is generated.
[0041] The multi-task time series prediction module concatenates the inter-farm embeddings of each pig farm with the corresponding historical abortion rates, inputs them into a long short-term memory network to obtain time series trends, and simultaneously sends the outputs into two parallel task heads to predict the probability of abnormal abortion rate risk and the specific abortion rate values for the next three time windows.
[0042] The early warning decision and visualization module sets a risk probability threshold. When the abnormal risk probability of the miscarriage rate exceeds the threshold, it generates early warning information of different levels and visualizes the early warning information, the abnormal risk probability of the miscarriage rate, and the specific miscarriage rate value.
[0043] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0044] (1) This invention strengthens the monitoring of porcine reproductive and respiratory syndrome (PRRS) in pig farms, provides timely early warning of abnormal abortion rates in pig farms, makes good risk prevention measures, reduces losses caused by sow abortions, and thus reduces the cost per kilogram of pork.
[0045] (2) Through the intelligent early warning system for porcine reproductive and respiratory syndrome (PRRS), the efficiency of early warning and diagnosis has been reduced from several weeks to minutes. By utilizing multi-source data such as production activities (introduction, herd entry, mating), historical abortion rates, and external conditions (such as weather) of various pig farms, a spatiotemporal map is constructed from both temporal and spatial perspectives. Graph attention networks and long short-term memory networks are used to capture the temporal trend of abortion rates in pig farms and the spatial information between pig farms, thereby predicting the probability of abnormal abortion rates due to PRRS in the future and providing early warnings for high-risk abortion rates.
[0046] (3) By automatically recording historical production activities, abortion records, weather conditions and other events of each pig farm, the system dynamically analyzes the connections between each pig farm. The system automatically triggers abortion rate alarms for pig farms with high PRRS risk. It comprehensively considers risk events within and between pig farms, and then captures the dependence of abortion rates at various times. It also considers the historical trend of abortion rates in pig farms, so as to better capture the changing trends for PRRS risk warning and improve the accuracy of PRRS risk warning. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments or examples of the present invention, the accompanying drawings used in the embodiments or examples 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 according to these drawings without creative effort.
[0048] Figure 1 A flowchart illustrating a method for early warning of abortion rates in pig farms that integrates spatiotemporal graph networks and knowledge enhancement is shown.
[0049] Figure 2 A flowchart for early warning of abortion rates in pig farms is shown;
[0050] Figure 3 A schematic diagram of the spatiotemporal knowledge graph of porcine reproductive and respiratory syndrome (PRRS) risk is shown.
[0051] Figure 4A block diagram of a pig farm abortion rate early warning system integrating spatiotemporal graph networks and knowledge enhancement is shown. Detailed Implementation
[0052] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0053] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0054] Figure 1 A flowchart is shown for a method for early warning of abortion rates in pig farms that integrates spatiotemporal graph networks and knowledge enhancement.
[0055] like Figure 1 As shown, this embodiment provides a method for early warning of abortion rate in pig farms that integrates spatiotemporal graph networks and knowledge enhancement, including:
[0056] S102, acquire multi-source historical data of each pig farm within a preset time step, and construct a knowledge graph of PRRS risk for each pig farm at each historical time t based on the multi-source historical data;
[0057] S104 connects the knowledge graphs of PRRS risk of all pig farms at the same time t according to their respective organizations and geographical locations to form a global spatiotemporal knowledge graph, and extracts the inter-farm relationship topology graph reflecting the relationship between pig farms, organizations and cities.
[0058] S106. Using a graph attention network, the representation of the internal event subgraph in the knowledge graph of PRRS risk of each pig farm is learned, and the intra-farm embedding with time weight is generated. Using the intra-farm embedding as node feature, the graph attention network is used again to learn the representation of the inter-farm relationship topology graph to generate an inter-farm embedding with spatial propagation risk.
[0059] S108: After splicing the inter-farm embeddings of each pig farm with the historical abortion rate, the data is input into a long short-term memory network to obtain the time-series trend. The output is simultaneously sent to two parallel task heads to predict the probability of abnormal abortion rate risk and the specific abortion rate value for the next three time windows. When the probability of abnormal abortion rate risk exceeds the threshold, an early warning is triggered.
[0060] It should be noted that the preset warning date and lookback window time step, for example, setting the current date for which a warning needs to be issued as day T, will automatically acquire all relevant data within the historical window from day T-60 to day T-1 according to the preset. Based on the lookback window, multi-source historical data is extracted from the pig farm production management system, environmental monitoring system, and laboratory information management system. The multi-source historical data includes production activity data, health performance data, external environmental data, and disease monitoring data. The production activity data includes, but is not limited to, event records of stages such as introduction of pigs (origin pig farm, quantity, date, and testing status), herd entry (sow herd transfer records), mating (mating success rate), and immunization (vaccine type and vaccination date). The health performance data includes the historical abortion rate of the pig farm. The external environmental data includes the weather conditions of the pig farm's location, such as temperature, humidity, and precipitation. The disease monitoring data includes positive test results for porcine reproductive and respiratory syndrome (PRRS).
[0061] A preset dynamic time window is used to extract multi-source historical data. For a specific historical moment t, a knowledge graph is constructed for it. The data covered is not just for the day t, but a review period ending at t. Preferably, the review period is set to 30 days prior to t, i.e., the data time range is [t-29, t], illustrating the knowledge graph. This depicts the risk status of pig farm i within 30 days prior to time t. (PRRS Risk Knowledge Graph) This dataset contains multiple subgraphs for each pig farm, covering events such as herd entry, introduction of new pigs, immunization, weather, historical abortion rate, and positive PRRSV detection within a 30-day period. Each subgraph focuses on describing a type of event or aspect of risk. Based on a predefined PRRSV risk ontology model, entities and relationships are extracted from multi-source historical data within a dynamic time window [t-29, t] to construct an in-farm event subgraph for each pig farm at each historical time t. These in-farm event subgraphs include: introduction of new pigs, herd entry, immunization, weather, historical abortion rate, and positive PRRSV detection. Based on these in-farm event subgraphs, a PRRSV risk knowledge graph reflecting the risk status within the dynamic time window is constructed and stored in a graph database in the form of a graph data structure.
[0062] Figure 2 A flowchart for early warning of abortion rates in pig farms is shown.
[0063] It should be noted that each pig farm i independently constructed a knowledge graph of PRRS risk at the same historical moment t. The internal risk status of the pig farm within the dynamic time window [t-29,t] is described in detail. The core of the global spatiotemporal knowledge graph is establishing connections between pig farms. Based on predefined rules, these connections are extracted and made explicit, forming the topological structure of the pig farm relationship graph. Connections between pig farms are constructed based on organizational affiliation and geographical proximity. Pig farms, organizational entities, and geographical entities are used as nodes. Two types of edges are created based on these connections, constructing a topological graph composed of pig farms, organizations, city nodes, and relationships. Organizational affiliation: If two (or more) pig farms belong to the same parent company, breeding group, or management system, they are considered to have a strong association. Geographical proximity: If two (or more) pig farms are located in the same city or region, or their geographical distance is within a preset threshold, they are considered to have a relationship. Through these two relationships, the originally isolated pig farm nodes are connected to common parent organizational nodes and geographical nodes, thus indirectly associating them with each other. The porcine reproductive and respiratory syndrome (PRRS) risk knowledge graph for each pig farm is then constructed. As a subgraph, it is attached to the corresponding pig farm node in the topology graph, and fused to generate a global spatiotemporal knowledge graph, such as the porcine reproductive and respiratory syndrome (PRRS) risk spatiotemporal knowledge graph. Figure 3 As shown, the spatiotemporal knowledge graph captures a static risk snapshot of all pig farms at a specific time t, and captures the spatial and management-dimensional correlations through inter-farm relationships.
[0064] Pig farm nodes, organization nodes, and city nodes are identified and extracted from the spatiotemporal knowledge graph. Each pig farm node carries a unique identifier (such as a pig farm ID) and its in-farm embedding vector at time t. The spatiotemporal knowledge graph is traversed to find and extract all belonging edges pointing from pig farm nodes to organization nodes and all located edges pointing from pig farm nodes to city nodes. All extracted pig farm, organization, and city nodes are used as the node set of a new graph, and the extracted belonging and located edges are used as the edge set of the new graph. An inter-farm relationship topology graph is constructed based on the bipartite graph structure. Pig farm nodes are connected to organization nodes and city nodes through edges, and organization nodes and city nodes are indirectly associated through shared pig farm nodes.
[0065] It should be noted that a graph attention network is used to analyze how risks propagate through shared organizations and cities within this inter-farm relationship topology. The pig farm nodes in the inter-farm relationship topology already possess quantified characteristics of their internal risks, while the characteristics of organization and city nodes need to be learned during training. The GAT network aggregates information from neighboring nodes, ultimately generating an inter-farm embedding for each pig farm that includes both its own risk and the risk of external propagation.
[0066] Obtain the porcine reproductive and respiratory syndrome (PRRS) risk knowledge graph for each pig farm i at historical time t. It contains multiple subgraphs g t,i,jDifferent subgraphs record introduction events, group entry events, and corresponding risk events at different times. For the same event subgraph, to capture the impact of different risk events on the abnormal risk of miscarriage rate, a graph attention network is used for representation learning of subgraph nodes. The attention weights between all nodes are calculated, and the information of each node is weighted and aggregated to generate a node embedding vector A with the importance of its neighboring nodes. t,i,j , is represented as:
[0067] A t,i,j =GAT(g t,i,j ;σ1)
[0068] Where g t,i,j This is a subgraph of events within the field, where σ1 is a learnable parameter.
[0069] The embedding vectors of all non-risk event nodes are selected from the obtained node embedding vectors and added together to generate a subgraph representation vector that represents the overall semantics and risk status of the event subgraph; non-risk event nodes refer to specific, traceable event operation entities.
[0070] Since different subgraphs record events with different occurrence times and time ranges, subgraphs closer to time t have a greater impact on abnormal abortion rates in pig farms, and recent events are more valuable for reference than distant events. For each subgraph, the time interval between its corresponding time range and the current time t is calculated, and this time interval is mapped to a time representation vector. Each subgraph representation vector is then concatenated with its corresponding time representation vector to generate an enhanced vector that integrates event content and time information. By summing and fusing the enhanced vectors of all subgraphs, a fixed-dimensional in-farm embedding vector that integrates all internal event information of the pig farm and its time decay effect is obtained. Represented as:
[0071]
[0072] Where g t,i,j For the subgraph of in-field events, l t,i,j Let i be the time representation vector, i be the pig farm identifier, j be the subgraph index, j = 0, 1, 2, ..., Linear be the linear transformation layer, Add be the addition operation, and MLP be the multilayer perceptron.
[0073] Because pig farms within the same organization or city face the risk of abortion rate transmission, a Graph Attention Network (GAT) is introduced to characterize the mutual influence between different pig farms by utilizing an inter-farm relationship topology graph and intra-farm embeddings to capture this abnormal risk. The inter-farm relationship topology graph is obtained, and the intra-farm embedding vector is used as the initial feature vector for each pig farm node. A learnable embedding vector is randomly initialized as the initial feature for each organization node and city node. The GAT is then used to learn the representation of the inter-farm relationship topology graph. In the GAT, the feature vector of each neighbor node is multiplied by its corresponding attention weight. All these weighted features are then aggregated with the target node's own features, and a non-linear transformation is performed to generate a new representation vector for the target node that incorporates neighbor information. The updated node embedding matrix is then obtained to obtain the inter-farm embedding. Represented as:
[0074]
[0075] in This is a topological diagram of the inter-field relationships. Let σ2 be the inter-farm embedding for the i-th pig farm, and let σ2 be a learnable parameter.
[0076] Inter-farm embedding incorporates risk information from all pig farms within its jurisdiction or area, thus becoming a more accurate representation of organizational and regional risks. Inter-farm embedding is a comprehensive risk vector that includes both internal state and external environment, which is used to improve the accuracy of the final time series forecast.
[0077] It should be noted that, for each pig farm, the inter-farm vector and historical abortion rate observations are obtained at each time t. For each time t in the lookback window, the inter-farm vector is... Compared with historical miscarriage rate observations a i,t The features are concatenated to form a fused feature vector. Finally, a fusion feature sequence Z of [T-60, T-1] is generated for each pig farm. i =[p i,T-60 ;p i,T-59 ;…;p i,T-1 [It provides the most comprehensive input information for time series prediction through alignment and fusion.]
[0078] Changes in abortion rate are a typical time-series problem, exhibiting long-term dependence and complex trends. LSTM networks, due to their internal gating mechanism, are highly adept at learning and memorizing such long-term temporal patterns. The fused feature sequence is imported into an LSTM network to obtain a hidden state vector, encoding the deep temporal trends implied by all risk information and abortion rate performance in the pig farm over the past 60 days. To improve the stability and generalization of the abortion risk prediction task, a multi-task learning process is implemented by incorporating a related abortion rate prediction task. The hidden state vector is input into two parallel risk probability prediction heads and abortion rate value prediction heads.
[0079] The risk probability prediction head predicts the probability of abnormal miscarriage rates due to porcine reproductive and respiratory syndrome (PRRS) within three future time windows: [T+1~T+7], [T+8~T+14], and [T+15~T+21]. The Sigmoid function is used as the activation function for this task head, compressing the output to the (0,1) interval to obtain the probability values for the three time windows. Represented as:
[0080]
[0081] Where f1 is the task header function, φ is the multilayer perceptron, φ is the set of trainable parameters of the LSTM network, and ψ1 is the set of trainable parameters of the multilayer perceptron.
[0082] The miscarriage rate prediction header predicts specific miscarriage rate values for three identical time windows in the future. The Softplus function is used as the activation function for this header to obtain consecutive, non-negative miscarriage rate values for the three time windows. Represented as:
[0083]
[0084] Where f2 is the task head function, which is a multilayer perceptron. The two task heads have different parameters. φ is the set of trainable parameters of the LSTM network, and ψ1 is the set of trainable parameters of the multilayer perceptron.
[0085] The loss function of the model is defined as:
[0086]
[0087] Where k is the index of a future time point, y i,k This is a true label, indicating whether an abnormal miscarriage rate actually occurred at a future point in time. For predicting probabilities, z refers to the risk of an abnormal abortion rate occurring in pig farm i at a future time point k. i,k The true abortion rate value refers to the specific abortion rate actually observed at a future time point k in pig farm i. The predicted abortion rate refers to the specific abortion rate predicted by the model for pig farm i at a future time point k.
[0088] Predicting specific abortion rates as a regression task provides more accurate and continuous supervision signals for model learning, helping the main risk probability prediction task learn more robust feature representations and preventing overfitting. Furthermore, the two tasks share an LSTM encoder, and the shared layer learns general temporal features useful for both tasks, making the entire model more stable and reliable. The risk probability output from the main task header is compared with a preset risk threshold. If the predicted risk probability exceeds the threshold in any future time window, an early warning is generated for the pig farm. This warning clearly indicates the time range of the risk and the abortion rate value. The warning is communicated to pig farm managers through a visual interface or message notification, enabling them to take early intervention measures such as strengthening biosecurity, isolation, and monitoring to avoid or reduce potential economic losses.
[0089] Figure 4 The architecture diagram of a pig farm abortion rate early warning system that integrates spatiotemporal graph networks and knowledge enhancement is shown.
[0090] The second embodiment of the present invention provides a pig farm abortion rate early warning system that integrates spatiotemporal graph networks and knowledge enhancement. The system includes a multi-source data acquisition and preprocessing module, a spatiotemporal knowledge graph management module, a risk characterization learning module, a multi-task time series prediction module, and an early warning decision and visualization module.
[0091] The multi-source data acquisition and preprocessing module is responsible for acquiring multi-source historical data from each pig farm within a preset time step, preprocessing the multi-source historical data, and storing the preprocessed data in a spatiotemporal database.
[0092] The spatiotemporal knowledge graph management module constructs a PRRS risk knowledge graph for each pig farm at each historical time t based on a predefined PRRS risk ontology model and preprocessed multi-source historical data. It connects the PRRS risk knowledge graphs of all pig farms at the same time t according to their respective organizations and geographical locations to form a global spatiotemporal knowledge graph and extracts the inter-farm relationship topology graph that reflects the relationship between pig farms, organizations, and cities.
[0093] The risk representation learning module uses a graph attention network to learn the representation of the internal event subgraph in the knowledge graph of PRRS risk for each pig farm, and generates an intra-farm embedding with time weights. Using the intra-farm embedding as node features, the graph attention network is used again to learn the representation of the inter-farm relationship topology graph, and an inter-farm embedding with spatial propagation risk is generated.
[0094] The multi-task time series prediction module concatenates the inter-farm embeddings of each pig farm with the corresponding historical abortion rates, inputs them into a long short-term memory network to obtain time series trends, and simultaneously sends the outputs into two parallel task heads to predict the probability of abnormal abortion rate risk and the specific abortion rate values for the next three time windows.
[0095] The early warning decision and visualization module sets a risk probability threshold. When the abnormal risk probability of the miscarriage rate exceeds the threshold, it generates early warning information of different levels and visualizes the early warning information, the abnormal risk probability of the miscarriage rate, and the specific miscarriage rate value.
[0096] The third embodiment of the present invention provides a computer-readable storage medium, which includes a program for a pig farm abortion rate early warning method that integrates spatiotemporal graph networks and knowledge enhancement. When the program is executed by a processor, it implements the steps of the pig farm abortion rate early warning method that integrates spatiotemporal graph networks and knowledge enhancement.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed methods and systems can be implemented in other ways. The system embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, and can be electrical, mechanical, or other forms. Furthermore, in the various embodiments of the present invention, all functional units can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0098] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0099] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for early warning of pig farm abortion rate by fusing space-time graph network and knowledge enhancement, characterized in that, The method comprises the following steps: The multi-source historical data of each pig farm in a preset time step is acquired, and a blue-ear disease risk knowledge graph is constructed according to the multi-source historical data of each pig farm at each historical time The blue-ear disease risk knowledge graph is constructed. The same time The risk knowledge graph of all pig farms below is connected according to the organizations and geographical positions, to form a global spatio-temporal knowledge graph, and a field relationship topology graph reflecting the relationships among pig farms, organizations and cities is extracted. The graph attention network is used to learn the representation of the internal event subgraph in the blue-ear disease risk knowledge graph of each pig farm, generate the in-farm embedding fused with the time weight, and use the in-farm embedding as the node feature to learn the representation of the inter-farm relationship topology graph again by using the graph attention network, and generate the inter-farm embedding with spatial propagation risk. The inter-farm embedding of each pig farm and the historical abortion rate are spliced, and then input into a long short-term memory network to obtain a time trend, and the output is simultaneously input into two parallel task heads to predict the abortion rate abnormal risk probability and the specific abortion rate value in the future three time windows, and when the abortion rate abnormal risk probability exceeds a threshold value, an early warning is triggered. The graph attention network is used to learn the representation of the internal event subgraph in the blue-ear disease risk knowledge graph of each pig farm, generate the in-farm embedding fused with the time weight, and use the in-farm embedding as the node feature to learn the representation of the inter-farm relationship topology graph again by using the graph attention network, and generate the inter-farm embedding with spatial propagation risk, including: Acquire each pig farm At historical moments The blue-ear disease risk knowledge graph, for the event subgraph, uses a graph attention network to perform subgraph node representation learning, calculates the attention weights between all nodes, aggregates the information of each node by weighting, and generates a node embedding vector with neighbor node importance , represented as: , wherein is an in- field event subgraph, is a learnable parameter, is a pig farm identification, is a subgraph index, ; All embedding vectors of non-risk event nodes are selected from the obtained node embedding vectors and added to generate a subgraph representation vector representing the overall semantics and risk state of the event subgraph. For each subgraph, the time interval of the corresponding time range and the current time is calculated, the time interval is mapped as a time feature vector, each subgraph feature vector is spliced with the corresponding time feature vector, an enhanced vector integrating event content and time information is generated, the enhanced vectors of all subgraphs are fused by additive summation, and a fixed-dimensional in-farm embedding vector integrating all internal event information of the pig farm and the time decay effect is obtained , which is represented as: , wherein is an in-field event subgraph, is a time representation vector, is a linear transformation layer, is an addition operation, is a multi-layer perceptron; The in-farm embedding is used as the node feature, and the graph attention network is used again to learn the representation of the inter-farm relationship topology graph, and the inter-farm embedding with spatial propagation risk is generated, including: The inter-farm relationship topology graph is acquired, the in-farm embedding vector is taken as an initial feature vector of each pig farm node, graph attention network is used to perform representation learning on the inter-farm relationship topology graph, an updated node embedding matrix is acquired, and an inter-farm embedding is obtained is represented as: , wherein is an inter-farm relationship topology, is an inter-farm embedding for the th pig farm, are learnable parameters.
2. The spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to claim 1, characterized in that, The multi-source historical data of each pig farm in a preset time step is acquired, and a blue-ear disease risk knowledge graph is constructed for each pig farm at each historical time point according to the multi-source historical data The blue-ear disease risk knowledge graph is constructed, including: A preset early warning day and a look-back window time step are set, and multi-source historical data are extracted from a pig farm production management system, an environmental monitoring system and a laboratory information management system based on the look-back window, wherein the multi-source historical data include production activity data, health performance data, external environment data and epidemic disease monitoring data. a preset dynamic time window, extracting multi-source historical data according to the dynamic time window, extracting entities and relations from the multi-source historical data of the dynamic time window according to a predefined PRRS risk ontology model, constructing a PRRS risk ontology model for each pig farm at each historical time point constructing an in-field event subgraph, the in-field event subgraph comprising: a breeding link subgraph, a joining group link subgraph, an immunization link subgraph, a weather link subgraph, a historical abortion rate subgraph, and a PRRS positive detection subgraph; The blue-ear disease risk knowledge graph reflecting the risk state in the dynamic time window is constructed according to the in-farm event subgraph, and the blue-ear disease risk knowledge graph is stored in the graph database in the form of a graph data structure.
3. The spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to claim 1, characterized in that, The same time The following all pig farm blue ear disease risk knowledge graph, according to the organization and geographical location are connected, constitute the global spatiotemporal knowledge graph, including: Acquiring the same historical moment The blue-ear disease risk knowledge graph of each pig farm is independently constructed, the correlation between the pig farms is constructed according to the organizational affiliation and the geographical proximity relationship, the pig farm, the organizational entity and the geographical position entity are taken as nodes, two types of edges are created according to the correlation, and a topological graph composed of the pig farm, the organization, the city node and the relationship is constructed. The blue-ear disease risk knowledge graph of each pig farm is taken as a subgraph and mounted on the corresponding pig farm node in the topology graph to generate a global spatio-temporal knowledge graph.
4. The spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to claim 3, characterized in that, An inter-farm relationship topology graph reflecting the relationship among pig farms, organizations and cities is extracted, including: Pig farm nodes, organization nodes and city nodes are identified and extracted from the spatio-temporal knowledge graph, and all belong-to relationship edges from the pig farm nodes to the organization nodes and all in-located relationship edges from the pig farm nodes to the city nodes are found and extracted by traversing the spatio-temporal knowledge graph; All the extracted pig farm nodes, organization nodes and city nodes are taken as a node set of a new graph, and all the extracted belong-to relationship edges and in-located relationship edges are taken as an edge set of the new graph, and the inter-farm relationship topology graph is constructed according to the bipartite graph structure, wherein the pig farm nodes are connected to the organization nodes and the city nodes through edges, and the organization nodes and the city nodes are indirectly connected through the shared pig farm nodes.
5. The spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to claim 1, characterized in that, The inter-farm embedding of each pig farm and the historical abortion rate are spliced, and then input into a long short-term memory network to obtain a time trend, and the output is simultaneously input into two parallel task heads to predict the abortion rate abnormal risk probability and the specific abortion rate value in the future three time windows, including: For each pig farm, the inter-farm vector and historical abortion rate observation at each time point are obtained For each time point in the look-back window The inter-farm vector and historical abortion rate observation are spliced to form a fusion feature vector, and finally a fusion feature sequence is generated for each pig farm; The fusion feature sequence is input into an LSTM network to obtain a hidden state vector, and the hidden state vector is input into two parallel risk probability prediction heads and abortion rate value prediction heads. The risk probability of the abortion rate anomaly caused by porcine reproductive and respiratory syndrome in the next three time windows is predicted in the risk probability prediction head, a Sigmoid function is used as the activation function of the task head to compress the output to the interval (0, 1), and the probability values of the three time windows are obtained; The specific abortion rate values of the future three same time windows are predicted in the abortion rate value prediction head, a Softplus function is used as the activation function of the task head to obtain the continuous and non-negative abortion rate values of the three time windows.
6. A spatiotemporal graph network and knowledge-enhanced pig farm abortion rate early warning system, characterized in that, The system for implementing the spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to any one of claims 1-5 comprises a multi-source data acquisition and preprocessing module, a spatio-temporal knowledge graph management module, a risk representation learning module, a multi-task time series prediction module, and an early warning decision and visualization module; The multi-source data acquisition and preprocessing module is responsible for acquiring multi-source historical data of each pig farm within a preset time step, preprocessing the multi-source historical data, and storing the preprocessed data in a spatio-temporal database; The spatio-temporal knowledge graph management module constructs a PRRS risk knowledge graph for each pig farm at each historical time t based on the pre-processed multi-source historical data according to the pre-defined PRRS risk ontology model, connects the PRRS risk knowledge graphs of all pig farms at the same time t according to the organizations and geographical locations to which the pig farms belong, and forms a global spatio-temporal knowledge graph, and extracts a field relationship topology graph reflecting the relationships among pig farms, organizations and cities. The spatio-temporal knowledge graph management module constructs a PRRS risk knowledge graph for each pig farm at each historical time t based on the pre-processed multi-source historical data according to the pre-defined PRRS risk ontology model, connects the PRRS risk knowledge graphs of all pig farms at the same time t according to the organizations and geographical locations to which the pig farms belong, and forms a global spatio-temporal knowledge graph, and extracts a field relationship topology graph reflecting the relationships among pig farms, organizations and cities. The risk representation learning module uses a graph attention network to learn the representation of the internal event subgraph in the porcine reproductive and respiratory syndrome risk knowledge graph of each pig farm, generates a time weight fused farm embedding, and uses the farm embedding as a node feature to perform representation learning on the inter-farm relationship topology graph using a graph attention network again to generate an inter-farm embedding with spatial propagation risk; The multi-task time series prediction module concatenates the inter-farm embedding of each pig farm with the corresponding historical abortion rate, inputs the long short-term memory network to obtain the time series trend, and simultaneously inputs the output into two parallel task heads to predict the abortion rate anomaly risk probability and the specific abortion rate value of the future three time windows; The early warning decision and visualization module sets a risk probability threshold, generates different levels of early warning information when the abortion rate anomaly risk probability exceeds the threshold, and visualizes the early warning information, the abortion rate anomaly risk probability, and the specific abortion rate value.
Citation Information
Patent Citations
Early warning method and system for animal diseases based on social graph network
CN114864105A
Method and system for predicting and classifying event sequences embedded in a knowledge graph
WO2022253449A1