Target recognition method based on YOLOX and classification regression loss

By classifying the regression loss function in YOLOX, and adjusting the loss value to increase the penalty for the detection box with poor regression effect, the problem of YOLOX detection accuracy upper limit is solved, and the detection accuracy and recall rate are improved.

CN115082735BActive Publication Date: 2024-11-19NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210722006.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-17
Publication Date
2024-11-19
Estimated Expiration
2042-06-17

AI Technical Summary

Technical Problem

When YOLOX handles certain detection tasks, the detection accuracy limit is high, making it difficult to effectively improve.

Method used

By classifying the regression loss function in YOLOX, liou=-log(iou) is used when iou is small and liou=1-iou2 is large, the loss function is adjusted to increase the loss of the detection box with poor regression effect. Values ​​prompt the model to focus more on learning difficult samples.

Benefits of technology

It improves the accuracy of the target detection task, especially reduces the missed detection phenomenon, and improves the detection accuracy and recall rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082735B_ABST
    Figure CN115082735B_ABST
Patent Text Reader

Abstract

The present invention discloses a target recognition method based on YOLOX and classification regression loss, S1, obtaining relevant high-quality images of the target to be detected; S2, marking the target in the high-quality image; S3, dividing the data set into a training data set and a verification data set; S4, classifying the regression loss function in the loss function to obtain the final loss function; S5, applying the final loss function to the YOLOX target detection algorithm; S6, inputting the training data set into the target detection algorithm for training; S7, after reaching the preset number of training times, taking the last 3 models of the training and analyzing them on the test data set to obtain the optimal target detection algorithm model; S8, using the optimal target detection algorithm model to identify the image to be detected. The present invention can increase the loss value of the detection frame with poor regression effect, so that the model pays more attention to the samples with poor regression effect, thereby improving the accuracy of the target detection task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image recognition, and relates to an image recognition method, and specifically to a target recognition method based on YOLOX and classification regression loss. Background Art

[0002] Object detection is one of the key issues in computer vision research and an important basis for understanding high-level semantic information of images. The main task of object detection is to locate the object of interest and give category information based on the input image.

[0003] With the vigorous development of deep learning and artificial intelligence technology, applying deep learning technology to the field of image processing has become a trend in contemporary scientific computer technology. The development of deep learning has promoted the progress of target detection technology. Single-stage target detection algorithms represented by the YOLO series have begun to be widely used in intelligent video surveillance, industrial detection and other fields because of their fast detection speed and good detection accuracy, reducing the consumption of human capital through computer vision. It has extremely important practical significance.

[0004] YOLOX is the latest product in the YOLO series of algorithms. Although it has higher detection accuracy than the previous YOLO series of algorithms, its upper limit of accuracy is still not high when processing certain detection tasks. Summary of the invention

[0005] The present invention aims to optimize the regression loss function and improve its detection accuracy. Specifically, a target recognition method based on YOLOX and classification regression loss is provided, comprising the following steps: S1, obtaining relevant high-quality images of the target to be detected;

[0006] S2, mark the objects in the high-quality images to form a VOC data set;

[0007] S3, divide the data set into a training data set and a validation data set;

[0008] S4, classify the regression loss function in the loss function to obtain the final loss function;

[0009] S5. Apply the final loss function to the YOLOX target detection algorithm;

[0010] S6, inputting the training data set into the target detection algorithm for training;

[0011] S7, after reaching the preset number of training times, take the last three models of training and analyze them on the test data set to obtain the optimal target detection algorithm model;

[0012] S8. Use the optimal target detection algorithm model to identify the image to be detected.

[0013] Furthermore, in S4, the regression loss function is classified according to the following:

[0014] The loss function formula in YOLOX is: Loss = l cls +l iou +l conf (1),

[0015] Among them, l cls is the classification loss, l iou is the regression loss, l conf is the confidence loss.

[0016] Furthermore, the regression loss is calculated as:

[0017] When iou is small, use the regression function formula: l iou = -log(iou) (4);

[0018] When the iou is large, use the regression function formula:

[0019] l iou =1-iou 2 (2);

[0020] iou is the intersection area between the predicted box and the true box divided by the union area, calculated as:

[0021]

[0022] Furthermore, the regression loss function is classified and the specific classification process is as follows:

[0023] S41, find l iou = -log(iou) and 1-iou 2 The horizontal coordinate of the intersection point is iou k ;

[0024] S42, when the value of iou is less than iou k When the regression loss function is l iou =-log(iou), when the value of iou is greater than or equal to iou k When the regression loss function is l iou =1-iou 2 ;

[0025] S43. Obtain the final regression loss function and apply it to the algorithm model.

[0026] Furthermore, the specific method to obtain the optimal target detection algorithm model is as follows:

[0027] S61, performing detection and analysis on the last three algorithm models after training on the test set;

[0028] S62, calculating the precision Press and the recall Recall;

[0029] S63, calculating the AP value of each category;

[0030] S64, calculating the mAP values ​​of all categories;

[0031] S65. Compare the mAP values ​​of the three models, and select the model corresponding to the maximum mAP value as the optimal target detection algorithm model.

[0032] Furthermore, the specific formula for calculating the precision Press and the recall Recall in S62 is as follows:

[0033]

[0034]

[0035] TP is the number of correctly predicted positive samples, FP is the number of incorrectly predicted positive samples, FN is the number of incorrectly predicted negative samples, and the detection threshold, Iou, is set to 0.5. When the overlapping area between the detection box and the true box exceeds 50%, the detection box is considered correct.

[0036] Furthermore, in S63, AP is the area of ​​the curve enclosed by different precision and recall rates, and the calculation formula is as follows:

[0037]

[0038] Furthermore, the formula for calculating the mAP value of all categories in S64 is as follows:

[0039]

[0040] n is the number of categories.

[0041] A computer-readable storage medium, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned target recognition method based on YOLOX and classification regression loss.

[0042] The beneficial effect of the present invention is that the present invention can increase the loss value of the detection frame with poor regression effect, so that the model pays more attention to the samples with poor regression effect, thereby improving the accuracy of the target detection task. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1It is a flow chart of the present invention;

[0044] Figure 2 Schematic diagram of regression loss value of the present invention;

[0045] Figure 3 is a schematic diagram of Example 1 of the present invention without applying regression loss;

[0046] Figure 4 is a schematic diagram of the application of regression loss in Example 1 of the present invention;

[0047] Figure 5 This is a schematic diagram of Example 2 of the present invention where no regression loss is applied;

[0048] Figure 6 This is a schematic diagram of the application of regression loss in Example 2 of the present invention;

[0049] In Example 1, insulator represents an insulator, damaged represents damage, and in Example 2, Gun represents a gun, and Knife represents a knife. It can be seen from Examples 1 and 2 that after applying the classification regression loss function, the problem of missed detection of the target can be solved well, thereby improving the detection accuracy of the target. DETAILED DESCRIPTION

[0050] The specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings.

[0051] like Figure 1 A target detection method based on YOLOX and classification regression loss is shown, and the method comprises the following steps:

[0052] S1. Obtain relevant high-quality images of the target to be detected;

[0053] S2, mark the objects in the high-quality images to form a VOC data set;

[0054] S3, divide the data set into a training data set and a validation data set;

[0055] S4, classify the regression loss function in the loss function to obtain the final loss function;

[0056] S5. Apply the final loss function to the YOLOX target detection algorithm;

[0057] S6, inputting the training data set into the target detection algorithm for training;

[0058] S7, after reaching the preset number of training times, take the last three models of training and analyze them on the test data set to obtain the optimal target detection algorithm model;

[0059] S8. Use the optimal target detection algorithm model to identify the image to be detected.

[0060] In S4, the regression loss function is classified according to the following criteria:

[0061] The loss function formula in YOLOX is: Loss = l cls +l iou +l conf (1),

[0062] Among them, l cls is the classification loss, l iou is the regression loss, l conf is the confidence loss, where the regression loss is calculated as: iou =1-iou 2 (2).

[0063] iou is the intersection area between the predicted box and the true box divided by the union area, calculated as:

[0064]

[0065] When the iou is large, it means that the regression effect of the prediction box is good, otherwise the regression effect of the prediction box is poor. In order to further improve the regression effect of the model, the present invention proposes the idea of ​​classifying and processing samples with different iou. When the iou is small, the regression function formula is used: iou =-log(iou)(4) for processing, -log(iou) is used for iou when it is small, compared with 1-iou 2 , can give a larger loss value, increase the algorithm's penalty for detection boxes with poor regression effects, and make the algorithm model pay more attention to samples that are difficult to learn, thereby improving the detection accuracy of the algorithm model. When the iou is large, that is, when the regression effect of the prediction box is good, the loss value is 1-iou. 2 The calculated loss value is slightly larger than the loss value calculated by -log(iou), which is conducive to further optimization of the detection frame with better regression effect. At the same time, because there is a certain size gap between the loss value of the detection frame with better regression effect and the loss value of the detection frame with poor regression effect, this will not shift the focus of the neural network from those detection frames with poor regression effect to those with better detection frames.

[0066] The regression loss function is classified and the specific classification process is as follows:

[0067] S41, find l iou = -log(iou) and 1-iou 2 The horizontal coordinate of the intersection point is iou k ;

[0068] S42, when the value of iou is less than iou k When the regression loss function is l iou =-log(iou), when the value of iou is greater than or equal to iou k When the regression loss function is l iou =1-iou 2 ;

[0069] S43, obtain the final regression loss function (the regression loss value in the method provided by the present invention and the loss value in the conventional method are as follows Figure 2 and applied in the algorithm model.

[0070] The specific approach to obtain the optimal target detection algorithm model is:

[0071] S61, performing detection and analysis on the last three algorithm models after training on the test set;

[0072] S62. Calculate the precision Press and recall Recall. The specific formula is as follows:

[0073]

[0074]

[0075] TP is the number of correctly predicted positive samples, FP is the number of incorrectly predicted positive samples, FN is the number of incorrectly predicted negative samples, and the detection threshold, Iou, is set to 0.5. When the overlapping area between the detection box and the true box exceeds 50%, the detection box is considered correct.

[0076] S63. Calculate the AP value of each category. AP is the area of ​​the curve enclosed by different precision and recall rates. The calculation formula is as follows:

[0077]

[0078] S64. Calculate the mAP value of all categories, where n is the number of categories.

[0079]

[0080] S65. Compare the mAP values ​​of the three models, and select the model corresponding to the maximum mAP value as the optimal target detection algorithm model.

[0081] Embodiment 1, as Figure 3 and 4 As shown, it is applied to the key components of transmission lines and their defect detection.

[0082] For the key components and defects detection of power transmission lines, the detection results with and without the application of classification regression loss function are shown in the figure. It can be seen that after applying the classification regression loss function, the phenomenon of missed detection of the target can be well solved, thereby improving the detection accuracy of the target.

[0083] Embodiment 2, as Figure 5 and 6 As shown, it is applied to X-ray based contraband image detection.

[0084] For X-ray-based contraband image detection, the detection results with and without the application of the classification regression loss function are shown in the figure. It can be seen that after applying the classification regression loss function, the phenomenon of missed detection of the target can be well solved, thereby improving the detection accuracy of the target.

[0085] In summary, the present invention provides a target detection method based on YOLOX and classification regression loss, which can increase the loss value of the detection frame with poor regression effect, increase the penalty intensity of the detection frame with poor regression effect, make the model pay more attention to samples with poor regression effect, and improve its detection accuracy.

[0086] The above embodiments are only for illustrating the technical idea of ​​the present invention, and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the present invention.

Claims

1. A target recognition method based on YOLOX and classification regression loss, characterized in that: The method comprises the following steps: S1. Obtain relevant high-quality images of the target to be detected; S2, mark the objects in the high-quality images to form a VOC data set; S3, divide the data set into a training data set and a validation data set; S4, classify the regression loss function in the loss function to obtain the final loss function; S5. Apply the final loss function to the YOLOX target detection algorithm; S6, inputting the training data set into the target detection algorithm for training; S7, after reaching the preset number of training times, take the last three models of training and analyze them on the test data set to obtain the optimal target detection algorithm model; S8, using the optimal target detection algorithm model to identify the image to be detected; In S4, the regression loss function is classified according to the following criteria: The loss function formula in YOLOX is: Loss = l cls +l iou +l conf (1), Among them, l cls is the classification loss, l iou is the regression loss, l conf is the confidence loss; The regression loss is calculated as: When iou is small, use the regression function formula: l iou = -log(iou) (4); When the iou is large, use the regression function formula: L iou =1-iou 2 (2); iou is the intersection area between the predicted box and the true box divided by the union area, calculated as: The regression loss function is classified and the specific classification process is as follows: S41, find l iou = -log(iou) and 1-iou 2 The horizontal coordinate of the intersection point is iou k ; S42, when the value of iou is less than iou k When the regression loss function is l iou =-log(iou), when the value of iou is greater than or equal to iou k When the regression loss function is l iou =1-iou 2 ; S43. Obtain the final regression loss function and apply it to the algorithm model.

2. The target recognition method based on YOLOX and classification regression loss according to claim 1 is characterized in that: The specific approach to obtain the optimal target detection algorithm model is: S61, performing detection and analysis on the last three algorithm models after training on the test set; S62, calculating the precision Press and the recall Recall; S63, calculating the AP value of each category; S64, calculating the mAP values ​​of all categories; S65. Compare the mAP values ​​of the three models, and select the model corresponding to the maximum mAP value as the optimal target detection algorithm model.

3. The target recognition method based on YOLOX and classification regression loss according to claim 2 is characterized in that: The specific formula for calculating precision Press and recall Recall in S62 is as follows: TP is the number of correctly predicted positive samples, FP is the number of incorrectly predicted positive samples, FN is the number of incorrectly predicted negative samples, and the detection threshold, Iou, is set to 0.

5. When the overlapping area between the detection box and the true box exceeds 50%, the detection box is considered correct.

4. The target recognition method based on YOLOX and classification regression loss according to claim 3 is characterized in that: In S63, AP is the area of ​​the curve enclosed by different precision and recall rates, and the calculation formula is as follows:

5. The target recognition method based on YOLOX and classification regression loss according to claim 4 is characterized in that: The formula for calculating the mAP value of all categories in S64 is as follows: n is the number of categories.

6. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the target recognition method based on YOLOX and classification regression loss as described in any one of claims 1-5.