Detection methods, detection devices and storage media

By optimizing the detection threshold using a genetic algorithm model, the accuracy problem caused by subjective threshold setting in existing detection technologies is solved, achieving a balance between over-detection rate and false negative rate, and improving the accuracy of detection results.

CN117999577BActive Publication Date: 2026-11-10CONTEMPORARY AMPEREX TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202280006557.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-06
Publication Date
2026-11-10
Estimated Expiration
2042-09-06

AI Technical Summary

Technical Problem

In existing detection technologies, the pre-set thresholds are based on the subjective settings of developers, which affects the accuracy of the detection results and makes it difficult to simultaneously optimize the over-detection rate and the false negative rate.

Method used

A genetic algorithm model is used to determine the non-dominated solutions for overkill and false negative rates by using the confidence levels and detection thresholds of multiple detection items, and to optimize the detection thresholds to improve the accuracy of the detection results.

Benefits of technology

By optimizing the detection threshold, the phenomenon of detecting qualified products as defects and defects as qualified products can be reduced, thereby improving the accuracy of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117999577B_ABST
    Figure CN117999577B_ABST
Patent Text Reader

Abstract

This application provides a detection method, a detection device, and a storage medium. The detection method includes: acquiring an image to be detected; acquiring multiple confidence levels corresponding to multiple detection items based on the image to be detected; and determining a detection result for the image to be detected based on the multiple confidence levels and multiple detection thresholds. The multiple detection thresholds correspond to multiple detection items and are non-dominated solutions to an objective function of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified items detected as defects, and the under-detection rate is the proportion of defects detected as qualified items. The technical solution of this application can improve the accuracy of the detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of detection technology, and in particular to a detection method, a detection device, and a storage medium. Background Technology

[0002] In the existing field of detection technology, the detection result is generally determined by comparing a pre-set threshold with the detected value. The pre-set threshold is often based on the subjective setting or experience value of the developer, which affects the accuracy of the detection result.

[0003] Therefore, how to provide a detection method to improve the accuracy of detection results is a technical problem that urgently needs to be solved. Summary of the Invention

[0004] This application provides a detection method, a detection device, and a storage medium, which can improve the accuracy of detection results.

[0005] In a first aspect, this application provides a detection method, comprising: acquiring an image to be detected; acquiring multiple confidence levels corresponding to multiple detection items based on the image to be detected; determining a detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds, wherein the multiple detection thresholds correspond to the multiple detection items and are non-dominated solutions to an objective function of over-detection rate and under-detection rate, wherein the over-detection rate is the proportion of qualified items detected as defects, and the under-detection rate is the proportion of defects detected as qualified items.

[0006] This application provides a detection method, including: acquiring an image to be detected; acquiring multiple confidence levels corresponding to multiple detection items based on the image to be detected; and determining the detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds. The multiple detection thresholds correspond to multiple detection items and are non-dominated solutions to the objective function of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified items detected as defects, and the under-detection rate is the proportion of defects detected as qualified items. This detection method is used to detect the image to be detected based on multiple detection thresholds corresponding to multiple detection items. The multiple detection thresholds are non-dominated solutions to the objective function of over-detection rate and under-detection rate. Thus, the specific values ​​of the multiple detection thresholds are more appropriate. When using multiple detection thresholds to detect multiple detection items of the image to be detected, it helps to avoid detecting defects as qualified items and qualified items as defects, thereby improving the accuracy of the detection results.

[0007] In one possible implementation, before determining the detection result of the image to be detected based on the plurality of confidence levels and the plurality of detection thresholds, the detection method further includes: acquiring first test data and second test data, wherein the first test data is qualified data and the second test data is unqualified data; and acquiring the plurality of detection thresholds based on the first test data and the second test data. This facilitates the detection of the image to be detected based on the plurality of detection thresholds after acquiring them.

[0008] In one possible implementation, obtaining the plurality of detection thresholds based on the first test data and the second test data includes: obtaining a plurality of prediction confidences and prediction results based on the first test data and the second test data, wherein the plurality of prediction confidences correspond to the plurality of detection items; and obtaining the plurality of detection thresholds based on the plurality of prediction confidences and the prediction results. This facilitates obtaining multiple detection thresholds based on multiple prediction confidences and prediction results.

[0009] In one possible implementation, obtaining the multiple detection thresholds based on the multiple prediction confidence levels and the prediction results includes: determining the initial population of the genetic algorithm model based on the multiple prediction confidence levels and the prediction results; iterating based on the objective function of the overkill rate and the false negative rate using the initial population to obtain a non-dominated solution to the objective function of the overkill rate and the false negative rate; and determining the multiple detection thresholds based on the non-dominated solution. This facilitates the determination of relevant parameters of the genetic algorithm model, thereby facilitating the calculation of multiple detection thresholds based on the genetic algorithm model.

[0010] In one possible implementation, the independent variables of the objective function for the over-detection rate and the false negative rate correspond to the multiple detection items, and the dependent variables of the objective function for the over-detection rate and the false negative rate are the over-detection rate and the false negative rate. In this way, the independent variables of the objective function can be determined based on the multiple detection items and the multiple prediction confidence levels corresponding to the multiple detection items. Based on the prediction results, the first test data and the second test data determine the dependent variable of the objective function, thereby determining the objective function of the genetic algorithm model. This facilitates the calculation of multiple detection thresholds based on the objective function.

[0011] In one possible implementation, determining the plurality of detection thresholds based on the non-dominated solutions includes: determining a set of detection thresholds based on the non-dominated solutions, the set of detection thresholds including multiple sets of the non-dominated solutions; and determining the plurality of detection thresholds based on the non-dominated solution in the set of detection thresholds corresponding to the minimum false negative rate. In the iterative solution process using a genetic algorithm model based on the objective function, there may be multiple non-dominated solutions. Selecting the non-dominated solution with the minimum false negative rate from among the multiple non-dominated solutions as the plurality of detection thresholds can further reduce the false negative rate while ensuring the overkill rate.

[0012] In one possible implementation, the non-dominated solution is the solution in which the objective functions for both the over-detection rate and the false negative rate are in a Pareto optimal state. Thus, when both the objective functions for the over-detection rate and the false negative rate are in a Pareto optimal state, a set of acceptable detection thresholds can be determined, and the required detection threshold can then be selected based on this set.

[0013] In one possible implementation, obtaining a non-dominated solution to the objective function of overkill and underkill rates by iterating through the initial population includes: employing a non-dominated sorting genetic algorithm with an elitist strategy to iterate through the initial population and obtain a non-dominated solution to the objective function of overkill and underkill rates. This can accelerate the calculation of multiple detection thresholds, making the solution process more efficient; simultaneously, it can retain individuals with better characteristics in the population during the iteration process, thereby making the calculated solution more accurate.

[0014] In one possible implementation, the first test data is over-detection data, which refers to the data in the first test data that were detected as defects even if they were otherwise acceptable. This facilitates the determination of the objective function for the over-detection rate based on the over-detection data, thereby making it easier to determine multiple detection thresholds in the subsequent process of obtaining multiple detection thresholds based on the objective function for the over-detection rate.

[0015] In one possible implementation, the number of first test data and second test data is the same. This facilitates the determination of the objective functions for overdetection rate and false negative rate based on the same number of first and second test data, thereby improving the accuracy of the detection results.

[0016] In one possible implementation, determining the detection result of the image to be detected based on the plurality of confidence levels and the plurality of detection thresholds includes: determining the detection result as unqualified when the plurality of confidence levels are greater than at least one of the plurality of detection thresholds; or determining the detection result as qualified when the plurality of confidence levels are less than or equal to each of the plurality of detection thresholds.

[0017] In this implementation, if multiple confidence levels are greater than any one of multiple detection thresholds, the detection result can be determined as unqualified; if multiple confidence levels are less than or equal to each of multiple detection values, the detection result can be determined as qualified. This facilitates the determination of whether defects exist in the image to be inspected.

[0018] Secondly, this application provides a detection device, including a processing module, the processing module being configured to: acquire an image to be detected; acquire multiple confidence levels corresponding to multiple detection items based on the image to be detected; and determine a detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds, wherein the multiple detection thresholds correspond to the multiple detection items and are non-dominated solutions to an objective function of over-detection rate and under-detection rate, the over-detection rate being the proportion of qualified items detected as defects, and the under-detection rate being the proportion of defects detected as qualified items.

[0019] Thirdly, embodiments of this application provide a detection device, comprising: a memory for storing computer-executable instructions; and a processor for accessing the memory and executing the computer-executable instructions to perform operations in the method according to any one of the first aspects.

[0020] Fourthly, this application provides a storage medium for storing a computer program that, when executed by a computing device, causes the computing device to implement the method described in any one of the first aspects.

[0021] This application provides a detection method, including: acquiring an image to be detected; acquiring multiple confidence levels corresponding to multiple detection items based on the image to be detected; and determining the detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds. The multiple detection thresholds correspond to multiple detection items and are non-dominated solutions to the objective function of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified items detected as defects, and the under-detection rate is the proportion of defects detected as qualified items. This detection method is used to detect the image to be detected based on multiple detection thresholds corresponding to multiple detection items. The multiple detection thresholds are non-dominated solutions to the objective function of over-detection rate and under-detection rate. Thus, the specific values ​​of the multiple detection thresholds are more appropriate. When using multiple detection thresholds to detect multiple detection items of the image to be detected, it helps to avoid detecting defects as qualified items and qualified items as defects, thereby improving the accuracy of the detection results. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on the drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of a detection method according to an embodiment of this application;

[0024] Figure 2 This is a schematic diagram of a detection method according to an embodiment of this application;

[0025] Figure 3 This is a schematic diagram illustrating the acquisition of a detection threshold according to an embodiment of this application;

[0026] Figure 4 This is a schematic diagram of defect detection according to an embodiment of this application;

[0027] Figure 5 This is a schematic diagram illustrating the acquisition of a detection threshold according to an embodiment of this application;

[0028] Figure 6 This is a flowchart illustrating the acquisition of multiple detection thresholds according to an embodiment of this application;

[0029] Figure 7 A schematic diagram of a detection device according to an embodiment of this application;

[0030] Figure 8 This is a schematic diagram of a detection device according to an embodiment of this application.

[0031] The accompanying drawings are not drawn to scale. Detailed Implementation

[0032] The embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The detailed description of the following embodiments and the accompanying drawings are used to illustrate the principles of this application by way of example, but should not be used to limit the scope of this application, that is, this application is not limited to the described embodiments.

[0033] In this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, in this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0034] In the field of target detection, a predetermined threshold is typically set. By comparing the predetermined threshold with the detection value or confidence level obtained by the detection model, the presence of the corresponding target can be determined. For example, in the field of industrial defect detection, the predetermined threshold can be used to determine whether a product has a corresponding defect.

[0035] Researchers have found that predetermined thresholds are often set based on the subjective or experiential values ​​of developers. These thresholds are crucial to the accuracy of detection results. If a product is considered defective when the confidence level is greater than the predetermined threshold, and the threshold is set too low, some qualified products may be judged as defective, leading to over-detection; conversely, if the threshold is set too high, some defective products may be judged as qualified, resulting in missed detections.

[0036] To determine a suitable predetermined threshold, some schemes use grid search to find the optimal solution. However, researchers have found that grid search can only yield a set of approximate, better solutions, making it difficult to obtain a precise optimal threshold. Furthermore, when multiple detection items exist, grid search is not only time-consuming but also extremely difficult, making it hard to obtain a suitable threshold.

[0037] In view of this, this application provides a detection method in which the detection threshold corresponds to multiple detection items and is a non-dominated solution to the objective function of over-detection rate and under-detection rate. This makes the specific value of the detection threshold more appropriate. When using multiple detection thresholds to detect multiple detection items of the image to be detected, it helps to avoid the phenomenon of detecting defects as qualified and qualified as defective, thereby improving the accuracy of the detection results.

[0038] The detection method of this application can be applied to the field of target detection. In the field of target detection, the image to be detected is typically processed to obtain a confidence level corresponding to the target. By comparing a pre-set detection threshold with the confidence level, it can be determined whether the corresponding target exists in the image to be detected. For example, the detection method of this application can be applied to the field of multi-defect detection in industry, such as the detection of multiple defects in tabs. For an image to be detected, multiple detection items need to be detected, and the detection result of each item will affect the detection result of the image to be detected. For example, if even one detection item is abnormal, the detection result of the image to be detected can be determined to be unqualified; only when multiple detection items are normal can the image to be detected be determined to be qualified. Therefore, the setting of multiple detection thresholds corresponding to multiple detection items is crucial to the accuracy of the detection result.

[0039] Figure 1 This is a schematic diagram of a detection method according to an embodiment of this application. Figure 1 As shown, the detection method 100 includes the following steps.

[0040] Step 110: Obtain the image to be detected.

[0041] The image to be inspected is a photograph of an object. By inspecting the image, the state of the object can be determined. For example, when performing defect detection using the image to be inspected, the image can be a photograph of a product. By inspecting the image, it can be determined whether the product has defects.

[0042] Step 120: Based on the image to be detected, obtain multiple confidence levels for the corresponding multiple detection items.

[0043] In target inspection, there are usually multiple inspection items. For example, the tabs of electrodes often have defects such as foreign objects, tears, gaps, folds, wrinkles, and Z-shaped folds. In order to detect multiple defects, multiple inspection items are usually set for each defect.

[0044] Each test item corresponds to a confidence level. For example, in the field of defect detection, the confidence level represents the probability that the test result of the test item has this type of defect. The confidence level ranges from 0 to 1. The higher the confidence level, the higher the probability of having this type of defect.

[0045] In step 120, the image to be detected can be input into the detection device, which then calculates multiple confidence levels corresponding to multiple detection items. For example, step 120 can be specifically executed by the detection model in the detection device. Based on the input image to be detected, the detection model can calculate the confidence levels corresponding to multiple detection items one by one. This detection model can be a pre-trained model.

[0046] Step 130: Determine the detection result of the image to be detected based on multiple confidence levels and multiple detection thresholds.

[0047] Multiple detection thresholds correspond to multiple detection items; that is, there is a one-to-one correspondence between multiple detection thresholds and multiple detection items. By comparing the detection threshold and confidence level corresponding to each detection item, the detection result of the detection item can be determined.

[0048] Multiple detection thresholds are non-dominated solutions to the objective functions of over-detection rate and under-detection rate. Over-detection rate is the proportion of qualified products detected as defects, and under-detection rate is the proportion of defects detected as qualified products.

[0049] A non-dominated solution is one in which no solution can be found in the set of available solutions that further improves the objective function. Multiple detection thresholds represent non-dominated solutions to the objective function of over-detection rate and false negative rate; in other words, multiple detection thresholds represent the optimal harmonic solution that balances over-detection rate and false negative rate.

[0050] A defect is defined as a defect of a certain degree. For example, for the inspection item of folding, a slight fold is judged as no folding defect, while a fold exceeding a predetermined degree is considered to have a folding defect. The predetermined degree can be a folding degree that is manually set in advance.

[0051] "Pass" means that there are no defects. In other words, if none of the multiple inspection items show any defects, the inspection result of the image to be inspected is considered passable.

[0052] It should be noted that the defect in the embodiments of this application refers to the fact that the object or product corresponding to the image has a defect during the detection process, and does not necessarily mean that the object or product cannot be used due to the defect.

[0053] The method described in this application embodiment can be executed by a detection device, specifically by a processing module within the detection device. This processing module can be built into a computer, which can acquire relevant data from the production line. The computer may or may not be connected to the production line.

[0054] This application provides a detection method, including: acquiring an image to be detected; acquiring multiple confidence levels corresponding to multiple detection items based on the image to be detected; and determining the detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds. The multiple detection thresholds correspond to multiple detection items and are non-dominated solutions to the objective function of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified items detected as defects, and the under-detection rate is the proportion of defects detected as qualified items. This detection method is used to detect the image to be detected based on multiple detection thresholds corresponding to multiple detection items. The multiple detection thresholds are non-dominated solutions to the objective function of over-detection rate and under-detection rate. Thus, the specific values ​​of the multiple detection thresholds are more appropriate. When using multiple detection thresholds to detect multiple detection items of the image to be detected, it helps to avoid detecting defects as qualified items and qualified items as defects, thereby improving the accuracy of the detection results.

[0055] Figure 2 This is a schematic diagram of a detection method according to an embodiment of this application. In one embodiment, before step 130, the detection method 100 further includes the following steps.

[0056] Step 210: Obtain the first test data and the second test data. The first test data is qualified data, and the second test data is unqualified data.

[0057] The first and second test data are true values, that is, objectively existing actual values. These true values ​​can refer to theoretical true values, defined true values, or relative true values.

[0058] The first test data is qualified data, that is, qualified data in reality. The first test data can be image data, in which the object corresponding to the image does not have the defects corresponding to the multiple detection items. For example, the data is an image of a tab, and the multiple detection items are six types of defect detection items for the tab: foreign objects, tears, gaps, folds, wrinkles, and Z-shaped folds. The tab in the image does not have any of the above six types of defects.

[0059] The second test data is non-compliant data, i.e., data that is actually non-compliant. The second test data can be image data, in which the object corresponding to the image has defects corresponding to multiple detection items. For example, the data is an image of a tab, and the multiple detection items are six types of defect detection items for the tab: foreign objects, tears, gaps, folds, wrinkles, and Z-shaped folds. The tab in this image has a defect corresponding to at least one of the detection items.

[0060] Step 220: Obtain multiple detection thresholds based on the first test data and the second test data.

[0061] In this embodiment, the multiple detection thresholds are obtained based on the first test data and the second test data, and the specific values ​​of the multiple detection thresholds are more reasonable. After obtaining the multiple detection thresholds, the multiple detection thresholds can be used as the detection thresholds of the detection device, so as to facilitate the determination of whether the image to be detected meets the requirements based on the confidence level of the image to be detected obtained by the detection device and the detection thresholds.

[0062] Figure 3 This is a schematic diagram illustrating the acquisition of a detection threshold according to an embodiment of this application. In one embodiment, as... Figure 3 As shown, step 220 includes the following steps.

[0063] Step 221: Based on the first test data and the second test data, obtain multiple prediction confidence levels and prediction results. Multiple prediction confidence levels correspond to multiple detection items.

[0064] Step 222: Obtain multiple detection thresholds based on multiple prediction confidences and prediction results.

[0065] In step 221, the first test data and the second test data can be input into the detection device, which then calculates multiple prediction confidence levels and prediction results. For example, the first test data and the second test data can be input into the prediction model in the detection device, and the prediction model calculates prediction confidence levels and prediction results corresponding one-to-one with multiple detection items.

[0066] The prediction model can be a pre-trained model. The prediction model can have the same structure as the detection model or a different structure.

[0067] In some embodiments, steps 221 and 222 may include the following specific steps.

[0068] First, the detection device acquires input data. This input data can be either first test data or second input data.

[0069] Secondly, the detection device analyzes the input data and generates multiple detection frames.

[0070] In this step, the analysis of the input data includes analyzing the input image and detecting whether it contains defects corresponding to multiple detection items. For example, in detecting whether the input image contains a tab fold defect, the detection device generates multiple predicted target boxes. By calculating the Intersection over Union (IOU) between the predicted target box and the ground truth target box, the predicted target box with the highest IOU is selected as the final target box. The final target box corresponds to a different confidence value for each detection item. When detecting four types of defects, the final target box has four confidence values, and the sum of these four confidence values ​​is 1. The one with the highest confidence value is selected as the predicted confidence, and then the predicted confidence is output. By detecting the four detection items, each input image can ultimately obtain four predicted confidence values.

[0071] Figure 4 This is a schematic diagram illustrating defect detection according to an embodiment of this application. Figure 4 The diagram illustrates defect detection of a tab, including a ground truth bounding box and predicted bounding boxes 1 and 2. During the detection of a specific type of item on the tab, multiple predicted bounding boxes are generated. Figure 4 (Only two are shown; there may be more in reality.) By calculating the intersection-union ratio (IUU) between the predicted and ground truth bounding boxes, the predicted bounding box that is closest to the ground truth bounding box can be determined. For example, Figure 4 The predicted target box 2 has the largest intersection-union ratio with the ground truth target box. Therefore, the predicted target box 2 can be used as the final target box, that is, the target box that is closest to the ground truth target box.

[0072] In actual production processes, detection devices can be used to determine the type of defects in objects corresponding to input images. For example, in a detection task with four detection items, the predicted target box 2 has four confidence values, and the sum of the four confidence values ​​is 1. The detection item corresponding to the highest confidence value is very likely the type of defect present in the target. If the highest confidence value is greater than a predetermined threshold, it can be determined that the target has that type of defect.

[0073] Finally, the detection device compares the predetermined threshold with the prediction confidence level and outputs the prediction result. Table 1 shows the specific data of the prediction confidence level and prediction result output by the prediction model of an embodiment of this application. Table 1 is only used as an example to illustrate the prediction result and prediction confidence level, and does not impose specific limitations on the embodiments of this application. Table 1. Prediction Confidence and Prediction Results ID Score1 Score2 Score3 Score4 Prediction results 0 0.0630 0 0 0.765 NG 1 0.76 0.09 0.12 0.05 NG 2 0.05 0 0 0.1 OK 3 0 0 0.06 0 OK

[0074] In Table 1, ID represents the input image number, with different numbers representing different samples. Score1, Score2, Score3, and Score4 represent the prediction confidence scores of different detection items. For example, the predetermined thresholds for the four detection items are 0.05, 0.1, 0.1, and 0.5, respectively. In the image with ID 0, the prediction confidence scores for the four detection items are 0.0630, 0, 0, and 0.765, respectively. The value of Score1 is greater than 0.05, and the value of Score4 is greater than 0.5. Therefore, the image with ID 0 is judged as unacceptable, and the prediction result is NG. A prediction result of NG indicates that the object corresponding to the image has a defect, but it does not necessarily mean that the object corresponding to the image is unusable and needs to be scrapped. In the image with ID 3, the prediction thresholds for the four detection items are 0, 0, 0.06, and 0, respectively. All four values ​​are less than the predetermined thresholds corresponding to the four detection items. Therefore, the image with ID 3 is judged as acceptable, and the prediction result is OK.

[0075] In this embodiment, the file output by the detection device includes predicted values ​​for multiple input samples, and the predicted values ​​include multiple prediction confidence levels and prediction results corresponding to multiple detection items.

[0076] In this embodiment, the obtained prediction confidence and prediction result are both predicted values, while the first test data and the second test data are both true values. The prediction confidence and prediction result can be obtained from the first test data and the second test data, thus facilitating the calculation of multiple detection thresholds based on the prediction confidence and prediction result in subsequent processes.

[0077] Figure 5 This is a schematic diagram illustrating the acquisition of a detection threshold according to an embodiment of this application. In one embodiment, as... Figure 5 As shown, step 222 includes the following steps.

[0078] Step 2221: Determine the initial population of the genetic algorithm model based on multiple prediction confidences and prediction results.

[0079] Genetic algorithm models refer to methods that simulate the natural evolutionary process of organisms. They generate an initial population through encoding, and then through heredity or crossover mutation, they evolve step by step to produce increasingly better approximate solutions according to the principle of survival of the fittest, thus iterating until the optimal solution is finally generated.

[0080] The file output by the detection device, containing the sample number, multiple prediction confidence levels for each sample, and prediction results, serves as input to the genetic algorithm model. The initial population is then determined based on this input. For example, the initial population size can be set to 500.

[0081] Step 2222: Based on the objective functions of overkill rate and missed detection rate, iterate according to the first generation population to obtain the non-dominated solutions of the objective functions of overkill rate and missed detection rate.

[0082] Through selection, crossover, and mutation, a new generation of offspring is obtained from the initial population. This offspring population is then subjected to further selection, crossover, and mutation to generate new offspring populations. This process is iterated until a convergence condition is met, for example, when the number of iterations reaches 100, at which point the iteration stops.

[0083] The iterative process is based on the objective function of overkill rate and false negative rate, with the aim of finding a non-dominated solution to the objective function of overkill rate and false negative rate.

[0084] Step 2223: Determine multiple detection thresholds based on non-dominated solutions.

[0085] Since multiple non-dominated solutions may be obtained during the process of solving the problem using a genetic algorithm model, it is necessary to determine an appropriate detection threshold from these multiple non-dominated solutions.

[0086] In this embodiment, the file output by the detection device described above can be used as the input file of the genetic algorithm model, thereby facilitating the calculation of multiple detection thresholds based on the genetic algorithm model.

[0087] In one embodiment, the independent variables of the objective function of the over-detection rate and the false negative rate correspond to multiple detection items, and the dependent variables of the objective function of the over-detection rate and the false negative rate are the over-detection rate and the false negative rate.

[0088] The objective functions for overkill rate and false negative rate each have multiple detection items as their independent variables. In other words, multiple prediction confidence levels can serve as independent variables for these two objective functions. For example, if the objective functions for overkill rate and false negative rate each have four detection items, then the independent variables for these two objective functions are x1, x2, x3, and x4.

[0089] A missed detection can refer to a situation where the predicted result of the second test data (non-compliant data) is compliant in the predictive model of the testing device. In other words, a missed detection means that the true value is non-compliant, but it is detected or predicted as compliant.

[0090] In the objective function of the false negative rate, the false negative rate is the ratio of the number of images that are missed to the number of images whose true value is unqualified.

[0091] "Over-testing" can refer to a situation where the predicted result of the first test data (pass data) is "fail" in the predictive model of the detection device. In other words, the true value is pass, but it is detected or predicted as fail.

[0092] In the objective function of the overkill rate, the overkill rate is the ratio of the number of overkilled images to the number of images with a true value of qualified.

[0093] In this embodiment, the independent variable is the prediction confidence level corresponding to multiple detection items, and the dependent variables are the over-detection rate and the false negative rate. This makes it easier to obtain the prediction confidence level that makes the over-detection rate and false negative rate reach the optimal level in a given region, and thus makes it easier to determine multiple detection thresholds.

[0094] In one embodiment, step 2223 includes: determining a set of detection thresholds based on non-dominated solutions, the set of detection thresholds including multiple sets of non-dominated solutions; and determining multiple detection thresholds based on the non-dominated solutions in the set of detection thresholds that correspond to the minimum false negative rate.

[0095] In this embodiment, during the iterative solution process using a genetic algorithm model based on the objective function, multiple non-dominated solutions may be obtained. Among these non-dominated solutions, selecting the one with the lowest false negative rate as multiple detection thresholds can further reduce the false negative rate while ensuring the over-detection rate. This avoids misclassifying unqualified products as qualified products, which is beneficial to improving production efficiency and safety.

[0096] In one embodiment, a non-dominated solution is the solution in which the objective functions of overkill rate and false negative rate are in Pareto optimal condition.

[0097] In this genetic algorithm model, the problem of solving multiple detection thresholds can be viewed as an optimization problem of two objective functions: overkill rate and false negative rate. For optimization problems with multiple objective functions, the solution space is discrete, and the solution to such problems is usually a set of equilibrium solutions, that is, a set of optimal solutions consisting of multiple Pareto optimal solutions.

[0098] A solution that is in a Pareto optimal state can be called a Pareto optimal solution, also known as a non-dominated solution. In other words, it is impossible for there to be a set of detection threshold solutions that can simultaneously make the overkill rate and the false negative rate smaller than the current solution.

[0099] In this embodiment, when the objective functions for over-detection rate and under-detection rate are in Pareto optimal state—that is, when both over-detection rate and under-detection rate are in Pareto optimal state—the values ​​of the independent variables are Pareto optimal solutions. For example, with four detection items, the independent variables corresponding to each detection item are x1, x2, x3, and x4, and a Pareto optimal solution is p = {x1, x2, x3, x4}. Since there are usually multiple solutions to the optimization problem of multiple objective functions in this genetic algorithm model, that is, there may be multiple Pareto optimal solutions p, and multiple Pareto optimal solutions p form the detection threshold set.

[0100] In this embodiment, when the overkill rate objective function and the false negative rate objective function are in Pareto optimal state, a set of detection thresholds that meet the requirements can be determined, and then the required detection threshold can be selected according to the set of detection thresholds.

[0101] Compared to obtaining a better solution for the threshold through grid search, obtaining multiple detection thresholds through the genetic algorithm model of this application is not only less time-consuming and easier to solve, but also allows for the search to find the optimal threshold solution that balances the over-detection rate and the false negative rate, which is conducive to achieving more accurate detection results.

[0102] In one embodiment, step 2222 includes: iterating the initial population using an Elite-based Nondominated Sorting Genetic Algorithm (NSGA-II) to obtain non-dominated solutions to the objective functions of overkill rate and false negative rate. This accelerates the calculation of multiple detection thresholds, making the solution process more efficient; simultaneously, it allows individuals with better characteristics to be retained in the population during iteration, resulting in more accurate solutions.

[0103] The advantages of NSGA-II lie in the introduction of non-dominated sorting, the introduction of crowding degree and crowding degree comparison operators, and the introduction of an elite strategy. Non-dominated sorting utilizes the concept of Pareto optimality to rank individuals in the population, with individuals in higher non-dominated states ranking higher in the hierarchy, thus selecting the better individuals and giving them a greater chance of advancing to the next iteration. Crowding degree is only applicable to comparisons between individuals at the same dominance level. It calculates the crowding degree for each individual's objective function, thus determining the individual's superiority. The elite strategy merges the current population with subpopulations generated through selection, crossover, and mutation, allowing them to compete for the next population. This ensures that individuals with better characteristics remain in the population, improving population diversity and computational efficiency.

[0104] In one embodiment, the first test data is overkill data, which is the data in the first test data that is detected as defective even if it is qualified.

[0105] Optionally, the first test data includes over-detection data. This avoids the situation where the first data does not include over-detection data, resulting in an over-detection rate of 0, which would be detrimental to the subsequent calculation of multiple detection thresholds based on the over-detection rate and false negative rate using a genetic algorithm.

[0106] In this embodiment, it is convenient to determine the overkill rate based on the overkill data, so that in the subsequent process of obtaining multiple detection thresholds, it is convenient to determine multiple detection thresholds based on the objective function of the overkill rate.

[0107] In one embodiment, the number of first test data and second test data is the same. This facilitates the determination of the objective functions for overkill rate and false negative rate based on the same number of first and second test data, thereby improving the accuracy of the calculation of false negative rate and overkill rate, and thus improving the accuracy of the detection results.

[0108] In one embodiment, step 130 includes: determining the test result as unqualified if a plurality of confidence levels are greater than at least one of a plurality of detection thresholds; or, determining the test result as qualified if a plurality of confidence levels are less than or equal to each of a plurality of detection thresholds.

[0109] In this embodiment, multiple confidence levels correspond to multiple detection items. That is, multiple confidence levels correspond one-to-one with multiple detection items, and multiple detection items correspond one-to-one with multiple detection thresholds. Therefore, multiple confidence levels correspond one-to-one with multiple detection thresholds.

[0110] During defect detection, the detection device calculates the confidence level for each detection item in the image to be inspected. By comparing multiple confidence levels with multiple detection thresholds, if a confidence level is greater than the corresponding detection threshold, it can be determined that the image to be inspected contains the defect corresponding to that detection item. If all confidence levels are less than or equal to the corresponding detection thresholds, it can be determined that the image to be inspected does not contain the defect corresponding to that detection item.

[0111] In this embodiment, if the confidence level is greater than any one of the multiple detection thresholds, the detection result can be determined as unqualified; if the confidence level is less than or equal to each of the multiple detection values, the detection result can be determined as qualified. This facilitates the determination of whether the object corresponding to the image to be detected has any defects.

[0112] Figure 6 This is a flowchart illustrating the acquisition of multiple detection thresholds according to an embodiment of this application. Figure 6 As shown, obtaining multiple detection thresholds may include the following steps.

[0113] Step 610: Obtain the first test data and the second test data.

[0114] Step 620: Based on the first test data and the second test data, obtain multiple prediction confidence scores and prediction results.

[0115] After the first and second test data are input into the detection device, the device processes the data and outputs the prediction confidence level, prediction result, and the corresponding test data number. These outputs can be saved in the output file for later use in the calculation process.

[0116] For example, there are n sets of test data, each set of test data corresponds to one image, and each image has m detection items to be detected. In the output file, the number of prediction confidences is n*m, and the number of prediction results is n.

[0117] Step 630: Determine the initial population of the genetic algorithm model based on multiple prediction confidences and prediction results.

[0118] The output file obtained in step 620 is used as the input file for the genetic algorithm model. This input file can be used as the initial population of the genetic algorithm model, or the initial population can be obtained by encoding the input file.

[0119] Step 640: Based on the objective functions of overkill rate and missed detection rate, iterate according to the first generation population to obtain the non-dominated solutions of the objective functions of overkill rate and missed detection rate.

[0120] In the genetic algorithm model, the m prediction confidence scores corresponding to m detection items are used as independent variables in the objective functions of overkill rate and false negative rate, while overkill rate and false negative rate are used as dependent variables in the same objective function. Multiple detection thresholds are determined by finding non-dominated solutions to the objective functions of overkill rate and false negative rate.

[0121] Step 650: Determine multiple detection thresholds based on non-dominated solutions.

[0122] The final computation result of the genetic algorithm model may have multiple non-dominated solutions, which constitute a set of detection thresholds. A suitable solution can be selected from this set as the detection threshold. For example, the non-dominated solution with the minimum false negative rate can be selected from the set, and then m detection thresholds corresponding to m detection items can be determined based on the selected non-dominated solution.

[0123] The above text combined Figures 1 to 6 The method embodiments of this application have been described in detail. The embodiments of the detection apparatus of this application will be described in detail below. It should be understood that the method embodiments and the apparatus embodiments correspond to each other, and similar descriptions can be referred to the method embodiments.

[0124] Figure 7 This is a schematic diagram of a detection device according to an embodiment of this application. Figure 7 As shown, this application embodiment provides a detection device 400, including a processing module 410. The processing module 410 is used to: acquire an image to be detected; acquire multiple confidence levels corresponding to multiple detection items based on the image to be detected; and determine the detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds. The multiple detection thresholds correspond to multiple detection items and are non-dominated solutions to the objective functions of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified items detected as defects, and the under-detection rate is the proportion of defects detected as qualified items.

[0125] In one embodiment, the processing module 410 is configured to: acquire first test data and second test data before determining the detection result of the image to be detected based on multiple confidence levels and multiple detection thresholds, and acquire multiple detection thresholds based on the first test data and the second test data, wherein the first test data is qualified data and the second test data is unqualified data.

[0126] In one embodiment, the processing module 410 is configured to: obtain multiple prediction confidence levels and prediction results based on the first test data and the second test data, wherein the multiple prediction confidence levels correspond to multiple detection items; and obtain multiple detection thresholds based on the multiple prediction confidence levels and prediction results.

[0127] In one embodiment, the processing module 410 is configured to: determine the initial population of the genetic algorithm model based on multiple prediction confidences and prediction results; iterate based on the objective function of overkill rate and false negative rate to obtain a non-dominated solution of the objective function of overkill rate and false negative rate; and determine multiple detection thresholds based on the non-dominated solution.

[0128] In one embodiment, the processing module 410 is configured to: determine a set of detection thresholds based on non-dominated solutions, the set of detection thresholds including multiple sets of non-dominated solutions; and determine multiple detection thresholds based on the non-dominated solutions in the set of detection thresholds that correspond to the minimum false negative rate.

[0129] In one embodiment, the processing module 410 is used to: use a non-dominated sorting genetic algorithm with an elitist strategy to iterate the first generation population and obtain a non-dominated solution to the objective function of overkill rate and missed detection rate.

[0130] In one embodiment, the processing module 410 is configured to: determine a set of detection thresholds based on the current values ​​of the independent variables when the overkill rate objective function and the missed detection rate objective function are in Pareto optimal state; and determine multiple detection thresholds based on the set of detection thresholds.

[0131] In one embodiment, the processing module 410 is configured to: determine the detection result as unqualified if a plurality of confidence levels are greater than at least one of a plurality of detection thresholds; or, determine the detection result as qualified if a plurality of confidence levels are less than or equal to each of a plurality of detection thresholds.

[0132] Figure 8 This is a schematic diagram of a detection device according to an embodiment of this application. Figure 8 As shown in the embodiments of this application, the detection device 500 includes a memory 510 and a processor 520. The memory 510 is used to store computer-executable instructions; the processor 520 is used to access the memory and execute the computer-executable instructions to perform the operations in any of the detection methods in the foregoing embodiments.

[0133] The processor 520 in this application embodiment can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiment can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods and steps disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0134] The memory 510 in this embodiment can be volatile memory or non-volatile memory, or it can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0135] This application provides a storage medium for storing a computer program, which, when executed by a computing device, causes the computing device to implement the method described in any of the foregoing embodiments.

[0136] Although this application has been described with reference to preferred embodiments, various modifications can be made thereto and components can be replaced with equivalents without departing from the scope of this application. In particular, the technical features mentioned in the various embodiments can be combined in any manner, provided there is no structural conflict. This application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. A detection method, characterized in that, include: Acquire the image to be detected; Based on the image to be detected, obtain multiple confidence levels corresponding to multiple detection items; Based on the multiple confidence levels and multiple detection thresholds, the detection result of the image to be detected is determined. The multiple detection thresholds correspond to the multiple detection items and are non-dominated solutions of the objective function of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified images being detected as defects, and the under-detection rate is the proportion of defects being detected as qualified images. Before determining the detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds, the detection method further includes: Acquire first test data and second test data, wherein the first test data is qualified data and the second test data is unqualified data; and acquire the plurality of detection thresholds based on the first test data and the second test data; The step of obtaining the plurality of detection thresholds based on the first test data and the second test data includes: Based on the first test data and the second test data, multiple prediction confidence levels and prediction results are obtained, wherein the multiple prediction confidence levels correspond to the multiple detection items; and, based on the multiple prediction confidence levels and the prediction results, multiple detection thresholds are obtained. The step of obtaining the multiple detection thresholds based on the multiple prediction confidences and the prediction results includes: Based on the multiple prediction confidence levels and the prediction results, the initial population of the genetic algorithm model is determined; Based on the objective functions of overkill rate and false negative rate, the non-dominated solutions of the objective functions of overkill rate and false negative rate are obtained by iterating according to the first generation population. Based on the non-dominated solution, the plurality of detection thresholds are determined.

2. The detection method according to claim 1, characterized in that, The independent variables of the objective functions for the over-detection rate and the false negative rate correspond to the multiple detection items, and the dependent variables of the objective functions for the over-detection rate and the false negative rate are the over-detection rate and the false negative rate.

3. The detection method according to claim 2, characterized in that, The step of determining the plurality of detection thresholds based on the non-dominated solution includes: Based on the non-dominated solutions, a set of detection thresholds is determined, wherein the set of detection thresholds includes multiple sets of the non-dominated solutions; The plurality of detection thresholds are determined based on the non-inferior solution corresponding to the minimum false negative rate in the set of detection thresholds.

4. The detection method according to claim 3, characterized in that, The non-dominated solution is the solution in which the objective function of the overkill rate and the missed detection rate is in Pareto optimal state.

5. The detection method according to any one of claims 1-4, characterized in that, The objective function based on the overkill rate and the false negative rate, iterated according to the initial population, obtains a non-dominated solution to the objective function of the overkill rate and the false negative rate, including: A non-dominated sorting genetic algorithm with an elitist strategy is used to iterate the first generation population to obtain a non-dominated solution to the objective function of the overkill rate and the missed detection rate.

6. The detection method according to claim 1, characterized in that, The first test data is over-detection data, which refers to the data in the first test data that were detected as defective even though they were otherwise qualified.

7. The detection method according to claim 1, characterized in that, The number of the first test data and the second test data are the same.

8. The detection method according to claim 1, characterized in that, Determining the detection result of the image to be detected based on the multiple confidence levels and multiple detection thresholds includes: If the confidence level is greater than at least one of the multiple detection thresholds, the detection result is determined to be unqualified; or, If the confidence level is less than or equal to each of the plurality of detection thresholds, the detection result is determined to be qualified.

9. A detection device, characterized in that, Includes a processing module, the processing module being used for: Acquire the image to be detected; Based on the image to be detected, obtain multiple confidence levels corresponding to multiple detection items; Based on the multiple confidence levels and multiple detection thresholds, the detection result of the image to be detected is determined. The multiple detection thresholds correspond to the multiple detection items and are non-dominated solutions of the objective function of over-detection rate and under-detection rate. The over-detection rate is the proportion of qualified images being detected as defects, and the under-detection rate is the proportion of defects being detected as qualified images. The processing module is also used for: Before determining the detection result of the image to be detected based on the multiple confidence levels and the multiple detection thresholds, Acquire first test data and second test data, and obtain the plurality of detection thresholds based on the first test data and the second test data, wherein the first test data is qualified data and the second test data is unqualified data; The processing module is used for: Based on the first test data and the second test data, multiple prediction confidence levels and prediction results are obtained, wherein the multiple prediction confidence levels correspond to the multiple detection items; Based on the multiple prediction confidence levels and the prediction results, the multiple detection thresholds are obtained; The processing module is used for: Based on the multiple prediction confidence levels and the prediction results, the initial population of the genetic algorithm model is determined; Based on the objective functions of overkill rate and false negative rate, the non-dominated solutions of the objective functions of overkill rate and false negative rate are obtained by iterating according to the first generation population. Based on the non-dominated solution, the plurality of detection thresholds are determined.

10. The detection device according to claim 9, characterized in that, The independent variables of the objective functions for the over-detection rate and the false negative rate correspond to the multiple detection items, and the dependent variables of the objective functions for the over-detection rate and the false negative rate are the over-detection rate and the false negative rate.

11. The detection device according to claim 10, characterized in that, The processing module is used for: Based on the non-dominated solutions, a set of detection thresholds is determined, wherein the set of detection thresholds includes multiple sets of the non-dominated solutions; The plurality of detection thresholds are determined based on the non-inferior solution corresponding to the minimum false negative rate in the set of detection thresholds.

12. The detection device according to claim 11, characterized in that, The non-dominated solution is the solution in which the objective function of the overkill rate and the missed detection rate is in Pareto optimal state.

13. The detection device according to any one of claims 9-12, characterized in that, The processing module is used for: A non-dominated sorting genetic algorithm with an elitist strategy is used to iterate the first generation population to obtain a non-dominated solution to the objective function of the overkill rate and the missed detection rate.

14. The detection device according to claim 9, characterized in that, The first test data is over-detection data, which refers to the data in the first test data that were detected as defective even though they were otherwise qualified.

15. The detection device according to claim 9, characterized in that, The number of the first test data and the second test data are the same.

16. The detection device according to claim 9, characterized in that, The processing module is used for: If the confidence level is greater than at least one of the multiple detection thresholds, the detection result is determined to be unqualified; or, If the confidence level is less than or equal to each of the plurality of detection thresholds, the detection result is determined to be qualified.

17. A detection device, characterized in that, include: Memory is used to store executable instructions for a computer; A processor for accessing the memory and executing the computer-executable instructions to perform the operations in the method according to any one of claims 1 to 8.

18. A storage medium, characterized in that, Used to store a computer program that, when executed by a computing device, causes the computing device to implement the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Material distribution decision-making method and device based on machine learning model and storage medium

    CN110310260A

  • Lithium battery defect detection method and device, equipment and storage medium

    CN113537414A