Graph neural network-based cattle herd behavior recognition method

Through a graph neural network-based method, local sub-groups are dynamically divided and a global dynamic graph is constructed, which realizes the multi-level feature fusion of cattle behavior, solves the problems of insufficient accuracy and real-time performance of cattle behavior recognition in existing technologies, and improves the timeliness and accuracy of anomaly detection.

CN120705741AInactive Publication Date: 2025-09-26HUBEI NIUYUAN ECOLOGICAL AGRI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510902260.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-09-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing cattle behavior recognition methods are difficult to effectively capture the dynamic interactions between cattle and changes in group structure, and have limited recognition capabilities in anomaly detection and early warning, and lack multi-level feature fusion and global-local information feedback mechanisms.

Method used

A graph neural network-based method is used to dynamically divide local sub-groups through multi-source time-series behavioral data and hierarchical dynamic graph neural networks, construct local and global dynamic graphs, and perform multi-level feature fusion to achieve accurate identification of cattle behavior and abnormal warning.

Benefits of technology

It improves the accuracy and real-time performance of cattle behavior identification, enables timely detection of abnormal behaviors, and enhances intelligent management and health protection capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705741A_ABST
    Figure CN120705741A_ABST
Patent Text Reader

Abstract

The invention discloses a cattle herd behavior recognition method based on a graph neural network. The method comprises the following steps: S1, collecting information of cattle only at different time steps and performing preprocessing; s2, on the basis of cattle time sequence behavior data, dynamically and locally dividing cattle herds at each time step, and constructing a local dynamic graph on the basis of each local sub-group; s3, modeling the dynamic relationship between the cows by using a dynamic graph neural network; s4, performing pooling operation on the local dynamic features to obtain local sub-group features; s5, taking all the local sub-groups as super nodes, and constructing a global dynamic graph; s6, applying a dynamic graph neural network to obtain global dynamic characteristics of each sub-group; s7, fusing the local dynamic features and the global dynamic features through an interlayer information interaction mechanism; and S8, identifying the behavior type of each cattle, and outputting a cattle group behavior identification result and abnormal early warning information. According to the invention, the hierarchical dynamic graph neural network is adopted to realize cattle behavior intelligent identification and abnormity early warning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent management of animal husbandry and artificial intelligence technology, and in particular to a cattle behavior recognition method based on graph neural network. Background Art

[0002] With the modernization of animal husbandry, cattle health management and behavioral monitoring have become important research areas in the field of smart farming. Traditional methods for identifying cattle behavior rely on manual observation, fixed camera monitoring, or activity sensor data from individual animals. While these methods can identify basic cattle behaviors to a certain extent, they suffer from low efficiency, strong subjectivity, and difficulty in implementing large-scale automated monitoring. In recent years, with the rapid development of the Internet of Things, big data, and artificial intelligence technologies, a growing number of studies have begun to explore the use of multi-source sensor data and intelligent algorithms to automatically identify cattle behavior. By deploying positioning devices, motion sensors, and environmental monitoring equipment on cattle, it is possible to collect real-time information on the cattle's spatial position, movement status, posture characteristics, and environmental parameters, providing a rich data foundation for subsequent behavioral analysis.

[0003] Currently, mainstream methods for identifying herd behavior mostly use statistically based machine learning models or convolutional and recurrent neural networks. These methods typically model individual cattle, neglecting the spatial relationships between cattle and the complex social interactions within the herd. Regarding group behavior recognition, some studies have attempted to incorporate social network analysis methods to model interactions between cattle, but these approaches are often limited to static graph structures and struggle to effectively capture dynamic interactions between cattle and changes in group structure over time. Furthermore, existing methods face challenges in processing large-scale spatiotemporal data on cattle herds, including complex data structures, high feature dimensionality, and diverse behavioral patterns. This makes it difficult to achieve both accurate and real-time behavior recognition.

[0004] Graph neural networks, a recently emerging deep learning method for processing complex structured data, have achieved promising results in social networks, bioinformatics, and traffic flow analysis. Some studies have applied graph neural networks to animal group behavior analysis, building relationship graphs between cattle to model the characteristics of group behavior. However, existing graph neural network methods focus on static relationship modeling at a single scale and lack effective characterization of the multi-level structure of cattle herds (such as local sub-groups and global groups). Furthermore, research on dynamic graph modeling, spatiotemporal feature fusion, and multi-level information interaction is insufficient, making it difficult to address the complexity of cattle herd behavior that changes dynamically over time and space. In particular, traditional methods have limited ability to identify group anomalies and lack multi-level feature fusion and global-local information feedback mechanisms, resulting in a need for improved accuracy in identifying abnormal behavior and speed of response.

[0005] Therefore, how to provide a cattle behavior recognition method based on graph neural network is an urgent problem that technicians in this field need to solve. Summary of the Invention

[0006] One purpose of the present invention is to propose a cattle herd behavior recognition method based on graph neural network. The present invention makes full use of multi-source time series behavior data, hierarchical dynamic graph neural network and multi-level feature fusion technology, and describes in detail the implementation process of dynamic local sub-group division of cattle, local and global dynamic graph modeling, multi-level feature fusion and abnormal behavior warning. It has the advantages of high recognition accuracy, effective capture of complex dynamic relationships of cattle herds, and real-time abnormality warning capabilities.

[0007] A method for identifying cattle herd behavior based on a graph neural network according to an embodiment of the present invention includes the following steps:

[0008] S1, collect cattle information at different time steps and preprocess it to obtain cattle temporal behavior data;

[0009] S2. Based on the cattle's temporal behavior data, the cattle herd is dynamically divided into local groups at each time step according to spatial distance and historical interaction frequency to obtain several local subgroups. A local dynamic graph is constructed based on each local subgroup to obtain local dynamic graph data;

[0010] S3. Applying dynamic graph neural network to the local dynamic graph data to model the dynamic relationship between cattle and obtain the local dynamic characteristics of each cattle in the local sub-group;

[0011] S4. Perform a pooling operation on the local dynamic features to obtain local sub-group features;

[0012] S5. Based on the characteristics of local subgroups, all local subgroups are treated as supernodes, and a global dynamic graph is constructed according to the relationship between subgroups to obtain global dynamic graph data;

[0013] S6. Applying dynamic graph neural network to the global dynamic graph data to obtain the global dynamic features of each subgroup;

[0014] S7, through the inter-layer information interaction mechanism, the local dynamic features and the global dynamic features are fused to obtain multi-level fusion features;

[0015] S8. Based on multi-level fusion features, the behavior category of each cow is identified, and the herd behavior identification results and abnormal warning information are output.

[0016] Optionally, the cattle time-series behavior data includes the spatial position information, motion state information, posture feature information and environmental feature information of each cow at each time step; the spatial position information includes the coordinate value of each cow in three-dimensional space; the motion state information includes the velocity component of each cow in the direction of each coordinate axis; the posture feature information includes the pitch angle θ, roll angle φ and yaw angle ψ of each cow; the environmental feature information includes the temperature T, humidity H and light intensity L of the environment in which each cow is located.

[0017] Optionally, the S2 specifically includes:

[0018] S21. Based on the cattle temporal behavior data, calculate the spatial distance between all cattle at each time step t.

[0019] S22. Count the interaction frequencies between all pairs of cattle within the historical time series window The frequency of interaction represents the number of interactions between the i-th cow and the j-th cow within a specific time period before time step t;

[0020] S23, according to spatial distance and historical interaction frequency Cluster the cattle and divide the cattle at each time step t into several local subgroups according to the preset threshold

[0021] S24. Construct a local dynamic graph based on each local subgroup The node set is the number of cattle in the subgroup, and the edge set According to spatial distance and historical interaction frequency Definition: If the spatial distance Less than the distance threshold and historical interaction frequency If the interaction threshold is greater than the interaction threshold, an edge is established between node i and node j.

[0022] S25, assign cattle temporal behavior data to each node i as the time-varying feature of the node, and assign a Give spatial distance and historical interaction frequency As the time-varying features of the edges, local dynamic graph data is obtained.

[0023] Optionally, the S3 specifically includes:

[0024] S31. The dynamic graph neural network includes a graph neural network layer and a time series modeling layer. The graph neural network layer aggregates information on node features and edge features at each time step, and the time series modeling layer performs time series dependency modeling on features of the same node at different time steps.

[0025] S32. In the graph neural network layer, based on the node neighborhood aggregation operation, the features of node i are aggregated with the features of neighboring nodes and edge features to obtain the intermediate feature representation of node i at the current time step;

[0026] S33. In the time series modeling layer, a time series neural network is used to perform sequence modeling on the intermediate features of node i at consecutive time steps to obtain the dynamic embedding features of node i;

[0027] S34, output each node i in the local subgroup The local dynamic features within the cluster are collected to collect the local dynamic features of all local sub-populations and all time steps.

[0028] Optionally, the pooling operation includes the following steps: The local dynamic features of all nodes in the pool are averaged:

[0029]

[0030] in, Represents a local subpopulation The overall feature representation at time step t is, represents the kth local subpopulation at time step t, where t represents the current time step, Represents a collection of nodes, represents the local subpopulation at time step t The number of internal nodes, i represents the local subgroup The node index within Represents the local dynamic characteristics of node i at time step t.

[0031] Optionally, the S5 specifically includes:

[0032] S51. For each time step t, all local sub-group features are used as node features to construct a local sub-group set. in represents the kth local subpopulation at time step t, M t is the number of local subpopulations at time step t;

[0033] S52, taking each local subgroup as a supernode of the global dynamic graph, and taking the local subgroup feature as the feature vector of the supernode;

[0034] S53, defining the connection relationship between super nodes based on the spatial proximity relationship, interaction relationship or member overlap relationship between local subgroups;

[0035] S54, all super nodes that satisfy the above relationship are and the edges that form the edge set of the global dynamic graph in A decision function that indicates whether one of the above three relationships is true;

[0036] S55. Construct a global dynamic graph at time step t The nodes are all local subgroups, and the edges are pairs of subgroups that satisfy spatial proximity, interaction, or member overlap relationships;

[0037] S56. Aggregate local subgroups Local subgroup characteristics and edge set ε t Together they serve as global dynamic graph data.

[0038] Optionally, the spatial proximity relationship includes for any two local subgroups and If the Euclidean distance between the spatial centroids of the two subpopulations is less than or equal to the pre-set distance threshold d th , then it is considered that there is a spatial proximity relationship between the two local subgroups;

[0039] The interaction relationship includes for any two local sub-populations and If within time step t, there is a cow belonging to At the same time there is another cow belonging to And if there is an edge connecting these two cows in the edge set of the original dynamic graph, then it is considered that there is an interactive relationship between the two local sub-groups;

[0040] The member overlap relationship includes for any two local subgroups and If within time step t, there is at least one cow in common between the two subpopulations, that is, there are cows belonging to and It is believed that there is a membership overlap between the two local subgroups.

[0041] Optionally, the S6 specifically includes:

[0042] S61. Based on the global dynamic graph data, a graph neural network-based modeling method is used to extract features from the global dynamic graph and calculate the high-order feature representation of each local subgroup;

[0043] S62. For each round of the message passing process of the graph neural network, update each local subgroup First, the features of all adjacent local subgroups of the current local subgroup at the current layer are aggregated, and then the aggregation results and the features of the current local subgroup at the current layer are input into the feature update function to obtain the local subgroup features of the next layer;

[0044] S63. Iterate the message passing process of all graph neural network layers L to obtain the final global high-order feature representation of each local sub-group;

[0045] S64. Combine or pool the global high-order features of all local sub-groups to obtain global dynamic features.

[0046] Optionally, the S7 specifically includes:

[0047] S71. For each time step t, obtain global dynamic features, global high-order features of each local subgroup, and local subgroup features;

[0048] S72. For each local sub-group, the overall features of the global dynamic graph are fed back to the local sub-group through the inter-layer information interaction mechanism;

[0049] S73. For each local subgroup, transform the global dynamic feature using a mapping function MAP(·) to obtain a mapped global dynamic feature that is consistent with the local subgroup feature space;

[0050] S74, performing multi-level feature fusion on the local subgroup features of the local subgroup, the global high-order features, and the mapped global dynamic features to obtain fused features;

[0051] S75. Based on the fusion features, the global dynamic graph information is dynamically injected into the feature representation of each local sub-group through the reverse feedback mechanism;

[0052] S76. Repeat steps S72 to S74 for all local subgroups to obtain a multi-level fusion feature set.

[0053] Optionally, the S8 specifically includes:

[0054] S81. Based on the multi-level fusion feature set, the individual cattle features in each local subgroup are fused with the multi-level fusion features of the local subgroup at the feature level or the decision level to obtain the final discriminant feature of each cattle;

[0055] S82, inputting the final discriminant features of each cow into the classification model, using a multi-class classifier to identify the behavior category of each cow, and outputting a probability distribution of the behavior category;

[0056] S83. For each cow at the current time step t, based on the behavior category probability distribution output by the classification model, select the behavior category with the largest probability value as the behavior recognition result of the cow at time step t;

[0057] S84, based on the cattle behavior recognition results and the probability distribution of the behavior categories, combined with historical behavior data and behavior category priors, using an anomaly detection algorithm to issue an abnormal behavior warning to the cattle, and output abnormal warning information;

[0058] S85. Obtain the behavior recognition result and abnormal warning information of each cow, and combine them into the herd behavior recognition result and abnormal warning information.

[0059] The beneficial effects of the present invention are:

[0060] This paper proposes a method for identifying cattle herd behavior based on a graph neural network. By fully utilizing multi-source time-series behavioral data of cattle, it achieves accurate modeling of the complex dynamic relationships within the herd. A dynamic local sub-group partitioning strategy that combines spatial distance with historical interaction frequency enables the system to adaptively capture the spatial aggregation and social interaction characteristics of the herd at different time steps, improving its ability to perceive changes in group structure. By constructing a dynamic graph based on each local sub-group and introducing time-varying features of nodes and edges, it can meticulously reflect the real-time behavioral relationships between cattle, laying a solid data foundation for subsequent feature extraction and behavior recognition.

[0061] In terms of feature modeling, the present invention adopts a multi-level feature extraction mechanism that combines local and global dynamic graph neural networks. By first modeling the dynamic relationship between cattle in local sub-groups, and then using each local sub-group as a super-node to construct a global dynamic graph, the effective integration of the multi-level structural information of the cattle herd is achieved. By utilizing the multi-level feature fusion and inter-layer information interaction mechanism, the behavioral characteristics of cattle can be fully explored at the global and local scales, and the ability to express complex behavioral patterns is enhanced. In addition, in response to actual application needs, the present invention also combines historical behavioral data and behavioral category priors to design an abnormal behavior detection and early warning mechanism based on multi-level fusion features, which improves the timeliness and accuracy of abnormal identification.

[0062] Combining the above technical measures, this invention effectively improves the accuracy and adaptability of cattle behavior recognition, enabling real-time monitoring and automated management of cattle dynamic behavior. The system not only supports precise identification of diverse behavioral categories but also promptly detects and issues warnings of abnormal cattle behavior, contributing to improved intelligent ranch management and cattle health assurance. The overall solution offers excellent engineering feasibility and scalability, meeting the practical needs of the modern livestock industry for large-scale, efficient, and intelligent cattle behavior monitoring. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0064] Figure 1 This is a flowchart of a cattle behavior recognition method based on graph neural network proposed in the present invention;

[0065] Figure 2 This is a schematic diagram of the cattle behavior feature modeling structure based on a hierarchical dynamic graph neural network in a cattle behavior recognition method based on a graph neural network proposed in the present invention;

[0066] Figure 3 This is a schematic diagram of the process of dividing a cattle herd into dynamic local subgroups in the cattle herd behavior recognition method based on graph neural network proposed in the present invention. DETAILED DESCRIPTION

[0067] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.

[0068] refer to Figure 1-3 , a cattle herd behavior recognition method based on graph neural network, including the following steps:

[0069] S1, collect cattle information at different time steps and preprocess it to obtain cattle temporal behavior data;

[0070] S2. Based on the cattle's temporal behavior data, the cattle herd is dynamically divided into local groups at each time step according to spatial distance and historical interaction frequency to obtain several local subgroups. A local dynamic graph is constructed based on each local subgroup to obtain local dynamic graph data;

[0071] S3. Applying dynamic graph neural network to the local dynamic graph data to model the dynamic relationship between cattle and obtain the local dynamic characteristics of each cattle in the local sub-group;

[0072] S4. Perform a pooling operation on the local dynamic features to obtain local sub-group features;

[0073] S5. Based on the characteristics of local subgroups, all local subgroups are treated as supernodes, and a global dynamic graph is constructed according to the relationship between subgroups to obtain global dynamic graph data;

[0074] S6. Applying dynamic graph neural network to the global dynamic graph data to obtain the global dynamic features of each subgroup;

[0075] S7, through the inter-layer information interaction mechanism, the local dynamic features and the global dynamic features are fused to obtain multi-level fusion features;

[0076] S8. Based on multi-level fusion features, the behavior category of each cow is identified, and the herd behavior identification results and abnormal warning information are output.

[0077] The present invention proposes a cattle behavior recognition method based on graph neural networks. By introducing a hierarchical dynamic graph neural network, efficient and intelligent recognition of cattle behavior and abnormal warning are achieved. By dynamically dividing subgroups and modeling time-series behavior data, the spatial and interactive relationships between cattle can be accurately captured, significantly improving the accuracy of behavior recognition and the timeliness of abnormality detection. Through the multi-level fusion of local and global features, the system can comprehensively reflect the dynamic behavioral changes of cattle groups and individuals, effectively making up for the shortcomings of traditional manual inspections or static models in real-time and accuracy. In addition, the data processing has a high degree of automation, which greatly reduces the need for manual intervention and improves the efficiency of breeding management. The present invention has demonstrated excellent recognition accuracy and early warning response speed in practical applications, providing a strong guarantee for cattle health management and production safety, and has good promotion and application value.

[0078] In this embodiment, the cattle time-series behavior data includes the spatial position information, motion state information, posture feature information and environmental feature information of each cow at each time step; the spatial position information includes the coordinate value of each cow in three-dimensional space; the motion state information includes the velocity component of each cow in the direction of each coordinate axis; the posture feature information includes the pitch angle θ, roll angle φ and yaw angle ψ of each cow; the environmental feature information includes the temperature T, humidity H and light intensity L of the environment in which each cow is located.

[0079] This method achieves multi-dimensional, accurate modeling of cattle behavior by collecting information on the cattle's spatial position, motion state, posture characteristics, and environmental features at each time step. This method effectively improves the accuracy of behavior recognition and the real-time nature of anomaly warnings, providing reliable data support and technical assurance for cattle health management and livestock farming safety.

[0080] In this embodiment, S2 specifically includes:

[0081] S21. Based on the cattle temporal behavior data, calculate the spatial distance between all cattle at each time step t.

[0082] S22. Count the interaction frequencies between all pairs of cattle within the historical time series window The frequency of interaction represents the number of interactions between the i-th cow and the j-th cow within a specific time period before time step t;

[0083] S23, according to spatial distance and historical interaction frequency Cluster the cattle and divide the cattle at each time step t into several local subgroups according to the preset threshold

[0084] S24. Construct a local dynamic graph based on each local subgroup The node set is the number of cattle in the subgroup, and the edge set According to spatial distance and historical interaction frequency Definition: If the spatial distance Less than the distance threshold and historical interaction frequency If the interaction threshold is greater than the interaction threshold, an edge is established between node i and node j.

[0085] S25, assign cattle temporal behavior data to each node i as the time-varying feature of the node, and assign a Give spatial distance and historical interaction frequency As the time-varying features of the edges, local dynamic graph data is obtained.

[0086] The present invention conducts an in-depth analysis of the temporal behavioral data of cattle. First, the spatial distance between all cattle is calculated at each time step, and the frequency of their interaction within the historical time series window is counted. According to the spatial distance and interaction frequency, the cattle are divided into several local sub-groups to achieve dynamic grouping. Subsequently, based on each sub-group, a local dynamic graph is constructed, and the cattle are used as nodes in the graph. If the spatial distance between two cattle is less than the set threshold and the interaction frequency is higher than the set threshold, a connection is established between the nodes. Each node and connection is assigned temporal behavioral data and related dynamic characteristics. This method can dynamically reflect the spatial proximity and behavioral interaction relationship between cattle, improve the precision and accuracy of the herd behavior structure modeling, and lay a solid data foundation for subsequent intelligent identification and abnormal warning.

[0087] In this embodiment, S3 specifically includes:

[0088] S31. The dynamic graph neural network includes a graph neural network layer and a time series modeling layer. The graph neural network layer aggregates information on node features and edge features at each time step, and the time series modeling layer performs time series dependency modeling on features of the same node at different time steps.

[0089] S32. In the graph neural network layer, based on the node neighborhood aggregation operation, the features of node i are aggregated with the features of neighboring nodes and edge features to obtain the intermediate feature representation of node i at the current time step;

[0090] S33. In the time series modeling layer, a time series neural network is used to perform sequence modeling on the intermediate features of node i at consecutive time steps to obtain the dynamic embedding features of node i;

[0091] S34, output each node i in the local subgroup The local dynamic features within the cluster are collected to collect the local dynamic features of all local sub-populations and all time steps.

[0092] The present invention realizes dynamic and multi-level modeling of cattle behavior through dynamic graph neural networks. First, the node features and edge features are aggregated using the time series modeling layer to accurately capture the time dependency of cattle behavior. Subsequently, the features of the individual and its neighbors are integrated through node neighborhood aggregation in the graph neural network layer to form a node feature representation at the current moment. The features of the node at consecutive moments are then sequence modeled through the time series modeling layer to obtain the dynamic evolution characteristics of the node. Finally, the local dynamic features of each cattle in the local sub-group are output, realizing dynamic perception of the individual and group behavior status of the cattle. The above method significantly improves the accuracy and timeliness of cattle behavior recognition, and provides a strong data foundation for intelligent breeding management.

[0093] In this embodiment, the pooling operation includes the following steps: The local dynamic features of all nodes in the pool are averaged:

[0094]

[0095] in, Represents a local subpopulation The overall feature representation at time step t is, represents the kth local subpopulation at time step t, where t represents the current time step, Represents a collection of nodes, represents the local subpopulation at time step t The number of internal nodes, i represents the local subgroup The node index within Represents the local dynamic characteristics of node i at time step t.

[0096] The present invention achieves a holistic representation of the local behavioral characteristics of a cattle herd by performing an average pooling operation on the local dynamic features of all nodes within a local sub-population. The pooling formula is used to sum and average the dynamic features of each node at the current moment to obtain a holistic representation of the sub-population at that moment. This effectively integrates the behavioral information of individuals within the sub-population, improving the representativeness and stability of the data. This method helps enhance the ability to model the local behavioral state of a cattle herd, improves the accuracy of subsequent group behavior recognition and anomaly detection, and provides more reliable data support for intelligent farming and health management.

[0097] In this embodiment, the S5 specifically includes:

[0098] S51. For each time step t, all local sub-group features are used as node features to construct a local sub-group set. in represents the kth local subpopulation at time step t, M t is the number of local subpopulations at time step t;

[0099] S52, taking each local subgroup as a supernode of the global dynamic graph, and taking the local subgroup feature as the feature vector of the supernode;

[0100] S53, defining the connection relationship between super nodes based on the spatial proximity relationship, interaction relationship or member overlap relationship between local subgroups;

[0101] S54, all super nodes that satisfy the above relationship are and the edges that form the edge set of the global dynamic graph in A decision function that indicates whether one of the above three relationships is true;

[0102] S55. Construct a global dynamic graph at time step t The nodes are all local subgroups, and the edges are pairs of subgroups that satisfy spatial proximity, interaction, or member overlap relationships;

[0103] S56. Aggregate local subgroups Local subgroup characteristics and edge set ε t Together they serve as global dynamic graph data and are output for subsequent global behavior modeling and analysis.

[0104] The present invention achieves hierarchical modeling of herd behavior by constructing a global dynamic graph using all local sub-group features at each moment as nodes. Formulas are used to define edge sets to determine whether any two local sub-groups satisfy spatial proximity, interaction, or member overlap. If any of these conditions are met, a connection is established. This method transforms complex herd behavior relationships into a graph structure, where nodes represent local sub-groups and edges reflect the connections between groups, effectively improving the global representation of herd behavior. The resulting global dynamic graph data provides high-quality structured information support for subsequent behavior modeling and analysis, facilitating refined intelligent management.

[0105] In this embodiment, the spatial proximity relationship includes for any two local subgroups and If the Euclidean distance between the spatial centroids of the two subpopulations is less than or equal to the pre-set distance threshold dth , then it is considered that there is a spatial proximity relationship between the two local subgroups;

[0106] The interaction relationship includes for any two local sub-populations and If within time step t, there is a cow belonging to At the same time there is another cow belonging to And if there is an edge connecting these two cows in the edge set of the original dynamic graph, then it is considered that there is an interactive relationship between the two local sub-groups;

[0107] The member overlap relationship includes for any two local subgroups and If within time step t, there is at least one cow in common between the two subpopulations, that is, there are cows belonging to and It is believed that there is a membership overlap between the two local subgroups.

[0108] The present invention achieves accurate modeling of complex behavioral connections within a herd by clearly defining the spatial proximity, interaction, and member overlap relationships between local subgroups. Spatial proximity determines the spatial proximity of subgroups through a Euclidean distance threshold, interaction determines behavioral interactions between subgroups through actual edges between cattle, and member overlap determines mobility through the overlap of members between subgroups. The strict determination of the above relationships provides a foundation for constructing a structured herd behavior network, improves the scientific nature and reliability of subsequent behavior identification and herd dynamics analysis, and contributes to the intelligent and refined management of herds.

[0109] In this embodiment, S6 specifically includes:

[0110] S61. Based on the global dynamic graph data, a graph neural network-based modeling method is used to extract features from the global dynamic graph and calculate the high-order feature representation of each local subgroup;

[0111] S62. For each round of the message passing process of the graph neural network, update each local subgroup First, the features of all adjacent local subgroups of the current local subgroup at the current layer are aggregated, and then the aggregation result and the features of the current local subgroup at the current layer are input into the feature update function to obtain the local subgroup features of the next layer;

[0112] S63. Iterate the message passing process of all graph neural network layers L to obtain the final global high-order feature representation of each local sub-group;

[0113] S64. Combine or pool the global high-order features of all local sub-groups to obtain global dynamic features.

[0114] This paper uses a global dynamic graph feature extraction method based on a graph neural network to deeply model the high-level behavioral characteristics of local subgroups of a herd. Through multiple rounds of message passing, the feature information between each local subgroup and its neighbors is fully integrated, improving the expressive power of the features. Ultimately, the high-level features of all local subgroups are combined or pooled to obtain global dynamic features, achieving a comprehensive depiction of the overall behavioral state of the herd. This method enhances the ability to model the complex behavioral structures of a herd, providing more accurate and systematic feature support for herd behavior analysis and intelligent management.

[0115] In this embodiment, the S7 specifically includes:

[0116] S71. For each time step t, obtain global dynamic features, global high-order features of each local subgroup, and local subgroup features;

[0117] S72. For each local sub-group, the overall features of the global dynamic graph are fed back to the local sub-group through the inter-layer information interaction mechanism;

[0118] S73. For each local subgroup, transform the global dynamic feature using a mapping function MAP(·) to obtain a mapped global dynamic feature that is consistent with the local subgroup feature space;

[0119] S74, performing multi-level feature fusion on the local subgroup features of the local subgroup, the global high-order features, and the mapped global dynamic features to obtain fused features;

[0120] S75. Based on the fusion features, the global dynamic graph information is dynamically injected into the feature representation of each local sub-group through the reverse feedback mechanism;

[0121] S76. Repeat steps S72 to S74 for all local subgroups to obtain a multi-level fusion feature set.

[0122] The present invention achieves dynamic feedback and enhancement of local sub-group features using global dynamic graph features through inter-layer information interaction and multi-level feature fusion methods. After mapping, global features are fused with local features in the same space, enabling each local sub-group to comprehensively utilize its own features, global high-order features, and global dynamic features, thereby enhancing the richness and distinctiveness of feature expression. Through a reverse feedback mechanism, global information is dynamically injected into local feature representations, effectively enhancing the local sub-group's ability to perceive overall group behavior. This method improves the accuracy of herd behavior modeling and provides a solid data foundation for subsequent intelligent analysis.

[0123] In this embodiment, the S8 specifically includes:

[0124] S81. Based on the multi-level fusion feature set, the individual cattle features in each local subgroup are fused with the multi-level fusion features of the local subgroup at the feature level or the decision level to obtain the final discriminant feature of each cattle;

[0125] S82, inputting the final discriminant features of each cow into the classification model, using a multi-class classifier to identify the behavior category of each cow, and outputting a probability distribution of the behavior category;

[0126] S83. For each cow at the current time step t, based on the behavior category probability distribution output by the classification model, select the behavior category with the largest probability value as the behavior recognition result of the cow at time step t;

[0127] S84, based on the cattle behavior recognition results and the probability distribution of the behavior categories, combined with historical behavior data and behavior category priors, using an anomaly detection algorithm to issue an abnormal behavior warning to the cattle, and output abnormal warning information;

[0128] S85. Obtain the behavior recognition result and abnormal warning information of each cow, and combine them into the herd behavior recognition result and abnormal warning information.

[0129] This invention improves the accuracy of behavioral identification features for each individual cow by integrating individual cow characteristics with multi-level fusion features of local subgroups. A multi-category classification model is used to accurately identify cattle behavior categories and output probability distributions, improving classification reliability. Combining historical behavioral data with category priors, an anomaly detection algorithm is used to provide real-time warnings for abnormal behavior of individual cows, ensuring the scientific and timely nature of anomaly detection. Ultimately, the system outputs herd behavior identification results and anomaly warning information, providing effective technical support for herd health management and precision farming.

[0130] Example 1:

[0131] To verify the feasibility of this invention, we applied it to the management of a modern dairy farm, conducting systematic experiments on identifying group behavior and providing early warning of abnormalities. The farm's daily activity area is approximately 6,000 square meters, and the herd consists of 120 cattle, including adults and young cattle at different physiological stages. The farm utilizes a management model that combines free grazing with scheduled feeding. Cattle movements are highly complex and group-based, making it difficult to detect abnormal individual behaviors in a timely manner, impacting herd health and production efficiency.

[0132] In practical application, high-precision triaxial accelerometers and positioning tags are first attached to the necks of cattle to collect real-time data on each cow's activity intensity, number of steps, standing / lying status, and spatial position per minute. This raw data is wirelessly transmitted to the data center, where the system performs preprocessing, including denoising, data alignment, and outlier removal, to ensure data quality. The system then dynamically divides the herd into local subgroups based on spatial distance and interaction frequency, with each subgroup typically consisting of 5 to 10 cattle. For each subgroup, a local dynamic graph is constructed at each time step to capture the interactions and behavioral changes within the subgroup.

[0133] A dynamic graph neural network (DGNN) is used to model local behavioral patterns in the local dynamic graph, capturing dynamic interaction features between cattle. Pooling is used to integrate these local features into overall behavioral features of subgroups. Furthermore, a global dynamic graph is constructed using local subgroups as supernodes, and this is remodeled using the DGNN to extract global group behavioral features. Through an inter-layer information exchange mechanism, local and global features are fused to generate a multi-level fused feature for each cattle. Finally, a behavior recognition model identifies the behavioral category of each cattle based on the fused features and provides real-time warnings for abnormal behavior.

[0134] During the 30-day experimental period, the system automatically identified the categories of cattle behavior every day, including common behaviors such as eating, drinking, resting, exercising, and licking, and issued real-time warnings for abnormal behaviors such as long periods of stillness and sudden decreases in activity. During the experiment, manual inspection records were compared with the system identification results. Statistical data show that the system has an accuracy rate of 96.8% in identifying routine behaviors of cattle, an accuracy rate of 94.5% in identifying abnormal behaviors, and an average response time of 2 minutes for abnormal warnings, which is significantly better than traditional manual inspections (average response time of more than 20 minutes). The system identified a total of 38 cases of abnormal behavior, of which 35 were manually confirmed to be true, 3 were missed, and 2 were false alarms. Compared with the control group that did not use the present invention, the control group only found 24 cases of abnormal behavior during the same period, and there were cases of missed reports and delays.

[0135] The application of this invention effectively improves the accuracy and timeliness of cattle behavior recognition, enabling intelligent, automated management of cattle health. As shown in the table below, the system using this invention outperforms traditional methods in terms of behavior recognition accuracy, timeliness of anomaly warnings, and the number of abnormal behaviors detected, fully demonstrating the beneficial effects of this invention.

[0136] Table 1 Comparison of cattle behavior recognition and abnormal warning effects

[0137]

[0138]

[0139] As can be seen from the table above, the present invention demonstrates significant improvements over traditional manual inspection methods in multiple key performance indicators for cattle behavior recognition and anomaly warning. First, in terms of behavior recognition accuracy, the present system achieved 96.8%, a 10.5 percentage point improvement over the 86.3% achieved by traditional manual inspections. This demonstrates that the present invention, through multi-level feature modeling based on dynamic graph neural networks, is able to more accurately capture the diverse behavioral characteristics of cattle, reducing errors caused by oversight or subjective judgment.

[0140] In terms of abnormal behavior recognition accuracy, the system of the present invention achieved 94.5%, far exceeding the 77.9% of the control group. This is mainly due to the system's ability to dynamically divide local sub-groups and model the interaction patterns and spatial relationships between cattle in real time, effectively identifying abnormalities such as sudden decreases in activity and abnormal stillness, which are difficult to detect in a timely manner through traditional experience. At the same time, the abnormal warning response time is significantly shortened to 2 minutes, compared to the 21 minutes of manual inspections, greatly improving the timeliness of management and enabling farmers to take intervention measures more quickly to reduce cattle health risks.

[0141] In terms of the number of abnormal behaviors detected, the system of the present invention discovered 38 cases of abnormal behavior in the same time period, significantly higher than the 24 cases detected by manual inspections. This demonstrates that the present invention not only improves the comprehensiveness of detection but also reduces the number of missed abnormalities. Furthermore, the number of false positives has also decreased, demonstrating that the system maintains good accuracy while improving sensitivity. Furthermore, the data collection frequency has been increased from the traditional once every two hours to once every minute, providing more detailed and comprehensive information, and data processing is fully automated, significantly reducing the manual burden.

[0142] Improved cattle health scores also indirectly demonstrate the effectiveness of the present invention. After applying the present system, cattle health scores increased by 13.5%, while traditional methods only achieved a 4.6% improvement. In summary, the present invention not only excels in the accuracy and timeliness of behavior recognition and anomaly warnings, as well as the degree of management automation, but also provides strong support for intelligent management of modern farms and the protection of cattle health.

[0143] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.

Claims

1. A cattle behavior recognition method based on graph neural network, characterized by: The steps include: S1, collect cattle information at different time steps and preprocess it to obtain cattle temporal behavior data; S2. Based on the cattle's temporal behavior data, the cattle herd is dynamically divided into local groups at each time step according to spatial distance and historical interaction frequency to obtain several local subgroups. A local dynamic graph is constructed based on each local subgroup to obtain local dynamic graph data; S3. Applying dynamic graph neural network to the local dynamic graph data to model the dynamic relationship between cattle and obtain the local dynamic characteristics of each cattle in the local sub-group; S4. Perform a pooling operation on the local dynamic features to obtain local sub-group features; S5. Based on the characteristics of local subgroups, all local subgroups are treated as supernodes, and a global dynamic graph is constructed according to the relationship between subgroups to obtain global dynamic graph data; S6. Applying dynamic graph neural network to the global dynamic graph data to obtain the global dynamic features of each subgroup; S7, through the inter-layer information interaction mechanism, the local dynamic features and the global dynamic features are fused to obtain multi-level fusion features; S8. Based on multi-level fusion features, the behavior category of each cow is identified, and the herd behavior identification results and abnormal warning information are output.

2. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The cattle time-series behavior data includes the spatial position information, motion state information, posture feature information and environmental feature information of each cow at each time step; the spatial position information includes the coordinate value of each cow in three-dimensional space; the motion state information includes the velocity component of each cow in the direction of each coordinate axis; the posture feature information includes the pitch angle θ, roll angle φ and yaw angle ψ of each cow; the environmental feature information includes the temperature T, humidity H and light intensity L of the environment in which each cow is located.

3. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The S2 specifically includes: S21. Based on the cattle temporal behavior data, calculate the spatial distance between all cattle at each time step t. S22. Count the interaction frequencies between all pairs of cattle within the historical time series window The frequency of interaction represents the number of interactions between the i-th cow and the j-th cow within a specific time period before time step t; S23, according to spatial distance and historical interaction frequency Cluster the cattle and divide the cattle at each time step t into several local subgroups according to the preset threshold S24. Construct a local dynamic graph based on each local subgroup The node set is the number of cattle in the subgroup, and the edge set According to spatial distance and historical interaction frequency Definition: If the spatial distance Less than the distance threshold and historical interaction frequency If the interaction threshold is greater than the interaction threshold, an edge is established between node i and node j. S25, assign cattle temporal behavior data to each node i as the time-varying feature of the node, and assign a Give spatial distance and historical interaction frequency As the time-varying features of the edges, local dynamic graph data is obtained.

4. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The S3 specifically includes: S31. The dynamic graph neural network includes a graph neural network layer and a time series modeling layer. The graph neural network layer aggregates information on node features and edge features at each time step, and the time series modeling layer performs time series dependency modeling on features of the same node at different time steps. S32. In the graph neural network layer, based on the node neighborhood aggregation operation, the features of node i are aggregated with the features of neighboring nodes and edge features to obtain the intermediate feature representation of node i at the current time step; S33. In the time series modeling layer, a time series neural network is used to perform sequence modeling on the intermediate features of node i at consecutive time steps to obtain the dynamic embedding features of node i; S34, output each node i in the local subgroup The local dynamic features within the cluster are collected to collect the local dynamic features of all local sub-populations and all time steps.

5. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The pooling operation includes the following steps: The local dynamic features of all nodes in the pool are averaged: in, Represents a local subpopulation The overall feature representation at time step t is, represents the kth local subpopulation at time step t, where t represents the current time step, Represents a collection of nodes, represents the local subpopulation at time step t The number of internal nodes, i represents the local subgroup The node index within Represents the local dynamic characteristics of node i at time step t.

6. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The S5 specifically includes: S51. For each time step t, all local sub-group features are used as node features to construct a local sub-group set. in represents the kth local subpopulation at time step t, M t is the number of local subpopulations at time step t; S52, taking each local subgroup as a supernode of the global dynamic graph, and taking the local subgroup feature as the feature vector of the supernode; S53, defining the connection relationship between super nodes based on the spatial proximity relationship, interaction relationship or member overlap relationship between local subgroups; S54, all super nodes that satisfy the above relationship are and the edges that form the edge set of the global dynamic graph in A decision function that indicates whether one of the above three relationships is true; S55. Construct a global dynamic graph at time step t The nodes are all local subgroups, and the edges are pairs of subgroups that satisfy spatial proximity, interaction, or member overlap relationships; S56. Aggregate local subgroups Local subgroup characteristics and edge set ε t Together they serve as global dynamic graph data.

7. The method for identifying cattle behavior based on graph neural network according to claim 6, characterized in that: The spatial proximity relationship includes for any two local subgroups and If the Euclidean distance between the spatial centroids of the two subpopulations is less than or equal to the pre-set distance threshold d th , then it is considered that there is a spatial proximity relationship between the two local subgroups; The interaction relationship includes for any two local sub-populations and If within time step t, there is a cow belonging to At the same time there is another cow belonging to And if there is an edge connecting these two cows in the edge set of the original dynamic graph, then it is considered that there is an interactive relationship between the two local sub-groups; The member overlap relationship includes for any two local subgroups and If within time step t, there is at least one cow in common between the two subpopulations, that is, there are cows belonging to and It is believed that there is a membership overlap between the two local subgroups.

8. The method for identifying cattle behavior based on graph neural network according to claim 1, characterized in that: The S6 specifically includes: S61. Based on the global dynamic graph data, a graph neural network-based modeling method is used to extract features from the global dynamic graph and calculate the high-order feature representation of each local subgroup; S62. For each round of the message passing process of the graph neural network, update each local subgroup First, the features of all adjacent local subgroups of the current local subgroup at the current layer are aggregated, and then the aggregation results and the features of the current local subgroup at the current layer are input into the feature update function to obtain the local subgroup features of the next layer; S63. Iterate the message passing process of all graph neural network layers L to obtain the final global high-order feature representation of each local sub-group; S64. Combine or pool the global high-order features of all local sub-groups to obtain global dynamic features.

9. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The S7 specifically includes: S71. For each time step t, obtain global dynamic features, global high-order features of each local subgroup, and local subgroup features; S72. For each local sub-group, the overall features of the global dynamic graph are fed back to the local sub-group through the inter-layer information interaction mechanism; S73. For each local subgroup, transform the global dynamic feature using a mapping function MAP(·) to obtain a mapped global dynamic feature that is consistent with the local subgroup feature space; S74, performing multi-level feature fusion on the local subgroup features of the local subgroup, the global high-order features, and the mapped global dynamic features to obtain fused features; S75. Based on the fusion features, the global dynamic graph information is dynamically injected into the feature representation of each local sub-group through the reverse feedback mechanism; S76. Repeat steps S72 to S74 for all local subgroups to obtain a multi-level fusion feature set.

10. The method for identifying cattle herd behavior based on graph neural network according to claim 1, characterized in that: The S8 specifically includes: S81. Based on the multi-level fusion feature set, the individual cattle features in each local subgroup are fused with the multi-level fusion features of the local subgroup at the feature level or the decision level to obtain the final discriminant feature of each cattle; S82, inputting the final discriminant features of each cow into the classification model, using a multi-class classifier to identify the behavior category of each cow, and outputting a probability distribution of the behavior category; S83. For each cow at the current time step t, based on the behavior category probability distribution output by the classification model, select the behavior category with the largest probability value as the behavior recognition result of the cow at time step t; S84, based on the cattle behavior recognition results and the probability distribution of the behavior categories, combined with historical behavior data and behavior category priors, using an anomaly detection algorithm to issue an abnormal behavior warning to the cattle, and output abnormal warning information; S85. Obtain the behavior recognition result and abnormal warning information of each cow, and combine them into the herd behavior recognition result and abnormal warning information.