Artificial intelligence-based sheep herding behavior identification method and system
By using an artificial intelligence-based approach and employing multiple monocular cameras and triangulation principles, a precise model of sheep grazing behavior was constructed. This solved the problems of long time spans and poor data density in sheep grazing behavior monitoring, and enabled accurate behavior monitoring and data optimization.
Patent Information
- Application Number
- CN202510149634.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2026-01-13
AI Technical Summary
Existing technologies for monitoring sheep grazing behavior suffer from problems such as long time spans and poor data density, resulting in insufficient accuracy in assessing sheep health status and breeding efficiency. Furthermore, existing identification systems are difficult to apply in complex environments.
By employing an artificial intelligence-based approach, a three-dimensional data structure encompassing time, behavior, and location is constructed through preprocessing of multiple monocular camera data sources, behavioral feature detection using the OpenPose network model, and localization integration based on triangulation principles. This data is then analyzed using data analysis software to achieve precise monitoring of grazing behavior.
It enables precise monitoring of sheep grazing behavior, providing location, time, and behavioral information down to the second level, and improves the accuracy and consistency of collected data through dataset optimization.
Smart Images

Figure CN121330751A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence and animal behavior, in particular, especially relates to a sheep grazing behavior recognition method and system based on artificial intelligence. BACKGROUND
[0002] In livestock breeding management, monitoring the grazing behavior of sheep is of great importance. At present, the monitoring methods of grazing behavior mainly focus on manual statistics, GPS positioning of some wearable devices, multi-axis gyroscopes, audio recognition and other methods. However, the data collected by this method has low density and poor accuracy, and the data collected later cannot optimize the data collected before. This situation seriously restricts the accurate grasp of the health status of sheep, the evaluation of breeding benefits and the rational use of pasture resources. For example, a long monitoring time span may lead to inaccurate understanding of the stage characteristics of sheep grazing behavior, and poor data density makes it difficult to provide detailed information to fully analyze the grazing, walking, resting and rumination behavior patterns of sheep and their relationship with environmental factors.
[0003] In addition to the above traditional methods, some researchers have begun to use new methods to strengthen the monitoring method of grazing behavior, among which the artificial intelligence video recognition method has attracted much attention. For example, wild animals are monitored by cameras to achieve identification and classification; fixed cameras are used to identify the feeding, rumination and resting time of animals in sheds. However, the recognition system used in this method usually has certain limitations. It can only work in a small area and is difficult to adapt to the situation of mobile or pan-tilt cameras commonly used in animal husbandry practices in complex environments. In terms of technology, there are also some more complex models that can recognize animal movements and skeleton positions. However, they also have many problems, such as the need for extremely large amounts of training data, and the difficulty of recognition increases greatly when facing high-overlapping herds.
[0004] In view of the problems in the related art, no effective solution has been proposed so far. SUMMARY
[0005] In order to overcome the above problems, the present application aims to provide a sheep grazing behavior recognition method and system based on artificial intelligence, which aims to solve the problems of long monitoring time span and poor data density in sheep grazing behavior monitoring.
[0006] To this end, the specific technical solutions adopted by the present application are as follows:
[0007] According to one aspect of the present application, a sheep grazing behavior recognition method based on artificial intelligence is provided, which comprises the following steps:
[0008] S1. Extract data sources from multiple monocular cameras in the ranch, and preprocess the data sources to obtain the categories and preliminary locations of objects in the data sources;
[0009] S2. Construct a sheep flock behavior rule base and, based on the OpenPose network model, detect sheep flock behavior features from data sources in multiple monocular cameras in the pasture.
[0010] S3. Based on the preprocessed data source and the pose information of the corresponding monocular camera, the monocular positioning of the object is calculated by using the principle of triangulation, and the final positioning of the object is obtained by integrating multiple monocular positioning information.
[0011] S4. Obtain time data of sheep activities from the data source, combine sheep behavior characteristics and the final location of objects to construct a three-dimensional data structure containing time-behavior-location, and use data analysis software to analyze the three-dimensional data structure to obtain sheep grazing behavior data.
[0012] Optionally, data sources are extracted from multiple monocular cameras in the ranch, and the data sources are preprocessed to obtain the categories and preliminary localizations of objects in the data sources, including the following steps:
[0013] S11. Based on the adaptive convolutional neural network model, classify and identify objects in the data source to obtain object classification results;
[0014] S12. Based on the YOLO V4 network model, locate and label the objects in the data source to obtain the preliminary object location.
[0015] Optionally, classifying and recognizing objects in the data source based on an adaptive convolutional neural network model includes the following steps:
[0016] S111. Collect image data with pre-labeled object types to obtain an image type dataset, and divide the image type dataset into a training set and a test set according to a preset ratio;
[0017] S112. Construct an initial adaptive convolutional neural network model, wherein the input of the initial adaptive convolutional neural network model is a normalized image type dataset, and the output of the initial adaptive convolutional neural network model is the classification result of the objects in the corresponding image type dataset.
[0018] S113. Extend the initial adaptive convolutional neural network model to obtain the optimal adaptive convolutional neural network model;
[0019] S114. Input the data sources from multiple monocular cameras into the optimal adaptive convolutional neural network model, and output the object classification results through the optimal adaptive convolutional neural network model.
[0020] Optionally, extending the initial adaptive convolutional neural network model to obtain the optimal adaptive convolutional neural network model includes the following steps:
[0021] S1131. Train the initial adaptive convolutional neural network model using the training set, test the trained initial adaptive convolutional neural network model using the test set, and calculate the accuracy of the test results.
[0022] S1132. Randomly select a convolutional layer as an extended convolutional layer in the current initial adaptive convolutional neural network model, and perform various network structure extensions at the extended convolutional layer to obtain multiple extended neural network models.
[0023] S1133. Train multiple extended neural network models using the training set, and test the multiple extended neural network models using the test set respectively, calculate the accuracy of the test results, and select the extended neural network model with the highest test accuracy among the multiple extended neural networks.
[0024] S1134. Determine whether the test accuracy of the selected extended neural network model is higher than the test accuracy of the initial adaptive convolutional neural network model. If so, use the extended neural network model as the current adaptive convolutional neural network model and continue to extend it until the test accuracy of the extended neural network model no longer improves, thus obtaining the optimal extended neural network model. Otherwise, use the initial adaptive convolutional neural network model as the optimal adaptive convolutional neural network model.
[0025] Optionally, the formula for calculating the accuracy of the test results is:
[0026]
[0027] In the formula, A represents the accuracy of the test result; N represents the total number of input images in the test set; ∑ represents the summation operation; n represents the sequence number of the input image in the test set; c represents the total dimension of the classification labels of the object images in the test set; and k represents the dimension sequence number of the classification labels of the object images in the test set. This represents the element in the k-th dimension of the classification label for the n-th image in the test set; This represents the element in the k-th column of the predicted classification label for the n-th image in the test set.
[0028] Optionally, based on the YOLO V4 network model, the objects in the data source are located and labeled to obtain the preliminary object localization, which includes the following steps:
[0029] S121. Each image in the collected image type dataset is labeled with its location using manual annotation, resulting in a training set and a test set for the location annotations.
[0030] S122. Construct a YOLO V4 network model and train and test the YOLO V4 network model based on the location-labeled training and test sets;
[0031] S124. Input the data sources from multiple monocular cameras into the YOLO V4 network model after training and testing, and output the preliminary object localization through the YOLO V4 network model.
[0032] Optionally, constructing a sheep flock behavior rule base and detecting sheep flock behavior features based on data sources from multiple monocular cameras in the pasture using the OpenPose network model includes the following steps:
[0033] S21. Collect behavioral images of sheep in different postures, and mark the key points of the bones of various parts of the sheep's body in different postures in the behavioral images to establish a sheep flock behavior rule library.
[0034] S22. Standardize the images in the sheep behavior rule library. Standardization includes resizing, normalizing pixel values, and smoothing.
[0035] S23. Integrate the Senet channel attention mechanism into the object detection algorithm, perform object detection on the standardized image, and obtain the object detection result;
[0036] S24. In the pre-configured OpenPose network model, replace VGG19 with the Mobilenet network with depthwise separable convolution as its core to obtain an improved OpenPose network model.
[0037] S25. The improved OpenPose network model is trained and tested using the target detection results to obtain the final OpenPose network model. Based on the data sources from multiple monocular cameras in the pasture, the coordinates of the joint points of the sheep skeleton are extracted using the final OpenPose network model.
[0038] S26. Obtain the joint motion trajectory by using Bézier curves to measure the coordinates of the joint points of the sheep skeleton, and use the trajectory similarity measurement algorithm to obtain the distance array between joints.
[0039] S27. Use a linear transformation classifier to classify the coordinates of the joints and determine the sheep's behavior and posture.
[0040] Optionally, depthwise separable convolution consists of depthwise convolution and pointwise convolution, and the ratio of the number of parameters in depthwise separable convolution to the number of parameters in traditional convolution is:
[0041]
[0042] In the formula, η represents the ratio of the number of parameters in depthwise separable convolution to the number of parameters in traditional convolution; W D W represents the number of parameters in a depthwise separable convolution; stand The parameter represents the number of parameters in a traditional convolution; N represents the number of channels in the output image. This represents the square of the convolution kernel size.
[0043] Optionally, based on the preprocessed data source and the pose information of the corresponding monocular camera, the monocular localization of the object is calculated using the principle of triangulation, and the final localization of the identified object is obtained by integrating multiple monocular localization information, including the following steps:
[0044] S31. Based on the focal length of the monocular camera, the object's positioning annotation in the preprocessed data source, and the monocular camera's pose information, calculate the relative distance and relative angle between the object and the camera by establishing a triangle relationship.
[0045] S32. The positioning results of each monocular camera are transformed and fused according to the pre-set coordinate transformation rules. A spatial coordinate transformation algorithm is used to unify the object position information from different perspectives into a common coordinate system, and the final positioning of the object is obtained by integrating multiple monocular positioning information.
[0046] According to another aspect of the present invention, an artificial intelligence-based sheep grazing behavior recognition system is also provided, the artificial intelligence-based sheep grazing behavior recognition system includes a data processing module, a behavior feature analysis module, a location analysis module and a sheep grazing behavior analysis module;
[0047] The data processing module is used to extract data sources from multiple monocular cameras in the ranch and preprocess the data sources to obtain the category and preliminary location of objects in the data sources.
[0048] The behavioral feature analysis module is used to build a sheep flock behavior rule base and, based on the OpenPose network model, to detect sheep flock behavior features from data sources in multiple monocular cameras in the pasture.
[0049] The positioning analysis module is used to calculate the monocular positioning of the object based on the preprocessed data source and the pose information of the corresponding monocular camera, and to integrate multiple monocular positioning information to obtain the final positioning of the object.
[0050] The sheep grazing behavior analysis module is used to obtain time data of sheep activities from data sources, combine sheep behavior characteristics with the final location of objects, construct a three-dimensional data structure including time-behavior-location, and use data analysis software to analyze the three-dimensional data structure to obtain sheep grazing behavior data.
[0051] Compared with the prior art, this application has the following advantages:
[0052] 1. This invention integrates artificial intelligence video recognition, grazing behavior modeling, and grassland geographic information to construct an accurate grazing behavior model that can present information such as the location, time, and behavior of grazing behavior with accuracy down to the second. Furthermore, it can reconstruct sheep grazing data by combining it with grassland information.
[0053] 2. The dataset used in this invention supports deep learning and is continuously optimized during the new data acquisition process. As the experiment progresses, not only does the accuracy of subsequent data acquisition gradually improve, but the accuracy of previously acquired data is also enhanced. Attached Figure Description
[0054] The above-mentioned features, characteristics, and advantages of the present invention, as well as their implementation methods, will become clearer and more readily understood in conjunction with the following description of the embodiments, which are illustrated in detail with reference to the accompanying drawings. Schematic diagrams are shown here:
[0055] Figure 1 This is a flowchart of a method for recognizing sheep grazing behavior based on artificial intelligence according to an embodiment of the present invention;
[0056] Figure 2 This is a schematic diagram of a sheep grazing behavior recognition system based on artificial intelligence according to an embodiment of the present invention.
[0057] In the picture:
[0058] 1. Data processing module; 2. Behavioral feature analysis module; 3. Location analysis module; 4. Sheep grazing behavior analysis module. Detailed Implementation
[0059] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0060] According to an embodiment of the present invention, a method and system for recognizing sheep grazing behavior based on artificial intelligence are provided.
[0061] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments, such as... Figure 1 As shown, the method for recognizing sheep grazing behavior based on artificial intelligence according to an embodiment of the present invention includes the following steps:
[0062] S1. Extract data sources from multiple monocular cameras in the ranch and preprocess the data sources to obtain the categories and preliminary locations of objects in the data sources.
[0063] It should be noted that in practical applications, if a microcontroller is chosen as the automated data acquisition device, the appropriate model must be selected based on the specific ranch environment and data acquisition requirements. The microcontroller needs to be programmed to set parameters such as data acquisition frequency and resolution to ensure that a dataset sufficient for analysis is acquired. If an importable video image acquisition system is used, a suitable camera device needs to be selected, and its installation location determined. Image acquisition can be achieved through a pan-tilt-zoom (PTZ) camera or a fixed camera.
[0064] Preferably, extracting data sources from multiple monocular cameras in the ranch and preprocessing the data sources to obtain the categories and preliminary locations of objects in the data sources includes the following steps:
[0065] S11. Based on the adaptive convolutional neural network model, classify and identify objects in the data source to obtain object classification results;
[0066] S12. Based on the YOLO V4 network model, locate and label the objects in the data source to obtain the preliminary object location.
[0067] Preferably, classifying and recognizing objects in the data source based on an adaptive convolutional neural network model includes the following steps:
[0068] S111. Collect image data with pre-labeled object types to obtain an image type dataset, and divide the image type dataset into a training set and a test set according to a preset ratio;
[0069] S112. Construct an initial adaptive convolutional neural network model, wherein the input of the initial adaptive convolutional neural network model is a normalized image type dataset, and the output of the initial adaptive convolutional neural network model is the classification result of the objects in the corresponding image type dataset.
[0070] S113. Extend the initial adaptive convolutional neural network model to obtain the optimal adaptive convolutional neural network model;
[0071] S114. Input the data sources from multiple monocular cameras into the optimal adaptive convolutional neural network model, and output the object classification results through the optimal adaptive convolutional neural network model.
[0072] It should be explained that the image dataset is divided as follows: 70% of the image dataset is used as the training set, and the remaining 30% is used as the test set.
[0073] The initial adaptive convolutional neural network is a twelve-layer convolutional neural network. The first ten layers of the twelve-layer convolutional neural network consist of five interleaved convolutional layers and five downsampling layers. The five convolutional layers can fully guarantee the network's feature extraction ability and improve classification accuracy; the five downsampling layers can effectively compress the data size, reduce the computational load of the network, and improve its operation speed; there is only one convolutional layer between every two downsampling layers, which gives the convolutional network more room for expansion; since there are too many parameters to be trained in the fully connected layer, only one fully connected layer is set in it to improve the training quality of the network, which can also improve the running speed of the final trained optimal adaptive convolutional neural network.
[0074] Preferably, extending the initial adaptive convolutional neural network model to obtain the optimal adaptive convolutional neural network model includes the following steps:
[0075] S1131. Train the initial adaptive convolutional neural network model using the training set, test the trained initial adaptive convolutional neural network model using the test set, and calculate the accuracy of the test results.
[0076] S1132. Randomly select a convolutional layer as an extended convolutional layer in the current initial adaptive convolutional neural network model, and perform various network structure extensions at the extended convolutional layer to obtain multiple extended neural network models.
[0077] S1133. Train multiple extended neural network models using the training set, and test the multiple extended neural network models using the test set respectively, calculate the accuracy of the test results, and select the extended neural network model with the highest test accuracy among the multiple extended neural networks.
[0078] S1134. Determine whether the test accuracy of the selected extended neural network model is higher than the test accuracy of the initial adaptive convolutional neural network model. If so, use the extended neural network model as the current adaptive convolutional neural network model and continue to extend it until the test accuracy of the extended neural network model no longer improves, thus obtaining the optimal extended neural network model. Otherwise, use the initial adaptive convolutional neural network model as the optimal adaptive convolutional neural network model.
[0079] Preferably, the formula for calculating the classification accuracy is:
[0080]
[0081] In the formula, A represents the accuracy of the test result; N represents the total number of input images in the test set; ∑ represents the summation operation; n represents the sequence number of the input image in the test set; c represents the total dimension of the classification labels of the object images in the test set; and k represents the dimension sequence number of the classification labels of the object images in the test set. This represents the element in the k-th dimension of the classification label for the n-th image in the test set; This represents the element in the k-th column of the predicted classification label for the n-th image in the test set.
[0082] It should be noted that the classification label and predicted classification label for each image are both vectors with 1 row and the number of columns equal to the number of image categories.
[0083] Preferably, based on the YOLO V4 network model, the objects in the data source are located and labeled to obtain the preliminary object localization, which includes the following steps:
[0084] S121. Each image in the collected image type dataset is labeled with its location using manual annotation, resulting in a training set and a test set for the location annotations.
[0085] S122. Construct a YOLO V4 network model and train and test the YOLO V4 network model based on the location-labeled training and test sets;
[0086] S124. Input the data sources from multiple monocular cameras into the YOLO V4 network model after training and testing, and output the preliminary object localization through the YOLO V4 network model.
[0087] It's important to explain that YOLO divides the input image into a 5x5 grid, with each grid cell responsible for predicting the bounding box and class probability of an object. Specifically, YOLO outputs the following information:
[0088] Bounding box coordinates: Each grid cell predicts one or more bounding boxes, each bounding box is represented by four parameters: center coordinates (x, y), width (w), and height (h).
[0089] Confidence score: For each bounding box, YOLO predicts a confidence score, which represents the probability that the bounding box actually contains an object and the accuracy of the bounding box prediction.
[0090] Category probability: Each grid cell also predicts the probability of belonging to each category.
[0091] The training process of YOLO includes: supervised learning using a labeled dataset, defining a loss function, comprehensively considering the coordinate error of the bounding box, confidence error and classification error, and optimizing the model parameters through backpropagation and gradient descent.
[0092] S2. Construct a sheep flock behavior rule base and, based on the OpenPose network model, detect sheep flock behavior features from data sources in multiple monocular cameras in the pasture.
[0093] Preferably, constructing a sheep flock behavior rule base and detecting sheep flock behavior features based on data sources from multiple monocular cameras in the pasture using the OpenPose network model includes the following steps:
[0094] S21. Collect behavioral images of sheep in different postures, and mark the key points of the bones of various parts of the sheep's body in different postures in the behavioral images to establish a sheep flock behavior rule library.
[0095] S22. Standardize the images in the sheep behavior rule library. Standardization includes resizing, normalizing pixel values, and smoothing.
[0096] S23. Integrate the Senet channel attention mechanism into the object detection algorithm, perform object detection on the standardized image, and obtain the object detection result;
[0097] S24. In the pre-configured OpenPose network model, replace VGG19 with the Mobilenet network with depthwise separable convolution as its core to obtain an improved OpenPose network model.
[0098] S25. The improved OpenPose network model is trained and tested using the target detection results to obtain the final OpenPose network model. Based on the data sources from multiple monocular cameras in the pasture, the coordinates of the joint points of the sheep skeleton are extracted using the final OpenPose network model.
[0099] S26. Obtain the joint motion trajectory by using Bézier curves to measure the coordinates of the joint points of the sheep skeleton, and use the trajectory similarity measurement algorithm to obtain the distance array between joints.
[0100] S27. Use a linear transformation classifier to classify the coordinates of the joints and determine the sheep's behavior and posture.
[0101] Preferably, the depthwise separable convolution consists of depthwise convolution and pointwise convolution, and the ratio of the number of parameters in the depthwise separable convolution to the number of parameters in the traditional convolution is:
[0102]
[0103] In the formula, η represents the ratio of the number of parameters in depthwise separable convolution to the number of parameters in traditional convolution; W D W represents the number of parameters in a depthwise separable convolution; stand The parameter represents the number of parameters in a traditional convolution; N represents the number of channels in the output image. This represents the square of the convolution kernel size.
[0104] It should be explained that depthwise separable convolution consists of depthwise convolution and pointwise convolution. Assume the input image size is D1×D1×M, and the convolution kernel size is D. K ×D K If the output image size is D0×D0×N, then the number of parameters in a traditional convolution is:
[0105] W stand =(D K ×D K ×M)×N;
[0106] In the formula, W stand D represents the number of parameters in a traditional convolution; K ×D K The size (length and width) of the convolution kernel is represented; D1×D1 represents the length of the input image and the output image; D0×D0 represents the width of the input image and the output image; M represents the number of channels in the input image; N represents the number of channels in the output image.
[0107] The kernel size of depthwise convolution is (D K D K ,1), In depthwise convolution, each input channel has an independent (D K ×D K The convolution kernel size is (1, 1, M). Therefore, there are M such convolution kernels. The kernel size for point convolution is (1, 1, M). In point convolution, a kernel of size (1×1×M) is used to generate each output channel, so N such kernels are needed. Therefore, the number of parameters for depthwise convolution and point convolution is:
[0108] W depthwise =(D K ×D K ×1)×M;
[0109] W pointwise = (1 × 1 × M) × N;
[0110] In the formula, W depthwise W represents the number of parameters in a depthwise convolution; pointwise D represents the number of parameters in a point convolution; K ×D K The size (length and width) of the convolution kernel is represented by M; the number of channels in the input image is represented by N; and the number of channels in the output image is represented by N.
[0111] Therefore, the number of parameters for depthwise separable convolution is:
[0112] W D =W depthwise +W pointwise ;
[0113] In the formula, W D This represents the number of parameters in a depthwise separable convolution; W depthwise W represents the number of parameters in a depthwise convolution; pointwise This represents the number of parameters in a point convolution.
[0114] Therefore, the ratio of the number of parameters in depthwise separable convolution to the number of parameters in traditional convolution is:
[0115]
[0116] In the formula, η represents the ratio of the number of parameters in depthwise separable convolution to the number of parameters in traditional convolution; W D W represents the number of parameters in a depthwise separable convolution; stand The parameter represents the number of parameters in a traditional convolution; N represents the number of channels in the output image. This represents the square of the convolution kernel size.
[0117] S3. Based on the preprocessed data source and the corresponding geographic-angle information of the monocular camera, the monocular localization of the identified object is obtained, and the final localization of the identified object is obtained by integrating multiple monocular localization information.
[0118] Preferably, the final location of the identified object is obtained by integrating multiple monocular positioning information based on the preprocessed data source and the pose information of the corresponding monocular camera, using the principle of triangulation and calculating the monocular localization of the object, including the following steps:
[0119] S31. Based on the focal length of the monocular camera, the object's positioning annotation in the preprocessed data source, and the monocular camera's pose information, calculate the relative distance and relative angle between the object and the camera by establishing a triangle relationship.
[0120] S32. The positioning results of each monocular camera are transformed and fused according to the pre-set coordinate transformation rules. A spatial coordinate transformation algorithm is used to unify the object position information from different perspectives into a common coordinate system, and the final positioning of the object is obtained by integrating multiple monocular positioning information.
[0121] It should be noted that the geographic and angle information in the pose information of a monocular camera needs to be obtained by installing a GPS module and a gimbal on the camera, or the position and angle information can be entered into the model during installation.
[0122] For monocular cameras, the principle of similar triangles and the known camera focal length are typically used to estimate distance. The formula for calculating relative distance is:
[0123]
[0124] In the formula, H represents the actual height of the object; h represents the pixel height of the object in the preprocessed data source; f represents the focal length of the camera; and D represents the relative distance.
[0125] The formula for calculating relative angles is:
[0126]
[0127] In the formula, α represents the relative angle; x represents the horizontal position of the object in the image, with the image center at 0; W represents the image width; and θ represents the horizontal angle of view of the camera.
[0128] To transform the coordinate systems of each camera into a common coordinate system, a homogeneous coordinate transformation matrix can be used. The formula for calculating the position of an object in the common coordinate system is:
[0129] P c =T i ×P i ;
[0130] In the formula, P c Indicates the position of an object in a common coordinate system; T i P represents the transformation matrix; i This represents the position of the object in the i-th camera coordinate system.
[0131] Commonly used spatial transformation algorithms include combinations of rotation matrices and translation vectors.
[0132] Using the above method, the relative distance and angle between the object and the camera can be calculated, and the positioning information of multiple cameras can be converted into a common coordinate system, thereby achieving comprehensive positioning of the sheep flock. In practical applications, correction and optimization are required based on specific camera parameters and the scene.
[0133] S4. Obtain time data of sheep activities from the data source, combine sheep behavior characteristics with the final location of identified objects, construct a three-dimensional data structure containing time, behavior and location, and use data analysis software to analyze the three-dimensional data structure to obtain sheep grazing behavior data.
[0134] like Figure 2 As shown, according to another embodiment of the present invention, an artificial intelligence-based sheep grazing behavior recognition system is also provided. The system includes a data processing module 1, a behavior feature analysis module 2, a location analysis module 3, and a sheep grazing behavior analysis module 4.
[0135] Data processing module 1 is used to extract data sources from multiple monocular cameras in the ranch and preprocess the data sources to obtain the category and preliminary location of objects in the data sources.
[0136] Behavioral feature analysis module 2 is used to build a sheep flock behavior rule base and, based on the OpenPose network model, detect sheep flock behavior features from data sources in multiple monocular cameras in the pasture.
[0137] The positioning analysis module 3 is used to calculate the monocular positioning of the object based on the preprocessed data source and the pose information of the corresponding monocular camera, and to integrate multiple monocular positioning information to obtain the final positioning of the object.
[0138] Module 4, which analyzes sheep grazing behavior, is used to obtain time data of sheep activities from the data source. It combines sheep behavior characteristics with the final location of objects to construct a three-dimensional data structure that includes time, behavior, and location. Data analysis software is then used to analyze the three-dimensional data structure to obtain the sheep grazing behavior data.
[0139] In summary, by utilizing the above-mentioned technical solutions of this invention, this invention integrates artificial intelligence video recognition, grazing behavior modeling, and grassland geographic information to construct an accurate grazing behavior model. This model can present information such as the location, time, and behavior of grazing behavior with accuracy down to the second level. Furthermore, by combining this model with grassland information, it can reconstruct sheep grazing data. The dataset used in this invention supports deep learning and is continuously optimized during new data collection. As the experimental time progresses, not only does the accuracy of subsequent data collection gradually improve, but the accuracy of previously collected data is also enhanced.
[0140] Although the present invention has been disclosed above with reference to preferred embodiments, the embodiments are merely examples for illustrative purposes and are not intended to limit the present invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the present invention. The scope of protection claimed by the present invention should be determined by the claims.
Claims
1. A method for recognizing sheep grazing behavior based on artificial intelligence, characterized in that, The AI-based method for recognizing sheep grazing behavior includes the following steps: S1. Extract data sources from multiple monocular cameras in the ranch, and preprocess the data sources to obtain the categories and preliminary locations of objects in the data sources; S2. Construct a sheep flock behavior rule base and, based on the OpenPose network model, detect sheep flock behavior features from data sources in multiple monocular cameras in the pasture. S3. Based on the preprocessed data source and the pose information of the corresponding monocular camera, the monocular positioning of the object is calculated by using the principle of triangulation, and the final positioning of the object is obtained by integrating multiple monocular positioning information. S4. Obtain time data of sheep activities from the data source, combine sheep behavior characteristics and the final location of objects to construct a three-dimensional data structure containing time-behavior-location, and use data analysis software to analyze the three-dimensional data structure to obtain sheep grazing behavior data.
2. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 1, characterized in that, The process of extracting data sources from multiple monocular cameras in the ranch and preprocessing the data sources to obtain the categories and preliminary locations of objects in the data sources includes the following steps: S11. Based on the adaptive convolutional neural network model, classify and identify objects in the data source to obtain object classification results; S12. Based on the YOLO V4 network model, locate and label the objects in the data source to obtain the preliminary object location.
3. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 2, characterized in that, The method of classifying and recognizing objects in the data source based on the adaptive convolutional neural network model includes the following steps: S111. Collect image data with pre-labeled object types to obtain an image type dataset, and divide the image type dataset into a training set and a test set according to a preset ratio; S112. Construct an initial adaptive convolutional neural network model, wherein the input of the initial adaptive convolutional neural network model is a normalized image type dataset, and the output of the initial adaptive convolutional neural network model is the classification result of the objects in the corresponding image type dataset. S113. Extend the initial adaptive convolutional neural network model to obtain the optimal adaptive convolutional neural network model; S114. Input the data sources from multiple monocular cameras into the optimal adaptive convolutional neural network model, and output the object classification results through the optimal adaptive convolutional neural network model.
4. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 3, characterized in that, The process of expanding the initial adaptive convolutional neural network model to obtain the optimal adaptive convolutional neural network model includes the following steps: S1131. Train the initial adaptive convolutional neural network model using the training set, test the trained initial adaptive convolutional neural network model using the test set, and calculate the accuracy of the test results. S1132. Randomly select a convolutional layer as an extended convolutional layer in the current initial adaptive convolutional neural network model, and perform various network structure extensions at the extended convolutional layer to obtain multiple extended neural network models. S1133. Train multiple extended neural network models using the training set, and test the multiple extended neural network models using the test set respectively, calculate the accuracy of the test results, and select the extended neural network model with the highest test accuracy among the multiple extended neural networks. S1134. Determine whether the test accuracy of the selected extended neural network model is higher than the test accuracy of the initial adaptive convolutional neural network model. If so, use the extended neural network model as the current adaptive convolutional neural network model and continue to extend it until the test accuracy of the extended neural network model no longer improves, thus obtaining the optimal extended neural network model. Otherwise, use the initial adaptive convolutional neural network model as the optimal adaptive convolutional neural network model.
5. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 4, characterized in that, The formula for calculating the accuracy of the test results is as follows: In the formula, A represents the accuracy of the test result; N represents the total number of input images in the test set; ∑ represents the summation operation; n represents the sequence number of the input image in the test set; c represents the total dimension of the classification labels of the object images in the test set; and k represents the dimension sequence number of the classification labels of the object images in the test set. This represents the element in the k-th dimension of the classification label for the n-th image in the test set; This represents the element in the k-th column of the predicted classification label for the n-th image in the test set.
6. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 2, characterized in that, The process of locating and labeling objects in the data source based on the YOLO V4 network model to obtain preliminary object localization includes the following steps: S121. Each image in the collected image type dataset is labeled with its location using manual annotation, resulting in a training set and a test set for the location annotations. S122. Construct a YOLO V4 network model and train and test the YOLO V4 network model based on the location-labeled training and test sets; S124. Input the data sources from multiple monocular cameras into the YOLO V4 network model after training and testing, and output the preliminary object localization through the YOLO V4 network model.
7. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 1, characterized in that, The process of constructing a sheep flock behavior rule base and detecting sheep flock behavior features from multiple monocular cameras in the pasture based on the OpenPose network model includes the following steps: S21. Collect behavioral images of sheep in different postures, and mark the key points of the bones of various parts of the sheep's body in different postures in the behavioral images to establish a sheep flock behavior rule library. S22. Standardize the images in the sheep behavior rule library. The standardization process includes size adjustment, normalization of pixel values and smoothing. S23. Integrate the Senet channel attention mechanism into the object detection algorithm, perform object detection on the standardized image, and obtain the object detection result; S24. In the pre-configured OpenPose network model, replace VGG19 with the Mobilenet network with depthwise separable convolution as its core to obtain an improved OpenPose network model. S25. The improved OpenPose network model is trained and tested using the target detection results to obtain the final OpenPose network model. Based on the data sources from multiple monocular cameras in the pasture, the coordinates of the joint points of the sheep skeleton are extracted using the final OpenPose network model. S26. Obtain the joint motion trajectory by using Bézier curves to measure the coordinates of the joint points of the sheep skeleton, and use the trajectory similarity measurement algorithm to obtain the distance array between joints. S27. Use a linear transformation classifier to classify the coordinates of the joints and determine the sheep's behavior and posture.
8. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 7, characterized in that, The depthwise separable convolution consists of depthwise convolution and pointwise convolution, and the ratio of the number of parameters in the depthwise separable convolution to the number of parameters in the traditional convolution is: In the formula, η represents the ratio of the number of parameters in depthwise separable convolution to the number of parameters in traditional convolution; W D W represents the number of parameters in a depthwise separable convolution; stand The parameter represents the number of parameters in a traditional convolution; N represents the number of channels in the output image. This represents the square of the convolution kernel size.
9. The method for recognizing sheep grazing behavior based on artificial intelligence according to claim 1, characterized in that, The process of obtaining the final location of the identified object by integrating multiple monocular positioning information, based on the preprocessed data source and the pose information of the corresponding monocular camera, using the principle of triangulation and calculating the monocular localization of the object, includes the following steps: S31. Based on the focal length of the monocular camera, the object's positioning annotation in the preprocessed data source, and the monocular camera's pose information, calculate the relative distance and relative angle between the object and the camera by establishing a triangle relationship. S32. The positioning results of each monocular camera are transformed and fused according to the pre-set coordinate transformation rules. A spatial coordinate transformation algorithm is used to unify the object position information from different perspectives into a common coordinate system, and the final positioning of the object is obtained by integrating multiple monocular positioning information.
10. An artificial intelligence-based sheep grazing behavior recognition system, used to implement the artificial intelligence-based sheep grazing behavior recognition method according to any one of claims 1-9, characterized in that, The system includes a data processing module, a behavior feature analysis module, a location analysis module, and a sheep grazing behavior analysis module; The data processing module is used to extract data sources from multiple monocular cameras in the ranch and preprocess the data sources to obtain the categories and preliminary locations of objects in the data sources. The behavioral feature analysis module is used to construct a sheep flock behavior rule base and, based on the OpenPose network model, to detect sheep flock behavior features from data sources in multiple monocular cameras in the pasture. The positioning analysis module is used to calculate the monocular positioning of the object based on the preprocessed data source and the pose information of the corresponding monocular camera, and to integrate multiple monocular positioning information to obtain the final positioning of the object. The sheep grazing behavior analysis module is used to obtain time data of sheep activities from the data source, combine sheep behavior characteristics and the final location of objects to construct a three-dimensional data structure containing time-behavior-location, and use data analysis software to analyze the three-dimensional data structure to obtain sheep grazing behavior data.