An improved method of animal image target detection model in qinghai plateau
By improving the YOLOv3 model, using the k-means++ clustering algorithm to select anchor values, increasing the feature scale, improving the NMS algorithm, and introducing the KL-Loss loss function, the problem of insufficient detection accuracy of animals on the Qinghai Plateau was solved, and the detection effect of small targets was improved.
Patent Information
- Application Number
- CN202211264994.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-10-17
AI Technical Summary
Existing image target detection models based on the YOLOv3 algorithm are not accurate enough in animal detection on the Qinghai Plateau, and cannot effectively classify and identify livestock animals, especially small targets.
An improved F-YOLOV3 model is adopted, which selects ideal anchor values by introducing the k-means++ clustering algorithm, increases the feature scale, improves the non-maximum suppression algorithm NMS, and introduces KL-Loss to calculate the bounding box regression loss, thereby optimizing the YOLOV3 model.
It significantly improves the detection accuracy of small targets in animal images of the Qinghai Plateau, and enhances the accuracy and recall rate of detection.
Smart Images

Figure CN115909049B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and in particular to an improved method for target detection model of animal images in the Qinghai Plateau. Background Technology
[0002] Animal husbandry is a major economic source in Qinghai Province, and its development directly impacts the living standards of farmers and herders. Currently, Qinghai Province employs various animal husbandry management models, including individual household grazing, joint household grazing, and hired grazing. Manual management of livestock not only wastes time and human resources but also suffers from omissions in statistical and identification processes. Therefore, a livestock target detection system, using mechanized methods to monitor livestock activity, can effectively monitor livestock conditions. This not only reduces human and material resources but also minimizes safety risks for managers and inspectors, making animal husbandry management more modern and information-based in both methods and standards.
[0003] Due to its unique climate, Qinghai experiences significant differences in its natural environment throughout the four seasons. The coat color and body shape of livestock animals also vary with the seasons, differing from other regions or livestock breeding areas. Consequently, image target detection algorithms based on the YOLOv3 algorithm are not very accurate in terms of detection and cannot effectively classify and identify animals on the Qinghai Plateau. Improvements are urgently needed. Summary of the Invention
[0004] To address the shortcomings of the existing technologies, this invention proposes an improved F-YOLOV3-based target detection algorithm for animal images from the Qinghai Plateau.
[0005] The technical solution of this invention is implemented as follows:
[0006] An improved method for animal image target detection model in the Qinghai Plateau, based on the YOLOv3 model:
[0007] First, the k-means++ clustering algorithm is introduced to re-cluster the dataset and select ideal anchor values to improve the predicted bounding boxes;
[0008] Secondly, based on the three existing feature sizes of the YOLOV3 model: (13*13), (26*26), and (52*52), a feature scale of (104*104) is added;
[0009] Furthermore, the Non-Maximum Suppression (NMS) algorithm is improved.
[0010] Define f(x) = 1 - tanh(x) 2 / σ);
[0011] Among them, s i N represents the final score of the predicted bounding box, and IOU is the intersection-union ratio between the predicted bounding box and the detection box with the highest confidence. t For setting a predefined threshold;
[0012] Finally, KL-Loss is introduced to calculate the bounding box regression loss, and the calculation formula is as follows:
[0013]
[0014]
[0015] Furthermore, when introducing the k-means++ clustering algorithm, the two sets of values with the highest average occurrence rate are selected as anchor values after at least 20 iterations, and each set of values contains 9 anchor values.
[0016] Compared with existing technologies, this invention helps to significantly improve the detection accuracy of small targets and can meet the target detection needs of animal images in the Qinghai Plateau. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 To improve multi-scale prediction.
[0019] Figure 2 A diagram showing the added KL-Loss loss. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] This invention proposes an improved method for animal image target detection model in the Qinghai Plateau, based on the YOLOv3 model:
[0022] First, the k-means++ clustering algorithm is introduced to re-cluster the dataset and select ideal anchor values to improve the predicted bounding boxes;
[0023] After more than 20 repeated operations, the two sets of values with the highest average occurrence rate were finally selected as the anchor values for this experiment. The values are shown in Table 1, F (First) and S (Second).
[0024] Table 1
[0025]
[0026] The reason for choosing two sets of data is that the occurrence rate of the first set of values is 13 out of 20, and the occurrence rate of the second set of values is 7 out of 20. Therefore, both sets of values were used as anchor values for training. Finally, the performance of the two sets of values in the test was as follows: the F feature value improved by 1% on yak, the S feature value improved by 0.2% and 1% on yak and sheep respectively, and mAP improved by 0.3%. The test results are shown in Table 2.
[0027] Table 2
[0028] Eigenvalues yak(AP) sheep(AP) horse(AP) mAP Original eigenvalues 0.80199 0.89543 0.87918 0.85887 F eigenvalues 0.81298 0.88823 0.86310 0.85477 S eigenvalues 0.80372 0.90547 0.87619 0.86179
[0029] Secondly, a 104*104 feature scale is added to the existing three feature sizes of the YOLOV3 model;
[0030] To reduce false positives and false negatives for small targets, a 104*104 feature scale was added to the original three feature scales of the YOLOv3 model, increasing the number of feature scales to four. The sizes of the four feature scales are as follows: (13*13) is responsible for detecting large targets, and anchor values with relatively large values are assigned to this size; (26*26) is responsible for detecting medium-sized targets, and anchor values with corresponding medium-sized values are assigned to this size; (52*52) is responsible for detecting relatively small targets, and anchor values with relatively small values are assigned to this size. The newly added (104*104) feature scale will be responsible for small targets that were missed or falsely detected by the (52*52) feature scale, thus improving the multi-scale prediction. Figure 1 As shown.
[0031] After the improvement of the four multi-scale predictions, the original anchor values could no longer be applied to the improved feature scales. The four feature scales and nine anchor values could not be matched, so it was necessary to re-cluster the anchor box values. The k-means++ algorithm was used to re-cluster the data to obtain 12 sets of anchor box values. As the feature scale increased, the anchor box values also increased. The method of assigning feature scales and anchor box values and the number of assignments continued the idea of the original model. Smaller feature scales were assigned larger anchor box values, and each feature scale was assigned 3 anchor box values. After training with 12 sets of anchor values, the AP of the sheep class was improved by 0.87%. The anchor box values of the new clusters and the test results after training are shown in Tables 3 and 4.
[0032] Table 3
[0033]
[0034]
[0035] Table 4
[0036] Eigenvalues yak(AP) sheep(AP) horse(AP) mAP Original eigenvalues 0.80199 0.89543 0.87918 0.85887 L eigenvalues 0.797960 0.904123 0.855649 0.852577
[0037] Furthermore, the Non-Maximum Suppression (NMS) algorithm is improved.
[0038] Traditional NMS algorithms classify detection boxes based on their scores, selecting the detection box M with the highest confidence and suppressing all other detection boxes that significantly overlap with M (using a predefined threshold), i.e., reducing the scores of other detection boxes to 0 (as shown in the following formula), thereby achieving the unique attribute of a single target's detection box. Where s i N represents the final score of the predicted bounding box, and IOU is the intersection-union ratio between the predicted bounding box and the detection box with the highest confidence. t For the predefined threshold,
[0039]
[0040] However, during the experiment, it was found that when different targets of the same category overlap, the red and blue detection boxes are subjected to non-maximum suppression (NMS). Since the IOU value of the blue detection box is greater than the predefined threshold, the blue detection box will be suppressed and removed. This will cause some overlapping targets to be unrecallable, resulting in a decrease in the overall recall rate.
[0041] To address the aforementioned problems, the NMS algorithm is improved as follows:
[0042] Define f(x) = 1 - tanh(x) 2 / σ), where tanhx is a composite function of hyperbolic tangent and exponential function. Therefore, the whole function can be understood as an elementary function composed of constant function and exponential function. Using this function, smaller scores are provided for the suppressed detection boxes, as shown in the following formula. The suppressed detection boxes are retained with a certain probability, thereby improving the recall rate of overlapping targets.
[0043]
[0044] Finally, to make the distribution of the predicted bounding boxes closer to the distribution of the real objects, thereby further improving the detection accuracy, the KL divergence is used to calculate the bounding box regression loss for both the real objects and the predicted bounding boxes. The calculation formula is as follows:
[0045]
[0046]
[0047] KL-Loss simultaneously learns bounding box regression and localization uncertainty, defining the KL divergence between the predicted and true distributions. Using KL-Loss to train the model in YOLO-V3 allows it to perceive uncertainty in the dataset; during bounding box regression, it calculates a smaller loss from uncertain bounding boxes. An overall diagram illustrating the addition of KL-Loss is shown below. Figure 2 As shown.
[0048] The improved target detection model for animal images on the Qinghai Plateau, obtained through the above methods, can effectively improve the detection accuracy of small targets.
[0049] The above description is merely a preferred embodiment of the present invention. The directional terms such as "left" and "right" used are for ease of explanation of the structure of the present invention and are not intended to limit the invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention. Structures or connections not described in detail above utilize existing technology.
Claims
1. An improved method of Qinghai Plateau animal image target detection model, characterized in that: Based on the YOLOV3 model: Firstly, the k-means++ clustering algorithm is introduced to re-cluster the data set and select the ideal anchor value to improve the prediction box. Secondly, the (104*104) feature scale is added to the existing three feature sizes of the YOLOV3 model: (13*13), (26*26), and (52*52). Thirdly, the non-maximum suppression algorithm NMS is improved. define f(x) = 1 - tanh(x / σ) 2 / σ); wherein s i represents the final score of the prediction box, IOU is the intersection over union between the prediction box and the detection box with the largest confidence, N t is a predefined threshold set. Finally, the KL-Loss is introduced to calculate the bounding box regression loss, and the formula is:
2. The improved method of Qinghai plateau animal image target detection model according to claim 1, characterized in that: When the k-means++ clustering algorithm is introduced, at least 20 iterations are performed to select the two groups of values with the highest average occurrence rate as the anchor values, and each group contains 9 anchor values.
Citation Information
Patent Citations
Road multi-target detection method based on improved multistage YOLOv3
CN111401148A
Automatic driving target identification method based on improved Mask R-CNN
CN113111722A