A large-area pasture livestock activity behavior tracking and monitoring system

By adjusting the CTU block partitioning strategy in the HEVC high-efficiency video coding algorithm and calculating the importance of CTU blocks based on livestock video features, the problems of resource waste and insufficient accuracy of behavior recognition caused by indiscriminate compression in the HEVC algorithm are solved, achieving more efficient video compression and behavior monitoring.

CN121842406BActive Publication Date: 2026-06-16HEILONGJIANG BAYI AGRICULTURAL UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HEILONGJIANG BAYI AGRICULTURAL UNIVERSITY
Filing Date
2026-03-11
Publication Date
2026-06-16

Smart Images

  • Figure CN121842406B_ABST
    Figure CN121842406B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of video compression, and proposes a large-area pasture livestock activity behavior tracking and monitoring system, which comprises: collecting livestock video, marking livestock in the video frame in the livestock video with a livestock marking box; dividing the video frame into different CTU blocks, calculating the importance evaluation value and static characteristic value of the CTU block; calculating the motion vector of the pixel point in the video frame, calculating the first dynamic characteristic value and the importance of the CTU block; calculating the number of divisions of the CTU block according to the importance in the HEVC high-efficiency video coding algorithm four-tree algorithm, obtaining the compressed livestock video, and obtaining the monitoring result of the livestock activity behavior according to the compressed livestock video of the livestock behavior to be monitored. The present application can improve the accuracy and stability of the tracking result of the livestock activity behavior.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video compression technology, specifically to a large-area pasture livestock activity tracking and monitoring system. Background Technology

[0002] Large-scale livestock activity and behavior tracking and monitoring in pastures is a core technological means to improve pasture management efficiency, ensure livestock health and safety, and optimize resource allocation. It can optimize refined feeding management, improve production efficiency, enable early detection and treatment of diseases, and reduce breeding risks. While video surveillance is commonly used to monitor livestock activity and behavior, the massive amounts of high-definition video data consume significant storage resources and can lead to transmission delays, affecting the real-time performance of behavior tracking.

[0003] The HEVC high-efficiency video coding algorithm can be used to compress livestock monitoring videos in pastures. The CTU coding tree unit is divided using a quadtree partitioning method. However, the HEVC high-efficiency video coding algorithm can only use the same compression weight to compress each frame in the livestock monitoring video to the same degree. Applying high-preservation compression to both the livestock and the pasture background without distinction can easily lead to waste of resources. Applying low-preservation compression without distinction can easily lead to missed detections or misjudgments of abnormal behaviors, reducing the accuracy of livestock activity tracking and monitoring. Summary of the Invention

[0004] This invention provides a large-area pasture livestock activity and behavior tracking and monitoring system to address the problem that the HEVC high-efficiency video coding algorithm's indiscriminate compression of image frames in video cannot balance the use of computing resources with the need for accurate identification of livestock behavior, resulting in insufficient accuracy in livestock activity and behavior tracking and monitoring. The specific technical solution adopted is as follows:

[0005] One embodiment of the present invention provides a large-area pasture livestock activity tracking and monitoring system, which includes the following modules:

[0006] The data acquisition module is used to collect livestock videos and mark the livestock in each video frame with a livestock label box;

[0007] The feature space similarity acquisition module is used to calculate the mask probability of each pixel in the livestock label box in the video frame based on all livestock label boxes in the same video frame, divide each video frame in the livestock video into CTU blocks of a preset size, calculate the mask probability disorder and importance evaluation value of the CTU block based on the number of pixels in the livestock label box and the mask probability of the CTU block, and calculate the static feature value of each CTU block based on the importance evaluation value of all CTU blocks in the same video frame.

[0008] The importance evaluation module is used to calculate the motion vector of each pixel in the next video frame in the adjacent video frame based on the differences between adjacent video frames in the livestock video. Based on the differences in the motion vectors of all pixels in the CTU block that are within the livestock annotation box, and the mask probability disorder of the CTU block, the first dynamic feature value of the CTU block is calculated. Combining the structured processing result of the first dynamic feature value of all CTU blocks in the same video frame with the static feature value, the importance of the CTU block is calculated.

[0009] The behavior monitoring result acquisition module is used to calculate the number of times the quadtree algorithm divides the CTU block in the HEVC high-efficiency video coding algorithm according to the importance of the CTU block, obtain compressed livestock videos, and obtain the monitoring results of livestock activity behavior based on the compressed livestock videos of the livestock behavior to be monitored.

[0010] Furthermore, the method for calculating the mask probability of the pixel is as follows:

[0011] Obtain the mask quality score for each pixel within the livestock label frame;

[0012] The normalized sum of the mask quality scores of the same pixel in all livestock annotation boxes in the same video frame is denoted as the mask probability of the same pixel in the same video frame.

[0013] Furthermore, the method for obtaining the mask probability disorder of the CTU block is as follows:

[0014] The information entropy of the mask probability of all pixels within the livestock label box in the CTU block is denoted as the mask probability disorder of the CTU block.

[0015] Furthermore, the method for determining the importance evaluation value is as follows:

[0016] The ratio of the number of pixels within the livestock label box of the CTU block to the total number of pixels contained in the CTU block is denoted as the target pixel ratio of the CTU block.

[0017] The average information entropy of the CTU block within the gray-level co-occurrence matrices of four preset different directions is denoted as the texture complexity of the CTU block.

[0018] The positive correlation between the target pixel ratio, mask probability disorder, and texture complexity of the CTU block is recorded as the importance evaluation value of the CTU block.

[0019] Furthermore, the method for obtaining the static feature values ​​of the CTU block is as follows:

[0020] Based on the importance evaluation values ​​of all CTU blocks in the same video frame, an importance evaluation matrix for the video frame and a feature importance evaluation matrix for the CTU blocks are established respectively; the similarity between the feature importance evaluation matrix of the CTU block and the importance evaluation matrix of the video frame in which the CTU block is located is denoted as the feature space similarity of the CTU block.

[0021] The ratio of the importance evaluation value of the CTU block to the similarity in the feature space is denoted as the static feature value of the CTU block.

[0022] Furthermore, the method for establishing the importance evaluation matrix of the video frame and the feature importance evaluation matrix is ​​as follows:

[0023] Arrange the importance evaluation values ​​of all CTU blocks in the same video frame according to the position of the CTU blocks in the video frame to obtain the importance evaluation matrix of the video frame;

[0024] Assign the importance evaluation value of the corresponding CTU block in the importance evaluation matrix of the video frame to 0, and obtain the feature importance evaluation matrix of the CTU block.

[0025] Furthermore, the method for determining the first dynamic characteristic value of the CTU block is as follows:

[0026] Based on adjacent video frames in the livestock video, obtain the motion vector of each pixel in the video frame, calculate the direction angle of the motion vector of the pixel, and calculate the importance direction concentration of the CTU block based on the direction angle of the motion vector of all pixels in the CTU block that are within the livestock annotation box.

[0027] The coefficient of variation of the magnitude of the motion vector of all pixels within the livestock annotation box in the CTU block is denoted as the significance length difference of the CTU block.

[0028] The first dynamic characteristic value of the CTU block is calculated based on the mask probability disorder, the concentration of important directions, and the difference in important length.

[0029] Furthermore, the method for obtaining the concentration of the important directions of the CTU block is as follows:

[0030] The Euclidean distance between the average sine and cosine values ​​of the direction angles of the motion vectors of all pixels within the livestock annotation box in the CTU block is denoted as the significance of the CTU block's orientation concentration.

[0031] Furthermore, the step of calculating the importance of a CTU block by combining the structured processing results of the first dynamic feature values ​​and the static feature values ​​of all CTU blocks in the same video frame includes the following steps:

[0032] Based on the normalized value of the first dynamic feature value of all CTU blocks in the same video frame, a hierarchical tree of all CTU blocks in the same video frame is established. The hierarchical spatial feature vector of each CTU block in the same video frame is extracted based on the hierarchical tree. The L2 norm of the hierarchical spatial feature corresponding to the CTU block is used as the second dynamic feature value of the CTU block.

[0033] The positive correlation result of the static eigenvalues, first dynamic eigenvalues, and second dynamic eigenvalues ​​of the CTU block is denoted as the importance of the CTU block.

[0034] Furthermore, the step of calculating the number of times the quadtree algorithm divides the CTU block in the HEVC high-efficiency video coding algorithm based on the importance of the CTU block includes the following steps:

[0035] The product of the difference between the number 1 and the importance of the CTU block and the first preset parameter, rounded down, is used as the number of times the quadtree algorithm divides the CTU block in the HEVC high-efficiency video coding algorithm.

[0036] The beneficial effects of this invention are:

[0037] To achieve more detailed preservation of behavioral information corresponding to livestock gathered in a pasture, this application evaluates the probability that pixels within a CTU block correspond to a group of livestock, obtaining an importance evaluation value for the CTU block. A higher importance evaluation value indicates more complex overlap of livestock represented by pixels within the CTU block, increasing the likelihood of losing important details during CTU block compression. Furthermore, considering the positional relationships between CTU blocks containing varying degrees of detail, the application evaluates the degree of livestock information contained in pixels corresponding to livestock positions within a CTU block, obtaining static feature values ​​for each CTU block in each video frame of the livestock video. Additionally, considering livestock in motion states such as walking or running, the application further... The information corresponding to the CTU block needs to retain more detailed information during compression. Based on the motion vector of each pixel in the video frame, the possibility of loss of detailed features due to motion features is evaluated to obtain the importance of the CTU block. Finally, based on the importance of the CTU block, the number of times the quadtree algorithm in the HEVC high-efficiency video coding algorithm divides the CTU block is calculated to obtain the compressed livestock video. This solves the problem that the HEVC high-efficiency video coding algorithm compresses image frames indiscriminately, which cannot balance the use of computing resources with the need for accurate identification of livestock behavior, resulting in insufficient accuracy in livestock activity tracking and monitoring. Based on the compressed livestock video of the livestock behavior to be monitored, the monitoring results of livestock activity behavior are obtained, improving the accuracy and stability of livestock activity behavior tracking results. Attached Figure Description

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

[0039] Figure 1 A flowchart illustrating a large-area pasture livestock activity and behavior tracking and monitoring system provided in one embodiment of the present invention;

[0040] Figure 2 This is a schematic diagram of the structure of a large-area pasture livestock activity tracking and monitoring system provided in one embodiment of the present invention. Detailed Implementation

[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] Please see Figure 1 It shows a flowchart of a large-area pasture livestock activity tracking and monitoring system according to an embodiment of the present invention. Figure 2 The diagram shows a structural schematic of a large-area pasture livestock activity tracking and monitoring system according to an embodiment of the present invention. The system includes: a data acquisition module, a feature space similarity acquisition module, an importance evaluation module, and a behavior monitoring result acquisition module.

[0043] The data acquisition module collects livestock videos and marks the livestock in each video frame with a livestock label box.

[0044] High-definition cameras are installed in areas where livestock can roam in large pastures, ensuring that the cameras' monitoring area covers the entire pasture where livestock can move. The cameras are used to collect video footage of the livestock.

[0045] In this embodiment, the duration of the livestock videos captured by the camera is set to 1 second, and the livestock videos are captured continuously.

[0046] To avoid the impact of salt-and-pepper noise generated by livestock activities on the monitoring of livestock behavior, this embodiment uses median filtering to denoise the livestock videos. To avoid uneven lighting in the livestock videos caused by varying degrees of reflection from livestock hair under light, this embodiment uses a histogram equalization algorithm to eliminate the impact of uneven lighting on the livestock videos.

[0047] The YOLOv8 model was used to identify livestock in each video frame of the livestock video. The rectangular bounding boxes of the identified livestock were recorded as livestock bounding boxes, and the livestock bounding boxes were labeled.

[0048] Specifically, in this embodiment, cattle are selected as livestock; when using the YOLOv8 model, the loss function is set to CIoU, the optimizer is set to AdamW, and the number of iterations is set to 500; the labelme annotation tool is used to label the rectangular annotation boxes; the use of the YOLOv8 model to identify targets and label annotations are well-known technologies and will not be described in detail.

[0049] At this point, the labeled animal tag boxes have been obtained for each video frame in the livestock video.

[0050] The feature space similarity acquisition module calculates the mask probability of each pixel within the livestock label boxes in the same video frame based on all livestock label boxes in the same video frame. It divides each video frame in the livestock video into CTU blocks of a preset size. Based on the number of pixels within the livestock label boxes and the mask probability of the CTU blocks, it calculates the mask probability disorder and importance evaluation value of the CTU blocks. Based on the importance evaluation value of all CTU blocks in the same video frame, it calculates the static feature value of each CTU block.

[0051] For each video frame in a livestock video, more features should be retained for the corresponding livestock pixels to facilitate the identification and monitoring of livestock activities and behaviors. Livestock in pastures may cluster together, causing pixels at clustered locations to contain relatively more feature information about the corresponding livestock's performance and behavior. More detailed CTU segmentation should be performed to ensure that clearer livestock features are preserved after the livestock video is compressed.

[0052] The SAM model is used to accurately divide livestock bounding boxes at the pixel level, and the mask quality score of each pixel in the livestock bounding box is obtained. Since livestock may cluster in pastures, the same pixel in the same video frame may be included in different livestock bounding boxes. The normalized value of the sum of the mask quality scores of the same pixel in all livestock bounding boxes in the same video frame is recorded as the mask probability of the same pixel in the same video frame.

[0053] The use of the SAM model to obtain the mask quality score of pixels is a well-known technique and will not be elaborated further. The mask quality score is a reliability evaluation of the classification result of the pixel corresponding to the animal "cow". The maximum value of the sum of all pixels in the same video frame is recorded as the first maximum value. The ratio of the sum of the mask quality scores of the pixels corresponding to all livestock annotation boxes to the first maximum value is the normalized value of the sum of the mask quality scores of the pixels corresponding to all livestock annotation boxes.

[0054] The HEVC high-efficiency video coding algorithm is used to divide each video frame in the livestock video into CTU blocks of a preset size, and any CTU block of any video frame in the livestock video is recorded as the target CTU block.

[0055] In this embodiment, the size of the CTU block is set to 64×64; the use of the HEVC high-efficiency video coding algorithm to obtain the CTU block of the preset size is a well-known technology and will not be described in detail here.

[0056] The ratio of the number of pixels within the livestock bounding boxes of the target CTU block to the total number of pixels contained in the target CTU block is denoted as the target pixel ratio of the target CTU block; the information entropy of the mask probability of all pixels within the livestock bounding boxes of the target CTU block is denoted as the mask probability disorder of the target CTU block; the mean of the information entropy of the gray-level co-occurrence matrix of the target CTU block in four different directions is denoted as the texture complexity of the target CTU block; the positive correlation between the target pixel ratio, mask probability disorder, and texture complexity of the target CTU block is denoted as the importance evaluation value of the target CTU block.

[0057] The calculation of information entropy and the acquisition of the gray-level co-occurrence matrix are well-known technologies and will not be elaborated further. The four different directions preset in this embodiment are... , , and .

[0058] It is understood that a positive correlation is applied to the target pixel ratio, mask probability disorder, and texture complexity of the target CTU block, ensuring that these parameters are positively correlated with the importance evaluation value of the target CTU block. It is also understood that the positive correlation in this application refers to the relationship between the independent and dependent variables. The independent variables are the target pixel ratio, mask probability disorder, and texture complexity of the target CTU block, and the dependent variable is the importance evaluation value of the target CTU block. The positive correlation means that the dependent variable increases (decreases) as the independent variable increases (decreases), and can be an additive or multiplicative relationship.

[0059] Preferably, as an embodiment of this application, the first preset weight, the second preset weight, and the third preset weight are used as weight values ​​for the target pixel ratio, mask probability disorder, and texture complexity of the target CTU block, respectively. The target pixel ratio, mask probability disorder, and texture complexity of the target CTU block are weighted and summed. The result of the weighted summation is recorded as the importance evaluation value of the target CTU block. Specifically, the summation of the products of the first preset weight and the target pixel ratio of the target CTU block, the second preset weight and the mask probability disorder, and the third preset weight and the texture complexity is recorded as the importance evaluation value of the target CTU block. The summation of the first preset weight, the second preset weight, and the third preset weight is 1. In this application, the values ​​of the first preset weight, the second preset weight, and the third preset weight are 0.3, 0.3, and 0.4, respectively.

[0060] The greater the mask probability disorder of the target CTU block, the more complex the overlapping of livestock represented by the pixels of the corresponding clustered livestock in the target CTU block, and the greater the possibility of losing important details when compressing the target CTU block. In this case, the importance evaluation value of the target CTU block is higher.

[0061] The importance evaluation value of each CTU block in each video frame of the livestock video can be obtained using the same method.

[0062] Based on the positional relationships between CTU blocks containing varying degrees of detail, the feature space similarity of each CTU block is calculated separately. Specifically:

[0063] Arrange the importance evaluation values ​​of all CTU blocks in the same video frame according to their positions in the video frame to obtain the importance evaluation matrix of the video frame; assign the importance evaluation value of the corresponding target CTU block in the importance evaluation matrix of the video frame to 0 to obtain the feature importance evaluation matrix of the target CTU block; and record the similarity between the feature importance evaluation matrix of the target CTU block and the importance evaluation matrix of the video frame in which the target CTU block is located as the feature space similarity of the target CTU block.

[0064] In this embodiment, cosine similarity is used to calculate the similarity between the feature importance evaluation matrix and the importance evaluation matrix.

[0065] The ratio of the importance evaluation value of the target CTU block to the similarity in the feature space is denoted as the static feature value of the target CTU block.

[0066] In the process of calculating the ratio, in order to avoid the denominator being zero, a preset value needs to be added to the denominator. In this example, the preset value is 0.001.

[0067] The larger the static feature value of the target CTU block, the more pixels corresponding to livestock within the target CTU block, and the more livestock information is contained in the pixels corresponding to the livestock positions within the target CTU block.

[0068] The same method can be used to obtain the static feature values ​​of each CTU block in each video frame of the livestock video.

[0069] At this point, the static feature values ​​of each CTU block in each video frame of the livestock video are obtained.

[0070] The importance evaluation module calculates the motion vector of each pixel in the next video frame of the adjacent video frame based on the differences between adjacent video frames. Based on the differences in the motion vectors of all pixels within the livestock annotation box in the CTU block, as well as the mask probability clutter of the CTU block, it calculates the first dynamic feature value of the CTU block. Combining the structured processing result of the first dynamic feature values ​​of all CTU blocks in the same video frame with the static feature value, it calculates the importance of the CTU block.

[0071] The behavior of livestock in a pasture is random. When livestock are walking, running or in motion in a video frame, more detailed information needs to be preserved when compressing the corresponding CTU block, while the CTU block containing livestock that are not moving is compressed to a greater extent.

[0072] The Farneback optical flow method is used to process adjacent video frames in the livestock video to obtain the motion vector of each pixel in each video frame. The direction angle of the motion vector of each pixel is calculated. The average sine value of the direction angle of the motion vector of all pixels in the target CTU block that are within the livestock annotation box is recorded as the average sine value of the target CTU block. The average cosine value of the direction angle of the motion vector of all pixels in the target CTU block that are within the livestock annotation box is recorded as the average cosine value of the target CTU block. The Euclidean distance between the average sine value and the average cosine value of the target CTU block is recorded as the significance orientation concentration of the target CTU block.

[0073] The coefficient of variation of the magnitude of the motion vectors of all pixels within the livestock annotation box in the target CTU block is denoted as the significance length difference of the target CTU block.

[0074] The same method can be used to obtain the significant length difference of each CTU block in each video frame of the livestock video.

[0075] Based on the mask probability disorder, importance direction concentration, and importance length difference of the CTU block, the first dynamic characteristic value of the CTU block is calculated. The formula for calculating the first dynamic characteristic value is:

[0076]

[0077] in, This represents the first dynamic characteristic value of the CTU block; Indicates the significant length variation of the CTU block; This represents the difference in mask probability clutter between the CTU block and the corresponding CTU block in the previous image frame. This indicates the directional concentration of the CTU block.

[0078] The greater the significant length difference of the CTU block, the greater the difference in mask probability disorder between the CTU block and the corresponding CTU block in the previous image frame, and the smaller the significant direction concentration of the CTU block, the more obvious the movement of the pixels within the livestock bounding box in the CTU block of the target CTU block relative to the corresponding CTU block in the previous image frame. These motion features are more likely to lead to the loss of detailed features. Therefore, when compressing the CTU block, more detailed information should be retained and the compression should be less severe.

[0079] when At that time, Add 1 to ensure that the logic described above holds true.

[0080] By comprehensively analyzing the first dynamic feature values ​​of all CTU blocks in the same video frame, the first dynamic feature values ​​of all CTU blocks in the same video frame are structured and transformed into a hierarchical tree structure. The normalized values ​​of the first dynamic feature values ​​of all CTU blocks in the same video frame are processed using a recursive binary search algorithm to obtain the hierarchical tree of all CTU blocks in the same video frame. Then, the hierarchical tree structure of the CTU blocks is transformed into the input of a tree neural network. The hierarchical spatial feature vector of each CTU block in the same video frame is extracted by Tree-LSTM. Specifically, the constructed hierarchical tree is used as input, and the total number of tree nodes is set to be consistent with the number of all CTU blocks in the video frame. The attribute of each node is assigned as the normalized result of the first dynamic feature value of the corresponding CTU block. The edge connection between nodes is established according to the natural hierarchical structure of the tree, and only the relationship between parent and child nodes is retained. The edge attribute is defined as the absolute value of the difference between the normalized results of the first dynamic features of the connected parent and child nodes. Tree-LSTM is selected as the sequence processing algorithm for feature extraction. The hierarchical tree structure and associated features are deeply fused and calculated by the tree neural network. Finally, the hierarchical spatial features corresponding to each CTU block in the same video frame are obtained. The hierarchical spatial features are represented in the form of high-dimensional feature vectors, which can completely integrate the dynamic features of the CTU block itself, the hierarchical position in the tree, and the association information of adjacent nodes. The L2 norm of the hierarchical spatial features corresponding to the CTU block is used as the second dynamic feature value of the CTU block.

[0081] In this embodiment, the Min-Max normalization method is used to calculate the normalized value; the recursive binary search algorithm, Tree-LSTM, and L2 norm are all well-known technologies and will not be described in detail; the capacity threshold of the recursive binary search algorithm should be greater than or equal to 8 and less than or equal to 32, and the balance factor should be greater than or equal to 0 and less than or equal to 1. In this embodiment, the capacity threshold of the recursive binary search algorithm is set to 16, and the balance factor is set to 0.5.

[0082] The positive correlation result of the static eigenvalues, first dynamic eigenvalues, and second dynamic eigenvalues ​​of the CTU block is denoted as the importance of the CTU block.

[0083] Preferably, as an embodiment of this application, the normalized value of the sum of the product of the first dynamic feature value and the second dynamic feature value of the CTU block and the static feature value is denoted as the importance of the CTU block.

[0084] The greater the importance of the CTU block, the more significant the movement of the pixels within the livestock bounding box. These movement features are more likely to lead to the loss of detailed features. Therefore, when compressing the CTU block, more detailed information should be retained and the compression should be less severe.

[0085] It should be noted that for the CTU block in the first video frame, since there is no previous adjacent frame, the importance of the CTU block in the first video frame is directly assigned to the normalized value of the static feature value.

[0086] At this point, the importance of each CTU block in each video frame of the livestock video is obtained.

[0087] The behavior monitoring result acquisition module calculates the number of times the quadtree algorithm in the HEVC high-efficiency video coding algorithm divides the CTU block according to the importance of the CTU block, obtains compressed livestock videos, and obtains the monitoring results of livestock activity behavior based on the compressed livestock videos of the livestock behavior to be monitored.

[0088] The product of the difference between the number 1 and the importance of the CTU block and the first preset parameter is rounded down to the floor value and recorded as the feature floor value of the CTU block. The sum of the feature floor value of the CTU block and the preset lower limit of the number of divisions is recorded as the preferred number of divisions of the CTU block.

[0089] The lower limit of the number of divisions should be an integer greater than or equal to 0 and less than or equal to 4. In this embodiment, the lower limit of the number of divisions is 2. The first preset parameter is the difference between the upper limit of the number of divisions and the lower limit of the number of divisions. The upper limit of the number of divisions should be set by those skilled in the art through the image resolution of the CTU block. In this embodiment, the upper limit of the number of divisions is 16, that is, the first preset parameter is 14.

[0090] The HEVC high-efficiency video coding algorithm is used to compress livestock videos. The optimal number of CTU block partitions is used as the number of CTU block partitions in the quadtree algorithm of the HEVC high-efficiency video coding algorithm to obtain the compressed livestock videos. The compressed livestock videos are then saved to the storage system.

[0091] The compressed livestock videos required for monitoring livestock behavior are extracted from the storage system and decompressed to obtain the videos to be monitored. The YOLOv8 model is used to identify the livestock in each video frame, and the rectangular bounding boxes of the identified livestock are recorded as target bounding boxes. The SORT algorithm is used to obtain the motion vector of the livestock corresponding to each target bounding box in the video frame. Based on the motion vector of the livestock corresponding to each target bounding box in the video frame, a continuous trajectory sequence is established for each livestock. The continuous trajectory sequence is coordinate time-series data in video frames, ensuring that the identity of each livestock is unique throughout the monitored video and that the trajectory is continuous. The sliding difference algorithm is used to extract the motion features of each continuous trajectory sequence, and the continuous trajectory sequence is divided into video windows of 30 frames in length. The motion features include instantaneous velocity, average velocity, and motion direction angle. The MLP (Multilayer Perceptron) classifier, combined with a majority voting strategy, is used to process the continuous trajectory sequences within each video window corresponding to livestock, thereby determining the dominant behavior of the livestock. Specifically, the softmax activation function is used to output the probability of the behavior category corresponding to the motion features. The behavior is defined based on a speed threshold, and all speeds are uniformly converted to the actual spatial scale of the pasture: walking is greater than or equal to 0.5 m / s and less than or equal to 2 m / s, running is greater than 2 m / s, and resting is less than 0.5 m / s. The majority voting strategy is applied to the classification results of all continuous windows within the same video to be monitored, and the behavior category with the highest frequency is selected as the dominant behavior of each livestock within the time period corresponding to the video to be monitored.

[0092] The decompression of compressed video, obtaining motion vectors using the SORT algorithm, extracting motion features using the sliding difference algorithm, using the MLP multilayer perceptron classifier, and the majority voting strategy are all well-known techniques and will not be elaborated further.

[0093] Thus, the results of tracking and monitoring livestock activities were obtained.

[0094] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A large-scale pasture livestock activity and behavior tracking and monitoring system, characterized in that, The system includes the following modules: The data acquisition module is used to collect livestock videos and mark the livestock in each video frame with a livestock label box; The feature space similarity acquisition module is used to calculate the mask probability of each pixel in the livestock label box in the video frame based on all livestock label boxes in the same video frame, divide each video frame in the livestock video into CTU blocks of a preset size, calculate the mask probability disorder and importance evaluation value of the CTU block based on the number of pixels in the livestock label box and the mask probability of the CTU block, and calculate the static feature value of each CTU block based on the importance evaluation value of all CTU blocks in the same video frame. The importance evaluation module is used to calculate the motion vector of each pixel in the next video frame in the adjacent video frame based on the differences between adjacent video frames in the livestock video. Based on the differences in the motion vectors of all pixels in the CTU block that are within the livestock annotation box, and the mask probability disorder of the CTU block, the first dynamic feature value of the CTU block is calculated. Combining the structured processing result of the first dynamic feature value of all CTU blocks in the same video frame with the static feature value, the importance of the CTU block is calculated. The behavior monitoring result acquisition module is used to calculate the number of times the quadtree algorithm divides the CTU block in the HEVC high-efficiency video coding algorithm according to the importance of the CTU block, acquire compressed livestock videos, and acquire the monitoring results of livestock activity behavior based on the compressed livestock videos of the livestock behavior to be monitored. The method for calculating the mask probability of the pixel is as follows: obtain the mask quality score of each pixel in the livestock label box; and record the normalized value of the sum of the mask quality scores of the same pixel in all livestock label boxes in the same video frame as the mask probability of the same pixel in the same video frame. The method for obtaining the mask probability disorder of the CTU block is as follows: the information entropy of the mask probability of all pixels in the livestock label box within the CTU block is recorded as the mask probability disorder of the CTU block. The method for determining the importance evaluation value is as follows: the ratio of the number of pixels within the livestock annotation box of the CTU block to the total number of pixels contained in the CTU block is denoted as the target pixel ratio of the CTU block; the average information entropy of the CTU block in the gray-level co-occurrence matrices of four preset different directions is denoted as the texture complexity of the CTU block; and the positive correlation between the target pixel ratio, mask probability disorder, and texture complexity of the CTU block is denoted as the importance evaluation value of the CTU block.

2. The large-area pasture livestock activity tracking and monitoring system according to claim 1, characterized in that, The method for obtaining the static feature values ​​of the CTU block is as follows: Based on the importance evaluation values ​​of all CTU blocks in the same video frame, an importance evaluation matrix for the video frame and a feature importance evaluation matrix for the CTU blocks are established respectively; the similarity between the feature importance evaluation matrix of the CTU block and the importance evaluation matrix of the video frame in which the CTU block is located is denoted as the feature space similarity of the CTU block. The ratio of the importance evaluation value of the CTU block to the similarity in the feature space is denoted as the static feature value of the CTU block.

3. The large-area pasture livestock activity tracking and monitoring system according to claim 2, characterized in that, The method for establishing the importance evaluation matrix of the video frame and the feature importance evaluation matrix is ​​as follows: Arrange the importance evaluation values ​​of all CTU blocks in the same video frame according to the position of the CTU blocks in the video frame to obtain the importance evaluation matrix of the video frame; Assign the importance evaluation value of the corresponding CTU block in the importance evaluation matrix of the video frame to 0, and obtain the feature importance evaluation matrix of the CTU block.

4. The large-area pasture livestock activity tracking and monitoring system according to claim 1, characterized in that, The method for determining the first dynamic characteristic value of the CTU block is as follows: Based on adjacent video frames in the livestock video, obtain the motion vector of each pixel in the video frame, calculate the direction angle of the motion vector of the pixel, and calculate the importance direction concentration of the CTU block based on the direction angle of the motion vector of all pixels in the CTU block that are within the livestock annotation box. The coefficient of variation of the magnitude of the motion vector of all pixels within the livestock annotation box in the CTU block is denoted as the significance length difference of the CTU block. The first dynamic characteristic value of the CTU block is calculated based on the mask probability disorder, the concentration of important directions, and the difference in important length.

5. A large-area pasture livestock activity tracking and monitoring system according to claim 4, characterized in that, The method for obtaining the concentration of the important directions of the CTU block is as follows: The Euclidean distance between the average sine and cosine values ​​of the direction angles of the motion vectors of all pixels within the livestock annotation box in the CTU block is denoted as the significance of the CTU block's orientation concentration.

6. A large-area pasture livestock activity tracking and monitoring system according to claim 1, characterized in that, The steps for calculating the importance of a CTU block by combining the structured processing results and static feature values ​​of the first dynamic feature values ​​of all CTU blocks in the same video frame include: Based on the normalized value of the first dynamic feature value of all CTU blocks in the same video frame, a hierarchical tree of all CTU blocks in the same video frame is established. The hierarchical spatial feature vector of each CTU block in the same video frame is extracted based on the hierarchical tree. The L2 norm of the hierarchical spatial feature corresponding to the CTU block is used as the second dynamic feature value of the CTU block. The positive correlation result of the static eigenvalues, first dynamic eigenvalues, and second dynamic eigenvalues ​​of the CTU block is denoted as the importance of the CTU block.

7. A large-area pasture livestock activity tracking and monitoring system according to claim 1, characterized in that, The steps for calculating the number of times the quadtree algorithm divides the CTU block in the HEVC high-efficiency video coding algorithm based on the importance of the CTU block are as follows: The product of the difference between the number 1 and the importance of the CTU block and the first preset parameter, rounded down, is used as the number of times the quadtree algorithm divides the CTU block in the HEVC high-efficiency video coding algorithm.