Defect detection model training method and device, equipment and storage medium

By removing severely defective regions and adjusting labels during the training process of the defect detection model, the impact of noisy samples on model performance is resolved, the robustness and generalization ability of the model are improved, and more efficient detection of minor defects is achieved.

CN116977256BActive Publication Date: 2026-08-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310110319.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-30
Publication Date
2026-08-25
Estimated Expiration
2043-01-30

AI Technical Summary

Technical Problem

Existing defect detection models are affected by noisy samples during training, resulting in low detection accuracy and poor performance. This is mainly due to the subjectivity of manually labeled images, which leads to inconsistent labeling of minor defects.

Method used

By performing defect detection on the original sample images, a first detection label set is obtained. The defect feature maps are then superimposed to determine reference points. Regions that may have serious defects are deleted to obtain candidate sample images. The model parameters are then adjusted to reduce the impact of noise.

Benefits of technology

This improves the robustness and generalization ability of the model, enabling it to better learn the features of minor defects, reduce the influence of noisy samples, and obtain a high-performance defect detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116977256B_ABST
    Figure CN116977256B_ABST
Patent Text Reader

Abstract

The application relates to the computer field, in particular to the artificial intelligence field, and provides a defect detection model training method and device, equipment and a storage medium. The method comprises the following steps: taking a reference point as the center, deleting a region possibly having a serious defect in an original sample image, generating a corresponding candidate sample image, performing defect detection on the candidate sample image, obtaining a second detection label set, and adjusting model parameters of a defect detection model based on the second detection label set and a second actual label set obtained through label modulation. The model can learn effective features representing slight defects in the training stage, has the ability to resist noise data interference, weakens the influence of noise samples, and further obtains a target defect detection model with high robustness, good generalization ability and strong performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer science, and more particularly to the field of artificial intelligence, and provides a method, apparatus, device, and storage medium for training a defect detection model. Background Technology

[0002] Industrial defect inspection refers to the quality inspection of industrial products during the manufacturing process. In recent years, with the rise of artificial intelligence (AI) technology, AI-based quality inspection, based on computer vision, has replaced the previous manual visual inspection, significantly improving the accuracy of quality inspection, saving labor costs, and has broad market application prospects.

[0003] Currently, when training a defect detection model, sample images from the training set are input into a neural network structure for feature extraction, then a fully connected layer is used for classification, and the model is trained end-to-end based on the softmax loss function to obtain a trained defect detection model, which is then used to detect defects in products.

[0004] Because manual annotation is subjective, some people may label sample images with minor defects as normal, while others may label them as defective, resulting in noisy labels. However, using noisy samples to train the model will affect the accuracy of the defect detection model training, thereby reducing the performance of the defect detection model. Summary of the Invention

[0005] This application provides a training method, apparatus, device, and storage medium for a defect detection model to address the problem of low detection accuracy and poor detection performance caused by the influence of noisy samples.

[0006] In a first aspect, embodiments of this application provide a method for training a defect detection model, comprising:

[0007] Defect detection is performed on the original sample image to obtain a first detection label set; during the detection process, the following are outputs: defect feature maps of each color channel with the same image size as the original sample image;

[0008] The feature values ​​of the first pixel at the same pixel position in each defect feature image are added together to obtain the response value of each second pixel in the response image with the same image size as the original sample image. The second pixel whose response value exceeds a first set threshold is determined as a reference point. The response value represents the degree of contribution of the pixel corresponding to the second pixel in the original sample image to the defect region in the original sample image.

[0009] Delete the target region centered on the pixel corresponding to the reference point from the original sample image to obtain a candidate sample image;

[0010] Defect detection is performed on the candidate sample image to obtain a second detection label set. Based on the second detection label set and the second actual label set of the original sample image, the model parameters of the defect detection model are adjusted. The second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio. The target deletion ratio represents the ratio of the area between the target region and the original sample image.

[0011] Secondly, embodiments of this application also provide a training apparatus for a defect detection model, comprising:

[0012] The first detection unit is used to perform defect detection on the original sample image and obtain a first detection label set; during the detection process, it outputs: defect feature maps of each color channel that have the same image size as the original sample image;

[0013] The processing unit is used to add the feature values ​​of the first pixel points at the same pixel position in each defect feature map to obtain the response values ​​of the second pixel points in the response map with the same image size as the original sample image, and to determine the second pixel points whose response values ​​exceed a first set threshold as reference points; the response value represents the degree of contribution of the pixel point corresponding to the second pixel point in the original sample image to the defect region in the original sample image.

[0014] Delete the target region centered on the pixel corresponding to the reference point from the original sample image to obtain a candidate sample image;

[0015] The second detection unit is used to perform defect detection on the candidate sample image and obtain a second detection label set.

[0016] The parameter adjustment unit is used to adjust the model parameters of the defect detection model based on the second detection label set and the second actual label set of the original sample image; the second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio, and the target deletion ratio represents the ratio of the area between the target region and the original sample image.

[0017] Optionally, the processing unit obtains the confidence level of the original sample image by performing the following operations:

[0018] By comparing the first detection label set of the original sample image with the corresponding first actual label set, the difference value generated during the model detection process is obtained.

[0019] The confidence level of the original sample image is obtained by performing probability fitting on the difference values.

[0020] Optionally, the parameter adjustment unit is used for:

[0021] Based on the second detection label set and the second actual label set of the original sample image, the total model loss of the defect detection model is determined;

[0022] Based on the total loss of the model, the model parameters of the defect detection model are adjusted.

[0023] Thirdly, embodiments of this application also provide a computer device, including a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor performs the steps of any of the above-described defect detection model training methods.

[0024] Fourthly, embodiments of this application also provide a computer-readable storage medium including program code, which, when the program product is run on a computer device, is used to cause the computer device to perform the steps of any of the above-described defect detection model training methods.

[0025] Fifthly, embodiments of this application also provide a computer program product, including computer instructions, which are executed by a processor to perform the steps of any of the above-described defect detection model training methods.

[0026] The beneficial effects of this application are as follows:

[0027] This application provides a method, apparatus, device, and storage medium for training a defect detection model. The method includes:

[0028] Defect detection is performed on the original sample image to obtain a first detection label set. Then, multiple defect feature maps output during the defect detection process are superimposed to obtain the response value of each second pixel in the response map with the same image size as the original sample image. The second pixel with a response value exceeding a first set threshold is determined as a reference point.

[0029] In the original sample image, the target region centered on the pixel corresponding to the reference point is deleted to obtain the candidate sample image. Defect detection is performed on the candidate sample image to obtain the second detection label set. Based on the second detection label set and the second actual label set of the original sample image, the model parameters of the defect detection model are adjusted. The second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio. The target deletion ratio represents the ratio of the area between the target region and the original sample image.

[0030] This application embodiment uses the obtained reference point as the center to delete regions in the original sample image that may have serious defects, so as to prevent the model from focusing too much on regions with serious defects during the training phase and ignoring regions with minor defects. In addition, by using the target deletion ratio between the target region and the original sample image, the originally sharp and prominent labels are adjusted to smoother labels, so that the model can learn effective features representing minor defects during the training phase, has the ability to resist the interference of noisy data, reduces the impact of noisy samples, and thus obtains a target defect detection model with high robustness, good generalization ability and high performance.

[0031] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0032] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0033] Figure 1 Example images of products with different degrees of defects provided in embodiments of this application;

[0034] Figure 2 This is an optional schematic diagram of an application scenario in the embodiments of this application;

[0035] Figure 3A A schematic diagram of the model structure of the defect detection model to be trained provided in an embodiment of this application;

[0036] Figure 3B This is a schematic diagram of the structure of a first encoder based on CNN provided in an embodiment of this application;

[0037] Figure 3C A schematic diagram illustrating the process of training a defect detection model provided in an embodiment of this application;

[0038] Figure 3D A logical diagram illustrating the training defect detection model provided in an embodiment of this application;

[0039] Figure 3E A logical schematic diagram of the generated response graph provided in the embodiments of this application;

[0040] Figure 3F This is a schematic diagram illustrating the logic of deleting a target region according to a fixed size, provided in an embodiment of this application.

[0041] Figure 3GA schematic diagram illustrating the process of deleting a target region based on the credibility of the original sample image, as provided in this application embodiment;

[0042] Figure 3H A logical diagram illustrating the deletion of a target region based on the credibility of the original sample image, provided for embodiments of this application;

[0043] Figure 3I This is a schematic diagram comparing tag modulation provided in an embodiment of this application;

[0044] Figure 4A A schematic diagram illustrating the process of detecting whether there are defects in two images to be detected, provided in an embodiment of this application;

[0045] Figure 4B A schematic diagram illustrating the process of detecting whether there are defects in two images to be detected, provided in an embodiment of this application;

[0046] Figure 5 A schematic diagram of the structure of a training device for a defect detection model provided in an embodiment of this application;

[0047] Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of this application;

[0048] Figure 7 This is a schematic diagram of the hardware structure of another electronic device using an embodiment of this application. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.

[0050] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.

[0051] 1. Artificial Intelligence:

[0052] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0053] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0054] With the research and advancement of artificial intelligence technology, AI is being studied and applied in various fields, such as smart homes, intelligent customer service, virtual assistants, smart speakers, intelligent marketing, autonomous driving, robotics, and smart healthcare. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.

[0055] 2. Machine Learning:

[0056] Machine learning is a multidisciplinary field that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, and many other disciplines. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance.

[0057] Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are found in all areas of artificial intelligence, including deep learning, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0058] 3. Computer vision is a comprehensive discipline that integrates computer science, signal processing, physics, applied mathematics, statistics, neurophysiology and other disciplines. It is also a challenging and important research direction in the scientific field.

[0059] This discipline uses various imaging systems to replace visual organs as input methods, with computers handling processing and interpretation instead of the brain. This allows computers to observe and understand the world visually, just like humans. Subfields of computer vision include face detection, face comparison, facial feature detection, blink detection, liveness detection, and fatigue detection.

[0060] 4. Defect Detection: Defect detection usually refers to the detection of surface defects of an item. Surface defect detection uses advanced machine vision inspection technology to detect defects such as spots, pits, scratches, color differences, and defects on the surface of a workpiece.

[0061] 5. A loss function or cost function is a function that maps the values ​​of a random event or its related random variables to non-negative real numbers to represent the "risk" or "loss" of that random event. In applications, the loss function is often used as a learning criterion in relation to optimization problems; that is, the model is solved and evaluated by minimizing the loss function. For example, it is used for parameter estimation in statistics and machine learning.

[0062] The design concept of the embodiments of this application is briefly introduced below:

[0063] Industrial defect inspection refers to the quality inspection of industrial products during the manufacturing process. In recent years, with the rise of AI technology, AI-based quality inspection based on computer vision has replaced the previous manual visual inspection, significantly improving the accuracy of quality inspection, saving labor costs, and has broad market application prospects.

[0064] Currently, when training a defect detection model, sample images from the training set are input into a neural network structure for feature extraction, then a fully connected layer is used for classification, and the model is trained end-to-end based on the softmax loss function to obtain a trained defect detection model, which is then used to detect defects in products.

[0065] However, defect detection is not a simple binary classification. Many defective images are quite minor. Due to the subjectivity of manual labeling, some people will label images with minor defects as normal, while others will label them as defective, resulting in noisy labels. Using noisy samples to train the model will affect the accuracy of the defect detection model training, thereby reducing the performance of the defect detection model.

[0066] For example, Figure 1 Images of products with varying degrees of defects are shown. Figure 1The product image shown in (a) is a defect-free image, and it can be undoubtedly labeled as a defect-free image category, such as labeled as 1.

[0067] Figure 1 The product image shown in (c) contains multiple black dots and exhibits noticeable graininess. Therefore, it can be undoubtedly concluded that... Figure 1 The product image shown in (c) is labeled with an image category label indicating a serious defect, such as 0.

[0068] However, Figure 1 In the product image shown in (b), only a few black dots appear, and the product image has a slight graininess. Therefore, Figure 1 The product image shown in (b) is an image with minor defects. When manually annotating such product images, subjective factors can easily influence the process. Some people may classify it as a defect-free image and label it as 1, while others may classify it as a defective image and label it as 0.

[0069] In view of this, embodiments of this application provide a method, apparatus, device, and storage medium for training a defect detection model. The method includes:

[0070] Defect detection is performed on the original sample image to obtain a first detection label set. Then, multiple defect feature maps output during the defect detection process are superimposed to obtain the response value of each second pixel in the response map with the same image size as the original sample image. The second pixel with a response value exceeding a first set threshold is determined as a reference point.

[0071] In the original sample image, the target region centered on the pixel corresponding to the reference point is deleted to obtain the candidate sample image. Defect detection is performed on the candidate sample image to obtain the second detection label set. Based on the second detection label set and the second actual label set of the original sample image, the model parameters of the defect detection model are adjusted. The second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio. The target deletion ratio represents the ratio of the area between the target region and the original sample image.

[0072] This application presents a novel training method for a defect detection model. Centered on a reference point, regions in the original sample image that may contain severe defects are removed. This avoids the model focusing only on regions with severe defects while ignoring regions with minor defects during feature extraction. Furthermore, by utilizing the target deletion ratio between the target region and the original sample image, previously sharp and prominent labels are adjusted to smoother labels. This enables the model to learn effective features representing minor defects during the training phase, giving it the ability to resist noise data interference and reducing the impact of noisy samples. Ultimately, this results in a target defect detection model with high robustness, good generalization ability, and strong performance.

[0073] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.

[0074] The embodiments of this application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.

[0075] Figure 2 One application scenario is shown, which includes two physical terminal devices 210 and a server 230. Each physical terminal device 210 establishes a communication connection with the server 230 through a wired network or a wireless network.

[0076] The physical terminal device 210 in this embodiment of the application may be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these.

[0077] The server 230 in this application embodiment can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides 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, content delivery networks (CDN), and big data and artificial intelligence platforms. This application does not impose any restrictions on these services.

[0078] The physical terminal device 210 calls the image acquisition module to capture images of the workpiece surface and obtain the image to be inspected 220. The image to be inspected 220 is then sent to the server 230, which has deployed the target defect detection model, to detect various types of defects on the workpiece surface, such as spots, pits, scratches, color differences, and defects.

[0079] The specific detection process is as follows: The target defect detection model extracts features from the image 220 to be detected through its internal encoder, obtaining defect feature maps corresponding to each color channel. Then, a fully connected layer maps these defect feature maps to the same feature space, predicting the probability that the image 220 belongs to each image category label. The image category label can be any one of the following: a label for images without defects or labels for images with various types of defects. Finally, based on the obtained predicted labels, it determines whether the image 220 is a defective image and, more specifically, what type of defect it contains.

[0080] To address the impact of noisy samples on model performance and training accuracy, this embodiment uses multiple original sample images to perform multiple rounds of iterative training on the model until a trained target defect detection model is output. Each iteration includes: using the obtained reference point as the center, deleting regions in the original sample images that may contain serious defects to obtain candidate sample images; then, based on the target deletion ratio between the target region and the original sample images, performing label modulation on the first actual label set of the original sample images to obtain a second actual label set; finally, adjusting the model parameters of the defect detection model based on the candidate sample images and the second actual label set.

[0081] Next, the training process of the defect detection model will be described in detail with reference to the corresponding attached figures.

[0082] First, refer to Figure 3A The diagram shown illustrates the structure. Let's first understand which modules make up the defect detection model during the training phase.

[0083] like Figure 3A As shown, the defect detection model to be trained includes: a first encoder for defect detection of the original sample image, a second encoder for defect detection of the candidate sample image, an adversarial deletion module for deleting target regions that may have serious defects, and a sample confidence module, a label modulation module, and a supervision loss module.

[0084] The first encoder and the second encoder have the same or similar network structure. They are both working modules built on convolutional neural networks (CNN), recurrent neural networks (RNN), or other more complex neural networks.

[0085] However, regardless of the neural network structure used, both encoders include: an input layer, an output layer, and hidden layers. For example, using a CNN as the first encoder, the network output is as follows: Figure 3BAs shown, it includes an input layer, a hidden layer and an output layer. The hidden layer is composed of multiple neural units, and the weights and bias parameters of each neural unit may be different.

[0086] The adversarial deletion module removes target regions that may have serious defects from the original sample image, centered on a reference point, to obtain candidate sample images. This avoids the model focusing only on regions with serious defects while ignoring regions with minor defects during feature extraction, thus improving the model's generalization ability.

[0087] The first actual label set includes at least one first actual label, each first actual label representing the probability value that the original sample image belongs to the corresponding image category. Therefore, the higher the probability value, the greater the likelihood that the annotator believes the original sample image belongs to this type of image category.

[0088] However, manual annotation is easily influenced by subjectivity, resulting in inconsistent probability values ​​for each first actual label and the presence of sharp, prominent one-hot labels, which affects the model training effect. Therefore, this embodiment employs a label modulation module to lower the probability value of the first actual label by a factor not less than a second set threshold and raise the probability value of the first actual label by a factor less than the second set threshold. This ensures that the probability value of the first actual label for a certain image category is not too high, preventing the model from focusing too much on the features of this type of label and reducing the model's generalization ability.

[0089] The supervised loss module uses loss functions such as cross-entropy loss, dice loss, focal loss, and KL divergence loss to determine the total model loss generated by the model in each iteration, and then adjusts the model parameters based on the total model loss.

[0090] The defect detection model is trained iteratively using multiple original sample images until a fully trained target defect detection model is output, such as... Figures 3C-3D As shown, the process of performing one iteration of training on the defect detection model is as follows:

[0091] S301: Using a server with a defect detection model to be trained, perform defect detection on the original sample image to obtain the first detection label set; during the detection process, the output includes: defect feature maps of each color channel with the same image size as the original sample image.

[0092] As shown in Formula 1, the first encoder M E (its weight is represented by θ) E For the original sample image x i Perform feature extraction and output defect feature map F iThe defect feature map set includes defect feature maps for each color channel, and feature values ​​for each pixel in each defect feature map, representing the defect features of pixels at the same pixel location in the original sample image.

[0093] F i =M E (x i ;θ E ) Formula 1;

[0094] in, W F H is the width of each defect feature map. F N is the height of each defect feature map. C It is the sum of dimensions. Each dimension corresponds to a color channel, and each color channel corresponds to at least one defect feature map.

[0095] As shown in Formula 2, each defect feature map is mapped to the same feature space to obtain the first detection label set P. i Where θ C It is composed of defect feature set F i Mapped to the first detection label set P i The mapping parameters.

[0096] P i =f(F i ;θ C ) Formula 2;

[0097] The first detection label set includes at least one first detection label, each of which represents the probability value of predicting that the original sample image belongs to the corresponding image category. Therefore, the higher the probability value, the greater the likelihood that the model considers the original sample image to belong to this type of image category.

[0098] S302: Add the feature values ​​of the first pixel at the same pixel position in each defect feature map to obtain the response value of each second pixel in the response map with the same image size as the original sample image, and determine the second pixel with the response value exceeding the first set threshold as the reference point; The response value represents the degree of contribution of the pixel corresponding to the second pixel in the original sample image to the defect area in the original sample image.

[0099] A defect feature map contains multiple first pixels, each with unique coordinates. Since all defect feature maps have the same image size, different defect feature maps will contain first pixels with the same coordinates; these first pixels are called "pixels with the same pixel location". Furthermore, the adversarial deletion module obtains a response map with the same image size as the original sample image by superimposing the feature values ​​of the first pixels at the same pixel location from each defect feature map.

[0100] like Figure 3E As shown, defect features Figure 1 The coordinates of the first pixel are (1,1), and the defect features are... Figure 2 The coordinates of the first pixel in the first defect feature map are also (1,1), and the coordinates of the first pixel in the second defect feature map are also (1,1). Therefore, these three first pixels are pixels with the same pixel position in different defect feature maps. Then, the feature values ​​of the three first pixels are added together, and the response value of the second pixel with coordinates (1,1) in the response map is determined to be 0.1.

[0101] However, due to the influence of the attached drawing format, Figure 3E This is an example after adjusting the original image to grayscale. Therefore, the differences between different colors in the response image are not very obvious. This image is for reference only. The specific color corresponding to the response value can be determined according to the actual situation.

[0102] There is a positive correlation between the response value and the degree of contribution; that is, the higher the response value, the greater the contribution of the corresponding pixel in the original sample image to the defect region in the image, meaning that the pixel is more likely to be in the defect region. Therefore, after generating the response map, the second pixel with a response value exceeding the first set threshold is determined as a reference point, and the pixel position {h} of each reference point is obtained. i ,w i This allows the model to remove the target region centered on the reference point from the original sample image, thus obtaining candidate sample images.

[0103] S303: Delete the target region centered on the pixel corresponding to the reference point in the original sample image to obtain the candidate sample image.

[0104] The deletion operation refers to removing regions that may have serious defects from the original sample image, so that the model will not only focus on regions with serious defects when extracting features from candidate sample images, but ignore regions with minor defects.

[0105] When performing step 303, this application embodiment provides the following methods for deleting the target region:

[0106] Method 1: Based on the fixed size of the target region, delete the target region centered on the pixel corresponding to the reference point in the original sample image to obtain the corresponding candidate sample image.

[0107] Figure 3F The original sample image shown on the left is a surface image of a screw. The defect detection model to be trained is used to perform the first defect detection on the surface image of the screw, and defects such as spots, scratches, and pits are found on the surface of the screw.

[0108] However, to reduce the impact of noisy samples on model training, the target region centered at the reference point is deleted from the original sample image, according to a fixed size (10*20) of the target region. Figure 3F The candidate sample image shown on the right.

[0109] However, due to the format of the attached figures, Figure 3F This uses a diagonal grid texture to represent the pixel values ​​that fill each first pixel in the target deletion area, creating a mosaic-like effect to indicate the target deletion area in the candidate sample image. This image is for reference only; the colors corresponding to the specific pixel values ​​can be determined based on the actual situation.

[0110] Method 2: Based on the credibility of the original sample image, determine the target deletion ratio for adjusting the target area size, and based on the target deletion ratio and the target range ratio for adjusting the aspect ratio of the target area, delete the target area centered on the pixel corresponding to the reference point in the original sample image to obtain the corresponding candidate sample image.

[0111] Generally, the difference between the first detected label and the first actual label of a noisy sample is large, resulting in low sample confidence, while the difference between labels of clean samples is small, leading to higher confidence. Therefore, embodiments of this application can also utilize a confidence-controlled deletion strategy to delete target regions centered on the pixels corresponding to reference points in the original sample image, obtaining corresponding candidate sample images. For example... Figure 3G As shown, the specific operation is as follows:

[0112] S3031: Based on the image size of the original sample image, the target deletion ratio, the target range ratio used to adjust the aspect ratio of the target region, and the pixel position of the reference point, determine the target region centered on the pixel corresponding to the reference point in the original sample image.

[0113] The specific implementation method for determining the target area is shown in Formula 3. These are the height and width of the target area, H. i W i These are the height and width of the original sample image, h, respectively. i w i These are the x and y coordinates of the reference point, r. i It is the target deletion ratio, δ i It is the proportion of the target range.

[0114]

[0115] As mentioned earlier, clean samples have high credibility, while noisy samples have low credibility. Substituting the credibility into Formula 4, we calculate that the target deletion ratio for clean samples is smaller to avoid deleting all defective areas and causing the model to misidentify them as defect-free images. The target deletion ratio for noisy samples is larger to ensure that potentially severely defective areas are removed as much as possible, preventing the model from focusing only on severely defective areas and ignoring slightly defective areas when extracting features from candidate images. Where G... i r represents the confidence level of the original sample image. i It is the target deletion ratio, and μ is a preset baseline deletion ratio.

[0116] r i =μ×(1-G i ) Formula 4;

[0117] The credibility of the original sample image is obtained by performing the following operations: by comparing the first detection label set with the corresponding first actual label set, the difference value generated during the model detection process is obtained; then, the difference value is subjected to probability fitting to obtain the credibility of the original sample image.

[0118] As shown in Equation 5, this application uses a Gaussian Mixture Model (GMM) for the first detection label set P. i With the corresponding first actual tag set y i The difference values ​​between them are used to perform probability fitting, thereby obtaining the confidence level G of the original sample image. i Here, abs refers to the absolute value function in programming languages.

[0119] G i =GMM(abs(P) i -y i )) Formula 5;

[0120] When the target deletion range is set too large, it can easily remove too many defects from the original sample image, causing the model to fail to learn effective features representing minor defects. Conversely, if the target deletion range is set too small, the model may focus too much on areas with severe defects during training, neglecting areas with minor defects, thus affecting the model's generalization ability and detection performance. Therefore, calculating the proportion of the target range becomes an important means of determining a reasonable target deletion range.

[0121] The specific implementation method for determining the target range ratio in this application is shown in Formula 6. Here, the preset range value δ is a positive integer, and the target range ratio δ... i It is used to adjust the aspect ratio of the target area.

[0122]

[0123] S3032: Delete the target region in the original sample image by adjusting the pixel value of each first pixel point within the target region.

[0124] For the target area centered on the reference point, perform deletion operations such as rectangle deletion and irregular shape deletion. Then, adjust the pixel value of each first pixel in the target area by performing the following operations: reset the pixel value of each first pixel in the target area; fill the pixel value of each first pixel according to the preset pixel value fill range.

[0125] The specific implementation method is shown in Formula 7. For each first pixel within the target area, the pixel value is randomly filled; for each first pixel outside the target area, the pixel value is not adjusted. The pixel value filling range is (0,1).

[0126]

[0127] Where m and n are the x and y coordinates of the first pixel, respectively, and x... i (m,n) is the pixel value of the first pixel before adjustment. It is the adjusted pixel value of the first pixel.

[0128] Figure 3H The original sample image shown on the left is a surface image of a screw. The defect detection model to be trained is used to perform the first defect detection on the surface image of the screw, and defects such as spots, scratches, and pits are found on the surface of the screw.

[0129] However, to reduce the impact of noisy samples on model training, based on the reliability of the original sample images, the target region centered on the pixel corresponding to the reference point is removed from the original sample images to obtain... Figure 3H The candidate sample image shown on the right.

[0130] However, due to the format of the attached figures, Figure 3H This uses a diagonal grid texture to represent the pixel values ​​that fill each first pixel in the target deletion area, creating a mosaic-like effect to indicate the target deletion area in the candidate sample image. This image is for reference only; the colors corresponding to the specific pixel values ​​can be determined based on the actual situation.

[0131] S304: Perform defect detection on the candidate sample image to obtain a second detection label set, and adjust the model parameters of the defect detection model based on the second detection label set and the second actual label set of the original sample image; the second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio, and the target deletion ratio represents the ratio of the area between the target region and the original sample image.

[0132] Since the two encoders have the same or similar network structures, the operations they perform are also the same or similar. The process of obtaining the first detection label set has been described in detail above; here, we will briefly explain the process of obtaining the second detection label set.

[0133] The second encoder extracts features from the read candidate sample images and outputs a defect feature map set. Then, based on the weights of each hidden layer in the second encoder and the corresponding bias parameters, it maps each defect feature map in the defect feature map set to the same feature space to obtain the second detection label set.

[0134] However, due to the subjective influence of manual annotation, the probability values ​​of each first-category label in the first actual label set are uneven, with some sharp and prominent one-hot labels, affecting the model training effect. Therefore, the label modulation module adjusts the first actual label set based on the obtained target deletion ratio to obtain the second actual label set, in order to adjust the originally sharp and prominent one-hot labels to... Figure 3I The relatively smooth labels shown in the second actual label set can also prevent the model from focusing too much on areas with serious defects and ignoring areas with minor defects. The defect detection model trained using this second actual label set will also have improved generalization ability and detection performance.

[0135] The specific adjustment process is as follows: based on the obtained target deletion ratio, the probability value of the first actual label in the first actual label set that is not less than the second set threshold is lowered; and based on the obtained target deletion ratio, the probability value of the first actual label in the first actual label set that is less than the second set threshold is raised; finally, the adjusted first actual label set is determined as the second actual label set of the original sample image.

[0136] As shown in Formula 8, perform the following operations for each first actual label to obtain the corresponding second actual label: obtain the first actual label of the j-th image category; when the probability value of the first actual label of the j-th image category is the maximum probability value in the first actual label set, lower the probability value of the label based on the target deletion ratio; when the probability value of the first actual label of the j-th image category is not the maximum probability value, raise the probability value of the label based on the target deletion ratio.

[0137]

[0138] Among them, y i (j) represents the probability value of the first actual label of the j-th image category before adjustment. r represents the probability value of the first actual label of the j-th image class after adjustment. iThis indicates the target deletion ratio, and c represents the total number of the first actual tags.

[0139] The supervised loss module uses loss functions such as cross-entropy loss, dice loss, focal loss, and KL divergence loss. Based on the second detection label set and the corresponding second actual label set, it determines the total model loss of the defect detection model, and then adjusts the model parameters of the defect detection model based on the total model loss.

[0140] Taking the cross-entropy loss function as an example, the second detection label set... With the corresponding second actual tag set Substituting into Formula 9, calculate the total model loss generated by the defect detection model in one iteration. in, This represents the cross-entropy loss function, which measures the similarity of probability distributions between the second detected label and the second actual label for the same image category.

[0141]

[0142] This application presents a model training method based on sample credibility-guided adversarial deletion. Based on the credibility of the original sample image, regions potentially containing serious defects are deleted from the original sample image. This prevents the model from focusing excessively on severely defective regions during training while neglecting regions with minor defects. Furthermore, by utilizing the target deletion ratio between the target region and the original sample image, previously sharp and prominent labels are adjusted to smoother labels. This allows the model to learn effective features representing minor defects during training, enhancing its ability to resist noise data interference and reducing the impact of noisy samples. Ultimately, this yields a robust, high-generalization, and high-performance target defect detection model, providing reliable technical support for industrial AI defect quality detection.

[0143] In the model application phase, the trained target defect detection model only includes the first encoder. For industrial defect detection tasks, the detection process of the target defect detection model is as follows: Figures 4A-4B As shown:

[0144] S401: Input the two images to be detected into the first encoder, extract their respective defect features, and obtain their respective defect feature sets. Each defect feature set includes: defect feature maps of each color channel that have the same image size as the image to be detected.

[0145] S402: Based on the weights of each hidden layer in the first encoder and the corresponding bias parameters, each defect feature map in the same defect feature map set is mapped to the same feature space, and the target detection label set 1 of the image to be detected is output as {no defect: 0.95; freckles: 0.01; pits: 0.01; scratches: 0.01; color difference: 0.01; defects: 0.01}, and the target detection label set 2 of the image to be detected is {no defect: 0.01; freckles: 0.80; pits: 0.15; scratches: 0.01; color difference: 0.02; defects: 0.01}.

[0146] S403: The predicted probability value of the defect-free label in the target detection label set 1 exceeds the preset threshold value of 0.5, and the target defect detection model determines that the image to be detected 1 is a defect-free image. Also, the predicted probability values ​​of the spot label and the pit label in the target detection label set 2 exceed the preset threshold value, and the target defect detection model determines that the image to be detected 2 is a defective image, and the image also contains two types of defects: spots and pits.

[0147] Based on the same inventive concept as the above-described method embodiments, this application also provides a training device for a defect detection model. For example... Figure 5 As shown, the training device 500 for the defect detection model may include:

[0148] The first detection unit 501 is used to perform defect detection on the original sample image and obtain a first detection label set; during the detection process, it outputs: defect feature maps of each color channel with the same image size as the original sample image.

[0149] Processing unit 502 is used to add the feature values ​​of the first pixel points at the same pixel position in each defect feature map to obtain the response values ​​of the second pixel points in the response map with the same image size as the original sample image, and to determine the second pixel points whose response values ​​exceed a first set threshold as reference points; the response value represents the degree of contribution of the pixel point corresponding to the second pixel point in the original sample image to the defect area in the original sample image.

[0150] Remove the target region centered on the pixel corresponding to the reference point from the original sample image to obtain the candidate sample image;

[0151] The second detection unit 503 is used to perform defect detection on the candidate sample image and obtain a second detection label set;

[0152] The parameter adjustment unit 504 is used to adjust the model parameters of the defect detection model based on the second detection label set and the second actual label set of the original sample image. The second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio. The target deletion ratio represents the ratio of the area between the target region and the original sample image.

[0153] Optionally, the processing unit 502 is used for:

[0154] Based on the fixed size of the target region, the target region centered on the pixel corresponding to the reference point is deleted from the original sample image to obtain the corresponding candidate sample image.

[0155] Alternatively, based on the credibility of the original sample image, a target deletion ratio is determined to adjust the size of the target region. Based on the target deletion ratio and the target range ratio used to adjust the aspect ratio of the target region, the target region centered on the reference point is deleted from the original sample image to obtain the corresponding candidate sample image.

[0156] Optionally, the processing unit 502 is used for:

[0157] Based on the image size, target deletion ratio, target range ratio, and pixel position of the reference point of the original sample image, the target region centered on the pixel corresponding to the reference point in the original sample image is determined.

[0158] The target region in the original sample image is deleted by adjusting the pixel value of the first pixel point within the target region.

[0159] Optionally, the processing unit 502 adjusts the pixel values ​​of each first pixel point within the target area by performing the following operations:

[0160] Reset the pixel value of the first pixel in the target area;

[0161] The pixel values ​​of each first pixel are filled according to the preset pixel value filling range.

[0162] Optionally, the processing unit 502 is used for:

[0163] By comparing the first detection result with the corresponding first actual result, the difference value generated during the model detection process is obtained;

[0164] The confidence level of the original sample image is obtained by performing probability fitting on the difference values.

[0165] Optionally, the first actual label set includes at least one first actual label, each first actual label representing: the probability value of labeling the original sample image as belonging to the corresponding image category;

[0166] The training device 500 for the defect detection model also includes a tag modulation unit 505, which obtains a second actual tag set by performing the following operations:

[0167] Based on the obtained target deletion ratio, the probability value of the image category label in the first actual label set that is not less than the second set threshold is lowered; and,

[0168] Based on the obtained target deletion ratio, the probability value of the image category label in the first actual label set that is less than the second set threshold is increased;

[0169] The adjusted first actual label set is determined as the second actual label set of the original sample image.

[0170] Optionally, the parameter adjustment unit 504 is used for:

[0171] Based on the second detection result and the corresponding second actual result, determine the total model loss of the defect detection model;

[0172] Adjust the model parameters of the defect detection model based on the total model loss.

[0173] For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.

[0174] Having introduced the training method and apparatus for the defect detection model according to exemplary embodiments of this application, we will now introduce a computer device according to another exemplary embodiment of this application.

[0175] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."

[0176] Based on the same inventive concept as the above-described method embodiments, this application also provides a computer device. In one embodiment, the computer device may be a server, such as... Figure 2 The server 230 is shown. In this embodiment, the computer device is structured as follows: Figure 6 As shown, it may include at least a memory 601, a communication module 603, and at least one processor 602.

[0177] The memory 601 is used to store computer programs executed by the processor 602. The memory 601 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0178] Memory 601 may be volatile memory, such as random-access memory (RAM); memory 601 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 601 may be any other medium capable of carrying or storing a desired computer program having the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 601 may be a combination of the above-described memories.

[0179] The processor 602 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 602 is used to implement the training method of the aforementioned defect detection model when calling the computer program stored in the memory 601.

[0180] The communication module 603 is used to communicate with terminal devices and other servers.

[0181] This application embodiment does not limit the specific connection medium between the memory 601, communication module 603, and processor 602 described above. This application embodiment... Figure 6 The memory 601 and the processor 602 are connected via a bus 604, and the bus 604 is in Figure 6 The diagram uses thick lines to describe the connections between other components; these are for illustrative purposes only and should not be considered limiting. The 604 bus can be divided into address bus, data bus, control bus, etc. For ease of description, Figure 6 It is described using only a thick line, but does not indicate that there is only one bus or one type of bus.

[0182] The memory 601 stores a computer storage medium, which stores computer-executable instructions. These instructions are used to implement the training method for the defect detection model according to embodiments of this application. The processor 602 is used to execute the aforementioned training method for the defect detection model, such as... Figure 3C As shown.

[0183] In another embodiment, the computer device can also be other computer devices, such as... Figure 2 The physical terminal device 210 is shown. In this embodiment, the structure of the computer device can be as follows: Figure 7As shown, it includes components such as a communication component 710, a memory 720, a display unit 730, a camera 740, a sensor 750, an audio circuit 760, a Bluetooth module 770, and a processor 780.

[0184] The communication component 710 is used to communicate with the server. In some embodiments, it may include a Wireless Fidelity (WiFi) module, which is a short-range wireless transmission technology, and electronic devices can use the WiFi module to help objects send and receive information.

[0185] The memory 720 can be used to store software programs and data. The processor 780 executes various functions of the physical terminal device 210 and performs data processing by running the software programs or data stored in the memory 720. The memory 720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The memory 720 stores an operating system that enables the terminal device 210 to run. In this application, the memory 720 may store the operating system and various application programs, and may also store a computer program that executes the training method of the defect detection model of the embodiments of this application.

[0186] The display unit 730 can also be used to display information input by the object or information provided to the object, as well as a graphical user interface (GUI) of various menus of the terminal device 210. Specifically, the display unit 730 may include a display screen 732 disposed on the front of the terminal device 210. The display screen 732 may be configured as a liquid crystal display, a light-emitting diode, or the like. The display unit 730 can be used to display the defect detection interface, model training interface, etc., in the embodiments of this application.

[0187] The display unit 730 can also be used to receive input digital or character information and generate signal inputs related to object settings and function control of the physical terminal device 210. Specifically, the display unit 730 may include a touch screen 731 disposed on the front of the terminal device 210, which can collect touch operations on or near the object, such as clicking a button, dragging a scroll bar, etc.

[0188] The touchscreen 731 can be placed on top of the display screen 732, or the touchscreen 731 and the display screen 732 can be integrated to realize the input and output functions of the physical terminal device 210. After integration, it can be referred to as a touch display screen. In this application, the display unit 730 can display the application and the corresponding operation steps.

[0189] Camera 740 can be used to capture still images, and objects can publish images captured by camera 740 through an application. There can be one or multiple cameras 740. An object generates an optical image through a lens, which is projected onto a photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to processor 780 to be converted into a digital image signal.

[0190] The physical terminal device may also include at least one sensor 750, such as an accelerometer 751, a proximity sensor 752, a fingerprint sensor 753, and a temperature sensor 754. The terminal device may also be equipped with other sensors such as a gyroscope, barometer, hygrometer, thermometer, infrared sensor, light sensor, and motion sensor.

[0191] Audio circuitry 760, speaker 761, and microphone 762 provide an audio interface between the physical terminal device 210 and the terminal device 210. Audio circuitry 760 converts received audio data into electrical signals, which are then transmitted to speaker 761, where they are converted into sound signals for output. Physical terminal device 210 may also be equipped with volume buttons for adjusting the volume of the sound signal. On the other hand, microphone 762 converts collected sound signals into electrical signals, which are received by audio circuitry 760, converted into audio data, and then output to communication component 710 for transmission to, for example, another physical terminal device 210, or to memory 720 for further processing.

[0192] The Bluetooth module 770 is used to interact with other Bluetooth devices that also have a Bluetooth module via the Bluetooth protocol. For example, a physical terminal device can establish a Bluetooth connection with a wearable electronic device (such as a smartwatch) that also has a Bluetooth module through the Bluetooth module 770, thereby exchanging data.

[0193] The processor 780 is the control center of the physical terminal device, connecting various parts of the terminal through various interfaces and lines. It executes various functions and processes data by running or executing software programs stored in the memory 720 and calling data stored in the memory 720. In some embodiments, the processor 780 may include one or more processing units; the processor 780 may also integrate an application processor and a baseband processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the baseband processor mainly handles wireless communication. It is understood that the baseband processor may not be integrated into the processor 780. In this application, the processor 780 can run the operating system, applications, user interface display and touch response, and the training method of the defect detection model in the embodiments of this application. Furthermore, the processor 780 is coupled to the display unit 730.

[0194] Furthermore, it should be noted that in the specific embodiments of this application, object data related to defect detection models and the like are involved. When the above embodiments of this application are applied to specific products or technologies, permission or consent from the object is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0195] In some possible implementations, various aspects of the training method for the defect detection model provided in this application can also be implemented in the form of a program product, which includes a computer program. When the program product is run on a computer device, the computer program causes the computer device to perform the steps in the training method for the defect detection model according to the various exemplary embodiments of this application described above. For example, the computer device can perform actions such as... Figure 3C The steps are shown in the figure.

[0196] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0197] The program product of the embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include a computer program, and may run on an electronic device. However, the program product of this application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with a command execution system, apparatus, or device.

[0198] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a readable computer program. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with a command execution system, apparatus, or device.

[0199] Computer programs contained on readable media may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0200] Computer programs for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The computer program can execute entirely on the user's computer device, partially on the user's computer device, as a standalone software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device. In cases involving remote computer devices, the remote computer device can be connected to the user's computer device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer device (e.g., via the Internet using an Internet service provider).

[0201] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.

[0202] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0203] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing a computer-usable computer program.

[0204] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce a machine for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0205] These computer program commands may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the commands stored in the computer-readable storage medium produce an article of manufacture including command means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0206] These computer program commands can also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing the commands executed on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0207] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0208] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A training method for a defect detection model, characterized in that, include: Defect detection is performed on the original sample image to obtain a first detection label set; during the detection process, the following are outputs: defect feature maps of each color channel with the same image size as the original sample image; The first detection label set includes at least one first detection label, and each first detection label represents: the probability value of predicting that the original sample image belongs to the corresponding image category; The feature values ​​of the first pixel at the same pixel position in each defect feature image are added together to obtain the response value of each second pixel in the response image with the same image size as the original sample image. The second pixel whose response value exceeds a first set threshold is determined as a reference point. The response value represents the degree of contribution of the pixel corresponding to the second pixel in the original sample image to the defect region in the original sample image. Delete the target region centered on the pixel corresponding to the reference point from the original sample image to obtain a candidate sample image; Defect detection is performed on the candidate sample images to obtain a second detection label set, and the model parameters of the defect detection model are adjusted based on the second detection label set and the second actual label set of the original sample images. The second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio; wherein, the target deletion ratio represents the ratio of the area between the target region and the original sample image; The first actual label set includes at least one first actual label, and each first actual label represents the probability value of the original sample image belonging to the corresponding image category.

2. The method as described in claim 1, characterized in that, The step of deleting the target region centered on the pixel corresponding to the reference point in the original sample image to obtain a candidate sample image includes: According to the fixed size of the target region, the target region centered at the reference point is deleted from the original sample image to obtain the corresponding candidate sample image; Alternatively, based on the credibility of the original sample image, a target deletion ratio for adjusting the size of the target region is determined, and based on the target deletion ratio and the target range ratio for adjusting the aspect ratio of the target region, the target region centered on the pixel corresponding to the reference point is deleted from the original sample image to obtain a corresponding candidate sample image.

3. The method as described in claim 2, characterized in that, The step of deleting the target region centered on the pixel corresponding to the reference point in the original sample image based on the target deletion ratio and the target range ratio used to adjust the aspect ratio of the target region includes: Based on the image size of the original sample image, the target deletion ratio, the target range ratio for adjusting the aspect ratio of the target region, and the pixel position of the reference point, the target region in the original sample image is determined with the pixel corresponding to the reference point as the center. The target region is deleted from the original sample image by adjusting the pixel value of each first pixel point within the target region.

4. The method as described in claim 3, characterized in that, The pixel values ​​of each first pixel within the target area are adjusted by performing the following operations: Reset the pixel value of each first pixel point within the target area; The pixel values ​​of each first pixel are filled according to a preset pixel value filling range.

5. The method according to any one of claims 1-4, characterized in that, The credibility of the original sample image is obtained by performing the following operations: By comparing the first detection label set of the original sample image with the corresponding first actual label set, the difference value generated during the model detection process is obtained. The confidence level of the original sample image is obtained by performing probability fitting on the difference values.

6. The method according to any one of claims 1-4, characterized in that, The second actual tag set is obtained by performing the following operations: Based on the obtained target deletion ratio, the probability value of the first actual tag in the first actual tag set is reduced to not less than the second set threshold. as well as, Based on the obtained target deletion ratio, the probability value of the first actual tag in the first actual tag set that is less than the second set threshold is increased; The adjusted first actual label set is determined as the second actual label set of the original sample image.

7. The method according to any one of claims 1-4, characterized in that, The step of adjusting the model parameters of the defect detection model based on the second detection label set and the second actual label set of the original sample image includes: Based on the second detection label set and the second actual label set of the original sample image, the total model loss of the defect detection model is determined; Based on the total loss of the model, the model parameters of the defect detection model are adjusted.

8. A training device for a defect detection model, characterized in that, include: The first detection unit is used to perform defect detection on the original sample image and obtain a first detection label set; during the detection process, it outputs: defect feature maps of each color channel that have the same image size as the original sample image; The first detection label set includes at least one first detection label, and each first detection label represents: the probability value of predicting that the original sample image belongs to the corresponding image category. The processing unit is used to add the feature values ​​of the first pixel points at the same pixel position in each defect feature map to obtain the response values ​​of the second pixel points in the response map with the same image size as the original sample image, and to determine the second pixel points whose response values ​​exceed a first set threshold as reference points; the response value represents the degree of contribution of the pixel point corresponding to the second pixel point in the original sample image to the defect region in the original sample image. Delete the target region centered on the pixel corresponding to the reference point from the original sample image to obtain a candidate sample image; The second detection unit is used to perform defect detection on the candidate sample image and obtain a second detection label set. The parameter adjustment unit is used to adjust the model parameters of the defect detection model based on the second detection label set and the second actual label set of the original sample image; The second actual label set is obtained by adjusting the first actual label set based on the target deletion ratio; wherein, the target deletion ratio represents the ratio of the area between the target region and the original sample image; The first actual label set includes at least one first actual label, and each first actual label represents the probability value of the original sample image belonging to the corresponding image category.

9. The apparatus as claimed in claim 8, characterized in that, The processing unit is used for: According to the fixed size of the target region, the target region centered at the reference point is deleted from the original sample image to obtain the corresponding candidate sample image; Alternatively, based on the credibility of the original sample image, a target deletion ratio for adjusting the size of the target region is determined, and based on the target deletion ratio and the target range ratio for adjusting the aspect ratio of the target region, the target region centered on the pixel corresponding to the reference point is deleted from the original sample image to obtain a corresponding candidate sample image.

10. The apparatus as claimed in claim 9, characterized in that, The processing unit is used for: Based on the image size of the original sample image, the target deletion ratio, the target range ratio, and the pixel position of the reference point, a target region centered on the pixel corresponding to the reference point is determined in the original sample image. The target region is deleted from the original sample image by adjusting the pixel value of each first pixel point within the target region.

11. The apparatus as claimed in claim 10, characterized in that, The processing unit adjusts the pixel values ​​of each first pixel point within the target area by performing the following operations: Reset the pixel value of each first pixel point within the target area; The pixel values ​​of each first pixel are filled according to a preset pixel value filling range.

12. The apparatus according to any one of claims 8-11, characterized in that, The training device for the defect detection model further includes a label modulation unit, which obtains the second actual label set by performing the following operations: Based on the obtained target deletion ratio, the probability value of the image category label in the first actual label set that is not less than the second set threshold is reduced; as well as, Based on the obtained target deletion ratio, the probability value of the image category label in the first actual label set that is less than the second set threshold is increased; The adjusted first actual label set is determined as the second actual label set of the original sample image.

13. A computer device, characterized in that, It includes a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.

14. A computer-readable storage medium, characterized in that, It includes program code that, when run on a computer device, causes the computer device to perform the steps of the method according to any one of claims 1 to 7.

15. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Systems and methods for identifying manufacturing defects

    EP4068155A1

  • Regularized multi-label classification from partially labeled training data

    US10769766B1