Cow small target identification method and system based on improved YOLOv11
By improving the YOLOv11 algorithm, combining multi-scale feature fusion and BiFPN module, the problem of insufficient recognition accuracy of small targets in cattle farms is solved, and accurate counting and real-time monitoring of cattle farms is realized, recognition accuracy and positioning performance are improved, and the Operating costs.
Patent Information
- Application Number
- CN202411731176.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art When identifying small targets in cattle farms, especially under long distance, overlapping or blurred image conditions, the recognition accuracy and stability are insufficient, which affects the accuracy of tripwire intrusion detection.
Using the improved YOLOv11 algorithm, the model of identifying data sets of individuals in a cattle, building multi-scale feature fusion and cross-scale feature fusion, combined with Dynamic Fusion Module, BiFPN module and normalized Wasserstein distance, improve the model's ability to extract small-target features and bounding box prediction accuracy.
Accurate counting and real-time monitoring of cattle farms are realized, identification accuracy and positioning performance are improved, labor and operation costs are reduced, and efficiency and safety of cattle farm management are enhanced.
Smart Images

Figure CN119206198A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of small-target individual recognition of cattle, and in particular to a small-target recognition method and system of cattle based on improved YOLOv11. Background Art
[0002] In the prior art, in cattle farm management, accurate counting and real-time monitoring of cattle are key links to ensure the health, safety and efficient operation of the herd. In particular, in the tripwire intrusion detection system, accurately judging whether the number of cattle has changed is of great significance for timely detection of abnormal situations and prevention of cattle loss or theft. However, traditional cattle counting methods, such as manual patrols or monitoring based on fixed cameras, often have many shortcomings. On the one hand, manual patrols are not only time-consuming and laborious, but also easily affected by human factors, resulting in inaccurate counting results. On the other hand, although monitoring based on fixed cameras can achieve real-time monitoring of cattle farms, it faces many challenges in dealing with small target individual identification. In particular, when cattle are at a relatively far distance, it is often difficult to accurately identify each cattle due to the limitation of image resolution and the influence of lighting conditions. In addition, when multiple cattle are close to or overlap each other, it is also easy to cause recognition errors, thereby affecting the accuracy of tripwire intrusion detection.
[0003] In order to solve the above problems, researchers began to explore a method for identifying small individual cattle based on computer vision and deep learning technology. This method uses advanced image processing algorithms and deep learning models to accurately identify individual cattle from complex backgrounds and accurately count them. However, existing small target recognition methods still have shortcomings when processing long-distance, overlapping or blurred images, resulting in the need to improve recognition accuracy and stability. Summary of the invention
[0004] The present invention aims to solve the problem that the small target recognition method in the prior art still has deficiencies when processing long-distance, overlapping or blurred images, resulting in the need to improve the recognition accuracy and stability.
[0005] To solve the above technical problems, the present invention is achieved through the following technical solutions: Solution 1: The present invention proposes a method for recognizing small cattle targets based on improved YOLOv11, and the method comprises the following steps: S1. Constructing a cattle individual identification data set, wherein the cattle individual identification data set includes a training set and a test set; S2, build a cattle individual identification model based on the cattle individual identification dataset constructed in S1; S3, using the training set obtained in S1 to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in S2, to obtain a trained cattle individual recognition model; S4, using the test set obtained in S1, verifying the cattle individual recognition model trained in S3; S5. Based on the trained individual cattle identification model verified in S4, individual cattle are identified.
[0006] Further, a preferred implementation is provided, where S1 specifically includes: S11, collect individual images of cattle from different cattle farms; S12, based on the individual images of cattle collected from different cattle farms, the individual images of cattle in S11 are manually identified and labeled, and after the labeling is completed, they are converted into a txt storage label format; S13. Randomly divide the labeled individual cattle images into training sets and test sets according to the proportion.
[0007] Further, a preferred implementation is provided, in which the method for building a cattle individual recognition model of the improved YOLOv11 algorithm in S2 is: Multi-scale feature fusion, cross-scale feature fusion and normalization are performed on the original YOLOv11 algorithm model to obtain the individual cattle recognition model of the improved YOLOv11 algorithm.
[0008] Further, a preferred implementation is provided, in S3, the training set obtained in S1 is used to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in S2, and the method for obtaining the trained cattle individual recognition model is: S31, performing data enhancement on the training set obtained in S1, wherein the data enhancement includes rotation, flipping, and scaling; S32. According to the improved YOLOv11 algorithm obtained in S2, the parameters of the cattle individual recognition model are configured, including the network structure, the learning rate, and the batch size; at the same time, the weights of the cattle individual recognition model are initialized; S33. Use the preprocessed training set to train the cattle individual recognition model; set the weight of the cattle individual recognition model through the back propagation algorithm and the gradient descent optimization method to obtain the trained cattle individual recognition model.
[0009] Further, a preferred embodiment is provided, in which the method of using the test set in S1 in S4 to verify the trained cattle individual recognition model in S3 is: S41. Use the test set divided in S1 to verify the individual cattle model. The test set and the training set are consistent in category distribution and data quality in the verification of the individual cattle model.
[0010] S42, using the test set to perform performance evaluation on the trained cattle individual recognition model, wherein the performance evaluation includes calculating accuracy, recall rate, and F1 score indicators; S43. Compare the performance with that of the training set to complete the verification.
[0011] Furthermore, a preferred implementation is provided, wherein the multi-scale feature fusion is achieved through a DFM module and a residual connection method.
[0012] Furthermore, a preferred implementation is provided, wherein the cross-scale feature fusion is achieved by adding cross-scale connections and skip connections in the BiFPN module.
[0013] Solution 2: A cattle small target recognition system based on improved YOLOv11, the system includes: A cattle individual identification data set construction module is used to construct a cattle individual identification data set, wherein the cattle individual identification data set includes a training set and a test set; Build a cattle individual identification model module, which is used to build a cattle individual identification model of the improved YOLOv11 algorithm based on the cattle individual identification dataset constructed by the cattle individual identification dataset module; A cattle individual recognition model training module is used to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained by building the cattle individual recognition model module using the training set obtained in the cattle individual recognition data set building module to obtain a trained cattle individual recognition model; A cattle individual identification model verification module is used to verify the cattle individual identification model trained in the cattle individual identification model training module by using the test set in the cattle individual identification data set construction module; The cattle individual identification module is used to identify cattle individuals based on the trained cattle individual identification model that has been verified in the cattle individual identification model verification module.
[0014] Solution 3: A computer device includes a processor and a storage medium, wherein the memory stores a computer program. When the processor runs the computer program stored in the memory, the processor executes any one of the methods described in Solution 1.
[0015] Solution 4: A computer storage medium for storing a computer program. When the computer program is read by a computer, the computer executes any one of the methods described in Solution 1.
[0016] The present invention is beneficial in that: The present invention proposes a method and system for identifying small targets of cattle based on improved YOLOv11, aiming to overcome the shortcomings of the prior art and realize accurate counting and real-time monitoring of cattle in cattle farms. The method combines the most cutting-edge computer vision, deep learning and multi-sensor technology, and can effectively handle the problem of individual cattle identification in long-distance, overlapping or blurred images. Through this method, not only can accurate counting of cattle in cattle farms be achieved, but it can also be applied to tripwire intrusion detection systems to detect abnormal situations in time and take measures to ensure the safety and efficient operation of the herd. At the same time, the method has a high degree of automation, which can greatly reduce manual labor and operating costs, and bring higher efficiency and lower costs to cattle farm management.
[0017] Compared with the existing cattle individual recognition method based on convolutional neural network, the present invention significantly improves the model's ability to extract small target features and sensitivity to features in different directions by introducing DFM module and modifying Bottleneck block. At the same time, by introducing BiFPN module, the feature fusion capability of feature pyramid network is further enhanced. In addition, the normalized Wasserstein distance is used to replace part of the original IOU as part of the loss function, which improves the prediction accuracy of the model for the target bounding box. These improvements enable the present invention to have higher recognition accuracy and positioning performance in practical application scenarios such as cattle farm monitoring and breeding management, and can play a more important role.
[0018] The present invention is also applied to tripwire intrusion detection systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flowchart of the method for recognizing small cattle targets based on improved YOLOv11 as described in implementation mode 1.
[0020] Figure 2 This is a schematic diagram of the DFM branch dynamic fusion network described in Implementation Example 11.
[0021] Figure 3 This is a schematic diagram of the DFM branch dynamic fusion network jump connection layer described in Implementation Example 11.
[0022] Figure 4 This is a schematic diagram of the internal structure of the Bottleneck described in Implementation Example 11.
[0023] Figure 5 Schematic diagram of the BiFPN module described in Implementation Example 11.
[0024] Figure 6 This is a schematic diagram of the original YOLOv11 algorithm network model described in Implementation Example 11.
[0025] Figure 7This is a schematic diagram of the improved YOLOv11 algorithm network model described in Implementation Example 11. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the implementation methods of the present application clearer, the technical solutions in the implementation methods of the present application will be clearly and completely described below in conjunction with the drawings in the implementation methods of the present application. Obviously, the described implementation methods are only part of the implementation methods of the present application, not all of the implementation methods.
[0027] Implementation method 1: This implementation method provides a method for identifying small cattle targets based on improved YOLOv11, and the method includes the following steps: S1. Constructing a cattle individual identification data set, wherein the cattle individual identification data set includes a training set and a test set; S2, build a cattle individual identification model based on the cattle individual identification dataset constructed in S1; S3, using the training set obtained in S1 to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in S2, to obtain a trained cattle individual recognition model; S4, using the test set obtained in S1, verifying the cattle individual recognition model trained in S3; S5. Based on the trained individual cattle identification model verified in S4, individual cattle are identified.
[0028] Implementation method 2: This implementation method further limits the cattle small target recognition method based on improved YOLOv11 described in implementation method 1. S1 specifically includes: S11, collect individual images of cattle from different cattle farms; S12, based on the individual images of cattle collected from different cattle farms, the individual images of cattle in S11 are manually identified and labeled, and after the labeling is completed, they are converted into a txt storage label format; S13. Randomly divide the labeled individual cattle images into training sets and test sets according to the proportion.
[0029] Implementation method three: This implementation method is a further limitation of the cattle small target recognition method based on the improved YOLOv11 described in implementation method one. The method for building a cattle individual recognition model of the improved YOLOv11 algorithm in S2 is: Multi-scale feature fusion, cross-scale feature fusion and normalization are performed on the original YOLOv11 algorithm model to obtain the individual cattle recognition model of the improved YOLOv11 algorithm.
[0030] Implementation method 4: This implementation method is a further limitation of the cattle small target recognition method based on the improved YOLOv11 described in implementation method 1. In S3, the training set obtained in S1 is used to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in S2. The method for obtaining the trained cattle individual recognition model is: S31, performing data enhancement on the training set obtained in S1, wherein the data enhancement includes rotation, flipping, and scaling; S32. According to the improved YOLOv11 algorithm obtained in S2, the parameters of the cattle individual recognition model are configured, including the network structure, the learning rate, and the batch size; at the same time, the weights of the cattle individual recognition model are initialized; S33. Use the preprocessed training set to train the cattle individual recognition model; set the weight of the cattle individual recognition model through the back propagation algorithm and the gradient descent optimization method to obtain the trained cattle individual recognition model.
[0031] Implementation mode 5: This implementation mode further limits the cattle small target recognition method based on improved YOLOv11 described in implementation mode 1. In S4, the test set in S1 is used to verify the cattle individual recognition model trained in S3 as follows: S41. Use the test set divided in S1 to verify the individual cattle model. The test set and the training set are consistent in category distribution and data quality in the verification of the individual cattle model.
[0032] S42, using the test set to perform performance evaluation on the trained cattle individual recognition model, wherein the performance evaluation includes calculating accuracy, recall rate, and F1 score indicators; S43. Compare the performance with that of the training set to complete the verification.
[0033] Implementation method six: This implementation method is a further limitation of the cattle small target recognition method based on improved YOLOv11 described in implementation method three, and the multi-scale feature fusion is achieved through the DFM module and the residual connection method.
[0034] Implementation method seven: This implementation method is a further limitation of the cattle small target recognition method based on improved YOLOv11 described in implementation method three. The cross-scale feature fusion is achieved by adding cross-scale connections and jump connections in the BiFPN module.
[0035] Embodiment 8: This embodiment proposes a cattle small target recognition system based on improved YOLOv11, the system comprising: A cattle individual identification data set construction module is used to construct a cattle individual identification data set, wherein the cattle individual identification data set includes a training set and a test set; Build a cattle individual identification model module, which is used to build a cattle individual identification model of the improved YOLOv11 algorithm based on the cattle individual identification dataset constructed by the cattle individual identification dataset module; A cattle individual identification model training module is used to train the cattle individual identification model of the improved YOLOv11 algorithm obtained by building the cattle individual identification model module using the training set obtained in the cattle individual identification data set building module to obtain a trained cattle individual identification model; A cattle individual identification model verification module is used to verify the cattle individual identification model trained in the cattle individual identification model training module by using the test set in the cattle individual identification data set construction module; The cattle individual identification module is used to identify cattle individuals based on the trained cattle individual identification model that has been verified in the cattle individual identification model verification module.
[0036] Embodiment 9. This embodiment proposes a computer device, including a processor and a storage medium, wherein the memory stores a computer program. When the processor runs the computer program stored in the memory, the processor executes the method described in any one of embodiments 1 to 7.
[0037] Embodiment 10: This embodiment proposes a computer storage medium for storing a computer program. When the computer program is read by a computer, the computer executes the method described in any one of Embodiments 1 to 7.
[0038] Implementation 11. This implementation includes an example, which is used to explain the above implementation. Figures 1 to 7 To illustrate this implementation method, the specific steps include: S1. Constructing cattle individual identification dataset The image data of individual cattle were screened and sorted from the cattle farm monitoring images to form a large data set containing more than 50,000 images. Subsequently, these image data were divided into training sets and test sets, and all sample images were carefully labeled; S11. Collect individual images of cattle from different cattle farms. The selected categories should include different types of cattle, different time periods, different light levels and different environmental backgrounds; S12, manually identify the individual cattle images in step S11, completely mark the cattle parts, preferably select from small to large, from far to near when marking, and convert them into txt storage label format after marking; S13. Randomly divide the labeled images into training sets and test sets according to the proportion.
[0039] S2. Build an individual cattle recognition model based on the improved YOLOv11 algorithm Multi-scale feature fusion is performed on the original YOLOv11 algorithm model, and after cross-scale feature fusion and normalization, the cattle individual recognition model of the improved YOLOv11 algorithm is obtained; S21, Introducing Dynamic Fusion Module (DFM) A DFM module is added to the core part of the cattle individual recognition model. The module is designed with three parallel processing branches, namely branch 1, branch 2, and branch 3. Each branch uses convolution kernels of different sizes (3×3, 5×5, and 7×7) to capture feature information of different scales. The output feature maps of these three branches are spliced in the channel dimension to achieve effective fusion of multi-scale features. In order to further optimize the fused features, they are processed through an additional convolution layer and batch normalization layer. Finally, the processed features are added to the dimensionality reduction representation of the input features, which significantly enhances the feature extraction and generalization capabilities of the model.
[0040] S22. Modify the Bottleneck block The Bottleneck block is optimized within the layer of the cattle individual recognition model. The 3×3 convolution originally used for learning in the spatial and feature dimensions is replaced by a series of 1×3 and 3×1 convolution layers. The learning of the spatial dimension is further decomposed, which helps the model to enhance its sensitivity to features in different directions, while reducing the number of parameters, thereby improving the accuracy and efficiency of feature extraction.
[0041] S23. Add BiFPN module In order to improve the feature fusion capability of the feature pyramid network, the Bidirectional Feature Pyramid Network (BiFPN) module is introduced into the model. The BiFPN module realizes the effective fusion of features at different levels through bidirectional connection and weighted feature fusion strategy, thereby enhancing the model's ability to detect multi-scale targets.
[0042] S24, normalized Wasserstein distance instead of IOU In the loss function, the normalized Wasserstein distance is used to replace part of the original IOU (Intersection over Union) as part of the evaluation of the target bounding box prediction accuracy. The normalized Wasserstein distance can more accurately reflect the similarity between bounding boxes, which helps to improve the model's prediction accuracy for the target bounding box, thereby further improving the accuracy of individual cattle identification.
[0043] S3. Cattle individual identification model training optimization The training set obtained in S1 is used to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in step S2 to obtain an optimized model; S31, perform data augmentation on the training set obtained in S1. This includes image augmentation (such as rotation, flipping, scaling, etc.) to improve the generalization ability of the model, and data normalization to ensure stability during model training.
[0044] S32. According to the improved YOLOv11 algorithm obtained in S2, configure the model parameters, including network structure, learning rate, batch size, etc. At the same time, initialize the model weights to prepare for the training process; S33, using the preprocessed training set to train the model. During the training process, the model weights are continuously adjusted through optimization methods such as back propagation algorithm and gradient descent to minimize the loss function and improve the recognition accuracy of the model.
[0045] S34. During the training process, pay close attention to the performance changes of the model, such as accuracy, recall, etc. According to the performance changes, timely adjust the learning rate, add regularization terms and other strategies to avoid overfitting and further improve the generalization ability of the model.
[0046] S4. Cattle individual identification model verification The optimized model obtained in step S3 is fully verified using the test set divided in step S1. This step is to ensure the accuracy and reliability of the model in practical applications; S41. Use the test set divided in S1 to verify the model. Ensure that the test set is consistent with the training set in terms of category distribution, data quality, etc., so as to objectively evaluate the performance of the model.
[0047] S42. Use the test set to conduct a comprehensive performance evaluation of the optimized model. This includes calculating indicators such as accuracy, recall, and F1 score to fully reflect the performance of the model in the task of individual cattle identification.
[0048] S43. Compare with the performance on the training set to verify the generalization ability of the model.
[0049] S5. Application of cattle individual identification Using the optimized model validated by S4 to identify individual cattle; On the other hand, the present invention also provides a cattle individual identification system based on an improved YOLOv11 algorithm, which specifically includes the following modules: Construct cattle individual identification dataset module: Construct cattle individual dataset and divide the dataset into training set and validation set for subsequent use.
[0050] Building a cattle individual recognition model module for the improved YOLOv11 algorithm: In this module, the original YOLOv11 algorithm model is deeply optimized. The core of the optimization is the introduction of the Dynamic Fusion Module (DFM) module, which processes three branches with different convolution kernel sizes (3×3, 5×5, and 7×7) in parallel, and splices the output feature maps of the three branches in the channel dimension to achieve multi-scale feature fusion. The fused features are further processed by another convolution layer and a batch normalization layer, and then the processed features are added to the reduced-dimensional representation of the input features, which significantly enhances the model's feature extraction and generalization capabilities. In addition, the Bottleneck block is modified to replace the 3×3 convolution originally used for learning in the spatial and feature dimensions with a series of 1×3 and 3×1 convolution layers to further decompose the spatial dimension learning and may enhance the model's sensitivity to features in different directions. At the same time, the BiFPN (Bidirectional Feature Pyramid Network) module is introduced in the model to enhance the feature fusion capability of the feature pyramid network.
[0051] Training cattle individual recognition model module: This module uses the previously constructed training set to train the optimized YOLOv11 cattle individual recognition model to obtain an optimized trained model.
[0052] Cattle individual identification module: This unit uses the optimized model obtained through training to accurately identify individual cattle. This unit can process surveillance images in real time and quickly and accurately identify the location and category of individual cattle.
[0053] See Figure 1 As shown, this embodiment provides a method for recognizing small targets of cattle based on the improved YOLOv11 algorithm. The method first classifies the individual cattle data set and divides it into a training set and a validation set. Subsequently, the training set is subjected to in-depth model training using the cattle small target recognition algorithm based on the improved YOLOv11 algorithm. After the training is completed, the test set is input into the trained network model to obtain the recognition result of the test sample set.
[0054] Specifically, the cattle small target recognition method based on the improved YOLOv11 algorithm described in this embodiment mainly includes the following steps: Step 1: Reference Figure 2 and Figure 3 , Dynamic Fusion Module (DFM) is introduced to enhance multi-scale feature fusion The present invention creatively introduces Dynamic Fusion Module (DFM) in the core architecture of the model, aiming to significantly enhance the model's multi-scale feature fusion capability in two-dimensional space. The DFM module processes three branches in parallel, namely, branch 1, branch 2, and branch 3, each of which uses a different convolution kernel size (3×3, 5×5, and 7×7) to fully capture the multi-scale information in the input two-dimensional feature map. This design enables the model to focus on subtle local features and broader global features at the same time, thereby improving the comprehensiveness and accuracy of feature extraction. In the DFM module, the output feature maps of the three branches branch 1, branch 2, and branch 3 are spliced in the channel dimension, realizing the effective fusion of multi-scale features in two-dimensional space. In order to further optimize the fused feature representation, the present invention also introduces an additional convolution layer and batch normalization layer. This combination deeply extracts the fused features, which not only improves the expressiveness of the features, but also enhances the robustness of the model.
[0055] In addition, in the specific implementation process of the DFM module, the present embodiment adopts the residual connection method to adapt to the processing of two-dimensional feature maps. First, the input two-dimensional feature map is divided into different channels, and these channels enter different convolutional layers for operation. The number of image channels of each convolutional layer is set to 512, and the convolution kernel size is 1×1 (that is, convolution is performed on a specific channel) to effectively extract features. Subsequently, the feature map is normalized by the batch normalization layer (BN layer), and a nonlinear transformation is introduced through the activation function RELU to prepare for subsequent feature splicing. At this time, part of the input feature map is passed through the same convolutional layer and then feature splicing is performed again. This residual connection method allows part of the input feature map to be directly passed to the output, effectively alleviating the gradient vanishing problem in the deep network. Finally, the spliced feature map is operated by a convolutional layer, the convolution kernel size of which is 3×3 (convolution is performed while keeping the spatial dimension unchanged), and the padding is 1 to generate the final output feature map. This step further refines the feature information, enabling the model to more accurately capture the inherent laws of the input data.
[0056] In order to further enhance the feature extraction capability of the model, this implementation also designs two additional convolutional layers to process the input two-dimensional feature map. The first convolutional layer uses a 1×1 convolution kernel, which is mainly used to adjust the number of channels of the feature map and preliminarily extract feature information. The second convolutional layer uses convolution kernels of different sizes (such as 3×3, 5×5, and 7×7) and sets the padding value accordingly. After processing by these two convolutional layers, feature maps with different receptive fields are obtained, which can be further used for subsequent feature fusion, classification, or regression tasks.
[0057] This embodiment achieves effective fusion of multi-scale features and decomposition of learning in different dimensions in the core part of the model by introducing the DFM module and adopting residual connection and other methods, thereby significantly improving the feature extraction ability and generalization performance of the model. This innovative design enables the model to better cope with complex and changeable two-dimensional input data, and improves its accuracy and robustness in various application scenarios.
[0058] Step 2: Reference Figure 4 , modify the Bottleneck block to optimize spatial dimension learning In order to further improve the model's sensitivity and learning ability to different dimensional features in two-dimensional image data, this implementation makes innovative improvements to the Bottleneck block in YOLOv11. The basic structure of the Bottleneck block is retained, but the convolutional layers therein are adjusted. The traditional Bottleneck block contains standard 3×3 convolutional layers for comprehensive learning in the feature dimension. In the improvement of this implementation, these standard convolutional layers are replaced with a more sophisticated composite convolutional module, which is composed of 1×3 and 3×1 convolutional layers in series.
[0059] The 1×3 layer focuses on feature extraction in the width dimension. Since the size of the convolution kernel is 1 in the width direction and 3 in the height direction (i.e., vertical direction), it can effectively capture subtle changes in the image in the horizontal direction and extract important features in the width direction; in contrast to the 1×3 convolution layer, this layer focuses on features in the height dimension. The size of the convolution kernel is 1 in the height direction and 3 in the width direction (i.e., horizontal direction), which enables it to carefully analyze the vertical structure of the image and extract key features in the height direction. With this design, the model can learn features independently in the two spatial dimensions of width and height while keeping the overall parameter quantity roughly unchanged. This method of decomposing spatial dimension learning not only improves the model's sensitivity to features in different directions, but also enhances its ability to understand complex spatial structures in two-dimensional images.
[0060] Step 3: Reference Figure 5 , introduce the BiFPN module to enhance the feature fusion capability of the feature pyramid network This implementation aims to further improve the performance of the YOLOv11 target detection model. By creatively introducing the BiFPN (Bidirectional Feature Pyramid Network) module, it significantly enhances the feature fusion capability of the feature pyramid network. The BiFPN module adopts a unique bidirectional feature fusion mechanism, which combines both top-down and bottom-up feature paths. It fuses feature maps of different scales by weighted summation, and ensures that feature maps of each scale can receive and integrate useful information from adjacent scales. In addition, this implementation also introduces cross-scale connection and jump connection strategies in the BiFPN module, which further promotes feature fusion between features of different scales, while retaining key information in the original feature map and avoiding the loss of important details.
[0061]
[0062]
[0063] in, Input feature map for layer 6, Input feature map for layer 7, Output feature map for layer 5 The bidirectional feature fusion strategy of the BiFPN module can efficiently integrate and optimize feature information from different scales, significantly enhancing the feature representation capability of small targets, thereby improving the accuracy and robustness of the model in detecting small targets. Through this innovative design, this implementation not only significantly improves the feature fusion capability of the YOLOv11 model, but also enhances its efficiency in utilizing feature information of different scales, especially in target detection tasks in complex scenarios. The overall performance of the model has been significantly improved, providing a more reliable and accurate solution for practical applications.
[0064] Step 4: Normalized Wasserstein distance replaces normalized IOU to improve target bounding box prediction accuracy In order to more accurately evaluate the performance of small object detection, the rectangular bounding box is first re-conceived as a two-dimensional Gaussian distribution model, which can better capture the characteristics of small objects. In this framework, the intersection over union (IoU) between the predicted box and the true box is innovatively transformed into a similarity measure between two Gaussian distributions. Wasserstein (NWD) is introduced to quantify the similarity between the two distributions.
[0065] During the development of cattle recognition technology, due to the diverse body shapes and postures of cattle, it is difficult for the bounding box defined by them to maintain a standard rectangular shape, which inevitably leads to the mixing of background pixels inside the bounding box. In order to improve the accuracy of describing the importance of pixels within the bounding box, this embodiment innovatively uses a two-dimensional Gaussian distribution model to model the bounding box. In this model, the center pixel of the bounding box is set as the weight peak, and the weight value gradually decreases as the pixel position extends toward the boundary. Define the bounding box as a pixel with The rectangular area of the parameter, where and Represent the horizontal and vertical coordinates of the center of the bounding box, respectively. and represent the width and height of the bounding box respectively.
[0066] In order to more accurately simulate the actual shape of the cattle, this implementation further introduces an inscribed ellipse that matches the weight distribution of the two-dimensional Gaussian distribution to approximate the main part of the cattle. This design can more accurately evaluate the contribution of each pixel in the bounding box to cattle recognition, thereby improving the accuracy and stability of recognition, and providing strong support for the development of cattle recognition technology.
[0067] The equation of the inscribed ellipse is:
[0068] in, = , = is the center of the ellipse, , is the semi-axis length along the (x) axis and the (y) axis. The probability density function of the 2D Gaussian distribution is expressed as:
[0069] in, is the coordinate, is the mean vector, Σ is the covariance matrix, for independent x and y, Σ = .
[0070] The Wasserstein distance between 2D Gaussian distributions is expressed as:
[0071] Further transformed into Frobenius norm form: .in, are the mean vectors of two Gaussian distributions, is the covariance matrix of two Gaussian distributions, is the trace of the matrix,
[0072] is the Frobenius norm.
[0073] For Gaussian distributions from bounding boxes A and B , , further simplified:
[0074] However, since the square of the Wasserstein distance itself is not directly applicable to the scenario of similarity measurement (that is, it is impossible to directly obtain a value between 0 and 1 as a substitute for IoU), an exponential normalization method is further adopted. The square of the Wasserstein distance is divided by a constant C that is closely related to the data set, and the exponential value of the negative square root is taken to obtain the normalized Wasserstein distance (NWD). Normalized form of NWD:
[0075] Where C is a constant that is closely related to the data set, are two Gaussian distributions, is the square of the Wasserstein distance between two Gaussian distributions. Since in actual shooting, there are both small targets and large targets that need to be correctly identified, this paper allocates the ratio of NWD and IOU based on weights.
[0076] Those skilled in the art will appreciate that the above are only preferred embodiments of the present invention, and the various embodiments of the present disclosure and / or the features described in the claims may be combined or combined in various ways, even if such combinations or combinations are not explicitly described in the present disclosure. It is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art may still modify the technical solutions described in the aforementioned embodiments, or perform equivalent substitutions on some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
[0077] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for recognizing small cattle targets based on improved YOLOv11, characterized in that: The method comprises the following steps: S1. Constructing a cattle individual identification data set, wherein the cattle individual identification data set includes a training set and a test set; S2, build a cattle individual identification model based on the cattle individual identification dataset constructed in S1; S3, using the training set obtained in S1 to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in S2, to obtain a trained cattle individual recognition model; S4, using the test set obtained in S1, verifying the cattle individual recognition model trained in S3; S5. Based on the trained individual cattle identification model verified in S4, individual cattle are identified.
2. The cattle small target recognition method based on improved YOLOv11 according to claim 1, characterized in that: S1 specifically includes: S11, collect individual images of cattle from different cattle farms; S12, based on the individual images of cattle collected from different cattle farms, the individual images of cattle in S11 are manually identified and labeled, and after the labeling is completed, they are converted into a txt storage label format; S13. Randomly divide the labeled individual cattle images into training sets and test sets according to the proportion.
3. The cattle small target recognition method based on improved YOLOv11 according to claim 1, characterized in that: The method for building a cattle individual recognition model of the improved YOLOv11 algorithm in S2 is: Multi-scale feature fusion, cross-scale feature fusion and normalization are performed on the original YOLOv11 algorithm model to obtain the individual cattle recognition model of the improved YOLOv11 algorithm.
4. The cattle small target recognition method based on improved YOLOv11 according to claim 1, characterized in that: In S3, the training set obtained in S1 is used to train the cattle individual recognition model of the improved YOLOv11 algorithm obtained in S2, and the method for obtaining the trained cattle individual recognition model is: S31, performing data enhancement on the training set obtained in S1, wherein the data enhancement includes rotation, flipping, and scaling; S32. According to the improved YOLOv11 algorithm obtained in S2, the parameters of the cattle individual recognition model are configured, including the network structure, the learning rate, and the batch size; at the same time, the weights of the cattle individual recognition model are initialized; S33. Use the preprocessed training set to train the cattle individual recognition model; set the weight of the cattle individual recognition model through the back propagation algorithm and the gradient descent optimization method to obtain the trained cattle individual recognition model.
5. The cattle small target recognition method based on improved YOLOv11 according to claim 1, characterized in that: In S4, the test set in S1 is used to verify the cattle individual recognition model trained in S3 as follows: S41, using the test set divided in S1 to perform cattle individual model verification, wherein the test set and the training set are consistent in category distribution and data quality of cattle individual model verification; S42, using the test set to perform performance evaluation on the trained cattle individual recognition model, wherein the performance evaluation includes calculating accuracy, recall rate, and F1 score indicators; S43. Compare the performance with that of the training set to complete the verification.
6. The cattle small target recognition method based on improved YOLOv11 according to claim 3, characterized in that: The multi-scale feature fusion is achieved through the DFM module and the residual connection method.
7. The cattle small target recognition method based on improved YOLOv11 according to claim 3, characterized in that: The cross-scale feature fusion is achieved by adding cross-scale connections and skip connections in the BiFPN module.
8. The cattle small target recognition system based on improved YOLOv11 is characterized by: The system comprises: A cattle individual identification data set construction module is used to construct a cattle individual identification data set, wherein the cattle individual identification data set includes a training set and a test set; Build a cattle individual identification model module, which is used to build a cattle individual identification model of the improved YOLOv11 algorithm based on the cattle individual identification dataset constructed by the cattle individual identification dataset module; A cattle individual identification model training module is used to train the cattle individual identification model of the improved YOLOv11 algorithm obtained by building the cattle individual identification model module using the training set obtained in the cattle individual identification data set building module to obtain a trained cattle individual identification model; A cattle individual identification model verification module is used to verify the cattle individual identification model trained in the cattle individual identification model training module by using the test set in the cattle individual identification data set construction module; The cattle individual identification module is used to identify cattle individuals based on the trained cattle individual identification model that has been verified in the cattle individual identification model verification module.
9. A computer device comprising a memory and a processor, characterized in that: A computer program is stored in the memory. When the processor runs the computer program stored in the memory, the processor executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Dairy cow individual identity recognition method fusing multi-region depth features
CN111259978A
Target identification detection method based on improved YOLOv5
CN114627502A
Traffic sign identification method and system based on improved YOLOv7 algorithm
CN118334616A
Complex scene military target identification method based on improved YOLOv8
CN118470306A
Cited By
Lightweight aerial image target detection method based on improved YOLOv11
CN119832219A
