An image data enhancement method and device based on automobile paint surface defect detection

By generating and optimizing automotive paint defect data using the CARP-GAN network, and combining image smoothing and morphological algorithms, the problem of insufficient generalization and realism of existing data augmentation methods is solved, resulting in a more diverse automotive paint defect dataset and improving detection performance.

CN116664977BActive Publication Date: 2025-11-25WUHAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310649382.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2025-11-25
Estimated Expiration
2043-05-31

AI Technical Summary

Technical Problem

In existing automotive paint defect detection methods, image data augmentation methods lack generalization and realism, making it difficult to effectively expand datasets with various defect styles and shooting angles.

Method used

A new dataset of automotive paint defects was generated using a CARP-GAN network, combined with Med-BGauss image smoothing and morphological optimization algorithms, and then a cut-paste algorithm with random variable parameters.

Benefits of technology

It generates a more diverse and realistic dataset of automotive paint defects, improving the generalization of detection and the diversity of data, and enhancing the feasibility of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116664977B_ABST
    Figure CN116664977B_ABST
Patent Text Reader

Abstract

The application discloses an image data enhancement method and device based on automobile paint surface defect detection, and the method comprises the following steps: S1, using a CARP-GAN network to generate automobile paint surface defect data; S2, using a Med-BGauss image smoothing algorithm and a morphological algorithm to optimize the generated automobile paint surface defect data; S3, based on a cut-paste algorithm with random variable parameters, obtaining the finally generated automobile paint surface defect data set. The CARP-GAN network proposed in the application can generate a defect data set with more quantity, more diverse style and more real data through existing automobile paint surface defect data; the Med-BGauss image smoothing algorithm and the morphological algorithm proposed in the application can effectively optimize the generated automobile paint surface defect data, so that the work of separating the automobile paint surface defect and the background is easier; the cut-paste algorithm with random variable parameters proposed in the application ensures that only one defect picture is pasted into one paint surface background, and the coordinates of pasting each time are random and variable, so that the generated data is more diverse.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image enhancement technology, specifically relating to an image data enhancement method and apparatus based on automotive paint defect detection. Background Technology

[0002] As an indispensable part of automobiles, automotive paint defects, if not detected at the factory, will not only reduce the economic benefits of the vehicle but also lead to greater resource waste during subsequent repainting. Therefore, automotive paint defect detection is of great research value in order to ensure the quality of automotive paint.

[0003] A major challenge in automotive paint defect detection is the scarcity of paint defect datasets, which hinders generalization in both subsequent image processing and machine learning training. Therefore, a data augmentation scheme for automotive paint defect detection is needed to address this issue, aiming to enhance the limited datasets and improve the feasibility of subsequent detection operations.

[0004] Among the many existing technologies for data augmentation of automotive paint defect data, there are methods that directly crop, rotate, scale, and stitch the defect data to obtain more new datasets; there are also methods that directly generate new defect data based on improved GAN generative adversarial networks, but these often result in problems such as poor image realism and pattern collapse.

[0005] Therefore, while the methods described above can expand the defect dataset to a certain extent, the realism of defects in the synthesized new images is often low, and there is a lack of corresponding data matching for the various defect styles, shooting angles, and lighting conditions that may occur in industrial settings. Thus, data augmentation operations based on existing technologies often lack generalization and realism. Summary of the Invention

[0006] The purpose of this invention is to provide an image data enhancement method and apparatus based on automotive paint defect detection, which solves the problems of lack of generalization and realism in existing automotive paint defect image data enhancement.

[0007] The technical solution adopted in this invention is as follows:

[0008] An image data enhancement method based on automotive paint defect detection includes the following steps:

[0009] S1. Use the CARP-GAN network to generate defect data;

[0010] S2. Optimize the generated defect data using the Med-BGauss image smoothing algorithm and morphological algorithm;

[0011] S3. Based on the cut-paste algorithm with random variable parameters, the final generated dataset of automotive paint defects is obtained.

[0012] Preferably, step S1 includes:

[0013] The CARP-GAN network was used to train the discriminator and generator separately on a dataset of automotive paint defects.

[0014] The discriminator network is defined as follows: its structure comprises a 6-layer Conv-MaxPool structure, a 1-layer Conv-AvgPool structure, and a 4-layer fully connected (FC) structure, using the LeakyReLU activation function. The proposed discriminator network structure can downsample the car paint image using the Conv-MaxPool structure and extract pixel features of defects using the Conv-AvgPool structure. Simultaneously, the LeakyReLU nonlinear function is used to activate the neural network, mitigating potential gradient vanishing and jitter issues.

[0015] The generator network is defined as follows: it reconstructs the introduced random noise into a 16×16 noisy image with one channel. Then, it upsamples the image, weighting the features of different input channels during the upsampling process. It can also deform the convolutional kernel and introduce a channel attention mechanism to further weight the features of different channels, thereby improving the image feature reconstruction after the upsampling step. The generator network mainly consists of two modules: a kernel prediction module and a feature reconstruction module. The kernel prediction module includes the following steps:

[0016] First, for a feature map with an input size of H×W and C channels, a 1×1 convolution kernel is used to compress the channels to... To reduce the computational load of subsequent operations, for the compressed feature map, a k×k convolutional layer is used in each selected region to generate a reconstruction kernel. The encoder parameters are... Where C u For s 2 (k+2) 2 s is the upsampling expansion ratio. For each (k+2)×(k+2) recombined kernel, a softmax function is used to normalize it spatially, so that the sum of the kernel weights is 1.

[0017] The feature recombination module includes the following steps:

[0018] For each reconstructed kernel, it is mapped back to the input feature map. A (k+2)×(k+2) region centered at that location is extracted, and the pixel feature matrix of this region is multiplied by the upsampling kernel to obtain the output result. Finally, the feature reconstruction results of each selected region are concatenated to obtain the upsampling result.

[0019] The CARP-GAN network proposed in this invention can generate more numerous, more diverse, and more realistic defect data from existing automotive paint defect data.

[0020] Preferably, step S2 includes:

[0021] This step includes image processing operations using the Med-BGauss image smoothing algorithm and morphological algorithms.

[0022] The Med-BGauss image smoothing algorithm includes the following steps:

[0023] (1) Divide the input image into a window of size n×n, with the center of the window being the current processing point I(x,y).

[0024] (2) Calculate the median gray value med and the range r = I(x,y) of the pixel gray values ​​within the window. max -I(x,y) min .

[0025] (3) If the current pixel value I(x,y) is not in If the window size is within the range, then the window size will be increased by two pixels to (n+2)×(n+2).

[0026] (4) Repeat steps (2) and (3) until I(x,y) is in Within, output the current pixel value I(x,y).

[0027] (5) For each pixel, construct a Gaussian weight function, which includes two dimensions: pixel value and spatial location. This function can be expressed as:

[0028]

[0029] Where i and j are the spatial positions of the center pixel, and x and y are the spatial positions of the current pixel. I(i,j) and I(x,y) are the pixel values ​​of the center pixel and the current pixel, respectively. sigma_d and sigma_r are the standard deviations of the Gaussian function.

[0030] (6) For the current pixel, calculate the weighted average of its surrounding pixels using the following formula:

[0031]

[0032] Where W(x,y) is the weighted sum. This weighted average is used as the pixel value of the current pixel.

[0033] After obtaining the image after the above image smoothing process, the image is binarized using the Otsu's method, and then the image morphology operation of opening is performed.

[0034] The Med-BGauss image smoothing algorithm and morphological algorithm proposed in this invention can effectively optimize the generated defect data and separate automotive paint defects from the background to obtain the image mask of the defect location.

[0035] Preferably, step S3 includes:

[0036] The defect images in the defect dataset cropped in step S2 are processed. A set of two-dimensional random number seeds is generated. Based on the random number seeds, the cropped defect images are randomly pasted into the background image of the defect-free car paint surface. The pasting coordinates are determined by the random number seeds. The random algorithm ensures that only one defect image is pasted into each paint background image. The cut-paste algorithm based on random variable parameters will merge and generate new car paint defect data. The formula for determining the random seed is:

[0037]

[0038]

[0039] Where x and y are the calculated coordinates of the defect data center. W and H are the width and height of the background image, respectively. w and h are the maximum width and height of the defect data mask, respectively. Rand() is a function for generating random numbers.

[0040] The cut-paste algorithm based on random variable parameters proposed in this invention ensures that a paint background will only be pasted with one defect image, and the coordinates of each pasting are randomly variable, making the generated data more diverse.

[0041] The present invention also provides an image data enhancement device based on automotive paint defect detection, comprising:

[0042] The defect generation unit is used to generate automotive paint defect data using a CARP-GAN network; it includes:

[0043] The CARP-GAN network consists of a discriminator network and a generator network;

[0044] The discriminator network structure includes a Conv-MaxPool structure, a Conv-AvgPool structure, and an FC fully connected layer structure. The discriminator network structure downsamples existing automotive paint defect images through the Conv-MaxPool structure and extracts the pixel features of automotive paint defects by combining the Conv-AvgPool structure.

[0045] The generator network reconstructs the introduced random noise into a noisy image, and then upsamples the noisy image to restore the image features; the generator network consists of two modules: a kernel prediction module and a feature reconstruction module;

[0046] The steps of the kernel prediction module are as follows:

[0047] For a feature map with input size H×W and number of channels C, a 1×1 convolution kernel is used to compress the channels to... For the compressed feature map, a k×k convolutional layer is used in each selected region to generate a reconstruction kernel. The encoder parameters are: Where C u For s 2 (k+2) 2 s is the upsampling expansion ratio; each (k+2)×(k+2) recombinant kernel is spatially normalized using the softmax function so that the sum of the kernel weights is 1;

[0048] The steps of the feature recombination module are as follows:

[0049] For each recombined kernel, it is mapped back to the input feature map, and a (k+2)×(k+2) region centered at that location is extracted. The pixel feature matrix of this region is then multiplied by the upsampling kernel to obtain the output result. Finally, the feature recombined results of each selected region are concatenated to obtain the upsampling result.

[0050] The defect optimization unit is used to optimize the generated automotive paint defect data using the Med-BGauss image smoothing algorithm and morphological algorithms.

[0051] The defect dataset unit is used to obtain the final generated dataset of automotive paint defects based on the cut-paste algorithm with random variable parameters.

[0052] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0053] The CARP-GAN network proposed in this invention can generate a larger number of defect datasets with more diverse styles and more realistic data from existing automotive paint defect data.

[0054] The Med-BGauss image smoothing algorithm and morphological algorithm proposed in this invention can effectively optimize the generated automotive paint defect data, making it easier to separate automotive paint defects from the background.

[0055] The cut-paste algorithm based on random variable parameters proposed in this invention ensures that a paint background will only be pasted with one defect image, and the coordinates of each pasting are randomly variable, making the generated data more diverse. Attached Figure Description

[0056] Figure 1 This is a flowchart of the image data enhancement method based on automotive paint defect detection according to the present invention;

[0057] Figure 2 This is a structural diagram of the first half of the discriminator neural network of the present invention;

[0058] Figure 3 This is a structural diagram of the middle part of the discriminator neural network of the present invention;

[0059] Figure 4 This is a structural diagram of the latter half of the discriminator neural network of the present invention;

[0060] Figure 5 This is a structural diagram of the generator kernel prediction module of the present invention;

[0061] Figure 6 This is a structural diagram of the generator feature recombination module of the present invention;

[0062] Figure 7 This is a graph of automotive paint defect data generated by the present invention;

[0063] Figure 8 These are grayscale histograms before and after the image smoothing operation of this invention;

[0064] Figure 9 This is a diagram showing the results of implementing the image morphology operation of the present invention;

[0065] Figure 10 This is the final generated image of automotive paint defects according to the present invention. Detailed Implementation

[0066] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0067] To better address the challenge of insufficient datasets in automotive paint defect detection, this invention provides an image data enhancement method and apparatus based on automotive paint defect detection, which will be described in detail below.

[0068] Figure 1 A flowchart illustrating an image data enhancement method based on automotive paint defect detection, provided in this embodiment of the invention, includes the following steps:

[0069] S1. Use the CARP-GAN network to generate defect data;

[0070] S2. Optimize the generated defect data using the Med-BGauss image smoothing algorithm and morphological algorithm;

[0071] S3. Based on the cut-paste algorithm with random variable parameters, the final generated dataset of automotive paint defects is obtained.

[0072] In an embodiment of the present invention, step S1 uses a CARP-GAN network to generate defect data. A GAN (Generative Adversarial Network) consists of two networks: a generator and a discriminator. The generator G (Generator) is the network that generates images; it receives random noise z and generates an image from this noise, denoted as G(z). The discriminator D (Discriminator) is the network that determines whether an image is real; it takes an image x as input and outputs D(x) representing the probability that image x is a real image.

[0073] To address the problems of unstable training, pattern collapse, and unsuitability for augmenting automotive paint defect data in traditional GAN ​​networks, this invention proposes a CARP-GAN network. The loss function of this network is:

[0074]

[0075] In the formula, For real samples, The sample is generated by the generator, and λ is the penalty coefficient.

[0076] In step S1, the discriminator network is defined, as follows: Figure 2 , Figure 3 and Figure 4 As shown, the discriminator network structure consists of a 6-layer Conv-MaxPool structure with a 5×5 kernel size and a stride of 2; the MaxPool kernel size is 2×2, with a stride of 2 for the first two and last two layers, and a stride of 1 for the middle layers. This is then connected to a Conv-AvgPool structure. Finally, the LeakyReLU nonlinear function is used to activate the neural network, improving potential gradient vanishing and jitter issues.

[0077] Step S1 defines the generator network, which reconstructs the introduced random noise into a 16×16 noisy image with one channel. Then, the image is upsampled. During upsampling, features from different input channels are weighted, and the convolutional kernel can be deformed. A channel attention mechanism is also introduced to further weight features from different channels, thus improving image feature reconstruction after the upsampling step. The generator network mainly consists of two modules: a kernel prediction module and a feature reconstruction module. The kernel prediction module includes the following steps:

[0078] First, for a feature map with an input size of H×W and C channels, a 1×1 convolution kernel is used to compress the channels to... To reduce the computational load of subsequent operations, for the compressed feature map, a k×k convolutional layer is used in each selected region to generate a reconstruction kernel. The encoder parameters are... Where C u For s 2 (k+2) 2 s is the upsampling dilation ratio. For each (k+2)×(k+2) recombined kernel, a softmax function is used for spatial normalization, ensuring that the sum of the kernel weights is 1. The kernel prediction module structure diagram is shown below. Figure 5 As shown.

[0079] The feature recombination module includes the following steps:

[0080] For each reconstructed kernel, it is mapped back to the input feature map. A (k+2)×(k+2) region centered at that location is extracted, and the pixel feature matrix of this region is multiplied by the upsampling kernel to obtain the output result. Finally, the feature reconstruction results of each selected region are concatenated to obtain the upsampling result. The feature reconstruction module structure diagram is shown below. Figure 6 As shown.

[0081] The automotive paint defect data generated in step S1 is as follows: Figure 7 As shown.

[0082] In some embodiments of the present invention, step S2 includes image processing operations using the Med-BGauss image smoothing algorithm and morphological algorithm.

[0083] The Med-BGauss image smoothing algorithm includes the following steps:

[0084] (1) Divide the input image into a window of size n×n, with the center of the window being the current processing point I(x,y).

[0085] (2) Calculate the median gray value med and the range r = I(x,y) of the pixel gray values ​​within the window. max-I(x,y) min .

[0086] (3) If the current pixel value I(x,y) is not in If the window size is within the range, then the window size will be increased to (n+2)×(n+2).

[0087] (4) Repeat steps (2) and (3) until I(x,y) is in Within, repeatedly output the current pixel value I(x,y).

[0088] (5) For each pixel, construct a Gaussian weight function, which includes two dimensions: pixel value and spatial location. This function can be expressed as:

[0089]

[0090] Where i and j are the spatial positions of the center pixel, and x and y are the spatial positions of the current pixel. I(i,j) and I(x,y) are the pixel values ​​of the center pixel and the current pixel, respectively. sigma_d and sigma_r are the standard deviations of the Gaussian function.

[0091] (6) For the current pixel, calculate the weighted average of its surrounding pixels using the following formula:

[0092]

[0093] Where W(x,y) is the weighted sum. This weighted average is used as the pixel value of the current pixel.

[0094] The grayscale histograms before and after image smoothing are as follows: Figure 8 As shown, the image smoothness is significantly improved. After obtaining the smoothed image, the image is binarized using the Otsu's method, and then image morphology operations such as opening are performed.

[0095] The Otsu's method is used to segment the foreground and background using a threshold. The optimal threshold is determined by maximizing the inter-class variance. Commonly used methods include binary methods, inverse binary methods, truncation methods, inverse truncation methods, zeroing methods, and inverse zeroing methods. This step uses the inverse binary method, and its formula is as follows:

[0096]

[0097] In the formula, img(i,j) is the gray value of the image at (i,j), threshold is the segmentation threshold, and maxval is the maximum gray value.

[0098] Then, an opening operation is performed. The method involves first performing erosion on the binarized image, followed by dilation. First, a structuring element B is placed at each pixel position in image A, aligning the center point of structuring element B with that pixel. For each pixel position, if all points of structuring element B coincide with the corresponding pixel position in image A, the pixel retains its original value; otherwise, the pixel is set to 0. For the eroded image, a dilation operation is performed again, using structuring element B to dilate each pixel position, and setting all pixels intersecting with B to 1. The opening operation removes small noise patches from the binary image and smooths image edges to obtain a more continuous and smooth image contour. The image after morphological processing is shown below. Figure 9 As shown.

[0099] In some embodiments of the present invention, step S3 includes:

[0100] The defect images in the defect dataset cropped in step S2 are processed. A set of two-dimensional random number seeds is randomly generated. Based on the generated random number seeds, the cropped defect images are randomly pasted into the defect-free car paint background image. The algorithm included in this step ensures that only one defect image is pasted into each paint background image, and the coordinates of the pasting are randomly variable each time. The formula for determining the random seed is:

[0101]

[0102]

[0103] Where x and y are the calculated coordinates of the defect data center. W and H are the width and height of the background image, respectively. w and h are the maximum width and height of the defect data mask, respectively. rand() is the function for selecting random numbers.

[0104] The data on the new automotive paint defect generated after step S3 is as follows: Figure 10 As shown.

[0105] The present invention also provides an image data enhancement device based on automotive paint defect detection for implementing any of the above methods, comprising:

[0106] The defect generation unit is used to generate automotive paint defect data using the CARP-GAN network.

[0107] The defect optimization unit is used to optimize the generated automotive paint defect data using the Med-BGauss image smoothing algorithm and morphological algorithms.

[0108] The defect dataset unit is used to obtain the final generated dataset of automotive paint defects based on the cut-paste algorithm with random variable parameters.

[0109] In summary, this invention provides an image data enhancement method and apparatus based on automotive paint defect detection. The method includes the following steps: generating new automotive paint defect data using a CARP-GAN adversarial network; optimizing the generated defect data using a Med-BGauss image smoothing algorithm and a morphological algorithm; and generating an expanded dataset using a cut-paste algorithm based on random variable parameters. The CARP-GAN generative adversarial network proposed in this invention can effectively extract image features of paint defects from the automotive paint defect dataset and generate new defect data. The image smoothing and morphological processing algorithm proposed in this invention can optimize the new defect data generated in the above steps, increasing the peak signal-to-noise ratio and eliminating "checkerboard" patterns in the image. The cut-paste algorithm based on defects and the original background proposed in this invention can randomly generate new defect data. Compared with existing technologies, this invention can generate a more realistic automotive paint defect dataset, providing a large amount of effective data for defect detection training operations.

[0110] It should be noted that, depending on the implementation needs, the various steps / components described in this application can be broken down into more steps / components, or two or more steps / components or parts of the operation of steps / components can be combined into new steps / components to achieve the purpose of this invention.

[0111] Those skilled in the art will readily understand that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An image data enhancement method based on automotive paint defect detection, characterized in that, Includes the following steps: S1. Generate automotive paint defect data using a CARP-GAN network; including: The CARP-GAN network consists of a discriminator network and a generator network; The discriminator network structure includes a Conv-MaxPool structure, a Conv-AvgPool structure, and an FC fully connected layer structure. The discriminator network structure downsamples existing automotive paint defect images through the Conv-MaxPool structure and extracts the pixel features of automotive paint defects by combining the Conv-AvgPool structure. The generator network reconstructs the introduced random noise into a noisy image, and then upsamples the noisy image to restore the image features; the generator network consists of two modules: a kernel prediction module and a feature reconstruction module; The steps of the kernel prediction module are as follows: For a feature map with input size H×W and number of channels C, a 1×1 convolution kernel is used to compress the channels to... For the compressed feature map, a k×k convolutional layer is used in each selected region to generate a reconstruction kernel. The encoder parameters are: Where C u For s 2 (k+2) 2 s is the upsampling expansion ratio; each (k+2)×(k+2) recombinant kernel is spatially normalized using the softmax function so that the sum of the kernel weights is 1; The steps of the feature recombination module are as follows: For each recombined kernel, it is mapped back to the input feature map, and a (k+2)×(k+2) region centered at that location is extracted. The pixel feature matrix of this region is then multiplied by the upsampling kernel to obtain the output result. Finally, the feature recombined results of each selected region are concatenated to obtain the upsampling result. S2. The generated automotive paint defect data is optimized using the Med-BGauss image smoothing algorithm and morphological algorithm. S3. Based on the cut-paste algorithm with random variable parameters, the final generated dataset of automotive paint defects is obtained.

2. The image data enhancement method based on automotive paint defect detection according to claim 1, characterized in that, The discriminator network structure specifically includes a 6-layer Conv-MaxPool structure, a 1-layer Conv-AvgPool structure, and a 4-layer FC fully connected layer structure, and the LeakyReLU activation function is used to activate the neural network.

3. The image data enhancement method based on automotive paint defect detection according to claim 1, characterized in that, The processing steps of the Med-Bgauss image smoothing algorithm include: (1) Divide the input image into a window of size n×n, with the center of the window being the current processing point (x,y); where x and y are pixel positions; (2) Calculate the median gray value med and the range r = I(x,y) of the pixel gray values ​​within the window. max -I(x,y) min ; (3) If the current pixel value I(x,y) is not in If the window size is within the range, then the window size will be increased by m pixels; (4) Repeat steps (2) and (3) until I(x,y) is in Within the range, output the current pixel value I(x,y); (5) For each pixel, construct a Gaussian weight function, which includes two dimensions: pixel value and spatial location. The function is expressed as: Where i and j are the spatial positions of the center pixel, x and y are the spatial positions of the current pixel, I(i,j) and I(x,y) are the pixel values ​​of the center pixel and the current pixel, respectively, and sigma_d and sigma_r are the standard deviations of the Gaussian function; (6) For the current pixel, calculate the weighted average of its surrounding pixels using the following formula: Where W(x,y) is the weight sum; Use this weighted average as the pixel value of the current pixel.

4. The image data enhancement method based on automotive paint defect detection according to claim 1, characterized in that, The processing steps of image morphology algorithms include: The image is binarized using the Otsu's method, and then an opening operation is performed for image morphology.

5. The image data enhancement method based on automotive paint defect detection according to claim 1, characterized in that, Based on the cut-paste algorithm with randomized variable parameters, the final generated dataset of automotive paint defects is obtained, including: A set of two-dimensional random number seeds is generated. Based on these seeds, optimized images of automotive paint defects are randomly pasted into background images of defect-free automotive paint. The background type and pasting coordinates are determined by the random number seeds, ensuring that each paint background image is pasted with only one defect image. The formula for determining the random number seeds is: Where x and y are the calculated center coordinates of the defect image; W and H are the width and height of the background image, respectively; w and h are the maximum width and height of the defect image, respectively; and rand() is a function for generating random numbers.

6. An image data enhancement device based on automotive paint defect detection, characterized in that, include: The defect generation unit is used to generate automotive paint defect data using a CARP-GAN network; it includes: The CARP-GAN network consists of a discriminator network and a generator network; The discriminator network structure includes a Conv-MaxPool structure, a Conv-AvgPool structure, and an FC fully connected layer structure. The discriminator network structure downsamples existing automotive paint defect images through the Conv-MaxPool structure and extracts the pixel features of automotive paint defects by combining the Conv-AvgPool structure. The generator network reconstructs the introduced random noise into a noisy image, and then upsamples the noisy image to restore the image features; the generator network consists of two modules: a kernel prediction module and a feature reconstruction module; The steps of the kernel prediction module are as follows: For a feature map with input size H×W and number of channels C, a 1×1 convolution kernel is used to compress the channels to... For the compressed feature map, a k×k convolutional layer is used in each selected region to generate a reconstruction kernel. The encoder parameters are: Where C u For s 2 (k+2) 2 s is the upsampling expansion ratio; each (k+2)×(k+2) recombinant kernel is spatially normalized using the softmax function so that the sum of the kernel weights is 1; The steps of the feature recombination module are as follows: For each recombined kernel, it is mapped back to the input feature map, and a (k+2)×(k+2) region centered at that location is extracted. The pixel feature matrix of this region is then multiplied by the upsampling kernel to obtain the output result. Finally, the feature recombined results of each selected region are concatenated to obtain the upsampling result. The defect optimization unit is used to optimize the generated automotive paint defect data using the Med-BGauss image smoothing algorithm and morphological algorithms. The defect dataset unit is used to obtain the final generated dataset of automotive paint defects based on the cut-paste algorithm with random variable parameters.

7. The image data enhancement device based on automotive paint defect detection according to claim 6, characterized in that, The discriminator network structure in the defect generation unit specifically includes a 6-layer Conv-MaxPool structure, a 1-layer Conv-AvgPool structure, and a 4-layer FC fully connected layer structure, and the neural network is activated by the LeakyReLU activation function.

8. The image data enhancement device based on automotive paint defect detection according to claim 6, characterized in that, The processing steps of the Med-Bgauss image smoothing algorithm in the defect optimization unit include: (1) Divide the input image into a window of size n×n, with the center of the window being the current processing point (x,y); where x and y are pixel positions; (2) Calculate the median gray value med and the range r = I(x,y) of the pixel gray values ​​within the window. max -I(x,y) min ; (3) If the current pixel value I(x,y) is not in If the window size is within the range, then the window size will be increased by m pixels; (4) Repeat steps (2) and (3) until I(x,y) is in Within the range, output the current pixel value I(x,y); (5) For each pixel, construct a Gaussian weight function, which includes two dimensions: pixel value and spatial location. The function is expressed as: Where i and j are the spatial positions of the center pixel, x and y are the spatial positions of the current pixel, I(i,j) and I(x,y) are the pixel values ​​of the center pixel and the current pixel, respectively, and sigma_d and sigma_r are the standard deviations of the Gaussian function; (6) For the current pixel, calculate the weighted average of its surrounding pixels using the following formula: Where W(x,y) is the weight sum; Use this weighted average as the pixel value of the current pixel.

9. The image data enhancement device based on automotive paint defect detection according to claim 6, characterized in that, The image morphology algorithm processing steps in the defect optimization unit include: The image is binarized using the Otsu's method, and then an opening operation is performed for image morphology.

10. The image data enhancement device based on automobile paint defect detection according to claim 6, characterized in that, The cut-paste algorithm based on random variable parameters in the defect dataset unit yields the final generated dataset of automotive paint defects, including: A set of two-dimensional random number seeds is generated. Based on these seeds, optimized images of automotive paint defects are randomly pasted into background images of defect-free automotive paint. The background type and pasting coordinates are determined by the random number seeds, ensuring that each paint background image is pasted with only one defect image. The formula for determining the random number seeds is: Where x and y are the calculated center coordinates of the defect image; W and H are the width and height of the background image, respectively; w and h are the maximum width and height of the defect image, respectively; and rand() is a function for generating random numbers.

Citation Information

Patent Citations

  • Construction violation behavior detection model construction method and application thereof

    CN111832443A

  • Industrial defect sample generation method and system based on generative adversarial network

    CN115661062A