Object detection optimization method, system, device and storage medium based on deep learning
By introducing a dual-branch parallel sample matching algorithm and actual loss function optimization in the object detection algorithm, the problem of insufficient target detection accuracy and computational resource consumption in the existing technology is solved, and efficient and robust object detection effect is achieved.
Patent Information
- Application Number
- CN202411648967.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-11-19
AI Technical Summary
The existing object detection algorithms have shortcomings in detection accuracy and computing resource consumption, especially in complex scenarios, and lack of generalization ability and robustness, and at the same time, there is a lack of unified and efficient positive and negative sample matching methods.
The object detection optimization method based on deep learning is adopted, and the training sample set is matched positively and negatively by double-branch parallel sample matching algorithm. Combined with one-to-many and one-to-one positive and negative sample matching algorithms, the actual loss function of the object detection model is constructed, and the model parameters are optimized by verifying the sample set.
It significantly improves the detection accuracy and efficiency of object detection, reduces computing resource consumption, enhances the generalization ability and robustness of the model, and simplifies the model training and deployment process.
Smart Images

Figure CN119152323B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and specifically relates to a target detection optimization method, system, device and storage medium based on deep learning. Background Art
[0002] In the field of computer vision, object detection, as a basic and key technology, is widely used in many fields such as autonomous driving, video surveillance, and medical image analysis. Although traditional object detection algorithms, such as the RCNN series and the YOLO series, have made significant progress in detection accuracy and speed, they still face some challenges.
[0003] First, existing target detection algorithms usually require a series of complex post-processing steps after detection, such as non-maximum suppression (NMS), to remove redundant detection results and optimize the position of the bounding box. These post-processing steps not only increase the complexity and computational cost of the algorithm, but may also introduce additional errors and affect the detection accuracy. Secondly, target detection tasks in different scenarios place higher demands on the generalization ability and robustness of the algorithm. For example, in autonomous driving, target detection algorithms need to be able to cope with complex and changing road environments, vehicles and pedestrians of different scales, as well as challenges such as illumination and occlusion. However, existing target detection algorithms often find it difficult to maintain stable detection performance when facing these complex scenarios. In addition, with the continuous development of deep learning technology, various target detection network architectures have emerged. However, different network architectures handle positive and negative samples differently, and there is a lack of a unified and efficient positive and negative sample matching method to adapt to these different network architectures. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a target detection optimization method, system, device and storage medium based on deep learning, which simplifies the algorithm post-processing process during target detection, can improve the speed of target detection while ensuring the accuracy of target detection, and effectively reduce the consumption of computing resources required for target detection.
[0005] The present invention provides the following technical solutions:
[0006] In a first aspect, a method for optimizing target detection based on deep learning is provided, comprising the following steps:
[0007] Acquire an image sample data set; the image sample data set includes a training sample set and a verification sample set;
[0008] The target detection model is trained. During the training, a dual-branch parallel sample matching algorithm is used to match positive and negative samples of the training sample set, and an actual loss function of the target detection model is constructed according to the loss of the positive and negative sample matching and the original loss of the target detection model; based on the constructed actual loss function, the parameters of the target detection model are iteratively optimized through the verification sample set until the target detection model meets the preset optimization conditions; the dual-branch parallel sample matching algorithm includes: a parallel one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner and a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm;
[0009] The trained target detection model is used to detect the target, and during the detection, only the one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used for positive and negative sample matching.
[0010] Optionally, the dual-branch parallel sample matching algorithm is used to match positive and negative samples on the training sample set, including using a one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner to match positive and negative samples on the training sample set, and the process is as follows:
[0011] The target detection model is used to predict the input image and generate a prediction box, and the category score S corresponding to the prediction box in all preset category scores is obtained;
[0012] Get the IOU value between each real box and each predicted box;
[0013] Based on the obtained IOU value and category score S, obtain the alignment of each real box with all predicted boxes;
[0014] According to the alignment degree between each true box and all predicted boxes, the topK predicted boxes are selected as candidate positive samples of the true box, and the predicted boxes in the training sample set except all candidate positive samples are negative samples;
[0015] If a predicted box corresponds to multiple candidate positive samples of the real box, the IOU value between the predicted box and each real box is compared, and the real box corresponding to the maximum IOU value is selected to correspond to the predicted box, and the predicted box is filtered out from the candidate positive samples of the remaining real boxes to obtain the final positive sample.
[0016] Optionally, the alignment of the predicted box with the true box for:
[0017]
[0018] in, is the IOU value between the real box and the predicted box, is the weight of the category score S, is the weight of U.
[0019] Optionally, the dual-branch parallel sample matching algorithm is used to match positive and negative samples on the training sample set, including a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm, and the positive and negative samples on the training sample set are matched in the following process:
[0020] The object detection model predicts the input image and generates candidate boxes and predicted boxes;
[0021] Take all candidate boxes and predicted boxes as a detection box set, and obtain the cost matrix between each real box and each detection box in the detection box set;
[0022] Take all the cost matrices as input, and use the Hungarian matching algorithm to find the detection box with the minimum cost for each real box.
[0023] All the detection boxes with the smallest cost found are regarded as positive samples, and all the detection boxes except all the positive samples in the training sample set are negative samples.
[0024] Optionally, when the target detection model predicts the input image and generates candidate boxes and predicted boxes, if the trained target detection model relies on anchor base to achieve detection, the corresponding candidate boxes are generated according to the width and height of the preset anchor boxes; if the trained target detection model relies on anchor free to achieve detection, the candidate boxes with a set stride are generated according to each anchor point.
[0025] Optionally, the cost matrix of the ground truth box and the detection box for:
[0026]
[0027] in, For the prediction box belong The probability of the class, is the indicator function of the category cost, is the indicator function of the position cost, For real frame With prediction box The position cost matrix between ;
[0028]
[0029] in, For real frame With prediction box The IOU loss between is the weight of IOU loss, For real frame With prediction box The L1 norm between is the weight of the L1 norm;
[0030] For each real frame, the expression of finding the detection frame with the minimum cost corresponding to it using the Hungarian matching algorithm is:
[0031]
[0032] in, is the current real frame The best matching result, N is the set of detection boxes, It is the matching result set between the current real box and all predicted boxes.
[0033] Optionally, constructing an actual loss function of the target detection model according to the loss of positive and negative sample matching and the original loss of the target detection model includes:
[0034] The positive sample set obtained by matching the one-to-many positive and negative sample matching algorithm is recorded as M, and the positive sample set obtained by matching the one-to-one positive and negative sample matching algorithm is recorded as O;
[0035] For each real box, the set M and the set O are grouped and recorded as and ,in, and are the positive sample sets obtained by matching the one-to-many positive and negative sample matching algorithm corresponding to the i-th and n-th real frames, respectively. and The positive samples corresponding to the i-th and n-th real frames are obtained by matching using the one-to-one positive and negative sample matching algorithm;
[0036] For each real box, calculate its corresponding as well as The CIOU loss between them is calculated as the loss for matching positive and negative samples.
[0037] The loss of positive and negative sample matching and the original loss of the target detection model are combined to form the actual loss function of the target detection model;
[0038] The actual loss function of the object detection model for:
[0039]
[0040]
[0041] in, is the loss of positive and negative sample matching, is the original loss function of the target detection model, is the interaction ratio between the predicted box and the true box, for The positive samples in for The positive samples in is the Euclidean distance between the center points of two positive samples, To fully wrap and The diagonal length of the minimum circumscribed rectangle of ; is the weight function, is the aspect ratio similarity term, Positive sample The width of Positive sample Height, Positive sample The width of Positive sample height.
[0042] In a second aspect, a target detection optimization system based on deep learning is provided, comprising:
[0043] A sample acquisition module is used to acquire an image sample data set; the image sample data set includes a training sample set and a verification sample set;
[0044] A training module is used to train the target detection model. During training, a dual-branch parallel sample matching algorithm is used to match positive and negative samples of the training sample set, and an actual loss function of the target detection model is constructed according to the loss of the positive and negative sample matching and the original loss of the target detection model; based on the constructed actual loss function, the parameters of the target detection model are iteratively optimized through the verification sample set until the target detection model meets the preset optimization conditions; the dual-branch parallel sample matching algorithm includes: a parallel one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner and a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm;
[0045] The target detection module is used to detect the target using the trained target detection model. During the detection, only the one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used for positive and negative sample matching.
[0046] In a third aspect, a computer device is provided, comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the steps of the deep learning-based target detection optimization method described in any one of the first aspects are implemented.
[0047] In a fourth aspect, a computer-readable storage medium is provided for storing a computer program; when the computer program is executed by a processor, the steps of the deep learning-based target detection optimization method described in any one of the first aspects are implemented.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] (1) The present invention significantly improves the detection accuracy and efficiency of target detection. By introducing an innovative dual-channel matching mechanism, one-to-many and one-to-one positive and negative sample matching, the present invention effectively reduces false detection and missed detection while ensuring high accuracy. The one-to-many branch can capture the complex relationship between the target and its corresponding multiple prediction frames, while the one-to-one branch ensures that each target is matched with only one optimal detection frame. The two complement each other and jointly improve the detection accuracy. In addition, since complex post-processing steps such as non-maximum suppression are omitted, the overall execution efficiency of the algorithm is significantly improved, making real-time target detection possible.
[0050] (2) The target detection model trained by the present invention has strong generalization ability and high robustness. When matching positive and negative samples, the present invention does not rely on a specific target detection network architecture and can be seamlessly integrated into various existing target detection models, showing strong generalization ability. At the same time, by introducing the difference loss calculation to optimize the learning process of the two matching branches, the algorithm can better adapt to complex changes in different scenarios, including target occlusion, scale changes, illumination changes, etc., thereby enhancing robustness.
[0051] (3) The present invention can simplify the model training and deployment process. The end-to-end design of the present invention does not require subsequent steps such as non-maximum suppression and bounding box regression of traditional target detection algorithms, which greatly simplifies the model training and deployment process. This not only lowers the threshold for the application of the present invention, but also improves the flexibility and ease of use of the present invention in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a step flow chart of the target detection optimization method based on deep learning of the present invention.
[0053] Figure 2 It is a schematic diagram of the training process of the target detection optimization method based on deep learning of the present invention.
[0054] Figure 3It is a schematic diagram of the reasoning flow of the target detection optimization method based on deep learning of the present invention.
[0055] Figure 4 This is a sample diagram of matching results using the one-to-many positive and negative sample matching algorithm of the present invention.
[0056] Figure 5 This is a sample diagram of matching results using the one-to-one positive and negative sample matching algorithm of the present invention.
[0057] Figure 6 It is a schematic diagram of the calculation formula of IOU.
[0058] Figure 7 This is a schematic diagram of the CIOU calculation principle. DETAILED DESCRIPTION
[0059] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0060] It should be noted that the term "comprises" and any variations of the term in the specification and claims of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products or apparatus.
[0061] Example 1
[0062] like Figure 1 As shown, a target detection optimization method based on deep learning is provided, comprising the following steps (step S1-step S3):
[0063] Step S1: Acquire an image sample data set, where the image sample data set includes a training sample set and a verification sample set.
[0064] The image sample dataset needs to be formatted according to the trained object detection model.
[0065] The trained target detection model can be any target detection model in the RCNN series or the YOLO series.
[0066] As an option, the trained target detection model may be YOLOv8, so that the image sample dataset is adjusted to the format required by YOLOv8. The specific method of adjusting the image sample dataset may refer to the prior art.
[0067] Step S2: Train the target detection model.
[0068] like Figure 2 As shown, Figure 2 and Figure 3 The Regression in it is the bounding box coordinate information of the prediction box; Classification is the score of the prediction box belonging to each category, PAN (Path Aggregation Network) is the path aggregation network; Backbone is the backbone network, One-to-many Head is the One-to-many prediction head, and One-to-oneHead is the One-to-one prediction head.
[0069] Step S2 specifically includes the following sub-steps (step S2.1-step S2.3):
[0070] Step S2.1: During training, a dual-branch parallel sample matching algorithm is used to match positive and negative samples in the training sample set.
[0071] The dual-branch parallel sample matching algorithm includes: a parallel one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner and a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm.
[0072] TaskAlignedAssigner is a strategy for sample allocation in target detection tasks. TaskAlignedAssigner can refer to the existing technology.
[0073] Specifically, a one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner is used to match positive and negative samples on the training sample set, further including the following sub-steps (step S2.1.1-step S2.1.5):
[0074] Step S2.1.1: Generate a prediction box for the input image through the target detection model, and obtain the category score S corresponding to the prediction box in all preset category scores.
[0075] The trained target detection model predicts and generates a prediction box for the input image, as well as a category score S of the prediction box among all preset category scores. The prediction box includes coordinate information of a bounding box to determine the position and size of the target object in the image.
[0076] Step S2.1.2: Get the IOU value between each real box gt bbox and each predicted box pred bbox.
[0077] like Figure 6As shown, the IOU value between the real box and the predicted box can be obtained according to the existing technology. Specifically, the intersection area and the union area between the real box and the predicted box are calculated, and the IOU value is the ratio of the intersection area area to the union area area.
[0078] Step S2.1.3: Based on the obtained IOU value and category score S, obtain the alignment of each true box with all predicted boxes.
[0079] Alignment between the predicted box and the true box for:
[0080]
[0081] in, is the IOU value between the real box and the predicted box, is the weight of the category score S, is the weight of U.
[0082] Step S2.1.4: According to the alignment degree between each true box and all predicted boxes, select the topK predicted boxes as candidate positive samples of the true box, and the predicted boxes in the training sample set except all candidate positive samples are negative samples.
[0083] Usually the first 10 anchors / anchor points are selected as candidate positive samples of the real box, and the matching results are as follows: Figure 4 As shown, of course, the number of K can also be adjusted according to actual needs; more positive samples mean that multiple true values close to the target can be predicted at the same time, and then the best one can be selected from them to achieve higher accuracy.
[0084] Step S2.1.5: If a predicted box corresponds to multiple candidate positive samples of the real box, compare the IOU value of the predicted box with each real box, select the real box corresponding to the largest IOU value to correspond to the predicted box, and filter the predicted box from the candidate positive samples of the remaining real boxes to obtain the final positive sample.
[0085] A one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used to match positive and negative samples of the training sample set, further including the following sub-steps (step S2.1.6-step S2.1.9):
[0086] Step S2.1.6: The object detection model predicts the input image and generates candidate boxes (anchors) and prediction boxes.
[0087] Specifically, if the trained target detection model relies on anchor base to achieve detection, the corresponding candidate box is generated according to the preset width and height of the anchor box; if the trained target detection model relies on anchor free to achieve detection, a candidate box with a set stride is generated according to each anchor point; the trained target detection model can refer to the existing technology in the way that the prediction box is generated by predicting the input image.
[0088] As a specific example, for the anchor free target detection algorithm, an anchor with stride = 5 is generated according to each anchor point.
[0089] Step S2.1.7: Take all candidate boxes and predicted boxes as a detection box set, and obtain the cost matrix between each real box and each detection box in the detection box set.
[0090] Specifically, calculate the category cost matrix of the real box and the detection box :
[0091]
[0092] in, For the prediction box belong Probability of the class; is the indicator function of the category cost, indicating that only when the category of the real box The category cost is calculated only when it is not empty, otherwise it is -1.
[0093] Calculate the ground truth box With prediction box The position cost matrix between for;
[0094]
[0095] in, For real frame With prediction box The IOU loss between is the weight of IOU loss, For real frame With prediction box The L1 norm between is the weight of the L1 norm.
[0096] Cost matrix between the true box and the detection box for:
[0097]
[0098] in, is the indicator function of the position cost, indicating that only when the category of the real box The position cost is calculated only when it is not empty, otherwise it is 1.
[0099] Step S2.1.8: Take all cost matrices as input, and for each real box, use the Hungarian matching algorithm to find the corresponding detection box with the minimum cost.
[0100] The Hungarian matching algorithm can find the best matching mapping between the real box and the detection box, that is, each real box corresponds to a detection box, and the cost between the two is minimal.
[0101] The specific steps of the Hungarian matching algorithm can refer to the prior art.
[0102] For each real frame, the expression of finding the detection frame with the minimum cost corresponding to it using the Hungarian matching algorithm is:
[0103]
[0104] in, is the current real frame The best matching result, N is the set of detection boxes, It is the matching result set between the current real box and all predicted boxes.
[0105] The one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm can match only one positive sample to each positive sample, thus eliminating the need for tedious post-processing. The matching results are as follows: Figure 5 shown.
[0106] Step S2.1.9: All the detection boxes with the lowest cost found are regarded as positive samples, and all the detection boxes except all the positive samples in the training sample set are negative samples.
[0107] Step S2.2: Construct the actual loss function of the target detection model based on the loss of positive and negative sample matching and the original loss of the target detection model.
[0108] Step S2.2 further includes the following sub-steps (step S2.2.1-step S2.2.4):
[0109] Step S2.2.1: The positive sample set obtained by matching the one-to-many positive and negative sample matching algorithm is recorded as M, and the positive sample set obtained by matching the one-to-one positive and negative sample matching algorithm is recorded as O.
[0110] Step S2.2.2: For each ground-truth box, group the set M and the set O into groups, denoted as and .
[0111] and are the positive sample sets obtained by matching the one-to-many positive and negative sample matching algorithm corresponding to the i-th and n-th real frames, respectively. and are the positive samples obtained by matching the one-to-one positive and negative sample matching algorithm corresponding to the i-th and n-th real boxes respectively; the number of positive samples matched by the one-to-one positive and negative sample matching algorithm is the same as the number of real boxes; the number of positive samples matched by the one-to-many positive and negative sample matching algorithm is the product of the number of real boxes and topK, where n is the number of real boxes, that is The number of candidate positive samples is topK.
[0112] Step S2.2.3: For each real box, calculate its corresponding as well as The CIOU loss between them is used, and the calculated CIOU loss is used as the loss for positive and negative sample matching.
[0113] Specifically, the present invention designs a loss metric to make a positive sample obtained by one-to-one matching infinitely close to the best one among many positive samples in one-to-many matching, so that the advantages of both can be combined at the same time.
[0114] like Figure 7 As shown, the loss of positive and negative sample matching for:
[0115]
[0116] in, is the interaction ratio between the predicted box and the true box, for The positive samples in for The positive samples in is the Euclidean distance between the center points of two positive samples, To fully wrap and The diagonal length of the minimum circumscribed rectangle of ; is the weight function, is the aspect ratio similarity term, Positive sample The width of Positive sample Height, Positive sample The width of Positive sample height.
[0117] Step S2.2.4: Combine the loss of positive and negative sample matching and the original loss of the target detection model to form the actual loss function of the target detection model.
[0118] The actual loss function of the object detection model for:
[0119]
[0120] in, is the loss of positive and negative sample matching, is the original loss function of the target detection model. The original loss function of the target detection model can be determined according to the prior art.
[0121] Step S2.3: Based on the constructed actual loss function, the parameters of the target detection model are iteratively optimized through the verification sample set until the target detection model meets the preset optimization conditions.
[0122] The target detection model gradually optimizes its parameters by continuously iteratively performing forward propagation and back propagation processes to generate the final model with the best performance and complete the training process.
[0123] S3: Detect the target using the trained target detection model. When performing target detection, only the one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used for positive and negative sample matching.
[0124] Specifically, when the model is trained and reasoned, the one-to-many branch is removed and only the one-to-one branch is retained. In this way, not only high accuracy is obtained after model reasoning, but also only one prediction result is obtained for each target, thereby eliminating the tedious post-processing process and simplifying the model deployment process.
[0125] like Figure 3As shown, the present invention proposes a dual-channel positive and negative sample matching algorithm that combines one-to-many and one-to-one matching mechanisms, which effectively improves the accuracy of target detection; secondly, the present invention realizes end-to-end detection without post-processing such as NMS: through the strategy of dual-branch training and single-branch reasoning, accurate target detection is achieved without the need for complex post-processing steps such as non-maximum suppression (NMS), which significantly improves the detection efficiency; in addition, the present invention enhances the generalization ability and robustness of the algorithm. Specifically, the present invention can be seamlessly integrated into a variety of target detection networks, and adapt to different scenarios through differential loss calculation, which enhances the generalization and robustness of the algorithm to complex environments; finally, the present invention can be applied to target detection in multiple fields such as autonomous driving, video surveillance, and medical image analysis.
[0126] Example 2
[0127] Provided is a target detection optimization system based on deep learning, comprising:
[0128] A sample acquisition module is used to acquire an image sample data set; the image sample data set includes a training sample set and a verification sample set;
[0129] A training module is used to train the target detection model. During training, a dual-branch parallel sample matching algorithm is used to match positive and negative samples of the training sample set, and an actual loss function of the target detection model is constructed according to the loss of the positive and negative sample matching and the original loss of the target detection model; based on the constructed actual loss function, the parameters of the target detection model are iteratively optimized through the verification sample set until the target detection model meets the preset optimization conditions; the dual-branch parallel sample matching algorithm includes: a parallel one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner and a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm;
[0130] The target detection module is used to detect the target using the trained target detection model. During the detection, only the one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used for positive and negative sample matching.
[0131] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0132] Example 3
[0133] The present invention provides a computer device, comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the steps of the above-mentioned target detection optimization method based on deep learning are implemented.
[0134] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0135] Example 4
[0136] The present invention provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the steps of the above-mentioned target detection optimization method based on deep learning are implemented.
[0137] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0138] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system, device, and storage medium disclosed in the embodiment, since they correspond to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0139] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.
[0140] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.
Claims
1. A target detection optimization method based on deep learning, characterized in that: The following steps are involved: Acquire an image sample data set; the image sample data set includes a training sample set and a verification sample set; The target detection model is trained. During the training, a dual-branch parallel sample matching algorithm is used to match positive and negative samples of the training sample set, and the actual loss function of the target detection model is constructed according to the loss of positive and negative sample matching and the original loss of the target detection model. Based on the constructed actual loss function, the parameters of the target detection model are iteratively optimized through the verification sample set until the target detection model meets the preset optimization conditions. The dual-branch parallel sample matching algorithm includes: a parallel one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner and a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm; The trained target detection model is used to detect the target, and during the detection, only the one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used for positive and negative sample matching; The dual-branch parallel sample matching algorithm is used to match positive and negative samples on the training sample set, including using a one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner to match positive and negative samples on the training sample set. The process is as follows: The target detection model is used to predict the input image and generate a prediction box, and the category score S corresponding to the prediction box in all preset category scores is obtained; Get the IOU value between each real box and each predicted box; Based on the obtained IOU value and category score S, obtain the alignment of each real box with all predicted boxes; According to the alignment degree between each true box and all predicted boxes, the topK predicted boxes are selected as candidate positive samples of the true box, and the predicted boxes in the training sample set except all candidate positive samples are negative samples; If a predicted box corresponds to multiple candidate positive samples of the real box, the IOU value between the predicted box and each real box is compared, and the real box corresponding to the maximum IOU value is selected to correspond to the predicted box, and the predicted box is filtered out from the candidate positive samples of the remaining real boxes to obtain the final positive sample.
2. The target detection optimization method based on deep learning according to claim 1, characterized in that: Alignment between the predicted box and the true box for: ; in, is the IOU value between the real box and the predicted box, is the weight of the category score S, is the weight of U.
3. The target detection optimization method based on deep learning according to claim 1, characterized in that: The dual-branch parallel sample matching algorithm is used to match positive and negative samples on the training sample set, including a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm, and the positive and negative samples on the training sample set are matched. The process is as follows: The object detection model predicts the input image and generates candidate boxes and predicted boxes; Take all candidate boxes and predicted boxes as a detection box set, and obtain the cost matrix between each real box and each detection box in the detection box set; Take all the cost matrices as input, and use the Hungarian matching algorithm to find the detection box with the minimum cost for each real box. All the detection boxes with the smallest cost found are regarded as positive samples, and all the detection boxes except all the positive samples in the training sample set are negative samples.
4. The target detection optimization method based on deep learning according to claim 3 is characterized in that: The target detection model predicts the input image, and when generating candidate boxes and prediction boxes, if the trained target detection model relies on anchor base to achieve detection, the corresponding candidate boxes are generated according to the width and height of the preset anchor boxes; if the trained target detection model relies on anchor free to achieve detection, a candidate box with a set stride is generated according to each anchor point.
5. The target detection optimization method based on deep learning according to claim 3 is characterized in that: Cost matrix of true box and detection box for: ; in, For the prediction box belong The probability of the class, is the indicator function of the category cost, is the indicator function of the position cost, For real frame With prediction box The position cost matrix between them; ; in, For real frame With prediction box The IOU loss between is the weight of IOU loss, For real frame With prediction box The L1 norm between is the weight of the L1 norm; For each real frame, the expression of finding the detection frame with the minimum cost corresponding to it using the Hungarian matching algorithm is: ; in, is the current real frame The best matching result, N is the set of detection boxes, It is the set of matching results between the current real box and all predicted boxes.
6. The target detection optimization method based on deep learning according to claim 1, characterized in that: The actual loss function of the target detection model is constructed according to the loss of positive and negative sample matching and the original loss of the target detection model, including: The positive sample set obtained by matching the one-to-many positive and negative sample matching algorithm is recorded as M, and the positive sample set obtained by matching the one-to-one positive and negative sample matching algorithm is recorded as O; For each real box, the set M and the set O are grouped and recorded as and ,in, and Respectively and The positive sample set corresponding to the real frame is obtained by matching the one-to-many positive and negative sample matching algorithm. and Respectively and The positive samples corresponding to the real frames are matched using the one-to-one positive and negative sample matching algorithm; For each real box, calculate its corresponding as well as The CIOU loss between them is calculated as the loss for matching positive and negative samples. The loss of positive and negative sample matching and the original loss of the target detection model are combined to form the actual loss function of the target detection model; The actual loss function of the object detection model for: ; ; in, is the loss of positive and negative sample matching, is the original loss function of the target detection model, is the interaction ratio between the predicted box and the true box, for The positive samples in for The positive samples in is the Euclidean distance between the center points of two positive samples, To fully wrap and The diagonal length of the minimum circumscribed rectangle of ; is the weight function, is the aspect ratio similarity term, Positive sample The width of Positive sample Height, Positive sample The width of Positive sample height.
7. A target detection optimization system based on deep learning, characterized in that: include: A sample acquisition module, used to acquire an image sample data set, wherein the image sample data set includes a training sample set and a verification sample set; The training module is used to train the target detection model. During training, a dual-branch parallel sample matching algorithm is used to match positive and negative samples of the training sample set, and the actual loss function of the target detection model is constructed according to the loss of positive and negative sample matching and the original loss of the target detection model. Based on the constructed actual loss function, the parameters of the target detection model are iteratively optimized through the verification sample set until the target detection model meets the preset optimization conditions. The dual-branch parallel sample matching algorithm includes: a parallel one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner and a one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm; The target detection module is used to detect the target using the trained target detection model. During the detection, only the one-to-one positive and negative sample matching algorithm based on the Hungarian matching algorithm is used for positive and negative sample matching. The dual-branch parallel sample matching algorithm is used to match positive and negative samples on the training sample set, including using a one-to-many positive and negative sample matching algorithm based on TaskAlignedAssigner to match positive and negative samples on the training sample set. The process is as follows: The target detection model is used to predict the input image and generate a prediction box, and the category score S corresponding to the prediction box in all preset category scores is obtained; Get the IOU value between each real box and each predicted box; Based on the obtained IOU value and category score S, obtain the alignment of each real box with all predicted boxes; According to the alignment degree between each true box and all predicted boxes, the topK predicted boxes are selected as candidate positive samples of the true box, and the predicted boxes in the training sample set except all candidate positive samples are negative samples; If a predicted box corresponds to multiple candidate positive samples of the real box, the IOU value between the predicted box and each real box is compared, and the real box corresponding to the maximum IOU value is selected to correspond to the predicted box, and the predicted box is filtered out from the candidate positive samples of the remaining real boxes to obtain the final positive sample.
8. A computer device, characterized in that: It includes a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the steps of the target detection optimization method based on deep learning described in any one of claims 1-6 are implemented.
9. A computer-readable storage medium, characterized in that: Used to store computer programs; when the computer programs are executed by the processor, the steps of the deep learning-based target detection optimization method described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
End-to-end detector with input as dense queries with deduplication pre-processing
CN114708424A
Address matching model training method based on comparative learning
CN115455315A