A product defect detection method and related device

By using a generative adversarial ternary model (GAT) for viewpoint generation and correction, combined with closed-loop detection based on defect confidence, the problem of insufficient intelligence in machine vision inspection is solved, and the comprehensiveness and accuracy of product inspection are achieved.

CN122391089APending Publication Date: 2026-07-14TIANJIN LONGSURE ROBOTICS TECH CO LTD +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TIANJIN LONGSURE ROBOTICS TECH CO LTD
Filing Date
2026-03-30
Publication Date
2026-07-14

Smart Images

  • Figure CN122391089A_ABST
    Figure CN122391089A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a product defect detection method and related equipment, and belongs to the technical field of machine learning. The method comprises the following steps: acquiring product data to be detected; inputting the product data to be detected into a trained product defect detection model for defect detection to obtain a product defect detection result; the product defect detection model is obtained through the following steps: performing multiple detection planning on training data of the product to be detected to generate different viewpoint detection schemes; performing defect detection on the product to be detected according to different detection schemes to obtain different detection results; performing multiple parameter adjustments on the product defect detection model according to the detection results until the defect confidence of the detection result is greater than a preset value, and finally taking the adjusted product defect detection model as the trained product defect detection model. The embodiment of the application can improve the comprehensiveness and accuracy of product detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine learning technology, and in particular to a product defect detection method and related equipment. Background Technology

[0002] In industrial manufacturing, surface defect detection is a crucial aspect of quality control. Currently, the mainstream methods for product defect detection include manual inspection and machine vision inspection. Manual inspection relies on visual judgment under specific lighting conditions, which has drawbacks such as low efficiency, high subjectivity, and the potential for prolonged observation to damage the eyesight of inspectors. In contrast, machine vision inspection has been widely used in manufacturing due to its advantages such as non-contact measurement, non-destructive testing, high inspection speed, and objective results. However, related machine vision inspections often simply follow prescribed trajectories, lacking intelligence and comprehensive product inspection, which can easily lead to lower accuracy in product defect detection.

[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention

[0004] The main objective of this application is to propose a product defect detection method and related equipment, which can improve the comprehensiveness and accuracy of product detection.

[0005] To achieve the above objectives, one aspect of this application provides a product defect detection method, the method comprising: Obtain data on the product to be tested; The product data to be detected is input into the trained product defect detection model to perform defect detection and obtain the product defect detection result. The product defect detection model is trained through the following steps: Develop a testing plan based on the training data of the product to be tested, and generate a first-viewpoint testing scheme. Defect detection is performed on the product to be inspected according to the first viewpoint detection scheme to obtain initial detection results; The defects in the initial detection results are analyzed for defect confidence to obtain the defect confidence level. If the defect confidence level is less than a preset value, the parameters of the product defect detection model are adjusted according to the initial detection results; the adjusted product defect detection model is used to perform secondary detection planning on the product data to be detected, and a second viewpoint detection scheme is generated to perform secondary defect detection until the defect confidence level is greater than the preset value. If the confidence level of the defect is greater than the preset value, the adjusted product defect detection model will be used as the trained product defect detection model.

[0006] In some embodiments, the product defect detection model includes a generative adversarial ternary model, wherein the step of performing detection planning on the training data of the product to be detected to generate a first viewpoint detection scheme includes: The first viewpoint detection scheme is obtained by using the trained generative adversarial ternary model to perform detection planning on the product data to be detected.

[0007] In some embodiments, the generative adversarial triadic model includes a viewpoint generation model and a viewpoint correction model, and the generative adversarial triadic model is trained through the following steps: The training data is input into the viewpoint generation model to generate a viewpoint, resulting in a first viewpoint output. The first viewpoint output is corrected using a viewpoint correction model to obtain the second viewpoint output; With the goal of minimizing the error between the first viewpoint output and the second viewpoint output, the viewpoint generation model is initialized with parameters based on the second viewpoint output to obtain a trained adversarial ternary model.

[0008] In some embodiments, before performing defect confidence analysis on the defects in the initial detection results, the method further includes: Defect analysis is performed on the initial detection results to determine whether there are defects in the initial detection results, and the probability of the presence of defects within the defect detection frame and the area of ​​the defect detection frame are obtained.

[0009] In some embodiments, performing defect confidence analysis on the defects in the initial detection results to obtain defect confidence includes: The intersection-union ratio (IU) is calculated by combining the area of ​​the defect detection box with the area of ​​the ground truth boxes in the training data. The confidence level of the defect is obtained by calculating the confidence level based on the probability of the presence of a defect within the defect detection frame and the cross-union ratio.

[0010] In some embodiments, the step of inputting the training data into the viewpoint generation model to generate a viewpoint and obtain a first viewpoint output is as follows: ; Where x represents the training data, y represents the output of the first viewpoint, and ReLU() represents the ReLU activation function. , , and These represent different parameters of the viewpoint generation model.

[0011] To achieve the above objectives, another aspect of this application provides a product defect detection device, the device comprising: The acquisition module is used to acquire data on the product to be tested. The detection module is used to input the product data to be detected into the trained product defect detection model to perform defect detection and obtain the product defect detection results.

[0012] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.

[0013] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods described above.

[0014] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer program product, including a computer program that, when executed by a processor, implements the aforementioned method.

[0015] The embodiments of this application include at least the following beneficial effects: This application provides a product defect detection method, apparatus, electronic device, storage medium, and program product. In training a product defect detection model, this solution generates a first-viewpoint detection scheme by performing detection planning on training data of the product to be tested; performs defect detection on the product to be tested according to the first-viewpoint detection scheme to obtain initial detection results; performs defect confidence analysis on the defects in the initial detection results to obtain defect confidence; uses the defect confidence as a criterion; if the defect confidence is less than a preset value, the parameters of the product defect detection model are adjusted according to the initial detection results; the adjusted product defect detection model performs secondary detection planning on the data of the product to be tested to generate a second-viewpoint detection scheme for secondary defect detection until the defect confidence is greater than the preset value. This solution achieves closed-loop detection of the product defect detection model through defect confidence. A defect confidence less than the preset value indicates that the initial detection results cannot be completely determined, and a second-viewpoint detection scheme is generated to re-detect the product to be tested. This allows for comprehensive detection of the product from different viewpoints, simulating human detection, realizing intelligent product detection, and improving the comprehensiveness and accuracy of product defect detection. Attached Figure Description

[0016] Figure 1 This is a flowchart of the product defect detection method provided in the embodiments of this application; Figure 2 This is a schematic diagram illustrating the operation of the viewpoint generation model provided in the embodiments of this application; Figure 3 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.

[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0019] In industrial manufacturing, surface defect detection is a crucial aspect of quality control. With increasing social productivity and rising consumer demands for product quality, accurate surface defect detection has become a core challenge for manufacturers. Defects such as pitting, scratches, shrinkage marks, cold indentations, and impact damage are prone to occur during manufacturing, processing, and transportation. These defects not only affect the product's appearance but also reduce its mechanical properties and user experience. Therefore, efficient defect detection for these products is essential for determining product yield and guiding subsequent processing procedures.

[0020] Currently, mainstream product defect detection methods include manual inspection and machine vision inspection. Manual inspection relies on visual judgment under specific lighting conditions, which has drawbacks such as low efficiency, high subjectivity, and the potential for prolonged observation to damage the inspector's eyesight. In contrast, machine vision inspection, due to its advantages of non-contact measurement, non-destructive testing, high inspection speed, and objective results, has been widely used in manufacturing. Integrating robots and vision systems into robotic vision inspection systems significantly improves inspection flexibility, while also increasing efficiency and reducing costs, and providing more accurate, data-driven inspection results. However, it is not comprehensive enough for all product inspections, which can lead to lower accuracy in product defect detection.

[0021] The robot inspection systems of related technologies simply perform inspections according to a prescribed trajectory, lacking intelligence.

[0022] In view of this, this application provides a product defect detection method. The defect confidence level enables closed-loop detection of the product defect detection model. If the defect confidence level is less than a preset value, it indicates that the initial detection result cannot be completely determined. A second viewpoint detection scheme is then generated to re-detect the product under test. The product is detected comprehensively from different viewpoints, simulating human detection, thereby realizing intelligent product detection and improving the comprehensiveness and accuracy of product defect detection.

[0023] The product defect detection method provided in this application relates to the field of machine learning technology. This product defect detection method can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or in-vehicle terminal, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the product defect detection method, but is not limited to the above forms.

[0024] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0025] Figure 1 This is an optional flowchart of the product defect detection method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S102.

[0026] Step S101: Obtain the product data to be tested; Step S102: Input the product data to be detected into the trained product defect detection model to perform defect detection and obtain the product defect detection result.

[0027] The training method for the product defect detection model may include, but is not limited to, steps S103 to S108: Step S103: Perform detection planning on the training data of the product to be tested and generate a first-viewpoint detection plan; Step S104: Perform defect detection on the product to be inspected according to the first viewpoint inspection plan to obtain the initial inspection results; Step S105: Perform a defect confidence analysis on the defects in the initial detection results to obtain the defect confidence level; Step S106: If the defect confidence level is less than the preset value, adjust the parameters of the product defect detection model according to the initial detection results. Step S107: The adjusted product defect detection model is used to perform secondary detection planning on the product data to be inspected, and a second viewpoint detection scheme is generated to perform secondary defect detection until the defect confidence level is greater than the preset value. Step S108: If the defect confidence level is greater than the preset value, the adjusted product defect detection model is used as the trained product defect detection model.

[0028] Steps S101 to S108 as shown in the embodiments of this application realize closed-loop detection of product defect detection model through defect confidence. If the defect confidence is less than the preset value, it means that the initial detection result cannot be completely determined. A second viewpoint detection scheme is generated to re-inspect the product under test. The product is detected comprehensively from different viewpoints, simulating human detection, realizing intelligent product detection, and improving the comprehensiveness and accuracy of product defect detection.

[0029] In some embodiments, step S103 may include, but is not limited to, step S311: Step S311: The trained generative adversarial ternary model is used to plan the detection of the product data to be detected, and a first-viewpoint detection scheme is obtained.

[0030] In step S311 of some embodiments, the product data to be inspected can be a CAD (Computer-Aided Design) model of the product to be inspected, and the first viewpoint inspection scheme can represent an inspection planning scheme under a certain viewpoint, serving as a reference for subsequent machine inspection. In manual inspection, for objects with curved surfaces or irregular shapes, inspectors will change the position of the object to observe defects. The change in the object's position will cause light to be reflected into the inspector's field of vision. This means that the viewpoint (the relationship between the light source, camera, and object) must be determined based on the size and shape of the object. Theoretically, multiple viewpoints may exist for a single surface. Therefore, this embodiment generates viewpoints by developing a data acquisition system and machine learning methods, thereby extracting knowledge from manual inspection. However, this viewpoint generation process requires a large dataset. Since the CAD model of the object to be inspected is available, this embodiment utilizes this model, combined with knowledge from manual inspection, to assist in viewpoint generation, reducing the required dataset. Therefore, viewpoint generation is performed using a Generative Adversarial Tri-model (GAT).

[0031] In some embodiments, the generative adversarial triad model includes a viewpoint generation model and a viewpoint correction model, and the generative adversarial triad model can be trained through steps S321 to S323: Step S321: Input the training data into the viewpoint generation model to generate viewpoints and obtain the first viewpoint output; Step S322: Correct the first viewpoint output using the viewpoint correction model to obtain the second viewpoint output; Step S323: With the goal of minimizing the error between the first viewpoint output and the second viewpoint output, the parameters of the viewpoint generation model are initialized based on the second viewpoint output to obtain the trained adversarial ternary model.

[0032] In steps S321 to S323 of some embodiments, the viewpoint generation model is data-driven. This is a machine learning model (typically a neural network) that generates an initial sequence of robot inspection viewpoints by learning from and mimicking demonstration data from human inspectors (such as workpiece image camera poses). In the GAT, this model acts as the generator (G). The viewpoint correction model is model-driven. This is an analytical model whose core knowledge comes from the workpiece's CAD model. The viewpoint correction model encodes physical rules and constraints (such as lighting and collision-free robot reachability) and is used to validate, optimize, and correct the viewpoints generated by the data-driven model. In the GAT, this model acts as an adversary (A).

[0033] The loss function is calculated based on the first and second viewpoint outputs to obtain the total loss value. When the total loss value exceeds a certain threshold, the parameters of the viewpoint generation model are calculated based on the modified second viewpoint output and training data, thereby initializing the viewpoint generation model and obtaining an adjusted viewpoint generation model. The training data is then input into the adjusted viewpoint generation model to obtain the third viewpoint output, which is then corrected. This process is repeated until the total loss value is less than a certain threshold, or the loss no longer decreases significantly after multiple iterations. After convergence, the parameters of G have incorporated the constraint knowledge of A, and the output of G will simultaneously satisfy the requirements of both data-driven and model-generated viewpoints.

[0034] GAT also includes a Tri-model, which means that the operation of the entire system is monitored and controlled by a Discrete Event Dynamic System (DEDS), so that GAT can converge stably during training.

[0035] GAT essentially combines human experience (physical models) with AI's learning ability (neural networks). Through digital twin technology, it repeatedly simulates, plays games, and optimizes in a computer, ultimately "forging" a detection scheme that performs well in reality.

[0036] In some embodiments, please refer to Figure 2 Step S321 is shown in the following formula: ; Where x represents the training data, y represents the first viewpoint output, and ReLU() represents the ReLU activation function. , , and These represent different parameters of the viewpoint generation model.

[0037] Specifically, in GAT training, the viewpoint correction model corrects the first viewpoint output y to obtain the second viewpoint output y1. When the total loss of y and y1 exceeds a certain set threshold, the new weights of the viewpoint generation model are calculated back based on y1 and x. and and bias and This allows for parameter initialization of the viewpoint generation model.

[0038] In some embodiments, the method further includes step S150 before performing step S105: Step S150: Perform defect analysis on the initial detection results to determine whether there are defects in the initial detection results, and obtain the probability of the presence of defects within the defect detection frame and the area of ​​the defect detection frame.

[0039] In step SS150 of some embodiments, the initial detection result can be a detection image. Machine learning is used to find the location of possible defects in the image, the defect detection box locks the location of the defect, and the probability of the presence of a defect within the defect detection box and the area of ​​the defect detection box are given as the basis for subsequent defect confidence calculation.

[0040] In some embodiments, step S105 may include, but is not limited to, steps S501 to S502: Step S501: Calculate the intersection-union ratio (IU) based on the area of ​​the defect detection box and the area of ​​the real box in the training data. Step S502: Calculate the confidence level based on the probability of a defect existing in the defect detection frame and the cross-union ratio to obtain the defect confidence level.

[0041] In steps S501 to S502 of some embodiments, the formula for calculating the defect confidence level is as follows: Defect confidence = Pr(0bject) * IOU(true, pred) Here, Pr(Object) is the probability that an object exists within the bounding box. If the object within the bounding box is certain, then Pr(Object) = 1; if there is no object at all, then Pr(Object) = 0; otherwise, Pr(Object) is a value between 0 and 1. IOU(true, pred) is the intersection-union ratio of the ground truth bounding box and the predicted bounding box, that is, the ratio of the intersection area of ​​the predicted bounding box to the union area of ​​the ground truth bounding box. The defect confidence score serves as the basis for judging the next step of model parameter tuning.

[0042] In steps S106 and S105 of some embodiments, if the defect confidence level is less than a preset value, it indicates that the detection accuracy of the model is insufficient, and further model parameter tuning is required. The parameters of the product defect detection model are adjusted according to the initial detection results to achieve closed-loop training. The adjusted product defect detection model is used to perform secondary detection planning on the product data to be detected, generating a second viewpoint detection scheme for secondary defect detection. The detection effect is evaluated again until the defect confidence level is greater than the preset value. Through iterative training, multiple model parameter tunings are performed to improve the model detection effect.

[0043] If the defect confidence level is greater than the preset value, it means that the detection result of the product defect detection model has reached the preset standard, and the adjusted product defect detection model will be used as the trained product defect detection model.

[0044] The following is a detailed introduction and explanation of the solution of the present invention in a specific drying room scenario: The product defect detection method provided in this application is applied to paint spraying in a drying oven. Traditional spraying path planning may rely on simple geometric trajectories or empirical formulas, making it difficult to simultaneously optimize spraying efficiency (speed), coating uniformity, and paint usage (cost). The GAT model combines data-driven machine learning with a physics-based analysis model, finding a globally better solution through "adversarial and cooperative" processes. The GAT model consists of three main modules in spraying path planning: a machine learning model (viewpoint generation model), an analysis model (viewpoint correction model), and a logical model. A machine learning model is typically a neural network. The input to a machine learning model is a 3D model of the automotive part (such as a point cloud or mesh), surface curvature, and physical constraints of the spray gun (such as maximum speed and acceleration). The output is one or more potential spraying paths. A path can be represented as a series of spatial coordinate points, spray gun orientation (angle), movement speed, paint flow rate, etc. The goal of the machine learning model is to generate a "good-looking" path that covers the entire surface as quickly as possible.

[0045] The analytical model acts like a "guardian of physical laws," caring not about the path itself, but only whether the resulting path conforms to standards. It evaluates the path output by the machine learning model based on physics knowledge. The analytical model can be a set of physical simulation models and rules. It calculates the paint film thickness distribution based on the distance, angle, speed, and flow rate between the spray gun and the surface. A classic model is the "elliptic double-β distribution model." The analytical model performs the following evaluations: Uniformity assessment: Calculate the variance (standard deviation) of the paint film thickness across the entire surface. A smaller variance indicates better uniformity. Cost assessment: Calculate the cost based on the total spraying time and paint consumption. Constraint checks: Check for potential collisions between the spray gun and the workpiece, and whether the acceleration exceeds the robot's load capacity, etc.

[0046] The analysis model quantifies and scores the paths generated by the machine learning model. For example, higher uniformity, shorter time, and less paint consumption result in a higher score.

[0047] The logical model sets the rules for the "game" between the machine learning model and the analytical model, and makes the final decision.

[0048] Game theory rules: Define how to adjust the parameters of the machine learning model based on the "score" given by the analytics model. For example, if the analytics model indicates that the coating is too thin in a certain area, the logic model instructs the machine learning model to move the spray gun slower or increase the flow rate in that area in the next iteration.

[0049] Loss function design: Based on the output of the analysis model, design a comprehensive loss function. For example: Total loss = Coating unevenness + α * Total time consumption + β * Total paint consumption (where α and β are weighting coefficients).

[0050] Termination criteria: Determines when to stop training. For example, when the total loss falls below a certain threshold, or when the loss no longer decreases significantly after several consecutive iterations.

[0051] In summary, the workflow of GAT (adversarial-cooperative game) is a cyclical and iterative process of "adversarial cooperation": Initialization: The machine learning model randomly generates an initial spraying path; Analysis and evaluation: The analysis model performs physical simulation of the path, calculates indicators such as coating uniformity, time, and paint consumption, and gives a very poor "score" (high loss value). Logical Coordination and Feedback: Based on the analysis results, the logical model calculates the loss value and feeds back information such as "where the mistake is" (e.g., "area A is too thin" or "area B wasted paint") to the machine learning model through the backpropagation algorithm.

[0052] Machine learning model improvement: The machine learning model adjusts its internal neural network parameters (weights and biases) based on feedback, attempting to generate a new path in order to obtain a better score from the analysis model.

[0053] Iterative loop: The machine learning model continuously "creates" new paths, the analytical model continuously "critically" evaluates them, and the logical model coordinates them in the middle.

[0054] Convergence: After multiple iterations, the path generated by the machine learning model is "very satisfactory" to the analysis model (the loss value is reduced to a very low level). At this point, the path achieves an optimal or near-optimal balance between spray uniformity, efficiency, and cost.

[0055] This embodiment has the following beneficial effects: Global optimization: Unlike traditional local optimization, GAT can search the entire solution space and find unexpected high-quality paths (e.g., unconventional oscillations).

[0056] Addressing complexity: For workpieces with complex curved surfaces (such as car doors and hoods), GAT can automatically adapt to changes in curvature and dynamically adjust spray gun parameters to improve uniformity.

[0057] Reduce trial and error costs: The entire process takes place in a virtual environment, eliminating the need for real paint and robots for extensive test spraying, thus saving significant costs and time.

[0058] Adaptability: If the paint type is changed (causing changes in flow characteristics) or the spray gun is changed, GAT can quickly relearn the new optimal path by simply updating the physical parameters in the analysis model.

[0059] Applying the GAT model to automotive paint spraying path planning essentially combines a teacher's experience (physical model) with AI's learning ability (neural network). Through digital twin technology, it repeatedly simulates, plays games, and optimizes in a computer, ultimately "forging" a spraying path that performs exceptionally well in reality—efficient, high-quality, and low-cost. This is a highly intelligent, future-oriented advanced manufacturing solution.

[0060] This application embodiment also provides a product defect detection device that can implement the above method. The device includes: The acquisition module is used to acquire data on the product to be tested. The detection module is used to input the product data to be detected into the trained product defect detection model to perform defect detection and obtain the product defect detection results.

[0061] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0062] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0063] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0064] Please see Figure 3 , Figure 3 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 using the methods described in the embodiments of this application. The input / output interface 903 is used to implement information input and output; The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904); The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.

[0065] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.

[0066] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0067] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0068] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0069] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0070] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0071] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0072] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0073] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0074] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0075] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0077] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0078] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0079] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0080] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A product defect detection method, characterized in that, The method includes the following steps: Obtain data on the product to be tested; The product data to be detected is input into the trained product defect detection model to perform defect detection and obtain the product defect detection result. The product defect detection model is trained through the following steps: Develop a testing plan based on the training data of the product to be tested, and generate a first-viewpoint testing scheme. Defect detection is performed on the product to be inspected according to the first viewpoint detection scheme to obtain initial detection results; The defects in the initial detection results are analyzed for defect confidence to obtain the defect confidence level. If the defect confidence level is less than a preset value, the parameters of the product defect detection model are adjusted according to the initial detection results; the adjusted product defect detection model is used to perform secondary detection planning on the product data to be detected, and a second viewpoint detection scheme is generated to perform secondary defect detection until the defect confidence level is greater than the preset value. If the confidence level of the defect is greater than the preset value, the adjusted product defect detection model will be used as the trained product defect detection model.

2. The method according to claim 1, characterized in that, The product defect detection model includes a generative adversarial ternary model. The step of performing detection planning on the training data of the product to be detected, generating a first-viewpoint detection scheme, includes: The first viewpoint detection scheme is obtained by using the trained generative adversarial ternary model to perform detection planning on the product data to be detected.

3. The method according to claim 2, characterized in that, The generative adversarial triadic model includes a viewpoint generation model and a viewpoint correction model, and is trained through the following steps: The training data is input into the viewpoint generation model to generate a viewpoint, resulting in a first viewpoint output. The first viewpoint output is corrected using a viewpoint correction model to obtain the second viewpoint output; With the goal of minimizing the error between the first viewpoint output and the second viewpoint output, the viewpoint generation model is initialized with parameters based on the second viewpoint output to obtain a trained adversarial ternary model.

4. The method according to claim 1, characterized in that, Before performing defect confidence analysis on the defects in the initial detection results, the method further includes: Defect analysis is performed on the initial detection results to determine whether there are defects in the initial detection results, and the probability of the presence of defects within the defect detection frame and the area of ​​the defect detection frame are obtained.

5. The method according to claim 4, characterized in that, The defect confidence analysis of the initial detection results to obtain the defect confidence level includes: The intersection-union ratio (IU) is calculated by combining the area of ​​the defect detection box with the area of ​​the ground truth boxes in the training data. The confidence level of the defect is obtained by calculating the confidence level based on the probability of the presence of a defect within the defect detection frame and the cross-union ratio.

6. The method according to claim 3, characterized in that, The process of inputting the training data into the viewpoint generation model to generate a viewpoint and obtain a first viewpoint output is as follows: ; Where x represents the training data, y represents the output of the first viewpoint, and ReLU() represents the ReLU activation function. , , and These represent the different parameters of the viewpoint generation model.

7. A product defect detection device, characterized in that, The device includes: The acquisition module is used to acquire data on the product to be tested. The detection module is used to input the product data to be detected into the trained product defect detection model to perform defect detection and obtain the product defect detection results.

8. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 6.