Defect detection model parameter construction method, controller, medium and product
By constructing deep learning defect detection model parameters, using the inference results of product images and deep learning models, setting initial thresholds and correcting detection parameters, the problem of parameter setting dependence on specifications in the existing technology is solved, and the detection accuracy and response speed are improved.
Patent Information
- Application Number
- CN202411821201.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, the parameter setting of deep learning defect detection model depends on customer specifications, which makes trial production and debugging time-consuming and costly, making it difficult to cover subtle differences in actual production, and the feedback cycle is long, making it difficult to respond to changes in the production environment and customer needs in a timely manner.
A method for constructing defect detection model parameters is proposed. By obtaining multiple product images, inputting deep learning models to obtain inference results, including defect categories, setting initial strict threshold, initial balance threshold and initial loose threshold, correcting the detection parameters of deep learning models according to defect categories, and obtaining defect detection model parameters.
It improves the accuracy of defect detection models to detect defects, reduces the time and cost of trial production and commissioning, and can respond more quickly to changes in the production environment and customer needs.
Smart Images

Figure CN119810509A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and in particular to a method for constructing defect detection model parameters, a controller, a medium and a product. Background Art
[0002] Among related technologies, deep learning is increasingly used in the field of industrial inspection, and can automatically identify defects in industrial products, such as scratches, damage, dirt, etc. Compared with traditional detection methods, deep learning defect detection has higher flexibility and accuracy, and can adapt to complex and changing defect styles and shapes. After the deep learning model is deployed to the production site, the parameter setting method is usually based on the customer specification, combined with the trial production survey data for verification and adjustment to ensure that the detection model meets the customer's quality standards. However, this method has some shortcomings: trial production debugging is time-consuming and costly, parameter settings rely on specifications and are difficult to cover subtle differences in actual production, and the feedback cycle is long, making it difficult to respond to changes in the production environment and customer needs in a timely manner.
[0003] Therefore, how to realize the construction of defect detection model parameters based on deep learning is the main problem currently facing the industry. Summary of the invention
[0004] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a method for constructing defect detection model parameters, a controller, a medium and a product, aiming to improve the accuracy of defect detection by the defect detection model.
[0005] In a first aspect, an embodiment of the present application provides a method for constructing defect detection model parameters, the method comprising: Get multiple product images; Inputting a plurality of product images into a deep learning model to obtain an inference result, wherein the inference result includes a defect category; According to the inference result, an initial strict threshold, an initial balanced threshold and an initial loose threshold are set; Based on the defect category, the detection parameters of the deep learning model are modified according to the initial strict threshold, the initial balanced threshold and the initial loose threshold to obtain defect detection model parameters.
[0006] According to some embodiments of the present application, the inference result further includes confidence, defect width and defect height, and the inputting of the plurality of product images into the deep learning model to obtain the inference result includes: The multiple product images are input into a deep learning model, and defect detection is performed on the multiple product images through a target detection algorithm to obtain the confidence level, the defect category, the defect width, and the defect height.
[0007] According to some embodiments of the present application, setting the initial strict threshold, the initial balanced threshold, and the initial loose threshold according to the reasoning result includes: Grouping the defect categories to obtain the defect quantity, the defect width, and the defect height corresponding to multiple groups of defect categories; Calculate the defect area based on the defect width and the defect height; An initial strict threshold, an initial balanced threshold, and an initial loose threshold are set according to the defect category, the defect number, the defect width, the defect height, and the defect area.
[0008] According to some embodiments of the present application, the initial strict threshold, the initial balanced threshold, and the initial loose threshold are set according to the defect category, the defect number, the defect width, the defect height, and the defect area, including: Under the same defect category, the defect width, the defect height and the defect area are sorted respectively to obtain three sets of sorted defect widths, defect heights and defect areas; The initial strict threshold, the initial balanced threshold and the initial loose threshold are set according to the defect quantity and the sorted three sets of the defect width, the defect height and the defect area.
[0009] According to some embodiments of the present application, the initial strict threshold, the initial balanced threshold, and the initial loose threshold are set according to the number of defects and the sorted three sets of the defect width, the defect height, and the defect area, including: A first position is calculated based on the number of defects and a first threshold parameter, a second position is calculated based on the number of defects and a second threshold parameter, and a third position is calculated based on the number of defects and a third threshold parameter; Obtaining a first width corresponding to the first position, a second width corresponding to the second position, and a third width corresponding to the third position of the sorted defect widths, setting the first width as an initial strict width threshold, setting the second width as an initial balanced width threshold, and setting the third width as an initial loose width threshold; Obtaining a first height corresponding to the first position, a second height corresponding to the second position, and a third height corresponding to the third position of the sorted defect heights, setting the first height as an initial strict height threshold, setting the second height as an initial balanced height threshold, and setting the third height as an initial loose height threshold; Obtain a first area corresponding to the first position, a second area corresponding to the second position, and a third area corresponding to the third position of the sorted defect area, set the first area as an initial strict area threshold, set the second area as an initial balanced area threshold, and set the third area as an initial loose area threshold.
[0010] According to some embodiments of the present application, the modifying the detection parameters of the deep learning model based on the defect category according to the initial strict threshold, the initial balanced threshold, and the initial loose threshold includes at least one of the following: When the defect category is a strip defect, the detection parameters of the deep learning model are modified according to a preset width threshold and a preset height threshold; When the defect type is a point defect, the detection parameters of the deep learning model are modified according to a preset area threshold; When the defect category is neither the strip defect nor the point defect, the detection parameters of the deep learning model are modified according to the width threshold, the height threshold, and the area threshold; Among them, the width threshold includes the width initial strict threshold, the width initial balanced threshold and the width initial loose threshold, the height threshold includes the height initial strict threshold, the height initial balanced threshold and the height initial loose threshold, and the area threshold includes the area initial strict threshold, the area initial balanced threshold and the area initial loose threshold.
[0011] According to some embodiments of the present application, the method further includes: For a target defect category set in a preset specification or the defect category is a severe defect, the deep learning model parameters are used as the defect detection model parameters.
[0012] In a second aspect, an embodiment of the present application provides a controller comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes a method for constructing defect detection model parameters according to the first aspect when running the computer program.
[0013] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute a method for constructing defect detection model parameters as described in the first aspect above.
[0014] In a fourth aspect, an embodiment of the present application provides a computer program product, comprising a computer program or computer instructions, characterized in that the computer program or the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer program or the computer instructions from the computer-readable storage medium, and the processor executes the computer program or the computer instructions, so that the computer device executes a method for constructing defect detection model parameters as described in the first aspect above.
[0015] According to the technical solution of the embodiment of the present application, at least the following beneficial effects are achieved: the embodiment of the present application proposes a method, a controller, a medium and a product for constructing defect detection model parameters, the method comprising: obtaining multiple product images; inputting multiple product images into a preset deep learning model to obtain inference results, wherein the inference results include defect categories; then, setting an initial strict threshold, an initial balanced threshold and an initial loose threshold according to the inference results; finally, based on the defect category, the detection parameters of the deep learning model are corrected according to the initial strict threshold, the initial balanced threshold and the initial loose threshold to obtain defect detection model parameters. Therefore, since the present application can correct the detection parameters of the deep learning model based on the defect category and according to the initial strict threshold, the initial balanced threshold and the initial loose threshold set by the inference results to obtain the defect detection model parameters, the accuracy of the defect detection model in detecting defects can be improved.
[0016] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0018] Figure 1 is a flow chart of a method for constructing defect detection model parameters provided by an embodiment of the present application; Figure 2 is a flow chart of a method for constructing defect detection model parameters provided by another embodiment of the present application; Figure 3 is a flow chart of a method for constructing defect detection model parameters provided by another embodiment of the present application; Figure 4 is a flow chart of a method for constructing defect detection model parameters provided by another embodiment of the present application; Figure 5 is a flow chart of a method for constructing defect detection model parameters provided by another embodiment of the present application; Figure 6 is a flow chart of a method for constructing defect detection model parameters provided by another embodiment of the present application; Figure 7 is a schematic diagram of a defect detection frame provided by an embodiment of the present application; Figure 8 It is a schematic diagram of a controller for executing a method for constructing defect detection model parameters provided in one embodiment of the present application. DETAILED DESCRIPTION
[0019] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0020] In the description of the present application, it should be understood that descriptions involving orientation, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0021] In the description of this application, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0022] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.
[0023] In some cases, deep learning is increasingly being used in the field of industrial inspection, and can automatically identify defects in industrial products, such as scratches, damage, dirt, etc. Compared with traditional inspection methods, deep learning defect detection has higher flexibility and accuracy, and can adapt to complex and changing defect styles and shapes. After the deep learning model is deployed to the production site, the parameter setting method is usually based on the customer specification, combined with the trial production survey data for verification and adjustment to ensure that the inspection model meets the customer's quality standards. However, this method has some shortcomings: trial production debugging is time-consuming and costly, parameter settings rely on specifications and are difficult to cover subtle differences in actual production, and the feedback cycle is long, making it difficult to respond to changes in the production environment and customer needs in a timely manner.
[0024] Therefore, how to realize the construction of defect detection model parameters based on deep learning is the main problem currently facing the industry.
[0025] Based on the above situation, the embodiments of the present application propose a method for constructing defect detection model parameters, a controller, a medium and a product, aiming to improve the accuracy of defect detection by the defect detection model.
[0026] The following further describes various embodiments of a method for constructing defect detection model parameters of the present application in conjunction with the accompanying drawings.
[0027] like Figure 1 As shown, Figure 1 It is a flowchart of a method for constructing defect detection model parameters provided by an embodiment of the present application; the method for constructing defect detection model parameters may include but is not limited to step S110, step S120, step S130 and step S140.
[0028] Step S110, obtaining multiple product images; Step S120: input multiple product images into the deep learning model to obtain inference results, wherein the inference results include defect categories; Step S130: setting an initial strict threshold, an initial balanced threshold, and an initial loose threshold according to the inference result; Step S140: Based on the defect category, the detection parameters of the deep learning model are corrected according to the initial strict threshold, the initial balanced threshold, and the initial loose threshold to obtain defect detection model parameters.
[0029] In one embodiment, first, multiple images of products with defects are obtained; then, the multiple product images are input into a deep learning model to obtain inference results, wherein the inference results include defect categories; then, an initial strict threshold, an initial balanced threshold, and an initial loose threshold are set according to the inference results; finally, based on the defect category, the detection parameters of the deep learning model are corrected according to the initial strict threshold, the initial balanced threshold, and the initial loose threshold to obtain defect detection model parameters.
[0030] It is understandable that the multiple product images in the embodiments of the present application are comprehensive and representative, covering multiple types of defects, including different defect categories, forms and severity, and covering multiple product models; in addition, the product images are collected under different lighting conditions. Therefore, it is possible to provide more comprehensive information for subsequent data processing, thereby correcting the detection parameters of the deep learning model, obtaining the defect detection model parameters, and further improving the accuracy of the defect detection model in detecting defects, so as to meet the needs of various actual production environments.
[0031] It can be understood that by correcting the detection parameters of the deep learning model through the initial strict threshold, the defect detection model's ability to recognize defects can be improved, and more minor defects can be detected, ensuring that even tiny flaws will not be ignored. Therefore, the accuracy of the defect detection model in detecting defects can be improved.
[0032] It can be understood that by correcting the detection parameters of the deep learning model through the initial balance threshold, the obtained defect detection model parameters can detect more defects while ensuring quality.
[0033] It can be understood that by correcting the detection parameters of the deep learning model through the initial loose threshold, the obtained defect detection model parameters can ignore minor defects that have little impact on product quality, thereby improving production efficiency.
[0034] It is worth noting that since the present application can correct the detection parameters of the deep learning model based on the defect category and according to the initial strict threshold, initial balanced threshold and initial loose threshold set by the reasoning results, the defect detection model parameters can be obtained, thereby improving the accuracy of the defect detection model in detecting defects.
[0035] In addition, if Figure 2 As shown, Figure 2 It is a flowchart of a method for constructing defect detection model parameters provided by another embodiment of the present application; regarding the above-mentioned step S120 of inputting multiple product images into a preset deep learning model to obtain inference results, it may include but is not limited to step S210 and step S220.
[0036] Step S210: input multiple product images into the deep learning model; Step S220: perform defect detection on multiple product images using a target detection algorithm to obtain confidence, defect category, defect width and defect height.
[0037] In one embodiment, first, the embodiment of the present application inputs multiple acquired product images into a deep learning model, and then the target detection algorithm of the deep learning model performs defect detection on the multiple product images, thereby outputting confidence, defect category, defect width and defect height.
[0038] It can be understood that the inference results include defect category, confidence, defect width, and defect height.
[0039] It can be understood that the confidence level indicates the reliability of the deep learning model's detection results for the product image, which is between 0 and 1. The higher the value, the stronger the model's confidence in the existence of the defect.
[0040] It can be understood that the defect width and the defect height represent the size of the detection frame respectively.
[0041] It can be understood that the embodiment of the present application performs defect detection on multiple product images through a target detection algorithm to obtain inference results, thereby providing important information for subsequent data analysis and correction of detection parameters of the deep learning model, thereby promoting the construction of defect detection model parameters to improve the accuracy of defect detection model in detecting defects.
[0042] In addition, if Figure 3 As shown, Figure 3 It is a flowchart of a method for constructing defect detection model parameters provided by another embodiment of the present application; regarding the above-mentioned step S130, it may include but is not limited to step S310, step S320 and step S330.
[0043] Step S310, grouping defect categories to obtain defect quantities, defect widths, and defect heights corresponding to multiple groups of defect categories; Step S320, calculating according to the defect width and the defect height to obtain the corresponding defect area; Step S330 , setting an initial strict threshold, an initial balanced threshold, and an initial loose threshold according to the defect type, defect number, defect width, defect height, and defect area.
[0044] In one embodiment, the embodiments of the present application are grouped according to defect categories to obtain the defect quantity, defect width and defect height corresponding to multiple groups of defect categories; then, in each group of defect categories, the defect width and defect height under the defect category are calculated to obtain the corresponding defect area; finally, the initial strict threshold, initial balanced threshold and initial loose threshold are set according to the defect category, defect quantity, defect width, defect height and defect area.
[0045] It can be understood that the defect area is the area of the detection frame, and the value is equal to the product of the defect height and the defect width.
[0046] In addition, if Figure 4 As shown, Figure 4 It is a flowchart of a method for constructing defect detection model parameters provided by another embodiment of the present application; regarding the above-mentioned step S330, it may include but is not limited to step S410 and step S420.
[0047] Step S410: Under the same defect category, the defect width, defect height and defect area are sorted respectively to obtain three sets of sorted defect width, defect height and defect area; Step S420: setting an initial strict threshold, an initial balanced threshold and an initial loose threshold according to the number of defects and the sorted three sets of defect width, defect height and defect area.
[0048] It is understandable that the embodiment of the present application will sort the defect width, defect height and defect area respectively under the same defect category, so as to set the initial strict threshold, initial balance threshold and initial loose threshold according to the number of defects and the three sets of defect width, defect height and defect area after sorting. Therefore, the embodiment of the present application can correct the detection parameters of the deep learning model according to the initial strict threshold, initial balance threshold and initial loose threshold based on the defect category, so as to obtain the defect detection model parameters, and then improve the accuracy of the defect detection model in detecting defects.
[0049] In addition, if Figure 5 As shown, Figure 5 It is a flowchart of a method for constructing defect detection model parameters provided by another embodiment of the present application; regarding the above-mentioned step S420, it may include but is not limited to step S510, step S520, step S530 and step S540.
[0050] Step S510, calculating a first position according to the number of defects and a first threshold parameter, calculating a second position according to the number of defects and a second threshold parameter, and calculating a third position according to the number of defects and a third threshold parameter; Step S520, obtaining the first width corresponding to the first position, the second width corresponding to the second position, and the third width corresponding to the third position of the sorted defect widths, setting the first width as the initial strict width threshold, setting the second width as the initial balanced width threshold, and setting the third width as the initial loose width threshold; Step S530, obtaining the first height corresponding to the first position, the second height corresponding to the second position, and the third height corresponding to the third position of the sorted defect heights, setting the first height as the initial strict height threshold, setting the second height as the initial balanced height threshold, and setting the third height as the initial loose height threshold; Step S540, obtain the first area corresponding to the first position, the second area corresponding to the second position, and the third area corresponding to the third position of the sorted defect areas, set the first area as the initial strict area threshold, set the second area as the initial balanced area threshold, and set the third area as the initial loose area threshold.
[0051] It can be understood that the above-mentioned first threshold parameter, second threshold parameter and third threshold parameter can be set according to actual needs, and the present application does not specifically limit the size of the first threshold parameter, the second threshold parameter and the third threshold parameter.
[0052] Exemplarily, the number of defects is 300, the first threshold parameter is 98%, the second threshold parameter is 95%, the third threshold parameter is 92%, the product of 300 and 98% is 294, the product of 300 and 95% is 285, and the product of 300 and 92% is 276; the values at position 294 of the sorted defect width, defect height and defect area are set as the initial strict threshold of width, the initial strict threshold of height and the initial strict threshold of area respectively; and the values at position 285 of the sorted defect width, defect height and defect area are set as the initial balance threshold of width, the initial balance threshold of height and the initial balance threshold of area respectively; and the values at position 276 of the sorted defect width, defect height and defect area are set as the initial loose threshold of width, the initial loose threshold of height and the initial loose threshold of area respectively.
[0053] It is understandable that if the product of the number of defects and the first threshold parameter or the second threshold parameter or the third threshold parameter is a decimal, it needs to be rounded up to ensure the final detection rate of the defect detection model.
[0054] In addition, if Figure 6 As shown, Figure 6It is a flowchart of a method for constructing defect detection model parameters provided by another embodiment of the present application; regarding the defect category in the above step S140, the detection parameters of the deep learning model are corrected according to the initial strict threshold, the initial balanced threshold and the initial loose threshold, which may include but are not limited to step S610, step S620 and step S630.
[0055] Step S610: When the defect type is a strip defect, the detection parameters of the deep learning model are corrected according to a preset width threshold and a preset height threshold; Step S620: When the defect type is a point defect, the detection parameters of the deep learning model are corrected according to a preset area threshold; Step S630: When the defect category is a non-strip defect or a point defect, the detection parameters of the deep learning model are modified according to the width threshold, the height threshold, and the area threshold; It can be understood that the width threshold includes the width initial strict threshold, the width initial balanced threshold and the width initial loose threshold, the height threshold includes the height initial strict threshold, the height initial balanced threshold and the height initial loose threshold, and the area threshold includes the area initial strict threshold, the area initial balanced threshold and the area initial loose threshold.
[0056] It is understandable that the area of the detection frame of the strip defect will fluctuate greatly depending on the angle. Therefore, the detection result is not limited by the area threshold, but the detection parameters of the deep learning model are corrected by the width threshold and the height threshold.
[0057] It is understandable that for point defects, a single width and height cannot fully reflect the severity of the defect. The area can better reflect the actual impact of the defect on the product appearance and function. A larger area means a more significant degree of damage, which cannot be reflected by width and height. Therefore, the detection results are not restricted by width thresholds and height thresholds, but the detection parameters of the deep learning model are corrected by area thresholds.
[0058] It can be understood that for non-strip defects and point defects, it is necessary to simultaneously select the width threshold, height threshold and area threshold to correct the detection parameters of the deep learning model.
[0059] In addition, it should be noted that for a target defect category set in a preset specification or a defect category that is a severe defect, the preset deep learning model parameters are used as defect detection model parameters.
[0060] It can be understood that for the target defect category set in the preset specification or the defect category is a serious defect, the width threshold, height threshold and area threshold are not selected to correct the detection parameters of the deep learning model, so that the defect detection model will not limit the detection of this category.
[0061] Based on the above-mentioned methods for constructing defect detection model parameters in each of the above-mentioned embodiments, overall embodiments of the method for constructing defect detection model parameters of the present application are respectively proposed below.
[0062] 1) Prepare deep learning models to be deployed at the production site, as well as images of products with defects. These product images should be comprehensive and representative, covering multiple types of defects, including different defect categories, forms, and severity. In addition, to ensure the wide applicability of the data, images collected under different lighting conditions and test data for different product models should also be considered. This will provide more comprehensive information for subsequent data analysis, making the detection parameters of the final defect detection model more adaptable and flexible to meet the needs of various actual production environments.
[0063] 2) The deep learning model infers all product images and generates inference results. During this process, the model's target detection algorithm outputs multiple parameters for each detected defect, including confidence, defect category, width, and height. Among them, confidence indicates the reliability of the model for the detection result, which is between 0 and 1. The higher the value, the stronger the model's confidence in the existence of the defect; width and height represent the size of the detection box, such as Figure 7 As shown in the figure, assuming that the black triangle is a defect, the detection box of the model is the minimum circumscribed rectangle of the defect parallel to the coordinate axis; the area is the area of the detection box. These inference results provide important basic information for subsequent data analysis and model parameter correction, enabling the model to more accurately identify and locate different types of defects.
[0064] 3) Set the initial strict threshold, initial balanced threshold and initial loose threshold.
[0065] a) Under the initial strict threshold: The model has very high requirements for defect recognition and can detect more minor defects to ensure that even tiny flaws are not ignored, thereby ensuring high product quality. In this example, 98% of defects can be detected under the initial strict threshold; b) Initial balance threshold: The model seeks a reasonable compromise between recognition accuracy and missed detection risk, and can detect an appropriate amount of defects while maintaining a certain quality standard. In this example, 95% of defects can be detected under the initial balance threshold; c) Initial loose threshold: The detection requirements of the model are relatively low, allowing some minor defects that have little impact on product quality to be ignored, thereby improving production efficiency. In this example, 92% of the defects can be detected under the initial loose threshold.
[0066] 4) Perform statistics on the model inference results.
[0067] The model inference results of the same defect category are grouped together, and the defect width, defect height, and defect area are counted for each group of defects. Then, the three features are sorted in descending order, and the value at the 98% position is used as the "initial strict threshold", the value at the 95% position is used as the "initial balanced threshold", and the value at the 92% position is used as the "initial loose threshold". For example: Assume that the deep learning model can detect three defect categories (category A, category B, and category C). After the model infers the product image, 1,200 inference results are obtained. The distribution under each category name is: the number of defects in category A is 300, the number of defects in category B is 400, and the number of defects in category C is 500.
[0068] The number of defects in category A is 300, and each defect has three parameters: defect width, defect height, and defect area. First, sort the 300 defect width values from large to small. The 98% position of 300 is 294, and the 294th value after sorting is used as the initial strict threshold of the width of category A; the 95% position of 300 is 285, and the 285th value after sorting is used as the initial balanced threshold of the width of category A; the 92% position of 300 is 276, and the 276th value after sorting is used as the initial loose threshold of the width of category A. According to the operation steps for width, the initial strict threshold, initial balanced threshold, and initial loose threshold of defect height and defect area are calculated respectively.
[0069] According to the operation steps of category A, the initial strict threshold, initial balanced threshold, and initial loose threshold of the width, height, and area of category B and category C are calculated respectively.
[0070] In particular, if the result of multiplying the number of a category by the detection threshold is a decimal, it needs to be rounded up to ensure that the final detection rate is not less than the initial strict threshold, the initial balanced threshold, and the initial loose threshold. For example, when calculating the initial balanced threshold, the number of detections of a category is 111, and the result of multiplying it by 95% is 105.45. If it is rounded up to 106, the actual detection rate is 106 / 111×100%=95.49%, while if it is rounded down to 105, the actual detection rate is 105 / 111×100%=94.59%, which is less than the initial balanced threshold.
[0071] 5) Correct the detection parameters of the deep learning model. The correction of the detection parameters of the deep learning model needs to fully consider the actual form of the defect and the requirements of the specification. The specific rules are as follows: a) For defect categories that must be detected as required by the specification or that seriously affect product quality, do not select any of the detection parameters in the width threshold, height threshold, or area threshold to correct the detection parameters of the deep learning model. In this way, the defect detection model parameters obtained will not restrict the detection of this category; b) The area of the detection box of strip defects will fluctuate greatly with different angles. Therefore, instead of limiting the detection results by the area threshold, the detection parameters of the deep learning model are corrected by the width threshold and the height threshold. c) For point defects, the single width and height cannot fully reflect the severity of the defect. The area can better reflect the actual impact of the defect on the appearance and function of the product. A larger area means a more significant degree of damage, which cannot be reflected by width and height. Therefore, instead of limiting the detection results by using the width threshold and height threshold, the detection parameters of the deep learning model are corrected by using the area threshold; d) For defects of other forms, it is necessary to select the width threshold, height threshold, and area threshold at the same time to correct the detection parameters of the deep learning model.
[0072] Based on a method for constructing defect detection model parameters in each of the above-mentioned embodiments, various embodiments of a controller, a computer-readable storage medium, and a computer program product of the present application are respectively proposed below.
[0073] like Figure 8 As shown, Figure 8 700 is a schematic diagram of a controller for executing a method for constructing defect detection model parameters provided by an embodiment of the present application. The controller 700 implemented in the present application includes: a processor 710, a memory 720, and a computer program stored in the memory 720 and executable on the processor 710, wherein: Figure 8 In the figure, a processor 710 and a memory 720 are taken as an example.
[0074] The processor 710 and the memory 720 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0075] The memory 720, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 720 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 720 optionally includes a memory 720 remotely arranged relative to the processor 710, and these remote memories 720 can be connected to the controller 700 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0076] Those skilled in the art will understand that Figure 8 The device structure shown in the figure does not constitute a limitation on the controller 700, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0077] exist Figure 8 In the controller 700 shown, the processor 710 can be used to call the control program stored in the memory 720, so as to implement the above-mentioned method for constructing a defect detection model parameter. Specifically, the non-transient software program and instructions required to implement the method for constructing a defect detection model parameter of the above-mentioned embodiment are stored in the memory 720, and when executed by the processor 710, the method for constructing a defect detection model parameter of the above-mentioned embodiment is executed.
[0078] It is worth noting that since the controller 700 of the embodiment of the present application can execute a method for constructing defect detection model parameters of any of the above-mentioned embodiments, the specific implementation methods and technical effects of the controller 700 of the embodiment of the present application can refer to the specific implementation methods and technical effects of a method for constructing defect detection model parameters of any of the above-mentioned embodiments.
[0079] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute the above-mentioned method for constructing a defect detection model parameter. Figures 1 to 6 The method steps in .
[0080] It is worth noting that since the computer-readable storage medium of the embodiment of the present application can execute a method for constructing defect detection model parameters of any of the above-mentioned embodiments, the specific implementation methods and technical effects of the computer-readable storage medium of the embodiment of the present application can refer to the specific implementation methods and technical effects of a method for constructing defect detection model parameters of any of the above-mentioned embodiments.
[0081] In addition, an embodiment of the present application further provides a computer program product, including a computer program or a computer instruction, the computer program or the computer instruction is stored in a computer-readable storage medium, the processor of the computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device executes the above-mentioned method for constructing a defect detection model parameter. Exemplarily, the above-described Figures 1 to 6 The method steps in .
[0082] It is worth noting that since the computer program product of the embodiment of the present application can execute a method for constructing a defect detection model parameter of any of the above-mentioned embodiments, the specific implementation manner and technical effects of the computer program product of the embodiment of the present application can refer to the specific implementation manner and technical effects of a method for constructing a defect detection model parameter of any of the above-mentioned embodiments.
[0083] It will be appreciated by those skilled in the art that all or some of the steps and systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0084] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0085] In several embodiments provided in the present application, it should be understood that the disclosed systems, apparatuses and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of apparatuses or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0086] It should also be understood that the various implementations provided in the embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0087] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the field can also make various equivalent modifications or substitutions under the shared conditions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A method for constructing defect detection model parameters, characterized in that: The method comprises: Get multiple product images; Inputting a plurality of product images into a deep learning model to obtain an inference result, wherein the inference result includes a defect category; According to the inference result, an initial strict threshold, an initial balanced threshold and an initial loose threshold are set; Based on the defect category, the detection parameters of the deep learning model are modified according to the initial strict threshold, the initial balanced threshold, and the initial loose threshold to obtain defect detection model parameters.
2. A method for constructing defect detection model parameters according to claim 1, characterized in that: The inference result also includes confidence, defect width and defect height. The multiple product images are input into the deep learning model to obtain the inference result, including: The multiple product images are input into a deep learning model, and defect detection is performed on the multiple product images using a target detection algorithm to obtain the confidence level, the defect category, the defect width, and the defect height.
3. A method for constructing defect detection model parameters according to claim 2, characterized in that: The setting of the initial strict threshold, the initial balanced threshold and the initial loose threshold according to the reasoning result includes: Grouping the defect categories to obtain the defect quantity, the defect width, and the defect height corresponding to multiple groups of defect categories; Calculate the defect area based on the defect width and the defect height; An initial strict threshold, an initial balanced threshold, and an initial loose threshold are set according to the defect category, the defect number, the defect width, the defect height, and the defect area.
4. A method for constructing defect detection model parameters according to claim 3, characterized in that: The setting of the initial strict threshold, the initial balanced threshold and the initial loose threshold according to the defect type, the defect number, the defect width, the defect height and the defect area includes: Under the same defect category, the defect width, the defect height and the defect area are sorted respectively to obtain three sets of sorted defect widths, defect heights and defect areas; The initial strict threshold, the initial balanced threshold and the initial loose threshold are set according to the defect quantity and the sorted three sets of the defect width, the defect height and the defect area.
5. A method for constructing defect detection model parameters according to claim 4, characterized in that: The setting of the initial strict threshold, the initial balanced threshold and the initial loose threshold according to the number of defects and the sorted three sets of the defect width, the defect height and the defect area includes: A first position is calculated based on the number of defects and a first threshold parameter, a second position is calculated based on the number of defects and a second threshold parameter, and a third position is calculated based on the number of defects and a third threshold parameter; Obtaining a first width corresponding to the first position, a second width corresponding to the second position, and a third width corresponding to the third position of the sorted defect widths, setting the first width as an initial strict width threshold, setting the second width as an initial balanced width threshold, and setting the third width as an initial loose width threshold; Obtaining a first height corresponding to the first position, a second height corresponding to the second position, and a third height corresponding to the third position of the sorted defect heights, setting the first height as an initial strict height threshold, setting the second height as an initial balanced height threshold, and setting the third height as an initial loose height threshold; Obtain a first area corresponding to the first position, a second area corresponding to the second position, and a third area corresponding to the third position of the sorted defect area, set the first area as an initial strict area threshold, set the second area as an initial balanced area threshold, and set the third area as an initial loose area threshold.
6. A method for constructing defect detection model parameters according to claim 5, characterized in that: The modifying the detection parameters of the deep learning model based on the defect category according to the initial strict threshold, the initial balanced threshold, and the initial loose threshold includes at least one of the following: When the defect category is a strip defect, the detection parameters of the deep learning model are modified according to a preset width threshold and a preset height threshold; When the defect type is a point defect, the detection parameters of the deep learning model are modified according to a preset area threshold; When the defect category is neither the strip defect nor the point defect, the detection parameters of the deep learning model are modified according to the width threshold, the height threshold, and the area threshold; Among them, the width threshold includes the width initial strict threshold, the width initial balanced threshold and the width initial loose threshold, the height threshold includes the height initial strict threshold, the height initial balanced threshold and the height initial loose threshold, and the area threshold includes the area initial strict threshold, the area initial balanced threshold and the area initial loose threshold.
7. The method for constructing defect detection model parameters according to claim 1, characterized in that: The method further comprises: For a target defect category set in a preset specification or the defect category is a severe defect, the deep learning model parameters are used as the defect detection model parameters.
8. A controller, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for constructing defect detection model parameters as described in any one of claims 1 to 7 when executing the computer program.
9. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute the method for constructing defect detection model parameters as described in any one of claims 1 to 7.
10. A computer program product comprising a computer program or computer instructions, characterized in that The computer program or the computer instructions are stored in a computer-readable storage medium, and the processor of a computer device reads the computer program or the computer instructions from the computer-readable storage medium. The processor executes the computer program or the computer instructions, so that the computer device executes the method for constructing defect detection model parameters as described in any one of claims 1 to 7.
Citation Information
Cited By
Model parameter automatic adjustment method and device
CN120747059A
Model parameter automatic adjustment method and device
CN120747059B
Precast beam concrete defect pouring parameter determination method, device, equipment and medium
CN121562841A