Defect detection model training method, surface defect detection method and computer equipment
The imitation defect image data set is generated by the imitation image generation model, and the neural network model is trained, which solves the problem of scarce number of defect samples and achieves high accuracy and robust defect detection.
Patent Information
- Application Number
- CN202411894943.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-21
- Publication Date
- 2025-04-15
AI Technical Summary
In industrial production, the number of defective samples is extremely scarce, which makes it difficult to design a suitable defect detection algorithm, and the prior art is difficult to improve detection accuracy.
A mimic image generation model is used to generate a mimic defect image data set through an adaptive iteratively optimized generative adversarial network model, which is used to train a neural network model and obtain a defect detection model.
A defect detection model with high accuracy and strong robustness is achieved based on a very small number of defect samples, and surface defects can be accurately detected.
Smart Images

Figure CN119832360A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a defect detection model training method, a surface defect detection method and a computer device. Background Art
[0002] With the development of the Internet and the rapid growth of traffic, industrial products such as ceramic filters and resonant cavities have been widely used as key components of laser signal transmitters. These objects may have defects on the front and sides during the manufacturing process. Since ceramic filters and other objects need to generate powerful lasers through oscillation, any defects on their surfaces may cause laser leakage or even completely destroy the internal structure. Therefore, defect detection on the surfaces of these objects is crucial to ensure the safety of production and life.
[0003] However, in actual industrial production, the number of defective samples is often extremely scarce, which brings great difficulties to the design of suitable defect detection algorithms and becomes the biggest limiting factor in improving detection accuracy. Summary of the invention
[0004] Based on this, it is necessary to provide a defect detection model training method, a surface defect detection method and a computer device that can improve the detection accuracy in response to the above technical problems.
[0005] In a first aspect, the present application provides a defect detection model training method, the method comprising:
[0006] A replica defect image dataset is generated by adopting a replica image generation model; the replica image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image;
[0007] The neural network model is trained based on the simulated defect image data set to obtain a defect detection model.
[0008] In one embodiment, the trained generative adversarial network model is a trained SinGAN model;
[0009] The imitation image generation model is used to generate an imitation defect image dataset, including:
[0010] Based on the global structure and defect distribution of the original defect image, clone sketches are drawn in batches; the clone sketches are used to characterize the surface defect features of the original defect image;
[0011] The imitation sketch is input as the input image into the trained SinGAN model, and the starting generation GAN level and superposition coefficient of each iteration are determined based on the adaptive iterative generation algorithm to obtain multiple imitation defect images as the imitation defect image dataset.
[0012] In one embodiment, based on the global structure and defect distribution of the original defect image, batch drawing of the cloned sketches includes:
[0013] Drawing the image background according to the surface structure layout of the original defect image;
[0014] According to the morphological characteristics of the defect texture of the original defect image, the defect area is drawn on the image background to obtain a defect sketch;
[0015] The defective sketch is subjected to noise addition and smoothing to obtain a cloned sketch.
[0016] In one embodiment, the defect sample image includes a real defect image; the maximum GAN layer of the trained SinGAN model outputs a simulated image with the same size as the real defect image;
[0017] The starting GAN level and superposition coefficient of each iteration are determined based on the adaptive iterative generation algorithm, including:
[0018] The copied image obtained in the current iteration cycle and the copied sketch in the current iteration cycle are calculated based on the superposition coefficient to obtain a superposition image;
[0019] The superimposed image is used as the input training image of the next iteration cycle, and the next starting generation GAN layer selection is performed until the preset number of iteration cycles is completed to obtain the starting generation layer sequence; wherein, the starting layer selection of each iteration cycle is calculated based on the tolerance coefficient and the superposition coefficient.
[0020] In one embodiment, the neural network model includes a YOLO model.
[0021] In one embodiment, a neural network model is trained based on a simulated defect image data set to obtain a defect detection model, including:
[0022] Defect framing is performed on the simulated defect image data set to obtain a defect calibration file; the defect calibration information stored in the defect calibration file includes vertex coordinates of the defect calibration frame;
[0023] The defect calibration file and the simulated defect image dataset are input into the YOLO model for training to obtain the defect detection model.
[0024] In a second aspect, the present application also provides a surface defect detection method, the method comprising:
[0025] The defect detection model trained by the defect detection model training method is used to perform surface defect detection to obtain a surface defect detection result.
[0026] In one of the embodiments, the surface defect detection result includes a defect framing area.
[0027] In a third aspect, the present application also provides a defect detection model training device, the device comprising:
[0028] A data set generation module is used to generate a simulated defect image data set using a simulated image generation model; the simulated image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image;
[0029] The training module is used to train the neural network model based on the simulated defect image data set to obtain a defect detection model.
[0030] In a fourth aspect, the present application also provides a surface defect detection device, the device comprising:
[0031] The defect detection module is used to perform surface defect detection using a defect detection model trained based on the above-mentioned defect detection model training method to obtain a surface defect detection result.
[0032] In a fifth aspect, the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned defect detection model training method or the steps of the above-mentioned surface defect detection method are implemented.
[0033] In a sixth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned defect detection model training method, or the steps of the above-mentioned surface defect detection method.
[0034] In a seventh aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned defect detection model training method, or the steps of the above-mentioned surface defect detection method.
[0035] The above-mentioned defect detection model training method, surface defect detection method and computer device use a replica image generation model to generate a replica defect image data set, and train a neural network model based on the replica defect image data set to obtain a defect detection model; wherein the replica image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image. The embodiment of the present application can obtain a defect detection model with high accuracy and strong robustness based on a very small number of defect samples, thereby realizing accurate detection of defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1a Schematic diagram of surface defects caused by burnt holes;
[0038] Figure 1b Schematic diagram of the surface defect of the crack;
[0039] Figure 1c It is a schematic diagram of the surface defect of the exposed bottom;
[0040] Figure 2 A schematic diagram of a process of a defect detection model training method in one embodiment;
[0041] Figure 3 A schematic diagram of a process for generating a plurality of imitation defect images in one embodiment;
[0042] Figure 4 A schematic diagram of a process of drawing a copy sketch in one embodiment;
[0043] Figure 5a To draw a background diagram;
[0044] Figure 5b To draw a schematic diagram of the defect area;
[0045] Figure 5c Schematic diagram for adding noise;
[0046] Figure 5d This is a schematic diagram of smoothing processing;
[0047] Figure 6 A schematic diagram of the structure of a single-sample generative adversarial network in one embodiment;
[0048] Figure 7 A schematic diagram of the quality of imitation images output by different GAN level generators in one embodiment;
[0049] Figure 8 A schematic diagram of an adaptive iterative generation algorithm in one embodiment;
[0050] Fig. 9 A schematic diagram of a YOLO model defect detection framing result in one embodiment;
[0051] Fig.10 is a structural block diagram of a defect detection model training device in one embodiment;
[0052] Fig.11 is an internal structure diagram of a computer device in one embodiment;
[0053] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0056] It is to be understood that terms such as “first”, “second”, etc. in the present application are only used to distinguish similar objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features.
[0057] It will be understood that “at least one” means one or more, and “plurality” means two or more.
[0058] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" and the like specify the presence of stated features, wholes, steps, operations, components, parts, or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof. At the same time, the term "and / or" used in this specification includes any and all combinations of the relevant listed items.
[0059] At present, industrial products such as ceramic filters and resonant cavities may have defects on the front and sides during the manufacturing process. These defects may include but are not limited to burn holes (such as Figure 1a As shown), cracks (as Figure 1b as shown) and exposed bottom (as shown Figure 1c As shown in the figure, burn holes are caused by high-power laser beams directly irradiating the surface of the object, leaving burn pits with darker colors. Cracks and exposed bottoms are caused by accidental drops or collisions, and are usually linear or polygonal.
[0060] In actual production, the probability of cracks or exposed bottoms in ceramic filters, resonant cavities and other objects is very low, and only a very small number of defective samples can be found among all the products to be inspected. For example, the number of filters with polygonal exposed bottoms on the top surface is very small, and only less than 5 defective samples can be found after inspecting tens of thousands of filters. This situation brings great difficulties to the design of appropriate defect detection algorithms and has become the biggest limiting factor in improving detection accuracy.
[0061] Surface defect detection algorithms based on traditional image processing methods include grayscale threshold, maximum stable extreme region, morphological processing, etc. However, these methods are usually not very robust in actual industrial assembly line inspections. For example, it is impossible to ensure that all surface images of objects taken have the same lighting environment, and the uncertainty of light intensity makes it difficult to design a more general segmentation threshold algorithm.
[0062] Commonly used defect detection methods based on machine learning and deep learning, such as support vector machines, gradient boosting decision trees, and residual networks, are not suitable for directly dealing with surface defect detection problems with a scarce number of abnormal samples. In the absence of more training samples, the above traditional methods are prone to overfitting the training data during the training process, resulting in poor final defect detection results.
[0063] In recent years, generative artificial intelligence, such as Generative Adversarial Networks (GAN), has been used to try to increase the diversity of training samples. However, the training of these algorithms usually requires a relatively large number of image samples to train a more general model, which also faces the problem of extremely scarce defect samples. Traditional defect detection methods are difficult to train models based on a single original image sample data.
[0064] As mentioned above, in actual industrial production, the number of defective samples is often extremely scarce, which brings great difficulties to the design of appropriate defect detection algorithms and becomes the biggest limiting factor in improving detection accuracy.
[0065] With the emergence of single-sample generative adversarial networks (SinGAN), it is possible to train multiple layers of GANs of different sizes from a single training image to capture different types of image information. The low-level GANs in this model focus more on the global structure, while the high-level GANs focus more on the detailed texture. Therefore, the model composed of multiple levels of GANs with gradually increasing sizes can generate imitation images with structures and textures similar to the original input images. This application expands the surface defect sample dataset based on a single-sample generative adversarial network and adaptive iterative optimization, and uses the expanded dataset to train the YOLO network to achieve accurate detection of new defects.
[0066] The embodiment of the present application uses a single real defect image sample to train an image generation model composed of a multi-layer generative adversarial network based on different image learning accuracies, overcoming the constraints of the amount of training data and effectively avoiding overfitting of the model. In addition, the present application proposes an adaptive iterative optimization method for generating images, which generates the global structure and detailed texture of the image through multiple cycles through the SinGAN network, thereby obtaining a more realistic imitation defect image.
[0067] It can be understood that this application belongs to the field of big data / AI (Artificial Intelligence) and can be applied to defect detection scenarios where the number of samples is extremely scarce. For example, the embodiments of this application can be applied to surface defect detection scenarios in industrial Internet scenarios, combined with cloud computing power to achieve rapid defect detection model training and on-site deployment, and update the detection model online / offline based on more detected defects, continuously improving the accuracy and recall rate of defect detection. This application can solve the problem of defect detection model robustness in scenarios where samples are extremely scarce.
[0068] It should be noted that the beneficial effects brought about by the embodiments of the present application or the technical problems solved are not limited to this one, but may also include other implicit or related problems. For details, please refer to the description of the following embodiments.
[0069] Before introducing the specific embodiments of the present application, the professional terms involved in the present application are explained first:
[0070] SinGAN (Single Image Generative Adversarial Network) is a deep learning model that can be trained based on only a single sample image. After training, it can generate a large number of imitation images that are similar to the training image in terms of spatial structure and detailed texture.
[0071] YOLO (You Only Look Once: Unified, Real-Time Object Detection): An object detection algorithm that can quickly and accurately identify and locate multiple objects in an image or video. The core idea is to transform the object detection task into a regression problem, segment the input image into a grid, and predict the bounding box and class probability in each grid cell.
[0072] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0073] In an exemplary embodiment, Figure 2 As shown, a defect detection model training method is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0074] Step 202, using a simulated image generation model to generate a simulated defect image dataset; the simulated image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image.
[0075] Among them, the simulated defect image data set may include multiple simulated defect images; the embodiment of the present application can generate multiple simulated defect images through the simulated image generation model; exemplarily, the large-scale generation of simulated defect images by the simulated image generation model can be understood as expanding the surface defect sample data set composed of a large number of surface defect simulated image samples, so that the embodiment of the present application can use the expanded data set (i.e., the expanded surface defect sample data set) to train the neural network model to achieve accurate detection of defects.
[0076] Specifically, the imitation image generation model may include a trained generative adversarial network model that has been adaptively iteratively optimized, and the trained generative adversarial network model may be obtained by training the generative adversarial network model using a single defect sample image.
[0077] This application uses a single defect sample image to train the generative adversarial network model to obtain a trained generative adversarial network model, and then adaptively iteratively optimizes the trained generative adversarial network model to obtain a replica image generation model, which can solve the problem of extremely small defect image data sets.
[0078] Among them, taking the defect sample image as a real defect image as an example, using a single defect sample image to train the generative adversarial network model can be understood as using a single sample generative adversarial network to generate multiple imitation defect images by training only on a single real surface defect image. Using a single real defect image as a sample, a imitation image generation model composed of multiple layers of generative adversarial networks can be trained based on different image learning accuracies, overcoming the constraints of the amount of training data and effectively avoiding overfitting of the model.
[0079] Furthermore, by adaptively iteratively optimizing the trained generative adversarial network model, the problem that it is impossible to train a defect detection model with high accuracy and strong robustness in surface defect detection scenarios due to the extremely scarce number of defect samples can be overcome; among them, by generating images based on adaptive iterative optimization, the global structure and detailed texture of the image are gradually generated through multiple cycles of generative adversarial network generation, so that a more realistic imitation defect image can be obtained.
[0080] Step 204: training the neural network model based on the simulated defect image data set to obtain a defect detection model.
[0081] Specifically, when a simulated defect image dataset is obtained, a neural network model can be trained based on the simulated defect image dataset to obtain a defect detection model, thereby realizing surface defect detection based on deep learning and adaptive iterative generation. It can be understood that by using the expanded simulated defect image dataset to train a neural network model, a defect detection model with high accuracy and strong robustness can be obtained based on a very small number of defect samples.
[0082] The above-mentioned defect detection model training method, by using a single defect sample image to train the generative adversarial network model, can obtain a trained generative adversarial network model that can generate image information of different finenesses. The trained generative adversarial network model is adaptively iteratively optimized to obtain a replica image generation model for better batch generation of realistic replica defect images. Then, the neural network model is trained through the replica defect image data set generated by the replica image generation model to obtain a defect detection model with high accuracy and strong robustness, which is conducive to more accurate surface defect detection.
[0083] In an exemplary embodiment, the trained generative adversarial network model is a trained SinGAN model; Figure 3 As shown, step 202 includes steps 302 to 304. Among them:
[0084] Step 302: based on the global structure and defect distribution of the original defect image, batch draw the clone sketches; the clone sketches are used to characterize the surface defect features of the original defect image.
[0085] Specifically, the imitation sketches can be drawn in batches based on the global structure and defect distribution of the original defect image, wherein the imitation sketches can be used to characterize the surface defect features of the original defect image. The batch drawing of imitation sketches can be understood as drawing feature sketches of the surface defect image. Exemplarily, the original defect image can be a real defect image.
[0086] In step 304, the imitation sketch is input as an input image into the trained SinGAN model, and the starting generation GAN level and superposition coefficient of each iteration are determined based on the adaptive iterative generation algorithm to obtain a plurality of imitation defect images as the imitation defect image data set.
[0087] Specifically, the embodiments of the present application can realize sketch drawing and generation of imitated defect images based on adaptive iteration, wherein, based on the global structure and defect distribution of the original defect image, batch drawing is used to draw imitated sketches for input images of the trained SinGAN model, and the trained SinGAN model is input, and a large number of surface defect imitated image samples (i.e., multiple imitated defect images) are obtained in combination with the adaptive iterative generation algorithm.
[0088] In practical applications, sketch drawing and generation of imitation defect images based on adaptive iteration may be to draw a feature sketch of a surface defect image, and based on a large number of feature sketches, batch generate imitation defect images using an adaptive iteration generation algorithm. The imitation sketch may be generated through relevant preprocessing steps, and these preprocessing steps may include but are not limited to drawing a background, drawing a defect area, adding noise, and smoothing. In one embodiment, Figure 4 As shown, step 302 includes steps 402 to 406. Among them:
[0089] Step 402: Draw an image background according to the surface structure layout of the original defect image.
[0090] Specifically, drawing an image background may refer to drawing a background, that is, imitating the surface structure layout of a real object and drawing a low-precision schematic image of the surface structure image of the object, such as Figure 5a shown.
[0091] Step 404 , based on the morphological features of the defect texture of the original defect image, the defect area is drawn on the image background to obtain a defect sketch.
[0092] Specifically, according to the morphological features of the defect texture of the original defect image, the defect area can be drawn on the image background to obtain a defect sketch. The defect area can be drawn by observing the morphological features of the defect texture of the real object and manually or by replacing the shape to draw some texture shape areas similar to the real defect contour and color on the background.
[0093] Taking the resonant cavity defect as an example, the shape can include ellipse, polygon and defect band formed by many tiny holes, such as Figure 5b As shown. Exemplarily, the drawing process can be a simplified version of a single training image: the positions of different components remain unchanged, and the colors of the components are converted to the average grayscale value of each component area (for example, the grayscale of these areas of the generated imitation image is around this average grayscale value). Figure 5a By similarly drawing some random dark areas in , many new clone sketches can be obtained, which can subsequently generate a large number of false resonator defect images.
[0094] Step 406, adding noise and smoothing the defective sketch to obtain a copied sketch.
[0095] Specifically, the defect sketch is subjected to noise addition and smoothing to obtain a simulated sketch. Regarding noise addition, when the defect sketch is obtained after drawing, salt and pepper noise can be optionally added to these sketches, and the proportion of salt and pepper noise can be set to 50%. There may be some uneven pixels with different grayscale values in the defect area, and the SinGAN model is used to reconstruct this texture.
[0096] Regarding the smoothing process, a Gaussian smoothing with a convolution kernel size of 3×3 can be performed so that the final defect imitation sketch is similar to the original defect image in spatial structure and contains all the high-dimensional texture information that needs to be generated.
[0097] A large number of imitation sketches obtained through the above steps are cyclically generated for multiple epochs (iteration cycles) based on the initial generation GAN layer sequence obtained by the adaptive iterative generation algorithm, and finally a large number of generated imitation defect images with the same size and similar style as the original real samples are obtained.
[0098] In one embodiment, the defect sample image may include a real defect image; the maximum GAN level of the trained SinGAN model outputs a simulated image with the same size as the real defect image; and the starting generation GAN level and superposition coefficient of each iteration are determined based on an adaptive iterative generation algorithm, including:
[0099] The copied image obtained in the current iteration cycle and the copied sketch in the current iteration cycle are calculated based on the superposition coefficient to obtain a superposition image;
[0100] The superimposed image is used as the input training image of the next iteration cycle, and the next starting generation GAN layer selection is performed until the preset number of iteration cycles is completed to obtain the starting generation layer sequence; wherein, the starting layer selection of each iteration cycle is calculated based on the tolerance coefficient and the superposition coefficient.
[0101] Specifically, regarding the training of the SinGAN model and the determination of the parameters of the adaptive iterative generation algorithm, the embodiment of the present application trains a single-sample generative adversarial network (SinGAN) model and determines the parameters of the adaptive iterative generation algorithm, so that the GAN layers of different sizes of the SinGAN model can be used to generate imitation defect images with high similarity in structure and texture. Among them, the single-sample generative adversarial network SinGAN is trained based on the original single defect sample image (i.e., a single defect sample image, for example, a single real defect image), and a multi-layer GAN network with gradually increasing sizes that can generate image information of different fineness is obtained, and then the starting generation GAN level and superposition coefficient of each iteration are determined based on the adaptive iterative generation algorithm for subsequent large-scale imitation defect image generation.
[0102] Regarding SinGAN model training, the following is an explanation with specific examples, such as Figure 6 The structure of the SinGAN model shown in FIG. 1 is the pyramid structure of the SinGAN model, in which the SinGAN network consists of multiple GAN layers of different sizes, each layer contains a generator and a discriminator, and the size of the imitation image generated by each level of the generator gradually increases from low to high levels, until the highest GAN level generates an imitation image of the same size as the original training image (which can be called a real image, such as a real defect image). Unlike other deep learning models, the training image of this model is a single image, not a large training sample data set. The training and prediction of the SinGAN model both start from the smallest GAN layer, and the GAN layers are connected in series from small to large, ending with the largest GAN layer. Image features of different scales can be extracted / generated during the training / prediction process.
[0103] Regarding the generator and discriminator structures of each GAN layer of the SinGAN model, each layer of the SinGAN GAN network consists of a generator and a discriminator. Among them, the generator is a convolutional network model, which contains multiple modules connected end to end. Each module consists of a "convolution-normalization-nonlinear connection" structure. The model parameters are updated through iterative training to find the optimal generator network parameters that can generate representative image features. The functions of each layer in a module are as follows:
[0104] Convolutional layer: Supplement the image information of the original image input to this layer.
[0105] Normalization layer: imposes range constraints on network parameters so that the input data of each convolution module is in a similar range, preventing gradient disappearance or explosion due to huge data differences.
[0106] Non-linear connection layer: The most significant data dimension in the convolutional network is enhanced, and the connection parameters corresponding to other data dimensions that have less impact on the generation of key image features will be reduced or set to 0.
[0107] The discriminator is a convolutional network model with a typical decoder structure, and the size of each layer increases from small to large.
[0108] Regarding the training process of the SinGAN model, SinGAN trains each GAN layer from small to large size during the training process, and first trains the generator and discriminator of the smallest size GAN network. For the training of each level of GAN, the generator continuously optimizes its own model parameters (such as the coefficients of each convolutional layer and connection layer of the generator itself), generates a realistic imitation image based on the input data, so that the discriminator cannot distinguish it from the image compressed (downsampled) to the output size of the original training image at this GAN level; the discriminator continuously optimizes its own model parameters (such as the coefficients of each convolutional layer and connection layer of the discriminator itself), so that it can better and better distinguish between real images and imitation images. The generator and discriminator are trained alternately (the generator and discriminator of the same layer are trained alternately, and the two models of this layer are trained to enter the training of the next layer of GAN, and the generator and discriminator of the next layer of GAN are trained alternately). The training stops after the set rounds or when the loss function of the generator and discriminator (such as L2 loss, discriminant loss, etc.) is less than the set threshold.
[0109] After the training of the low-level GAN layer is completed, the output data of its generator is a replica image with the same size as the input image of this level, and the image information is supplemented according to the style of the original training image. The image will be enlarged by upsampling and trained as part of the input of the next high-level GAN layer. Therefore, this means that the image information generated by the low-level GAN layer is mapped to the original image size. The scope of influence is larger than that of the high-level GAN layer. Among them, the image information can include the background of the image, the number / properties / texture of the defects, etc. The style of the original training image can refer to the structure and texture of the surface of the object, which can be understood as the arrangement of pixels. As for supplementing the image information of the replica image, it can be generated by feeding the replica sketch into the SinGAN model in the subsequent steps.
[0110] The training of the high-level GAN network of the SinGAN model is affected by the low-level GAN network. The training input data of each GAN layer is: ① The Gaussian noise map of the current GAN layer corresponding to the input image size (i.e. Figure 6 ② The image generated by the previous GAN layer is enlarged to the size of the input image of the current GAN layer through nonlinear upsampling (except for the bottom GAN layer, whose input is completely Gaussian noise image). It should be noted that the Gaussian noise image input to the current GAN layer is randomly generated and has no relationship with the original training image (except that the image size is the same).
[0111] After the pixel grayscale values of the two input images are combined by a certain linear superposition method, the combined image is input into the generator model as the original input data, and then the generator and the discriminator are trained alternately, and finally a generator model that can generate larger-sized imitation images is obtained. The generated imitation images have more detailed image information than the imitation images generated by the previous layer of GAN, such as Figure 7 As shown in the figure, the quality of the imitation images output by the generators of different GAN layers is gradually refined (from left to right, the GAN layers corresponding to the generated images are from low to high). The imitation image data will continue to be sent to the GAN of the next layer as part of the input data, and so on, until the training of the generator of the last layer of GAN is completed, and it can generate imitation images of the same size as the original training images (such as real defect images) (i.e., equal-sized imitation images).
[0112] As mentioned above, the training of the SinGAN model in the embodiment of the present application follows the following principles: the smaller the size of the GAN layer, the smaller the size of the image generated, and the earlier the training starts. After the training of the previous GAN layer is completed, the generated image obtained by inputting the training data into the GAN layer is upsampled, Gaussian noise is superimposed, and used as the input of the next GAN layer to generate a larger size imitation image, until the largest GAN layer is trained, and its output is an imitation image of the same size as the original training image (such as a real defect image), thereby obtaining a trained SinGAN model (i.e., a trained SinGAN model).
[0113]
[0114] Further, regarding the adaptive iterative optimization generation algorithm, the adaptive iterative generation algorithm can be based on the trained SinGAN model, by continuously inputting the imitation image generated by the model as the input image into the SinGAN network again, and adaptively selecting the starting generation GAN layer based on the loss function, to obtain a set of starting generation GAN layer parameter sequences that can generate more realistic imitation defect images based on multiple cycles, as the iterative generation algorithm parameters for subsequent large-scale generation of imitation images. The adaptive iterative generation algorithm is shown in the above table (Algorithm 1) and Figure 8 shown.
[0115] In each epoch, the quality of the generated imitation image is measured based on the normalized L2 image distance when each layer of GAN is used as the starting layer. However, the best quality image (the one with the smallest normalized L2 image distance L 2best ) as the input of the next iteration cycle, because the details generated by these images are often too specific and sharp, which is different from the texture arrangement of the real image. In this regard, the embodiment of the present application introduces a tolerance coefficient α (the value range is α>1), 2n <=αL 2best Within the range of L, select the smallest GAN layer as the starting GAN layer of this iteration cycle (it should be noted that each Epoch selects the GAN layer that satisfies L 2n <=αL 2bestThe smallest of these layers is used as the starting generation layer (the starting generation layers of different Epochs can be different), and the generated image finally obtained at the largest GAN layer is the imitation image of this iteration cycle. The imitation image generated by starting with a small-sized GAN layer can have a more creative generation of the global structure of the image, and then by selecting a small-sized GAN layer to start generation, it is possible to not determine most of the image information in the early Epoch, but to continuously enrich the texture information of the image through iterative generation of multiple Epochs, and make it different from the original image in global structure instead of being completely consistent.
[0116] By taking the clone image x' obtained in the current iteration cycle GANmax and the clone sketch x of the current iteration cycle epoch Based on the superposition coefficient λ, the pixel-level grayscale value is calculated to obtain the superposition image (x epoch ) new =λ×x' GANmax +(1-λ)×x epoch , the image will be used as the input training image of the next iteration cycle, and the next starting generation GAN layer selection will be performed until M Epochs are completed, and the starting generation layer sequence {Scale epoch1 ,Scale epoch2 ,…,Scale epochn}, as a subsequent method for generating a large number of imitation defect images, in order to determine the best starting level for generating GAN. In this process, the starting level selection of each iteration cycle is automatically calculated based on the tolerance coefficient α and the superposition coefficient λ, that is, the above is an adaptive iterative generation method.
[0117] In one embodiment, the neural network model includes a YOLO model.
[0118] Specifically, the YOLO model can be a YOLO target detection network, for example, a YOLO model based on a Darknet-53 backbone network, in which the residual connections between the convolutional layers of the model ensure that all useful information for class classification can be transferred across layers, thereby obtaining more accurate classification results. The model uses a total of 3 output feature maps, which are downsampled to 1 / 32, 1 / 16, and 1 / 8 of the original input, respectively, and can be used to detect defects of different sizes.
[0119] The embodiment of the present application utilizes a single-sample generative adversarial network to generate multiple imitation defect images by training only on a single real defect image. By using the expanded imitation defect image dataset to train the YOLO target detection network, new surface defects of real objects can be detected, thereby solving the problem of extremely small defect image datasets.
[0120] In one embodiment, a neural network model is trained based on a simulated defect image data set to obtain a defect detection model, including:
[0121] Defect framing is performed on the simulated defect image data set to obtain a defect calibration file; the defect calibration information stored in the defect calibration file includes vertex coordinates of the defect calibration frame;
[0122] The defect calibration file and the simulated defect image dataset are input into the YOLO model for training to obtain the defect detection model.
[0123] Specifically, in the YOLO model training stage, a large number of simulated defect images obtained in the aforementioned manner can be used as training sets for model training, wherein the defects in the simulated defect image data set can be manually framed, and all defects in each image and the four vertex coordinates of the defect calibration frame are stored in a file in, for example, the VOC2007 format (i.e., a defect calibration file); after the calibration is completed, the simulated defect image data set and the defect calibration file are input together into the YOLO model for training to obtain a defect detection model.
[0124] The above-mentioned defect detection model training method generates a large number of imitation defect images based on a single defect sample image, wherein a single original training image is input into a single-sample generative adversarial network composed of multiple layers of GAN layers of different sizes for training, so that an imitation image generation model that is sensitive to both the global structure and detailed texture of the image can be obtained, and the imitation sketch image is input into the bottom GAN layer of the model to start step-by-step generation, and finally a large number of realistic imitation surface defect images can be obtained.
[0125] Furthermore, based on the adaptive iterative generation algorithm designed based on the SinGAN pyramid structure, and based on the sensitivity of different levels of SinGAN to different image information, an adaptive iterative generation algorithm based on multiple cycles of inputting the SinGAN model and generating images from different starting GAN levels is proposed, which can better generate large quantities of realistic imitation defect images with both global structure and detailed texture.
[0126] In addition, supervision is provided for the imitation image generation model by drawing defect sketches. By drawing the background, batch drawing defect texture diagrams, adding salt and pepper noise and smoothing, a schematic diagram that is as similar as possible to the style of the original image is provided to the imitation image generation model, which plays a role in supervised learning, thereby ensuring the rationality of the structure and area of the image as much as possible during the generation process.
[0127] In an exemplary embodiment, a surface defect detection method is provided. This embodiment is described by taking the method applied to a terminal as an example. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0128] The defect detection model trained by the defect detection model training method is used to perform surface defect detection to obtain a surface defect detection result.
[0129] Specifically, the embodiment of the present application performs surface defect detection through a defect detection model, and can accurately detect new and real surface defects and obtain surface defect detection results.
[0130] In one of the embodiments, the surface defect detection result includes a defect framing area.
[0131] Specifically, taking the neural network model including the YOLO model as an example, Fig. 9 The YOLO model defect detection frame result is shown, where blue represents the true frame value and green represents the predicted frame value.
[0132] Taking the neural network model including the YOLO model as an example, in the YOLO model training stage, a large number of imitation defect images obtained in the above steps are used as training sets for model training. Furthermore, the defects in the imitation defect image data set can be manually framed, and all defects in each image and the four vertex coordinates of the defect calibration frame are stored in a file in the VOC2007 format; after the calibration is completed, the imitation defect image data set and the defect calibration file are input into the YOLO model for training.
[0133] For defect detection, the YOLO model based on the Darknet-53 backbone network can be used. The residual connections between the convolutional layers of this model ensure that all useful information for class classification can be passed across layers, resulting in more accurate classification results. The model uses a total of 3 output feature maps, which are downsampled to 1 / 32, 1 / 16, and 1 / 8 of the original input, respectively, for detecting defects of different sizes.
[0134] After the model training is completed, the real defect image is input into the YOLO model as the test data to test whether it can frame the defects in the test data. The results show that the YOLO model trained with the imitation defect image can detect the real defect location and the framed area has a high accuracy rate (such as Fig. 9 This proves the feasibility of the scheme.
[0135] It can be understood that the above-mentioned training implementation scheme of the defect detection model from the surface defect detection method is similar to the implementation scheme recorded in the above-mentioned defect detection model training method. Therefore, the specific limitations in the embodiments of one or more surface defect detection methods provided in the embodiments of the present application can be referred to the above limitations on the defect detection model training method, and will not be repeated here.
[0136] In order to further illustrate the scheme of the present application, a specific example is given below. Taking resonator defect detection as an example, in order to solve the problem of small data sets that cannot directly train robust defect detection models, given that the number of images that can be used for training and testing is limited, a total of 10 polygonal crack resonator surface images captured under different lighting environments are taken as an example. All these original images are cut into three parts, each part contains a part of a resonator, thereby converting the 10 defective resonator original images into 30 resonator partial images, each of which may not contain crack texture or multiple cracks.
[0137] For the selection of resonator defect training images as original real training samples, the image parts with the most cracks are selected as the input images of the SinGAN model among the 30 images and converted to a size of 416 × 416. The remaining 29 real resonator images are used as the test data set, and they are all converted to a size of 416 × 416.
[0138] For the SinGAN model, the number of GAN layers and the output image size of each GAN layer are determined by two factors: the minimum size and the scale factor. The minimum size determines the output size of the smallest GAN layer. The scale factor is the output size of the next larger GAN layer divided by the output size of the current GAN layer. The larger the scale factor, the larger the size of the next GAN layer. Therefore, increasing the scale factor can increase the training speed because it reduces the total number of GAN layers. However, a scale factor that is too large will result in insufficient expansion of image information in the convolution layer, resulting in poor quality of generated images. Exemplarily, an example setting of model parameters is as follows: minimum size = 25, maximum size = 416, number of GAN layers = 12, scale factor = 1.5. The number of modules in each GAN layer generator is set to 5 (where the module represents a "convolution-normalization-nonlinear connection" structure). After the low-level GAN layer training is completed, the generated imitation image will be upsampled, amplified and superimposed with noise, and input to the higher GAN layer of SinGAN, and so on from the bottom to the top, and finally output an imitation image as large as the original training image.
[0139] Optionally, 4 resonator backgrounds without any defects and 50 defect area drawings of different shapes and sizes are prepared. Then, these defect areas are randomly pasted onto the resonator background to obtain 4×50=200 fake resonator defect images. They are then generated according to the starting level sequence {Scale epoch1 ,Scale epoch2 ,…,Scale epochn} Input to the SinGAN model for M iteration cycles, replace white noise as the input data of the corresponding layer GAN generator in each cycle, and then start layer-by-layer generation, and finally get the imitation image of this cycle at the top GAN layer, and input the next iteration cycle for generation after pixel-level superposition. The 200 generated imitation images finally obtained after M iteration cycles will be used as the training data set of the YOLO network.
[0140] The YOLO model is trained using a labeled dataset of fully replicated resonator defects. All crack textures in the dataset of false defect images marked with rectangular bounding boxes can be pre-labeled to export category labels and location information in the form of PASCAL VOC. The batch size (Batchsize) is set to 16, and the YOLO model is trained for 100 epochs with a learning rate of 0.001 for the Adam optimizer. In each training epoch, 90% of the randomly selected training set is used to update the network parameters, and the remaining 10% is used for validation. After each epoch, a validation dataset containing 100 images is tested to check the effectiveness of the model.
[0141] After the YOLO model training is completed, the defect detection test is performed using the previously prepared 29 real resonator defect data sets as the test set. The test results show that the defect detection accuracy rate of more than 95% and the recall rate of more than 90% are achieved on the test data set, which proves the feasibility and robustness of the embodiment of the present application.
[0142] Training environment: Based on the PyTorch framework (v1.2.0, Python 3.7.10, CUDA 10.0 and CUDNN7.6.5), the SinGAN model is trained using the NVIDIA RTX 2070 GPU, and the YOLO model is trained using the NVIDIA GTX 1060 GPU.
[0143] As can be seen above, the YOLO model trained entirely with the imitation defect image training set performs well in the task of detecting new real defects. By collecting more and more real defect images, these images can be used to create more imitation samples as a supplement to the training data set to improve data diversity, so that the detection accuracy can be gradually improved based on more methods.
[0144] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0145] Based on the same inventive concept, the embodiment of the present application also provides a defect detection model training device for implementing the defect detection model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more defect detection model training device embodiments provided below can refer to the limitations of the defect detection model training method above, and will not be repeated here.
[0146] In an exemplary embodiment, Fig.10 As shown, a defect detection model training device is provided, comprising:
[0147] The data set generation module 901 is used to generate a simulated defect image data set using a simulated image generation model; the simulated image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image;
[0148] The training module 902 is used to train the neural network model based on the simulated defect image data set to obtain a defect detection model.
[0149] In one embodiment, the trained generative adversarial network model is a trained SinGAN model; the data set generation module 901 includes:
[0150] A sketch drawing module is used to batch draw clone sketches based on the global structure and defect distribution of the original defect image; the clone sketch is used to characterize the surface defect features of the original defect image;
[0151] The optimization iteration module is used to input the imitation sketch as an input image into the trained SinGAN model, and determine the starting generation GAN level and superposition coefficient of each iteration based on the adaptive iterative generation algorithm to obtain multiple imitation defect images as the imitation defect image data set.
[0152] In one of the embodiments, a sketch drawing module is used to draw an image background according to the surface structure layout of an original defect image; draw a defect area on the image background according to the morphological characteristics of the defect texture of the original defect image to obtain a defect sketch; and add noise and smooth the defect sketch to obtain a simulated sketch.
[0153] In one embodiment, the defect sample image includes a real defect image; the maximum GAN layer of the trained SinGAN model outputs a simulated image with the same size as the real defect image;
[0154] The optimization iteration module is used to calculate the pixel-level grayscale value of the imitation image obtained in the current iteration cycle and the imitation sketch of the current iteration cycle based on the superposition coefficient to obtain a superposition image; the superposition image is used as the input training image of the next iteration cycle to select the next starting generation GAN layer until a preset number of iteration cycles are completed to obtain a starting generation layer sequence; wherein the starting layer selection of each iteration cycle is calculated based on the tolerance coefficient and the superposition coefficient.
[0155] In one embodiment, the neural network model includes a YOLO model.
[0156] In one embodiment, the training module 902 is used to perform defect framing on the simulated defect image data set to obtain a defect calibration file; the defect calibration information stored in the defect calibration file includes the vertex coordinates of the defect calibration box; and the defect calibration file and the simulated defect image data set are input into the YOLO model for training to obtain a defect detection model.
[0157] Each module in the above defect detection model training device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0158] Based on the same inventive concept, the embodiment of the present application also provides a surface defect detection device for implementing the surface defect detection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more surface defect detection device embodiments provided below can refer to the limitations of the surface defect detection method above, and will not be repeated here.
[0159] In an exemplary embodiment, a surface defect detection device is provided, the device comprising:
[0160] The defect detection module is used to perform surface defect detection using a defect detection model trained based on the above-mentioned defect detection model training method to obtain a surface defect detection result.
[0161] In one of the embodiments, the surface defect detection result includes a defect framing area.
[0162] Each module in the above-mentioned surface defect detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0163] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data sets and model data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a defect detection model training method or a surface defect detection method is implemented.
[0164] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.12As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a defect detection model training method or a surface defect detection method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0165] Those skilled in the art will understand that Fig.11 , Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0166] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0167] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0168] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0169] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0170] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0171] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A defect detection model training method, characterized in that: The method comprises: A replica defect image data set is generated by adopting a replica image generation model; the replica image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image; The neural network model is trained based on the simulated defect image data set to obtain a defect detection model.
2. The method according to claim 1, characterized in that The trained generative adversarial network model is a trained SinGAN model; The method of using the imitation image generation model to generate the imitation defect image dataset includes: Based on the global structure and defect distribution of the original defect image, batch drawing of clone sketches; the clone sketches are used to represent the surface defect features of the original defect image; The imitation sketch is input as an input image into the trained SinGAN model, and the starting generation GAN level and superposition coefficient of each iteration are determined based on an adaptive iterative generation algorithm to obtain a plurality of imitation defect images as the imitation defect image data set.
3. The method according to claim 2, characterized in that The method of batch drawing the cloned sketches based on the global structure and defect distribution of the original defect image includes: Drawing an image background according to the surface structure layout of the original defect image; According to the morphological features of the defect texture of the original defect image, a defect area is drawn on the image background to obtain a defect sketch; Noise addition and smoothing are performed on the defective sketch to obtain the imitation sketch.
4. The method according to claim 2, characterized in that: The defect sample image includes a real defect image; the maximum GAN layer of the trained SinGAN model outputs a replica image with the same size as the real defect image; The method of determining the starting generation GAN level and superposition coefficient of each iteration based on the adaptive iterative generation algorithm includes: Calculating the pixel-level grayscale values of the imitation image obtained in the current iteration cycle and the imitation sketch in the current iteration cycle based on the superposition coefficient to obtain a superposition image; The superimposed image is used as the input training image of the next iteration cycle, and the next starting generation GAN layer selection is performed until a preset number of iteration cycles are completed to obtain a starting generation layer sequence; wherein the starting layer selection of each iteration cycle is calculated based on the tolerance coefficient and the superposition coefficient.
5. The method according to any one of claims 1 to 4, characterized in that: The neural network model includes a YOLO model.
6. The method according to claim 5, characterized in that The method of training a neural network model based on the simulated defect image data set to obtain a defect detection model includes: Defect framing is performed on the simulated defect image data set to obtain a defect calibration file; the defect calibration information stored in the defect calibration file includes vertex coordinates of the defect calibration frame; The defect calibration file and the simulated defect image data set are input into the YOLO model for training to obtain the defect detection model.
7. A surface defect detection method, characterized in that: The method comprises: Surface defect detection is performed using the defect detection model trained by the defect detection model training method according to any one of claims 1 to 6 to obtain a surface defect detection result.
8. The method according to claim 7, characterized in that The surface defect detection result includes a defect framed area.
9. A defect detection model training device, characterized in that: The device comprises: A data set generation module, used to generate a simulated defect image data set using a simulated image generation model; the simulated image generation model includes a trained generative adversarial network model that has been adaptively iteratively optimized; the trained generative adversarial network model is obtained by training the generative adversarial network model using a single defect sample image; The training module is used to train the neural network model based on the simulated defect image data set to obtain a defect detection model.
10. A surface defect detection device, characterized in that: The device comprises: A defect detection module is used to perform surface defect detection using the defect detection model trained by the defect detection model training method according to any one of claims 1 to 6 to obtain a surface defect detection result.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the processor implements the steps of the defect detection model training method described in any one of claims 1 to 6, or the steps of the surface defect detection method described in claim 7 or 8.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the defect detection model training method described in any one of claims 1 to 6, or the steps of the surface defect detection method described in claim 7 or 8 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the defect detection model training method described in any one of claims 1 to 6, or the steps of the surface defect detection method described in claim 7 or 8 are implemented.
Citation Information
Cited By
Defect contour generation method of machine vision deep learning surface defect sample, electronic equipment and storage medium
CN120047438A
Method for generating defect profile of machine vision deep learning surface defect sample, electronic device and storage medium
CN120047438B
Detection model training method for dead pixels in chip patterning process, product and equipment
CN120747082A