Pasture sheep flock detection tracking method based on unmanned aerial vehicle and safety early warning system
By using the high-definition camera equipped with a drone in the ranch, combined with the improved YOLOv8 model and multi-objective tracking algorithm, efficient and accurate monitoring and tracking of the flock is achieved, solving the problem of low management efficiency of traditional grazing methods and reducing labor costs.
Patent Information
- Application Number
- CN202411680989.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional grazing methods are difficult to achieve efficient and precise management of large-scale sheep, resulting in problems such as grassland degradation and land desertification, and manual monitoring increases labor costs and time.
The drone-based ranch flock detection and tracking method is adopted, and the improved YOLOv8 model is constructed through image recognition, target tracking and analysis technology, and combined with the SPPFCSPC module, CBAM attention module and C2f_DS module, real-time detection and multi-objective tracking of flocks are realized.
Efficient monitoring and precise tracking of sheep flocks have been achieved, labor costs have been reduced, management efficiency has been improved, and missing livestock have been promptly discovered and reported through the safety warning system.
Smart Images

Figure CN119625781A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated animal husbandry management, and in particular to a pasture sheep herd detection and tracking method based on an unmanned aerial vehicle and a safety early warning system. Background Art
[0002] As an important part of animal husbandry, sheep farming provides a large amount of mutton, wool and other livestock products for the domestic market, meeting people's consumption needs. It is also of great significance to increase farmers' and herdsmen's income and promote the economic and social development of agricultural and pastoral areas. Pasture production management faces problems such as aging of relevant staff and insufficient labor. Traditional grazing methods are limited by manpower, terrain and weather conditions, making it difficult to achieve efficient and precise management of large-scale sheep flocks. Traditional grazing methods often lead to grassland degradation, land desertification and other problems, seriously affecting the sustainable development of animal husbandry.
[0003] Traditional flock monitoring mainly relies on manual observation, which increases labor costs and time. With the rapid development of drone technology, its advantages such as flexibility and real-time transmission are widely used in animal husbandry. Drones can achieve rapid detection, tracking and monitoring of flocks, providing new solutions for the development of modern animal husbandry. With the continuous development of computer vision and artificial intelligence technology, image processing and pattern recognition technology are becoming more and more widely used in the field of animal husbandry.
[0004] With the continuous development of science and technology, automated and intelligent management methods have become an important trend in the development of animal husbandry. As a product of the combination of modern technology and animal husbandry, the drone grazing system has an important demonstration and promotion role. The research on the detection, tracking and safety warning system of drone grazing sheep flocks plays an important role in improving the efficiency of animal husbandry management, strengthening the safety of sheep flocks, promoting the sustainable development of animal husbandry, promoting the modernization and intelligentization of animal husbandry, and the development of animal husbandry-related industries.
[0005] Therefore, a sheep flock detection and tracking method based on UAV and a safety early warning system were proposed. Summary of the invention
[0006] The technical problem to be solved by the present invention is: how to efficiently monitor and accurately track the flock of sheep through image recognition, target tracking and analysis technology, thereby achieving safety warning, reducing labor costs, and improving management efficiency, and providing a ranch flock detection and tracking method based on drones.
[0007] The present invention solves the above technical problems through the following technical solutions, and the present invention comprises the following steps:
[0008] S1: Data collection and preprocessing
[0009] Obtain sheep flock video data from natural grassland pastures, and pre-process the sheep flock video data to obtain a sheep flock detection data set;
[0010] S2: Detection model construction and training
[0011] Based on the original YOLOv8 model, the SPPFCSPC module that combines the original features with the output of the fast spatial pyramid pooling network is introduced into the original YOLOv8 model, and the CBAM attention module is integrated. At the same time, the C2f_DS module is used to replace the standard convolution module in the original YOLOv8 model to obtain an improved YOLOv8 model. The improved YOLOv8 model is trained using the flock detection dataset to obtain a flock detection model.
[0012] S3: Herd Following
[0013] The sheep flock video data of the ranch is obtained in real time, the sheep flock detection model is used to detect and identify the sheep targets in the ranch sheep flock video data, and the multi-target tracking method is used to continuously track the detected sheep targets. By continuously tracking the sheep flock, the sheep flock quantity information can be obtained.
[0014] Furthermore, in step S1, in different areas of the natural grassland pasture, different weather conditions and different time periods, an unmanned aerial vehicle platform equipped with a high-definition camera is used to perform flight shooting to obtain pasture sheep video data covering a set height range, so as to comprehensively reflect the pasture environment and sheep activities.
[0015] Furthermore, in the step S1, the preprocessing process includes denoising, contrast enhancement, and image stabilization processing of each frame image in the ranch sheep herd video data, and screening out images with high blur and similarity through blur detection algorithm and similarity detection algorithm for deletion to obtain preprocessed ranch sheep herd video data.
[0016] Furthermore, in the step S1, each image in the preprocessed pasture sheep flock video data is labeled, and the position and category information of each sheep are marked to obtain a sheep flock detection data set.
[0017] Furthermore, in step S2, the SPPFCSPC module is used to replace the SPPF module in the 9th layer of the original YOLOv8 model; in the SPPFCSPC module, the input features are split, and some features are processed by the SPPF module. The model's processing capability for different scales is enhanced by using serial pooling operations during multiple convolution operations, and the remaining features are directly combined with the output of the SPPF module after the convolution operation.
[0018] Furthermore, in the step S2, the C2f_DS module is used to replace the C2f convolution modules in the 12th, 15th, 18th and 21st layers of the original YOLOv8 model; the C2f_DS module includes a deep convolution layer and a point-by-point convolution layer; the deep convolution layer convolves each channel through an independent convolution kernel and stacks the outputs to reduce parameters, and the point-by-point convolution layer uses the corresponding convolution kernel to perform channel mixing on the output of the deep convolution layer to generate the final feature map.
[0019] Furthermore, in the step S2, the CBAM attention module is added after the 15th, 18th and 21st layers of the original YOLOv8 model; the CBAM attention module includes a channel attention module and a spatial attention module. The channel attention module first extracts different global information from the input feature map using global maximum pooling and average pooling operations and then sends it to the MLP network for nonlinear transformation, learns and extracts the relationship between each channel feature, and generates corresponding feature representations; the spatial attention module performs maximum pooling and average pooling operations based on the channel dimension on the input feature map to extract significant features and overall feature distribution at different spatial positions in the feature map.
[0020] Furthermore, in step S3, the multi-target tracking method is a multi-target tracking method based on the improved ByteTrack algorithm, which changes the aspect ratio to the width of the predicted detection box by changing the Kalman filter state variable, and introduces trajectory interpolation processing to fill in the missing or occluded parts of the target that may appear between consecutive frames, so that the target trajectory is visually more continuous and smooth, wherein the trajectory interpolation processing infers the position of the target during occlusion or disappearance based on the known target trajectory points, thereby ensuring the continuity and accuracy of tracking.
[0021] The present invention provides a ranch sheep herd safety warning system based on unmanned aerial vehicles, including an unmanned aerial vehicle platform and a safety warning platform. The unmanned aerial vehicle platform collects ranch sheep herd video data in real time and transmits the data to the safety warning platform. A sheep herd detection model and a sheep herd multi-target tracking algorithm are deployed on the safety warning platform. Real-time detection and tracking interface display of the sheep herd are realized on the safety warning platform, and a sheep herd number threshold is set. When it is detected that the number of sheep is lower than or higher than the preset threshold, an alarm function is triggered to promptly notify animal husbandry managers.
[0022] Compared with the prior art, the present invention has the following advantages:
[0023] 1. The high-altitude operation capability of the UAV platform greatly expands the monitoring field of view, which not only reduces labor costs, but also significantly improves the timeliness and accuracy of monitoring, helping livestock managers to grasp the dynamics of the flock in a timely manner and make scientific decisions; by integrating target detection and target tracking technology, the proposed target detection model and multi-target tracking algorithm can still maintain a high recognition rate and tracking stability in complex environments, effectively solving problems such as target occlusion, and realizing accurate detection and tracking of flock targets.
[0024] 2. The safety early warning system can promptly detect and report missing livestock, providing strong emergency response support for livestock managers.
[0025] 3. The successful application of the present invention not only solves many problems existing in the current animal husbandry management, but also provides new ideas and new directions for the intelligent development of animal husbandry; by integrating advanced UAV technology, image recognition technology, target tracking technology and intelligent analysis technology, efficient, accurate and intelligent management of pasture sheep is achieved; this innovative management model will help promote the development of animal husbandry towards a more intelligent, automated and efficient direction, and inject new impetus into the sustainable development of animal husbandry. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a schematic diagram of an application of a method for detecting and tracking sheep in a pasture based on a drone in an embodiment of the present invention;
[0027] Figure 2 It is a schematic diagram of the overall process of a ranch sheep herd detection and tracking method and a safety early warning system based on drones in an embodiment of the present invention;
[0028] Figure 3 It is a schematic diagram of the structure of the SPPFCSPC module in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following is a detailed description of an embodiment of the present invention. This embodiment is implemented on the premise of the technical solution of the present invention, and a detailed implementation method and a specific operation process are given, but the protection scope of the present invention is not limited to the following embodiment.
[0030] like Figure 2 As shown, this embodiment provides a technical solution: a method for detecting and tracking sheep in a pasture based on a drone, comprising the following steps:
[0031] Step 1: Data collection and preprocessing
[0032] Obtain the sheep flock video data of the natural grassland pasture, and pre-process the sheep flock video data to obtain the sheep flock detection data set;
[0033] Step 2: Detection model construction and training
[0034] Based on the original YOLOv8 model, the SPPFCSPC module that combines the original features with the output of the fast spatial pyramid pooling network is introduced into the original YOLOv8 model, and the CBAM attention module is integrated. At the same time, the C2f_DS module is used to replace the standard convolution module in the original YOLOv8 model to obtain an improved YOLOv8 model. The improved YOLOv8 model is trained using the flock detection dataset to obtain a flock detection model.
[0035] Step 3: Herd tracking
[0036] Acquire the sheep flock video data in real time, use the sheep flock detection model to detect and identify the sheep targets in the sheep flock video data, and use the multi-target tracking method based on the improved ByteTrack algorithm to continuously track the detected sheep targets. By continuously tracking the sheep flock, it is convenient to obtain the sheep flock number information and other operations in the future.
[0037] In step 1, the specific process of obtaining the video data of sheep flocks in natural grassland pastures is as follows: in different areas of natural grassland pastures, different weather conditions and different time periods (morning, noon, and evening), use a drone platform equipped with a high-definition camera to fly and shoot, and obtain video data covering different heights of 25 to 70 meters. These data should fully reflect the pasture environment and sheep flock activities.
[0038] In step 1, the collected video data is preprocessed, including denoising, contrast enhancement, and image stabilization, to improve image quality. Subsequently, blur detection and similarity detection algorithms are used to filter out images with high blur and similarity for deletion, ensuring the clarity and diversity of the final data set.
[0039] In step one, the filtered images are annotated to mark the location, category and other information of each sheep, generating a data set required for target detection and multi-target tracking.
[0040] In step 2, a flock detection model is constructed based on the original YOLOv8 model. This embodiment uses the SPPFCSPC module and introduces the C2f_DS module to replace the standard convolution module to reduce the model size and calculation amount and improve the detection speed.
[0041] To be more specific, in this embodiment, the SPPFCSPC module replaces the SPPF module in the 9th layer of the original YOLOv8 network model.
[0042] As more specific, in this embodiment, if Figure 3As shown in the figure, in the SPPFCSPC module, the input features are split, some of which are processed by the SPPF module, and the model's processing capabilities for different scales are enhanced by using serial pooling operations in multiple convolution operations. The remaining features are directly combined with the output of the SPPF module after the convolution operation. This dual-branch processing method of differentially processing the input features and then merging them deeply combines the input features with the output features, allowing high-level features to fully utilize low-level information.
[0043] As more specific, in this embodiment, the C2f_DS module is used to replace the C2f convolution modules in the 12th, 15th, 18th, and 21st layers of the original YOLOv8 network model; the C2f_DS module includes two parts: deep convolution and point-by-point convolution. Feature extraction can be performed based on input features. DW convolves each channel with an independent convolution kernel and stacks the output to reduce parameters, while PW uses the corresponding convolution kernel to mix the channels of the former output to generate the final feature map.
[0044] In step 2, the CBAM convolutional attention mechanism module is integrated into the original YOLOv8 model. Through the spatial and channel attention mechanisms, the feature extraction capability of the sheep target is enhanced, while background interference is suppressed and the detection accuracy is improved.
[0045] As more specific, in this embodiment, the CBAM attention mechanism is adopted and added after the 15th, 18th and 21st layers of the improved model; the CBAM attention module includes CAM (Channel Attention Module) and SAM (Spatial Attention Module). CAM first uses global maximum pooling and average pooling operations to extract different global information from the input feature map and then sends it to the MLP (Multi-Layer Perceptron) network for nonlinear transformation, learns and extracts the complex relationship between the features of each channel, and generates the corresponding feature representation (feature map). SAM performs maximum pooling and average pooling operations based on the channel dimension on the input feature map to extract the significant features and overall feature distribution at different spatial positions in the feature map. Finally, the feature maps obtained by the two attention modules are spliced and further extracted and integrated through convolution operations, and the final spatial attention weight is generated through the Sigmoid activation function.
[0046] In step 2, the detection model is trained using the labeled data set, and the model parameters are optimized through continuous iteration until a satisfactory detection effect is achieved.
[0047] In step three, based on the sheep flock detection, the detected sheep targets are continuously tracked using the multi-target tracking algorithm of the improved ByteTrack algorithm. The multi-target tracking algorithm of the improved ByteTrack algorithm proposed in this embodiment changes the aspect ratio to the width of the predicted detection frame by changing the Kalman filter state variable to improve the tracking accuracy.
[0048] As more specific, in the multi-target tracking algorithm of the improved ByteTrack algorithm, trajectory interpolation technology is introduced to fill in the missing or occluded parts of the target that may appear between consecutive frames, making the target trajectory more visually continuous and smooth. The trajectory interpolation infers the position of the target during occlusion or disappearance based on the known target trajectory points, ensuring the continuity and accuracy of tracking.
[0049] In one embodiment of the present invention, a ranch sheep herd safety warning system based on drones is provided, including a drone platform (image acquisition device) and a safety warning platform. The drone hardware is responsible for collecting ranch sheep herd data and transmitting the data to the safety warning platform for processing.
[0050] The specific processing process of the above-mentioned ranch sheep safety early warning system is as follows:
[0051] Among them, the drone platform is equipped with a high-definition camera, GPS positioning system and wireless communication module to collect real-time video data of pasture sheep and transmit the data to the safety warning platform.
[0052] Deploy the flock detection model and flock multi-target tracking algorithm on the security early warning platform.
[0053] Real-time detection and tracking interface display of sheep flocks is realized on the safety warning platform.
[0054] Set a flock number threshold. When the number of sheep is detected to be lower or higher than the preset threshold, the alarm function is triggered to notify the livestock manager in time.
[0055] It should be noted that by building a drone platform with stable image acquisition capabilities, it is ensured that clear and stable videos of the sheep on the ranch can be captured during the flight.
[0056] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for detecting and tracking sheep flocks in a pasture based on drones, characterized in that: The following steps are involved: S1: Data collection and preprocessing Obtain the sheep flock video data of the natural grassland pasture, and pre-process the sheep flock video data to obtain the sheep flock detection data set; S2: Detection model construction and training Based on the original YOLOv8 model, the SPPFCSPC module that combines the original features with the output of the fast spatial pyramid pooling network is introduced into the original YOLOv8 model, and the CBAM attention module is integrated. At the same time, the C2f_DS module is used to replace the standard convolution module in the original YOLOv8 model to obtain an improved YOLOv8 model. The improved YOLOv8 model is trained using the flock detection dataset to obtain a flock detection model. S3: Herd Following The sheep flock video data of the ranch is obtained in real time, the sheep flock detection model is used to detect and identify the sheep targets in the ranch sheep flock video data, and the multi-target tracking method is used to continuously track the detected sheep targets. By continuously tracking the sheep flock, the sheep flock quantity information can be obtained.
2. The method for detecting and tracking sheep flocks in a pasture based on an unmanned aerial vehicle according to claim 1, characterized in that: In step S1, in different areas of the natural grassland pasture, different weather conditions and different time periods, an unmanned aerial vehicle platform equipped with a high-definition camera is used to perform flight shooting to obtain pasture sheep video data covering a set altitude range, so as to comprehensively reflect the pasture environment and sheep activities.
3. The method for detecting and tracking sheep flocks in a pasture based on an unmanned aerial vehicle according to claim 1, characterized in that: In step S1, the preprocessing process includes denoising, contrast enhancement, and image stabilization of each frame image in the ranch sheep herd video data, and filtering out images with high blur and similarity through blur detection algorithm and similarity detection algorithm for deletion to obtain preprocessed ranch sheep herd video data.
4. The method for detecting and tracking sheep flocks in a pasture based on an unmanned aerial vehicle according to claim 1, characterized in that: In the step S1, each image in the preprocessed sheep flock video data is labeled to mark the position and category information of each sheep, thereby obtaining a sheep flock detection data set.
5. The method for detecting and tracking sheep flocks in a pasture based on an unmanned aerial vehicle according to claim 1, characterized in that: In step S2, the SPPFCSPC module is used to replace the SPPF module in the 9th layer of the original YOLOv8 model; in the SPPFCSPC module, the input features are split, and some features are processed by the SPPF module. The model's processing ability for different scales is enhanced by using serial pooling operations in multiple convolution operations, and the remaining features are directly combined with the output of the SPPF module after the convolution operation.
6. The method for detecting and tracking sheep flocks in a pasture based on an unmanned aerial vehicle according to claim 5, characterized in that: In the step S2, the C2f_DS module is used to replace the C2f convolution modules in the 12th, 15th, 18th and 21st layers of the original YOLOv8 model; the C2f_DS module includes a deep convolution layer and a point-by-point convolution layer; the deep convolution layer convolves each channel through an independent convolution kernel and stacks the outputs to reduce parameters, and the point-by-point convolution layer uses the corresponding convolution kernel to mix the channels of the output of the deep convolution layer to generate a final feature map.
7. The method for detecting and tracking sheep flocks in a pasture based on an unmanned aerial vehicle according to claim 6, characterized in that: In the step S2, the CBAM attention module is added after the 15th, 18th and 21st layers of the original YOLOv8 model; the CBAM attention module includes a channel attention module and a spatial attention module. The channel attention module first extracts different global information from the input feature map by using global maximum pooling and average pooling operations and then sends it to the MLP network for nonlinear transformation, learns and extracts the relationship between the features of each channel, and generates corresponding feature representations; the spatial attention module performs maximum pooling and average pooling operations based on the channel dimension on the input feature map to extract significant features and overall feature distribution at different spatial positions in the feature map.
8. The method for detecting and tracking sheep in a pasture based on an unmanned aerial vehicle according to claim 7, characterized in that: In step S3, the multi-target tracking method is a multi-target tracking method based on the improved ByteTrack algorithm. The aspect ratio is changed to the width of the predicted detection frame by changing the Kalman filter state variable, and trajectory interpolation processing is introduced to fill in the missing or occluded parts of the target that may appear between consecutive frames, so that the target trajectory is visually more continuous and smooth. Among them, the trajectory interpolation processing infers the position of the target during occlusion or disappearance based on the known target trajectory points, thereby ensuring the continuity and accuracy of tracking.
9. A sheep herd safety warning system based on drones, characterized in that: It includes a drone platform and a safety warning platform. The drone platform collects real-time video data of pasture sheep and transmits the data to the safety warning platform. The safety warning platform is deployed with a sheep detection model and a sheep multi-target tracking algorithm. The safety warning platform realizes real-time detection and tracking interface display of the sheep and sets a sheep number threshold. When the number of sheep is detected to be lower than or higher than the preset threshold, the alarm function is triggered to notify the livestock managers in time.
Citation Information
Patent Citations
Goat flock counting method based on improved YOLOv5 algorithm
CN116310895A
Hu sheep target real-time tracking method based on neural network
CN116386077A
Cited By
Free-range sheep flock dynamic counting method and system based on multi-view vision
CN120412014A