Pig farm abortion rate early warning method and system integrating space-time diagram network and knowledge enhancement
By constructing a spatiotemporal graph network and a knowledge-enhanced early warning method, and utilizing graph attention networks and long short-term memory networks to predict abnormal abortion rates in pig farms, this approach addresses the shortcomings of existing technologies in terms of spatiotemporal correlation and temporal dynamics. It enables accurate early warning of abortion rates in porcine reproductive and respiratory syndrome (PRRS) and reduces economic losses.
Patent Information
- Application Number
- CN202511409330.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-09-29
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, especially in predicting 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 proactive and accurate early warning of abortion rates in pig farms, reduces economic losses caused by porcine reproductive and respiratory syndrome (PRRS), and improves the accuracy and efficiency of early warning.
Smart Images

Figure CN120996285A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent breeding, more particularly, to a pig farm abortion rate early warning method and system fusing a space-time graph network and knowledge enhancement. BACKGROUND
[0002] Porcine reproductive and respiratory syndrome (PRRS), commonly known as blue-ear disease, is one of the major diseases that endanger the global pig industry. Its infection can cause reproductive disorders in sows, especially abnormal increase in abortion rate and increase in dead and culled rate, causing huge economic losses to pig farms. At present, some technologies have attempted to predict and attribute the disease risk of pig farms. For example, some methods use machine learning models to predict the incidence probability or duration of major diseases such as African swine fever and blue-ear disease based on production data (such as introduction, group entry, and immunization records) within the pig farm, environmental data (such as weather), and historical health data. Some other methods introduce knowledge graph technology to build an attribution system based on biosecurity knowledge for tracing the virus transmission path and quantifying the risk points, and even train large models in the field to improve the generalization ability in small sample scenarios. Some research focuses on the explainability of risk prediction results, quantifying the contribution of each feature variable to the disease risk through techniques such as SHAP value analysis.
[0003] However, the existing technology still has obvious limitations: first, most methods only focus on the data within a single pig farm, ignoring the potential risk transmission paths between pig farms due to their close geographical location and belonging to the same organization management, and lack of modeling of spatial correlation; second, these methods often focus on evaluating the risk at the current or static moment, failing to fully capture the continuity and trend of abortion rate and other indicators in the time dimension, while the occurrence and development of blue-ear disease have obvious time-dependent characteristics; third, although knowledge graphs are used for risk attribution, they are mostly based on general biosecurity frameworks and do not deeply integrate the specific transmission mechanisms and risk logic of blue-ear disease, especially lacking the combination with dynamic changes in space and time, resulting in insufficient accuracy and timeliness in the early warning scenario. In summary, the existing blue-ear disease risk early warning technology for pig farms has deficiencies in handling spatial correlation, temporal dynamics, and disease-specific knowledge integration, and there is an urgent need for an intelligent early warning method that can capture the risk transmission relationship within and outside the pig farm, learn historical trend changes, and embed blue-ear disease field knowledge to achieve more forward-looking and accurate early warning of abortion rate abnormalities. SUMMARY
[0004] To solve the above technical problems, the present application proposes a pig farm abortion rate early warning method and system fusing a space-time graph network and knowledge enhancement, which predicts the future blue-ear disease abortion rate abnormality probability of the pig farm, early warns the high-risk abortion rate, and reduces the significant economic losses caused by abortion due to blue-ear disease.
[0005] The first aspect of the present application provides a pig farm abortion rate early warning method combining spatio-temporal graph network and knowledge enhancement, comprising the following steps:
[0006] Obtain multi-source historical data of each pig farm within a preset time step, and construct a blue-ear disease risk knowledge graph for each pig farm at each historical time t according to the multi-source historical data;
[0007] Connect the blue-ear disease risk knowledge graphs of all pig farms at the same time t according to the organizations and geographical locations to which they belong, to form a global spatio-temporal knowledge graph, and extract an inter-farm relationship topology graph reflecting the relationships among pig farms, organizations and cities;
[0008] Use a graph attention network to learn the representation of the internal event subgraph in the blue-ear disease risk knowledge graph of each pig farm, generate a time-weighted intra-farm embedding, and use the intra-farm embedding as the node feature to learn the representation of the inter-farm relationship topology graph again using a graph attention network, to generate an inter-farm embedding with spatial transmission risk;
[0009] After concatenating the inter-farm embeddings of each pig farm with the historical abortion rate, input them into a long short-term memory network to obtain the time series trend, and simultaneously input the output 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 trigger an early warning when the abortion rate abnormal risk probability exceeds a threshold.
[0010] In this scheme, multi-source historical data of each pig farm within a preset time step is obtained, and a blue-ear disease risk knowledge graph is constructed for each pig farm at each historical time t according to the multi-source historical data, comprising:
[0011] A preset early warning day and a look-back window time step are set, and multi-source historical data is extracted from the pig farm production management system, the environmental monitoring system and the laboratory information management system based on the look-back window, wherein the multi-source historical data includes production activity data, health performance data, external environment data and epidemic disease monitoring data;
[0012] A dynamic time window is preset, the multi-source historical data is extracted according to the dynamic time window, the entities and relationships are extracted from the multi-source historical data in the dynamic time window according to a pre-defined blue-ear disease risk ontology model, and an intra-farm event subgraph is constructed for each pig farm at each historical time t, wherein the intra-farm event subgraph includes a breeding link subgraph, a group entry link subgraph, an immunization link subgraph, a weather link subgraph, a historical abortion rate subgraph and a blue-ear disease positive detection subgraph;
[0013] A blue-ear disease risk knowledge graph reflecting the risk state in the dynamic time window is constructed according to the intra-farm event subgraph, and the blue-ear disease risk knowledge graph is stored in a graph database in the form of a graph data structure.
[0014] In this scheme, the blue-ear disease risk knowledge graph of all pig farms at the same time t is connected according to the organization and geographical location to form a global spatio-temporal knowledge graph, including:
[0015] The blue-ear disease risk knowledge graph of each pig farm at the same historical time t is obtained, the association between pig farms is constructed according to the organizational affiliation and geographical proximity, the pig farm, organization entity and geographical location entity are taken as nodes, two types of edges are created according to the association, and a topological graph composed of pig farm, organization, city nodes and relationships is constructed;
[0016] 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 topological graph to generate a global spatio-temporal knowledge graph.
[0017] In this scheme, the inter-farm relationship topological graph reflecting the relationship between pig farms, organizations and cities is extracted, including:
[0018] The pig farm node, organization node and city node are identified and extracted from the spatio-temporal knowledge graph, and all belonging relationship edges from the pig farm node to the organization node and all located relationship edges from the pig farm node to the city node are found and extracted by traversing the spatio-temporal knowledge graph;
[0019] All pig farm, organization and city nodes extracted are taken as a node set of a new graph, and all belonging relationship edges and located relationship edges extracted are taken as an edge set of the new graph, and an inter-farm relationship topological graph is constructed according to the bipartite graph structure, the pig farm node is connected to the organization node and the city node through the edge, and the organization node and the city node are indirectly associated through the shared pig farm node.
[0020] In this scheme, the graph attention network is used to learn the representation of the internal event subgraph in each pig farm's blue-ear disease risk knowledge graph, and the intra-farm embedding fused with time weight is generated, including:
[0021] The blue-ear disease risk knowledge graph of each pig farm i at historical time t is obtained, for the event subgraph, the graph attention network is used for subgraph node representation learning, the attention weight between all nodes is calculated, the information of each node is weighted and aggregated, and the node embedding vector A t,i,j is generated, which is represented as:
[0022] A t,i,j =GAT(g t,i,j ;σ1)
[0023] Where g t,i,j is the intra-farm event subgraph, and σ1 is a learnable parameter.
[0024] All the embedding vectors of non-risk event nodes are filtered 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;
[0025] For each subgraph, a time interval between the corresponding time range and the current time is calculated, the time interval is mapped as a time representation vector, each subgraph representation vector is spliced with the corresponding time representation vector to generate an enhanced vector that fuses event content and time information, and all subgraph enhanced vectors are fused by additive summation to obtain a fixed-dimensional farm embedding vector that fuses all internal event information and time decay effect of the pig farm is expressed as:
[0026]
[0027] where g t,i,j is a farm internal event subgraph, l t,i,j is a time representation vector, i is a pig farm identifier, j is a subgraph index, j=0,1,2…, Linear is a linear transformation layer, Add is an addition operation, and MLP is a multi-layer perceptron.
[0028] In the scheme, the farm embedding is taken as a node feature, and a 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, including:
[0029] An inter-farm relationship topology graph is obtained, the farm embedding vector is taken as an initial feature vector of each pig farm node, a graph attention network is used to learn the representation of the inter-farm relationship topology graph, an updated node embedding matrix is obtained, and an inter-farm embedding is obtained, the node embedding matrix is expressed as:
[0030]
[0031] where is an inter-farm relationship topology graph, is an inter-farm embedding of the i-th pig farm, and σ2 is a learnable parameter.
[0032] In the scheme, the inter-farm embedding of each pig farm is spliced with the historical abortion rate, and a long short-term memory network is used to obtain a time series trend, and the output is sent to two parallel task heads at the same time to predict the abortion rate abnormal risk probability and the specific abortion rate value in the future three time windows, including:
[0033] For each pig farm, an inter-farm vector and a historical abortion rate observation value at each time t are obtained, for each time t in the lookback window, the inter-farm vector and the historical abortion rate observation value are spliced to form a fusion feature vector, and finally a fusion feature sequence is generated for each pig farm;
[0034] The fusion feature sequence is introduced 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 an abortion rate value prediction head;
[0035] The risk probability prediction head is used for predicting a risk probability of abortion rate abnormality caused by blue-ear disease in future three time windows, a Sigmoid function is used as an activation function of the task head, output is compressed into a (0, 1) interval, and probability values of the three time windows are obtained;
[0036] The abortion rate value prediction head is used for predicting specific abortion rate values of the future three same time windows, a Softplus function is used as an activation function of the task head, and continuous, non-negative abortion rate numerical values of the three time windows are obtained.
[0037] The second aspect of the present application provides a pig farm abortion rate early warning system fusing a spatio-temporal graph network and knowledge enhancement, which 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.
[0038] The multi-source data acquisition and preprocessing module is responsible for acquiring multi-source historical data of each pig farm in a preset time step, and pre-processing the multi-source historical data, and storing the pre-processed data in a spatio-temporal database.
[0039] The spatio-temporal knowledge graph management module constructs a blue-ear disease risk knowledge graph for each pig farm at each historical time t based on the pre-processed multi-source historical data according to a pre-defined blue-ear disease risk ontology model, connects the blue-ear disease risk knowledge graphs of all pig farms at the same time t according to the belonging organizations and geographical positions to form a global spatio-temporal knowledge graph, and extracts a field relationship topology graph reflecting the pig farm-organization-city relationship;
[0040] The risk representation learning module learns the representation of an internal event subgraph in the blue-ear disease risk knowledge graph of each pig farm by using a graph attention network, generates a field embedding fused with a time weight, takes the field embedding as a node feature, and learns the representation of the field relationship topology graph again by using a graph attention network to generate a field-to-field embedding with a spatial propagation risk;
[0041] The multi-task time series prediction module splices the field-to-field embedding of each pig farm with the corresponding historical abortion rate, inputs the spliced result into a long short-term memory network to obtain a time series trend, and simultaneously inputs the output into two parallel task heads to respectively predict the abortion rate abnormality risk probability and the specific abortion rate value of the future three time windows.
[0042] The early warning decision and visualization module sets a risk probability threshold, and when the abnormal risk probability of the abortion rate exceeds the threshold, early warning information of different levels is generated, and the early warning information and the abortion rate abnormal risk probability and specific abortion rate value are visualized.
[0043] Compared with the prior art, the present application has the following advantages:
[0044] (1) The present application strengthens the monitoring of blue ear disease in pig farms, timely and early warns the abnormal abortion rate of the pig farm, makes good risk prevention, reduces the loss caused by the abortion of sows, and thus reduces the cost of piglets per kilogram.
[0045] (2) Through the intelligent early warning system of blue ear disease, the work efficiency of early warning and diagnosis is compressed from weeks to minutes. The time and space graph is constructed from the time and space angles by using the multi-source data of the pig farm production activities (introduction, group entry, breeding), historical abortion rate, external conditions (such as weather), and the time trend of the abortion rate of the pig farm and the spatial information between the pig farms are captured by means of graph attention network and long short-term memory network, and then the future blue ear disease abortion rate abnormal probability of the pig farm is predicted, and the high-risk abortion rate is early warned.
[0046] (3) By automatically recording the historical production activities, abortion records, weather conditions and other events of each pig farm, dynamically analyzing the connection between each pig farm, the system automatically triggers the flow rate alarm of the high blue ear risk pig farm, comprehensively considers the risk events in and between the pig farms, and then captures the dependence relationship of the abortion rate at each moment, considers the historical trend of the abortion rate of the pig farm, better captures the change trend for the risk early warning of the blue ear disease of the pig farm, and improves the accuracy of the risk early warning of the blue ear disease of the pig farm. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments or examples of the present application, the drawings needed to be used in the embodiments or example descriptions will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can also obtain other drawings according to the drawings shown without creating any creative labor.
[0048] Figure 1 A flowchart of a pig farm abortion rate early warning method fusing a space-time graph network and knowledge enhancement is shown;
[0049] Figure 2 A flowchart of a pig farm abortion rate early warning method fusing a space-time graph network and knowledge enhancement is shown;
[0050] Figure 3 A schematic diagram of a blue ear disease risk space-time knowledge graph is shown;
[0051] Figure 4A block diagram of a pig farm abortion rate early warning system fusing a spatio-temporal graph network and knowledge enhancement is shown. DETAILED DESCRIPTION
[0052] In order to enable a more clear understanding of the above-mentioned objects, features and advantages of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0053] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present application, however, the present application can also be implemented in other manners different from those described herein, and therefore, the protection scope of the present application is not limited by the specific embodiments disclosed below.
[0054] Figure 1 A flowchart of a pig farm abortion rate early warning method fusing a spatio-temporal graph network and knowledge enhancement is shown.
[0055] As Figure 1 shown, the present embodiment provides a pig farm abortion rate early warning method fusing a spatio-temporal graph network and knowledge enhancement, comprising:
[0056] S102, acquiring multi-source historical data of each pig farm within a preset time step, and constructing a blue-ear disease risk knowledge graph for each pig farm at each historical time t according to the multi-source historical data;
[0057] S104, connecting the blue-ear disease risk knowledge graphs of all pig farms at the same time t according to the organizations and geographical positions to which the pig farms belong, to form a global spatio-temporal knowledge graph, and extracting a field relationship topology graph reflecting the pig farm-organization-city relationship;
[0058] S106, learning the representation of an internal event subgraph in the blue-ear disease risk knowledge graph of each pig farm respectively by using a graph attention network, generating a field embedding fusing a time weight, taking the field embedding as a node feature, and again learning the representation of the field relationship topology graph by using the graph attention network to generate a field relationship topology graph with a spatial propagation risk;
[0059] S108, inputting the field relationship topology graph of each pig farm after being spliced with historical abortion rates into a long short-term memory network to obtain a time series trend, and simultaneously inputting the output into two parallel task heads to respectively predict the abortion rate abnormal risk probability and the specific abortion rate value in the future three time windows, and triggering an early warning when the abortion rate abnormal risk probability exceeds a threshold.
[0060] It should be noted that the preset warning day and the look-back window time step, for example, the current date that needs to perform the warning is T day, according to the preset, all related data in the historical window from T-60 day to T-1 day will be automatically obtained. Based on the look-back window, multi-source historical data is extracted from the pig farm production management system, the environmental monitoring system and the laboratory information management system, and the multi-source historical data includes production activity data, health performance data, external environment data and disease monitoring data; the production activity data includes but is not limited to event records of introduction (source pig farm, quantity, date, detection state), group entry (sow group transfer record), mating (mating success rate), immunization (vaccine type, inoculation date) and the like; the health performance data includes historical abortion rate of the pig farm; the external environment data includes weather conditions of the place where the pig farm is located, such as temperature, humidity, precipitation and the like; and the disease monitoring data includes positive detection results of blue ear disease.
[0061] A dynamic time window is preset, and multi-source historical data is extracted according to the dynamic time window, for a specific historical time t, a knowledge graph is constructed for the pig farm i The data covered is not only the day t, but also a review period with t as the end point. Preferably, the review period is set to 30 days before t, that is, the data time range is [t-29, t], which indicates that the knowledge graph Describes the risk status of the pig farm i within 30 days before t. The blue ear disease risk knowledge graph Contains multiple subgraphs of each pig farm, involving pig farm events in the introduction, group entry, immunization, weather, historical abortion rate and blue ear disease positive detection of the pig farm within 30 days. Each subgraph focuses on describing a type of event or a risk aspect, according to a predefined blue ear disease risk ontology model, entities and relationships are extracted from multi-source historical data in the dynamic time window [t-29, t], and a field event subgraph is constructed for each pig farm at each historical time t, the field event subgraph includes: introduction subgraph, group entry subgraph, immunization subgraph, weather subgraph, historical abortion rate subgraph and blue ear disease positive detection subgraph; according to the field event subgraph, a blue ear disease risk knowledge graph reflecting the risk state in the dynamic time window is constructed, and the blue ear disease risk knowledge graph is stored in the form of a graph data structure in a graph database.
[0062] Figure 2 A flowchart for performing pig farm abortion rate warning is shown.
[0063] It should be noted that the blue ear disease risk knowledge graph independently constructed by each pig farm i at the same historical time t The internal risk state of the pig farm in the dynamic time window [t-29, t] is described in detail. The core of the global spatio-temporal knowledge graph is to establish the association between pig farms, extract and explicit the association according to the pre-defined rules, and form the topology structure of the pig farm interrelation graph. According to the organizational affiliation and geographical proximity relationship, the association between pig farms is constructed, the pig farm, organization entity and geographical location entity are taken as nodes, two types of edges are created according to the association, and a topology graph composed of pig farm, organization, city node and relationship is constructed; wherein the organizational affiliation: if two (or more) pig farms belong to a parent company, breeding group or management system, it is considered that there is a strong association between them. Geographical proximity relationship: if two (or more) pig farms are located in the same city, region, or the geographical distance between each other is within the preset threshold, it is considered that there is an association between them. Through the two relationships, the originally isolated pig farm nodes are connected to the common superior organization node and the geographical node, thereby indirectly associating with each other. The blue-ear disease risk knowledge graph of each pig farm is mounted as a subgraph to the corresponding pig farm node in the topology graph, and a global spatio-temporal knowledge graph is fused to generate a blue-ear disease risk spatio-temporal knowledge graph as shown in Figure 3 . The spatio-temporal knowledge graph captures the static risk snapshot of all pig farms at a specific time t, and captures the association in the space and management dimension through the inter-farm relationship.
[0064] From the spatio-temporal knowledge graph, the pig farm node, organization node and city node are identified and extracted, each pig farm node carries a unique identifier (such as pig farm ID) and its in-farm embedding vector at time t. Traverse the spatio-temporal knowledge graph to find and extract all belong relationship edges from the pig farm node to the organization node and all located relationship edges from the pig farm node to the city node; all extracted pig farms, organizations, city nodes are taken as the node set of the new graph, and the extracted belong relationship edges and located relationship edges are taken as the edge set of the new graph, according to the bipartite graph structure, the inter-farm relationship topology graph is constructed, the pig farm node is connected to the organization node and the city node through the edge, and the organization node and the city node are indirectly associated through the shared connected pig farm node.
[0065] It should be noted that the graph attention network is used to analyze how the risk propagates through the common organization and the common city in this inter-farm relationship topology graph. The pig farm node of the inter-farm relationship topology graph has already attached the quantitative characteristics of its internal risk, while the characteristics of the organization and city nodes need to be learned in the training. The GAT network aggregates information from neighbor nodes, and finally generates an inter-farm embedding for each pig farm that contains both its own risk and external propagation risk.
[0066] The blue-ear disease risk knowledge graph of each pig farm i at historical time t is obtained , which includes multiple subgraphs g t,i,jDifferent sub-graphs record different time of introduction events, group events and corresponding risk events, etc. For the same event sub-graph, in order to capture the influence of different risk events on the abnormal risk of abortion rate, the graph attention network is used for the representation learning of the sub-graph nodes, the attention weights between all nodes are calculated, the information of each node is weighted aggregated, and the node embedding vector A t,i,j is generated, which represents:
[0067] A t,i,j =GAT(g t,i,j ;σ1)
[0068] wherein g t,i,j is the in-plant event sub-graph, and σ1 is a learnable parameter;
[0069] The embedding vectors of all non-risk event nodes are filtered from the obtained node embedding vectors and added to generate a sub-graph representation vector representing the overall semantics and risk state of the event sub-graph. The non-risk event nodes refer to specific and traceable event operation entities.
[0070] Since the occurrence time and time range of events recorded by different sub-graphs are different, the closer the sub-graph to the time t, the greater the influence on the abnormality of the pig farm abortion rate, and the recent events are more valuable than the long-term events. For each sub-graph, the time interval between the corresponding time range and the current time t is calculated, the time interval is mapped to a time representation vector, each sub-graph representation vector is spliced with the corresponding time representation vector to generate an enhanced vector that fuses event content and time information, and the enhanced vectors of all sub-graphs are fused by addition to obtain a fixed-dimensional in-plant embedding vector that fuses all internal event information of the pig farm and the time decay effect is represented as:
[0071]
[0072] wherein g t,i,j is the in-plant event sub-graph, l t,i,j is the time representation vector, i is the pig farm identifier, j is the sub-graph index, j = 0, 1, 2, …, Linear is a linear transformation layer, Add is an addition operation, and MLP is a multi-layer perceptron.
[0073] Since there is a risk of abortion rate spread among pig farms in the same organization or the same city, in order to capture this abnormal risk, a graph attention network GAT is introduced to depict the mutual influence among different pig farms by using the inter-farm relationship topology graph and the intra-farm embedding. The inter-farm relationship topology graph is obtained, the intra-farm embedding vector is taken as the initial feature vector of each pig farm node, and a learnable embedding vector is randomly initialized as the initial feature for each organization node and city node. The graph attention network is used to learn the representation of the inter-farm relationship topology graph. In the graph attention network, the feature vector of each neighbor node is multiplied by the corresponding attention weight, and then all the weighted features are aggregated with the feature of the target node itself. After a nonlinear transformation, a new representation vector of the target node is generated, which integrates the neighbor information. The updated node embedding matrix is obtained to obtain the inter-farm embedding, and the node embedding matrix is represented as:
[0074]
[0075] wherein is the inter-farm relationship topology graph, is the inter-farm embedding of the i-th pig farm, and σ2 is a learnable parameter.
[0076] The inter-farm embedding integrates the risk information of all pig farms under its jurisdiction or jurisdiction, thereby becoming a more accurate representation of organizational risk and regional risk. The inter-farm embedding is a comprehensive risk vector that contains internal state and external environment, which is used for final time series prediction to improve prediction accuracy.
[0077] It should be noted that for each pig farm, the inter-farm vector at each time t and the historical abortion rate observation are obtained. For each time t in the lookback window, the inter-farm vector is concatenated with the historical abortion rate observation a i,t to form a fusion feature vector Finally, a fusion feature sequence Z i =[p i,T-60 ;p i,T-59 ;…;p i,T-1 ] is generated for each pig farm from [T-60, T-1], which provides the most comprehensive input information for time series prediction.
[0078] The change of abortion rate is a typical time series problem with long-term dependence and complex trends. LSTM network is very good at learning and memorizing such long-term time series patterns due to its internal gating mechanism. The fusion feature sequence is input into the LSTM network to obtain a hidden state vector, which encodes the deep time trend contained in all risk information and abortion rate performance of the pig farm in the past 60 days. In order to improve the stability and generalization of the abortion risk prediction task, a multi-task learning is performed by adding an abortion rate prediction task related to the abortion rate risk prediction, and the hidden state vector is input into two parallel risk probability prediction heads and an abortion rate value prediction head;
[0079] In the risk probability prediction head, the risk probability of abortion rate anomaly caused by blue-ear disease in the future three time windows [T+1~T+7], [T+8~T+14] and [T+15~T+21] is predicted, a Sigmoid function is used as the activation function of the task head, the output is compressed to the interval (0, 1), and the probability values of the three time windows are obtained is represented as:
[0080]
[0081] Wherein f1 is the task head function, which is a multi-layer perceptron, φ is a set of trainable parameters of the LSTM network, and ψ1 is a set of trainable parameters of the multi-layer perceptron.
[0082] In the abortion rate value prediction head, the specific abortion rate values of the future three same time windows are predicted, a Softplus function is used as the activation function of the task head, and continuous, non-negative abortion rate numerical values of the three time windows are obtained is represented as:
[0083]
[0084] Wherein f2 is the task head function, which is a multi-layer perceptron, the parameters of the two task heads are different, φ is a set of trainable parameters of the LSTM network, and ψ1 is a set of trainable parameters of the multi-layer perceptron.
[0085] The loss function of the model is defined as:
[0086]
[0087] Wherein k is the index of the future time point, y i,k is the true label, indicating whether abortion rate anomaly really occurs at a future time point, is the predicted probability, indicating the risk probability of abortion rate anomaly of the pig farm i at a future time point k, z i,k is the true abortion rate value, indicating the specific numerical value of the abortion rate actually observed by the pig farm i at a future time point k, To predict the abortion rate value, the model predicts a specific value of the abortion rate of the pig farm i at a future time point k.
[0088] Predicting a specific abortion rate value as a regression task provides a more accurate and continuous supervision signal for model learning, helps the risk probability prediction main task to learn a more robust feature representation, prevents overfitting, and in addition, the two tasks share the LSTM encoder, the shared layer learns general temporal features useful for both tasks, making the entire model more stable and reliable. Compare the risk probability output by the main task head with the preset risk threshold. If the predicted risk probability of any future time window exceeds the threshold, generate an early warning message for the pig farm, which explicitly indicates the time range of the risk and the abortion rate value. The early warning message prompts the pig farm manager through a visual interface or message notification, enabling them to take proactive measures such as strengthening biosecurity, isolation, and monitoring, thereby avoiding or reducing potential economic losses.
[0089] Figure 4 An architecture diagram of a pig farm abortion rate early warning system integrating spatio-temporal graph networks and knowledge enhancement is shown.
[0090] The second embodiment of the present application provides a pig farm abortion rate early warning system integrating spatio-temporal graph networks and knowledge enhancement, which includes 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.
[0091] 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, and preprocessing the multi-source historical data. The preprocessed data is stored in a spatio-temporal database.
[0092] The spatio-temporal knowledge graph management module constructs a blue-ear disease risk knowledge graph for each pig farm at each historical time t based on the preprocessed multi-source historical data according to the predefined blue-ear disease risk ontology model. The blue-ear disease risk knowledge graphs of all pig farms at the same time t are connected according to their organizations and geographical locations to form a global spatio-temporal knowledge graph, and the inter-farm relationship topology reflecting the relationship between pig farms, organizations, and cities is extracted.
[0093] The risk representation learning module uses a graph attention network to learn the representation of the internal event subgraph in each pig farm's blue-ear disease risk knowledge graph, generating a time-weighted intra-farm embedding. 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, generating an inter-farm embedding with spatial propagation risk.
[0094] The multi-task time sequence prediction module inputs the inter-farm embedding of each pig farm and the corresponding historical abortion rate into a long short-term memory network to obtain a time trend, and simultaneously inputs the output into two parallel task heads to respectively predict the abortion rate abnormal risk probability and the specific abortion rate value in the future three time windows.
[0095] The early warning decision and visualization module sets a risk probability threshold, generates early warning information of different levels when the abortion rate abnormal risk probability exceeds the threshold, and visualizes the early warning information and the abortion rate abnormal risk probability and the specific abortion rate value.
[0096] The third embodiment of the present application provides a computer readable storage medium, the computer readable storage medium comprises a spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method program, when the spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method program is executed by a processor, the steps of the spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method are realized.
[0097] In several embodiments provided in the present application, it should be understood that the disclosed method and system can be implemented in other ways. The system embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division mode, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms. In addition, each functional unit in each embodiment of the present application can be integrated into a 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 realized in the form of hardware or hardware plus software functional unit.
[0098] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, the above-mentioned program can be stored in a computer readable storage medium, and the program executes the steps including the above-mentioned method embodiments when executed; and the above-mentioned storage medium includes: mobile storage device, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or optical disc and various storage program codes.
[0099] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application.
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: acquiring multi-source historical data of each pig farm within a preset time step, and constructing a blue-ear disease risk knowledge graph for each pig farm at each historical time t according to the multi-source historical data; connecting the blue-ear disease 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, to form a global spatio-temporal knowledge graph, and extracting a pig farm-organization-city relationship topological graph reflecting the relationships among the pig farms, the organizations and the cities; using a graph attention network to learn the representation of an internal event subgraph in the blue-ear disease risk knowledge graph of each pig farm, to generate a time-weighted in-farm embedding, taking the in-farm embedding as a node feature, and using the graph attention network again to learn the representation of the pig farm-organization-city relationship topological graph, to generate an inter-farm embedding with a spatial transmission risk; splicing the inter-farm embedding of each pig farm with a historical abortion rate, and inputting the spliced result into a long short-term memory network to obtain a time trend, and inputting the output into two parallel task heads to predict an abortion rate abnormal risk probability and a specific abortion rate value in three future time windows, and triggering an early warning when the abortion rate abnormal risk probability exceeds a threshold value.
2. The spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to claim 1, characterized in that, acquiring multi-source historical data of each pig farm within a preset time step, and constructing a blue-ear disease risk knowledge graph for each pig farm at each historical time t according to the multi-source historical data, comprising: presetting an early warning day and a look-back window time step, and extracting multi-source historical data 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 comprises production activity data, health performance data, external environment data and epidemic disease monitoring data; presetting a dynamic time window, extracting multi-source historical data according to the dynamic time window, extracting entities and relationships from the multi-source historical data in the dynamic time window according to a predefined blue-ear disease risk ontology model, and constructing an in-farm event subgraph for each pig farm at each historical time t, wherein the in-farm event subgraph comprises a breeding link subgraph, a group entry link subgraph, an immunization link subgraph, a weather link subgraph, a historical abortion rate subgraph and a blue-ear disease positive detection subgraph; constructing a blue-ear disease risk knowledge graph reflecting the risk state in the dynamic time window according to the in-farm event subgraph, and storing the blue-ear disease risk knowledge graph in a 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, connecting the blue-ear disease 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, to form a global spatio-temporal knowledge graph, comprising: acquiring the blue-ear disease risk knowledge graphs independently constructed by each pig farm at the same historical time t, constructing a correlation among the pig farms according to the organizational affiliation and the geographical proximity, taking the pig farms, the organization entities and the geographical location entities as nodes, creating two types of edges according to the correlation, and constructing a topological graph composed of the pig farm nodes, the organization nodes, the city nodes and the relationship nodes; mounting the blue-ear disease risk knowledge graph of each pig farm as a subgraph to the corresponding pig farm node in the topological graph, and fusing 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, extracting a pig farm-organization-city relationship topological graph reflecting the relationships among the pig farms, the organizations and the cities, comprising: identify and extract pig farm nodes, organization nodes and city nodes from the spatio-temporal knowledge graph, and traverse the spatio-temporal knowledge graph to find and extract all belong-to relationship edges from the pig farm node to the organization node and all located-in relationship edges from the pig farm node to the city node; all extracted pig farms, organizations and city nodes are taken as a node set of a new graph, and all extracted belong-to relationship edges and located-in relationship edges are taken as an edge set of the new graph, and an inter-farm relationship topology graph is constructed according to a bipartite graph structure, 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 associated 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 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 a time weight fused intra-farm embedding, and take the intra-farm embedding as a node feature, including: The PRRS risk knowledge graph of each pig farm i at a historical time t is obtained, for an event subgraph, graph attention network is used for subgraph node representation learning, attention weights between all nodes are calculated, information of each node is weighted and aggregated, and a node embedding vector A with neighbor node importance is generated t,i,j , is expressed as: A t,i,j = GAT(g t,i,j ; σ1) where g t,i,j is an in-field event subgraph, σ1is a learnable parameter; The embedding vectors of all non-risk event nodes are filtered 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, a time interval corresponding to the current time and the time range of the subgraph is calculated, the time interval is mapped to a time representation vector, each subgraph representation vector is spliced with the corresponding time representation vector to generate an enhanced vector that fuses event content and time information, and all subgraph enhanced vectors are fused by additive summation to obtain a fixed-dimensional in-farm embedding vector that fuses all internal event information of the pig farm and the time decay effect thereof is represented as: where g t,i,j is the in-farm event sub-graph, l t,i,j is the time representation vector, i is the pig farm identifier, j is the sub-graph index, j = 0, 1, 2, …, Linear is a linear transformation layer, Add is an addition operation, and MLP is a multi-layer perceptron.
6. The spatio-temporal graph network and knowledge enhanced pig farm abortion rate early warning method according to claim 1, characterized in that, The intra-farm embedding is taken as a node feature, and 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, 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 the inter-farm relationship topology, is the inter-farm embedding for the i-th farm, and σ2is a learnable parameter.
7. The spatio-temporal graph fusion network and knowledge enhanced pig farm abortion rate early warning method according to claim 1, characterized in that, After the inter-farm embedding of each pig farm is spliced with the historical abortion rate, the spliced result is input into a long short-term memory network to obtain a time trend, and the output is sent 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 the historical abortion rate observation value at each time t are obtained, the inter-farm vector and the historical abortion rate observation value at each time t in the look-back window 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; In the risk probability prediction head, the risk probability of the abortion rate abnormality caused by the blue-ear disease in the future three time windows is predicted, a Sigmoid function is used as the activation function of the task head, the output is compressed to the interval (0, 1), and the probability values of the three time windows are obtained; In the abortion rate value prediction head, the specific abortion rate values in the future three same time windows are predicted, a Softplus function is used as the activation function of the task head, and continuous, non-negative abortion rate values in the three time windows are obtained.
8. A spatiotemporal graph network and knowledge-enhanced pig farm abortion rate early warning system, characterized in that, The system is used for implementing the fusion spatio-temporal graph network and the knowledge-enhanced pig farm abortion rate early warning method according to any one of claims 1-7, and the system 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 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 blue-ear disease 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 blue-ear disease risk ontology model, connects the blue-ear disease 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 pig farm-organization-city relationship; The risk representation learning module learns the representation of the internal event sub-graph in the blue-ear disease risk knowledge graph of each pig farm by using a graph attention network, generates a field embedding fused with a time weight, and uses the field embedding as a node feature to learn the representation of the field relationship topology graph by using the graph attention network again, and generates a field-to-field embedding with a spatial propagation risk; The multi-task time series prediction module concatenates the field-to-field embedding of each pig farm with the corresponding historical abortion rate, inputs the same into a long short-term memory network to obtain a time series trend, and simultaneously inputs the output 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; The early warning decision and visualization module sets a risk probability threshold, generates early warning information of different levels when the abortion rate abnormal risk probability exceeds the threshold, and visualizes the early warning information, the abortion rate abnormal 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
Topology awareness-based time sequence knowledge graph extrapolation method of dynamic relation graph and time sequence fusion
CN118036749A
Time sequence knowledge graph reasoning method based on long and short term dependence
CN118780360A
Method for temporal knowledge graph reasoning based on distributed attention
US20230401466A1
Method and system for predicting and classifying event sequences embedded in a knowledge graph
US20240256975A1
Cited By
Data organization and time sequence prediction method and device based on space-time mapping knowledge domain
CN121524558A