Target detection confidence interval grade division method and system based on yolk algorithm
By introducing a confidence interval level division method in the yolo algorithm, the interval of the detection target is adjusted by using the equilibrium coefficient and standard deviation number z-score, the defect of using only confidence evaluation to identify the credibility of the results in the prior art is solved, and the credibility of the target detection results and the efficiency of data analysis are improved.
Patent Information
- Application Number
- CN202411903417.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, only the target confidence level is used as the credibility evaluation index for the identification result, and there is a situation where the identification result is incorrect, and when a large number of detection boxes appear, it is difficult for customers to distinguish the level of credibility.
The yolo algorithm-based object detection confidence interval level division method is used to predict the initial confidence through weights, divide the levels using dichotomy method, calculate the equilibrium coefficient and standard deviation number z-score, adjust the interval of the detection target, and realize the level division of the confidence interval.
The credibility of the prediction results is improved, and the impact of the imbalance number of categories on the weight effect is reduced through the adjustment of the equilibrium coefficient and the standard deviation number z-score, and the efficiency and accuracy of data analysis are improved.
Smart Images

Figure CN119832367A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing methods, and in particular to a method and system for classifying target detection confidence intervals based on a YOLO algorithm. Background Art
[0002] The YOLO algorithm occupies an important position in target detection applications, mainly due to its high efficiency, speed and relative accuracy. In existing algorithms, target confidence is generally used to indicate the credibility of the recognition result and the accuracy of the prediction box for the target position. However, in actual engineering applications, due to objective problems such as large differences between engineering data and training data and imbalanced training data of different categories, using confidence as the only indicator for evaluating the credibility of the recognition result has major defects. At the same time, when a large number of detection boxes appear on the same page, due to the lack of prompts, it is difficult for customers to distinguish in a short time which detection results are less reliable and need to be paid special attention to, and which detection results are more reliable and only need to be paid a little attention to. In the currently commonly used target detection result evaluation method, confidence is used as the only evaluation indicator. Due to the differences between engineering data and training data, it is often the case that the confidence is very high but the recognition result is wrong. At the same time, there is a lack of effective prompts for low-confidence detection results. Summary of the invention
[0003] The technical problem to be solved by the present invention is how to provide a method and system for classifying target detection confidence intervals based on the YOLO algorithm, which can improve the accuracy and efficiency of data analysis.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is: a method for classifying target detection confidence intervals based on the YOLO algorithm, comprising the following steps:
[0005] Use weights to directly predict the target, output the initial confidence, and use the dichotomy method to classify the initial confidence;
[0006] The equalization coefficient is calculated according to the number of categories in the training data set, and the adjusted confidence is obtained by multiplying the initial confidence by the equalization coefficient;
[0007] If the detection category of the yolov5 target detection algorithm is greater than 1, modify the network output layer of the yolov5 target detection algorithm to output the classification confidence of each detected target in all categories;
[0008] Calculate the standard deviation z-score of each detection target and determine the significance;
[0009] The target detection interval is adjusted according to the equalization coefficient and the standard deviation z-score, and the standard deviation z-scores of all detected targets are arranged in order from large to small. The target detection confidence interval is graded according to the sorting result.
[0010] The present invention also discloses a target detection confidence interval grading system based on the YOLO algorithm, comprising:
[0011] Initial confidence level classification module: used to directly predict the target using weights, output the initial confidence, and classify the initial confidence using the dichotomy method;
[0012] Confidence adjustment module: used to calculate the equalization coefficient according to the number of each category in the training data set, and multiply the initial confidence by the equalization coefficient to obtain the adjusted confidence;
[0013] Classification confidence calculation module: If the detection category of the yolov5 target detection algorithm is greater than 1, the network output layer of the yolov5 target detection algorithm is modified to output the classification confidence of each detected target in all categories;
[0014] Standard deviation calculation module: used to calculate the standard deviation z-score of each detection target and determine the significance;
[0015] The target detection confidence interval grading module is used to adjust the interval of the detection target according to the equalization coefficient and the standard deviation number z-score, arrange the standard deviation number z-score of all detection targets in order from large to small, and grade the target detection confidence interval according to the sorting result.
[0016] The beneficial effects of adopting the above technical solution are: the method realizes the significance correction of the prediction category results and improves the credibility of the prediction results. By analyzing the training set data and calculating the balance coefficient, the influence of the imbalance of the number of categories on the weight effect is effectively reduced. By using the dichotomy method to divide the test results into intervals, the efficiency and accuracy of data analysis are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0018] Figure 1 This is a flow chart of the level classification method according to an embodiment of the present invention;
[0019] Figure 2 is the confidence interval level division result when the number of categories is 1 in the embodiment of the present invention;
[0020] Figure 3is the confidence interval level division result when the number of categories is greater than 1 in the embodiment of the present invention;
[0021] Figure 4 It is a principle block diagram of the system described in the embodiment of the present invention. DETAILED DESCRIPTION
[0022] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0024] like Figure 1 As shown, an embodiment of the present invention discloses a method for classifying target detection confidence intervals based on the YOLO algorithm, and the method comprises the following steps:
[0025] Step 1: Use the weights to directly predict the target, output the initial confidence, and use the dichotomy method to grade the initial confidence into three intervals: green, yellow, and red. Green means high credibility and only needs slight attention; yellow means average credibility and needs moderate attention; red means low credibility and needs special attention.
[0026] The specific steps of dividing the confidence level interval by dichotomy are as follows:
[0027] Calculation method:
[0028] Test Tags:
[0029] ['setting','confidence','degree','area','time','design','calculation','method','form','test','test','flow','process','input','output','level','grade']
[0030] predict:
[0031] 1) Results
[0032] ['setting','trust','error','area','time','error','calculation','error','form','test','test','flow','error','input','output','level','grade']
[0033] 2) Confidence
[0034] ['0.91','0.92','0.7','0.88','0.99','0.92','0.66','0.95','0.59','0.87','0.94','0.91','0.89','0.82','0,92','0,92','0,95','0,91']
[0035] 3) Comparison between labels and prediction results
[0036] ['1','1','0','1','1','1','0','1','1','1','0','1','1','1','1','0','1','1','1','1','1']
[0037] Initial setting: The accuracy rate is above 95% for the green zone, the accuracy rate is between 85% and 95% for the yellow zone, and the accuracy rate is below 85% for the red zone.
[0038] Binary calculation interval
[0039] 1) First calculate the green level [x,1]x as the lower limit of confidence:
[0040] Let x be initially 0.5
[0041] Take out the part of the prediction confidence that is greater than 0.5
[0042] ['0.91','0.92','0.7','0.88','0.99','0.92','0.66','0.95','0.59','0.87','0.94','0.91','0.89','0.82','0,92','0,92','0,95','0,91']
[0043] ['1','1','0','1','1','1','0','1','1','1','0','1','1','1','1','0','1','1','1','1','1']
[0044] Calculate the accuracy rate by dividing the number of '1' by the total number = 14 / 18 = 0.77 < 0.95
[0045] Update x = (1 + 0.5) / 2 = 0.75
[0046] ['0.91','0.92','0.7','0.88','0.99','0.92','0.66','0.95','0.59','0.87','0.94','0.91','0.89','0.82','0,92','0,92','0,95','0,91']
[0047] ['1','1','0','1','1','1','0','1','1','1','0','1','1','1','1','0','1','1','1','1','1']
[0048] ['1','1',,'1','1','1',,'1','1','1','1','1','0','1','1','1','1','1']
[0049] Calculation accuracy 14 / 15 = 0.93 < 0.95
[0050] Update x = (1 + 0.75) = 2 = 0.875
[0051] ['0.91','0.92','0.7','0.88','0.99','0.92','0.66','0.95','0.59','0.87','0.94','0.91','0.89','0.82','0,92','0,92','0,95','0,91']
[0052] ['1','1','0','1','1','1','0','1','1','1','0','1','1','1','1','0','1','1','1','1','1']
[0053] ['1','1',,'1','1','1',,'1',,,'1','1','1','1',,'1','1','1','1','1']
[0054] Calculation accuracy 13 / 13=1>0.95
[0055] The lower limit of the green interval of the output level is 0.875, and the method for the yellow interval and the red interval is the same.
[0056] Step 2: Calculate the balancing coefficient based on the number of categories in the data set. Assume that there are N categories in the data set and the number of samples in each category i is count. i , the formula is:
[0057]
[0058] Among them, total_number is the total number of samples, and confidence is the confidence adjusted using the equalization coefficient.
[0059] The adjusted confidence is obtained by multiplying the initial confidence by the equalization coefficient.
[0060] Figure 2 is the confidence interval level division result when the number of categories is 1 in the embodiment of the present invention; Figure 3 : is the confidence interval level division result when the number of categories is greater than 1 in the embodiment of the present invention; (when there is only one category in the data set used to train the weight, that is, the weight can only detect one category, and the data set balance coefficient and z-score cannot be calculated. At this time, the confidence interval level division only uses the dichotomy method; when the number of categories is greater than 1, the data set balance coefficient and z-score are calculated to adjust the confidence, and then the adjusted confidence is divided into levels according to the dichotomy method, so Figure 2 and Figure 3 Two cases are shown).
[0061] Step 3, if the detection category is greater than 1, modify the network output layer to output the classification confidence of each detection target in all categories. In the yolo detection, the network will output the probability of all categories and take the one with the highest confidence. When the confidence of one category is significantly higher than that of other categories, this method is more credible, but when the confidence of several categories is close, the credibility of this method is not very high. The output results of the modified output layer are as follows:
[0062]
[0063] The first 7 columns are (xmin, ymin, xmax, ymax, confidence (confidence is the overall confidence, that is, the product of the object probability probability and the classification confidence confidence, which is also the default output confidence in yolo), class, the 6th column is the object probability obj_conf, and the 7-last column is the confidence of each of these nc categories)
[0064] Step 4: Calculate the standard deviation z-score of each detection target to determine significance. The specific process is as follows:
[0065] (1) Calculate the mean and standard deviation:
[0066] Mean:
[0067]
[0068] Standard Deviation:
[0069]
[0070] (2) Calculate z-score
[0071]
[0072] Step 5: Adjust the interval of the detection target according to the equalization coefficient and z-score. Arrange the z-scores of all detection targets in descending order. If the target is originally in the green confidence level and the z-score is in the bottom third, adjust its level to yellow; if the target is originally in the red confidence level and the z-score is in the top third, adjust its level to yellow; if the target is originally in the yellow confidence level and the z-score is in the top third, adjust its level to green.
[0073] like Figure 4 As shown, accordingly, the embodiment of the present invention also discloses a target detection confidence interval level classification system based on the YOLO algorithm, including: (in Figure 4 In the example, the initial confidence is obtained directly from the weighted prediction, and there is no separate module. According to the flowchart, the initial confidence should be obtained using the weighted prediction first, and then the equalization coefficient should be calculated to adjust the confidence. The adjusted confidence is used to divide the level interval using the dichotomy method, and then the z-score of each predicted target is calculated, and the level is adjusted according to the z-score).
[0074] Initial confidence level classification module: used to directly predict the target using weights, output the initial confidence, and classify the initial confidence using the dichotomy method;
[0075] Confidence adjustment module: used to calculate the equalization coefficient according to the number of each category in the data set, and multiply the initial confidence by the equalization coefficient to obtain the adjusted confidence;
[0076] Classification confidence calculation module: If the detection category of the YOLO algorithm is greater than 1, the network output layer of the YOLO algorithm is modified to output the classification confidence of each detection target in all categories;
[0077] Standard deviation calculation module: used to calculate the standard deviation z-score of each detection target and determine the significance;
[0078] The target detection confidence interval grading module is used to adjust the interval of the detection target according to the equalization coefficient and the standard deviation number z-score, arrange the standard deviation number z-score of all detection targets in order from large to small, and grade the target detection confidence interval according to the sorting result.
Claims
1. A target detection confidence interval classification method based on yolov5 target detection algorithm, characterized in that The steps include: Use weights to directly predict the target, output the initial confidence, and use the dichotomy method to classify the initial confidence; The equalization coefficient is calculated according to the number of categories in the training data set, and the adjusted confidence is obtained by multiplying the initial confidence by the equalization coefficient; If the detection category of the yolov5 target detection algorithm is greater than 1, modify the network output layer of the yolov5 target detection algorithm to output the classification confidence of each detected target in all categories; Calculate the standard deviation z-score of each detection target and determine the significance; The target detection interval is adjusted according to the equalization coefficient and the standard deviation z-score, and the standard deviation z-scores of all detected targets are arranged in order from large to small. The target detection confidence interval is graded according to the sorting result.
2. The target detection confidence interval classification method based on the YOLO algorithm as claimed in claim 1, characterized in that: When using the dichotomy method to rank the initial confidence, it is divided into three intervals: green, yellow and red. Green means high credibility, which only requires slight attention; yellow means average credibility, which requires moderate attention; and red means low credibility, which requires special attention.
3. The target detection confidence interval classification method based on the YOLO algorithm as claimed in claim 1, characterized in that: The calculation method of the equalization coefficient comprises the following steps: Suppose there are N categories in the data set, and the number of samples in each category i is count i , the formula is: Among them, total_number is the total number of samples, and confidence is the confidence adjusted using the equalization coefficient.
4. The target detection confidence interval classification method based on the YOLO algorithm as claimed in claim 1, characterized in that: The calculation method of the standard deviation z-score of the detection target includes the following steps: 1) Calculate the mean and standard deviation: Mean: Standard Deviation: 2) Calculate the z-score: In the above formula, n refers to the number of all categories, and x represents the classification confidence of the current prediction target in each category.
5. The target detection confidence interval classification method based on the YOLO algorithm as claimed in claim 1, characterized in that: Arrange the standard deviation z-scores of all detected targets in descending order. If the target was originally in the green confidence level and the z-score was in the bottom third, adjust its level to yellow; if the target was originally in the red confidence level and the z-score was in the top third, adjust its level to yellow; if the target was originally in the yellow confidence level and the z-score was in the top third, adjust its level to green.
6. A target detection confidence interval classification system based on the YOLO algorithm, characterized by include: Initial confidence level classification module: used to directly predict the target using weights, output the initial confidence, and classify the initial confidence using the dichotomy method; Confidence adjustment module: used to calculate the equalization coefficient according to the number of each category in the training data set, and multiply the initial confidence by the equalization coefficient to obtain the adjusted confidence; Classification confidence calculation module: If the detection category of the yolov5 target detection algorithm is greater than 1, the network output layer of the yolov5 target detection algorithm is modified to output the classification confidence of each detected target in all categories; Standard deviation calculation module: used to calculate the standard deviation z-score of each detection target and determine the significance; The target detection confidence interval grading module is used to adjust the interval of the detection target according to the equalization coefficient and the standard deviation number z-score, arrange the standard deviation number z-score of all detection targets in order from large to small, and grade the target detection confidence interval according to the sorting result.