Anti-arc light image data set expansion method based on diffusion model

Through the anti-arc image data set expansion method based on the diffusion model, the problem of insufficient data sets in automated welding is solved, diversified data samples are generated, the generalization ability of the laser strip recognition algorithm is improved, and the diversity of the data set is achieved Improvement and cost reduction.

CN118628407APending Publication Date: 2024-09-10SHENYANG AEROSPACE UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410496414.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In automated welding, deep learning algorithms face problems of insufficient data sets and single data samples when used for laser stripe image recognition, resulting in insufficient model generalization capabilities, and existing data set expansion methods cannot effectively improve data diversity, affecting algorithm performance. .

Method used

An anti-arc light image data set expansion method based on the diffusion model is adopted. The original image is noisy and denoised by training the diffusion model to generate data samples that meet the needs. The ET-Unet network structure and the multi-head self-attention mechanism are used to improve noise prediction and Image generation performance.

Benefits of technology

Diversified data samples are generated, the diversity of the data set is improved, the generalization ability of the laser bar recognition algorithm is enhanced, the cost of data collection and annotation is reduced, and the dependence on manual data expansion is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628407A
    Figure CN118628407A
Patent Text Reader

Abstract

The invention discloses an anti-arc-light image data set expansion method based on a diffusion model, and the method comprises the steps: S1, training a diffusion model, training the diffusion model through an offline process, carrying out the noise processing of an original image of a collected image through a diffusion step, recovering the image covered by the noise into the original image through a generation step, and carrying out the recognition of the original image; obtaining a new data sample; s2, randomly generated samples are input into the trained diffusion model, and data samples meeting requirements are generated through generation steps trained in the offline process. According to the invention, the diffusion model is utilized to generate more diverse data in an image generation mode, so that the cost of data acquisition is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of application of deep learning methods in industrial detection, and in particular to an anti-arc image data set expansion method based on a diffusion model. Background Art

[0002] Automated welding is an important part of the intelligent manufacturing industry. It uses machines and control systems to automatically perform welding work to improve production efficiency, ensure welding quality and reduce the risk of manual operation. Line structured light measurement is a commonly used 3D measurement technology. By projecting one or more structured light (such as laser) onto an object and then analyzing the deformation of the reflected light, the 3D information of the object can be obtained. In automated welding, line structured light measurement can be used to monitor the position and shape of the weld in real time, thereby achieving precise welding control. During the welding process, laser stripe images provide rich information that can be used to evaluate the welding quality. Laser stripes are bright areas generated during the welding process. Their shape, size, and brightness can reflect the stability of the welding process and the welding quality. However, since laser stripe images usually contain complex patterns and noise, it is not a simple task to extract useful information from them.

[0003] Deep learning is a powerful machine learning technique that can automatically learn and extract complex features from large amounts of data. By using deep learning algorithms, models can be trained that can automatically extract useful information from laser streak images, thereby accurately evaluating welding quality in real time. However, there are also some challenges in using deep learning for laser streak image recognition. First, deep learning models usually require a large amount of labeled data for training, and it is usually difficult and expensive to obtain such data in industrial environments. Second, conditions in industrial environments change frequently, and high recognition accuracy is required. These requirements force the model to have better performance, which often requires larger data sets.

[0004] Although deep learning methods have strong adaptability in industrial inspection, most of them are supervised methods, which are extremely dependent on data sets. The content of the data set determines the detection content of the deep learning algorithm, and the quality of the data set greatly affects the performance of the algorithm. In the field of automated welding, it is difficult to obtain a suitable public data set of laser stripes due to commercial or privacy issues. There are also many difficulties in the process of making a homemade data set. Due to the single scene, it is difficult to collect data with different changes in lighting, angles, etc. There is too much repetition when collecting large amounts of data. Secondly, some defects or scenes are very rare, and collecting diverse data has a significant impact on the generalization ability of the model.

[0005] At present, the data collection and production of laser bars in welding mainly start from two aspects. The first is to collect as many data images as possible in different environments, different features, and different angles in the early stage of data collection. The second is to expand the data set based on these collected images by random rotation, cropping, scaling, etc. Although this expansion method is fast and simple, these images are essentially part of the original images, and they cannot improve the diversity of the original data. The brightness and features of the expanded images are similar to the original images. Secondly, these simple changes may lose the information of the target in the image. The large number of data samples expanded by these methods will affect the real sample distribution of the data set, and thus the performance of the algorithm.

[0006] In summary, it is very meaningful to provide a method to provide a good data foundation for deep learning algorithms when applied to laser bar detection in welding. Summary of the invention

[0007] In view of this, the present invention discloses an anti-arc image data set expansion method based on a diffusion model to solve the problem of expanding the laser stripe data set in welding.

[0008] The technical solution of the present invention includes: an arc-resistant image data set expansion method based on a diffusion model, comprising:

[0009] S1: training the diffusion model, the diffusion model is trained through an offline process;

[0010] The offline process is as follows: the collected image is subjected to a diffusion step in sequence to make the original image noisy, and then the image covered by the noise is restored to the original image through a generation step to obtain a new data sample;

[0011] S2: Input the randomly generated samples into the trained diffusion model, and generate data samples that meet the requirements through the generation steps that have been trained in the offline process.

[0012] Preferably, the diffusion step is: inputting the original image x0 in the data set into the diffusion model, gradually adding noise ε to the image, and finally converting it into a noise image x after T steps of noise addition. T , where the noise ε comes from the noise sampler.

[0013] Preferably, the original image in the data set is input into the diffusion model:

[0014] The original image x0~q(x0) in the data set is input into the diffusion model, and a total of T diffusion processes are performed. The diffusion process is a Markov chain. The data obtained after each step of the diffusion process is the data obtained through the previous step x t-1 According to formula (1), we can get the following after Gaussian sampling:

[0015]

[0016] in is the variance of the sampling noise in each diffusion process, its range is (0,1), and β1<β2<…<β T , indicating that the added noise will become larger and larger, t∈T is the preset fixed sampling number, which is equivalent to the sampling time point, x tt is from the mean The variance is β t It is obtained from the Gaussian distribution sampling;

[0017] Mathematical induction is used to expand each step of the diffusion process, so as to establish the image x at any time. t The relationship q(x t~T |x0):

[0018] First, we adopt the re-parameterization technique, assuming that a t =1-β t , Then, according to formula (1), the following is obtained by step-by-step iteration:

[0019]

[0020] The random noise The noise ∈ at each step conforms to the Gaussian distribution;

[0021] Based on Bayesian probability theory, it can be seen from formula (2) that the step-by-step iterative process satisfies Gaussian distribution, so as to obtain x at any time from the initial x0 t The formula is:

[0022]

[0023] in and is the weighting coefficient of the two, further indicating that the weight system is composed of the known α t , β t get.

[0024] Preferably, in the generation step, the noise image x T Step-by-step denoising, using a noise prediction network to predict the noise that needs to be removed at each step Finally restore the image.

[0025] Preferably, according to the diffusion process, the original image x0 and q(x t |x t-1 ), combined with Bayesian probability theory, calculate the true distribution q(x t~1 |x t)The conditional probability of the process:

[0026]

[0027] Among them, q(x t~1 |x0)、q(x t |x0) are obtained from equation (3) during the diffusion process:

[0028]

[0029] Next, by substituting formula (5) into formula (4), we can obtain:

[0030]

[0031] Among them, for x t The probability distribution calculation of the time, C(x t ,x0) is a t-1 Irrelevant quantities, it is proved above that the diffusion process eventually satisfies The Gaussian distribution of , then according to the probability function of the Gaussian distribution, combined with formula (6), we can get the posterior probability q(x t~1 |x t ,x0) is:

[0032]

[0033]

[0034] Preferably, the noise sampler adopts a cosine function to add noise:

[0035]

[0036] Preferably, the noise prediction network adopts an ET-Unet network structure, in which a multi-layer perception layer (MLP) is used to encode time to distinguish noise at different times, and the time code and the corresponding image together constitute the input of the network;

[0037] The backbone of the network consists of an encoder on the left and a symmetrical decoder on the right. The encoder is responsible for encoding the noise image and time information, and the decoder is responsible for restoring the noise prediction result at the corresponding moment of the information output. When the network is deep, the multi-head self-attention mechanism in Transformer is added to improve the performance of the network.

[0038] The present invention provides an anti-arc image data set expansion method based on a diffusion model, which can generate a large number of data samples that meet the requirements of laser bar detection in welding, greatly alleviating the problem of insufficient data samples in deep learning algorithms in automated welding applications. The present invention also uses an unsupervised image generation method to achieve data set expansion, avoiding reliance on manually annotated images and reducing the cost of data collection and expansion.

[0039] This method solves the serious homogeneity problem between the images generated by the common expansion method and the original data samples, and can generate new data samples that meet the requirements; the data samples generated by this method have more uniform grayscale distribution, more diverse colors and brightness, and supplement the diversity of the data set, laying the foundation for realizing a laser bar recognition algorithm with stronger generalization ability.

[0040] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 A network structure diagram of laser stripe image generation based on a diffusion model provided in an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of the steps of diffusing a noise-added image provided by an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of denoising of an image generation process provided by an embodiment of the present invention;

[0046] Figure 4 A schematic diagram of the ET-UNet noise prediction network structure provided by the disclosed embodiment of the present invention;

[0047] Figure 5 A visualization diagram of the generation steps provided for the disclosed embodiment of the present invention;

[0048] Figure 6 A laser stripe image generated based on a diffusion model provided in an embodiment of the present invention;

[0049] Figure 7 A pixel distribution histogram of data provided for an embodiment of the present invention. DETAILED DESCRIPTION

[0050] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present invention. Instead, they are merely examples of systems consistent with some aspects of the present invention as detailed in the appended claims.

[0051] In order to solve the problem of how to better complete the expansion of the laser bar data set and generate high-quality data samples that better meet the needs. To alleviate the problems of low data acquisition diversity, small data volume, and high acquisition cost, this implementation plan provides an anti-arc image data set expansion method based on a diffusion model. Based on the diffusion model, the image generation method is used to complete the expansion of the data set. The algorithm flow of image generation is divided into offline process and online process:

[0052] The offline process is the training process of the diffusion model. In this process, the collected images go through the diffusion step and the generation step in sequence. The offline process gives the diffusion model the ability to understand and express the data, which is the premise and foundation of the online process.

[0053] The online process is the image generation process, which is the actual method carrier for data set expansion. This process removes the diffusion step. The randomly generated samples go through the generation steps that have been trained in the offline process to generate data samples that meet the requirements.

[0054] The present invention uses the generation of laser stripe images under multiple arc interferences in welding as an example to implement the algorithm. The overall structure of the diffusion model is as follows: Figure 1 As shown in FIG. 1 , the present invention provides a laser streak image generation algorithm based on a diffusion model to realize the expansion of the laser streak image data set in welding, which includes two main processes: a diffusion step and a generation step. In the diffusion process, the original image x0 in the data set is used as input, and noise is gradually added to the image. The noise ε comes from the noise sampler, and finally becomes a noise image x after T steps of noise addition. T In the generation step, the noise image x T It is step-by-step denoising, and the noise prediction network predicts the noise that needs to be removed at each step Finally, the image is restored. The offline process will go through the complete diffusion step and generation step in sequence. The main purpose is to train the noise prediction network so that it can predict more realistic noise. The online process will directly randomly initialize a noise image and only obtain a new data sample through the generation step.

[0055] The diffusion step is a process of gradually diffusing the original image into noise. The starting point of the diffusion step is the original image, and then a certain amount of noise is added in each step. The noise is usually sampled from a Gaussian distribution, making the data gradually more random and unpredictable. This process is a series of random diffusion steps, which is a transition from order to disorder. Each step makes the data distribution closer to the set noise distribution (such as Gaussian distribution). This process is repeated continuously until the data completely becomes noise. For the original image x0~q(x0), a total of T such diffusion processes are performed, and the data obtained after each diffusion process is obtained through the previous step data x t-1 , obtained by Gaussian sampling as follows:

[0056]

[0057] in is the variance of the sampling noise at each step, its range is (0,1), and β1<β2<…<β T , indicating that the added noise will become larger and larger. t∈T is the preset fixed sampling number, which is also equivalent to the sampling time point. From the formula, we can see that x t is from the mean The variance is β t The original image is converted into a noise image through a step-by-step noise addition process. Figure 2 shown.

[0058] Since the diffusion process is a Markov chain, the image at time t is only related to the image at time t-1, and the image at each moment can be obtained from the image at the previous moment, that is, q(x t |x t-1 ). How to establish x at any time t The relationship q(x t~T |x0), we can use mathematical induction to expand each diffusion process. First, we use the heavy parameter technique to assume that α t =1-β t , Then, according to formula (1), the following is obtained by step-by-step iteration:

[0059]

[0060] The random noise From the above formula, we can see that although the noise ∈ of each diffusion process is sampled from the variance βt Different distributions, but they all conform to Gaussian distribution. From Bayesian probability theory, we know that the addition of two normal distributions still conforms to normal distribution, but the mean and variance will change. Therefore, from formula (2), we can see that this iterative process will eventually satisfy Gaussian distribution, so as to obtain x at any time from the initial x0 t The formula is:

[0061]

[0062] From the above conclusions, we can conclude that the most important characteristic of the diffusion model is the chain propagation characteristic. The image at any time is linearly weighted by the original image x0 and random noise ∈. and is the weighting coefficient of the two, further indicating that the weight system is composed of the known α t , β t They are the cornerstones of the noise sampler in the diffusion model. The original image x0 is known, so the only unknown in this diffusion formula is the random noise ∈, which is sampled from a Gaussian distribution. Therefore, predicting each ∈ is the main task in the diffusion model training process. The training algorithm flow of the diffusion process is shown in the table.

[0063] Table 1 Training process of diffusion step

[0064]

[0065] The generation step can be regarded as the reverse process of the diffusion step. The diffusion step is to make the original image noisy, while the generation step is to restore the image that has been covered by noise to the original image. From a broad perspective, it is also a random diffusion process that conforms to the Markov chain. Assume that if we know the true distribution q(x t~1 |x t ), then from a satisfying x T The noise image can be gradually removed to restore the real image x0. The denoising process of the generation process is as follows: Figure 3 As shown in the figure, the generation process realizes the generation of the image, and the image generation of the laser stripes is completed based on this characteristic.

[0066] Although the distribution q(x t~1 |x t ) cannot be obtained directly, but according to the diffusion process, the original image x0 and q(x t |x t-1 ), combined with Bayesian probability theory, the conditional probability of this process can be calculated:

[0067]

[0068] In this way, the posterior probability is successfully converted into the prior probability through Bayesian probability theory. From the right side of the equation, we can see that q(x t~1 |x0)、q(x t |x0) can be obtained from equation (3) during the diffusion process:

[0069]

[0070] Next, by inserting equation (5) into equation (4), we can obtain:

[0071]

[0072] Among them, for x t The probability distribution calculation of the time, C(x t ,x0) is a t-1 Irrelevant quantities, it is proved above that the diffusion process eventually satisfies The Gaussian distribution of , then according to the probability function of the Gaussian distribution, combined with formula (6), we can get the posterior probability q(x t~1 |x t ,x0) is:

[0073]

[0074]

[0075] From formula (4), we can see that the final variance is a known quantity, which is obtained by the noise sampler during the diffusion process. From the mean value shown in formula (8) From the perspective of t and the original image x0. Ultimately, this probability distribution will guide the application of image generation. The sampling process of the generation process is shown in Table 2.

[0076] Table 2 Algorithm flow chart of the sampling process

[0077]

[0078] The noise sampler (Noise Schdeluer) defines the generation method of noise ∈ in the diffusion step and determines the strategy of adding or removing noise in each step, which is crucial for controlling the quality and diversity of the generated image. Linear noise addition is the most common noise addition method, but as the time t increases, the proportion of noise will increase greatly, thereby causing the feature information in the image to be lost prematurely, and at the beginning, it will be difficult to predict accurately because the proportion of added noise is very small. In order to solve this problem, the present invention adopts a smoother cosine function for noise addition, introduces a cosine function to make the noise addition process smoother, and solves the problem that the image becomes a noisy image too quickly during the linear noise addition process.

[0079]

[0080] The noise prediction network completes the noise prediction task in the generation step, which is a noise restoration task. The present invention uses a more robust noise prediction network to improve the performance of the algorithm for laser streak image restoration (generation). The present invention improves the U-Net and designs ET-UNet (Enhance Transformer based-UNet) to further improve the noise prediction capability. The network structure is as follows: Figure 4 As shown in the figure. Noise needs to be predicted at each time step (TimeStep) of the generation process, so a multi-layer perception layer (MLP) is used to encode time to distinguish the noise at different times. The time code and the corresponding image together constitute the input of the network. The backbone of the network consists of an encoder on the left and a symmetrical decoder on the right. The encoder is responsible for encoding the noise image and time information, and the decoder is responsible for restoring the information and outputting the noise prediction result at the corresponding time. When the network is deep, the multi-head self-attention mechanism in Transformer is added to improve the performance of the network.

[0081] In order to explore the ability of the diffusion model to understand and generate industrial detection data samples, the present invention conducted an experiment using the image detection of laser stripes in automated welding as an example. The completion of the diffusion model training in the offline process is a prerequisite for the online process to achieve image generation. The present invention visualizes the generation steps, and the visualization results are as follows: Figure 5 As shown in Figure 2, for a randomly initialized noise image, the model is able to generate a laser stripe image through gradual denoising during the generation process.

[0082] The present invention adopts unconditional image generation, that is, the initial noise image in the generation process is random, and no prior knowledge is added. Figure 6The laser stripe image generated based on the self-supervised diffusion model is shown. From the results, it can be seen that the method proposed in the present invention can generate sample images that conform to the original data set. The generated laser stripes are complete and have obvious features. At the same time, samples with arcs and splashes can be generated. In addition, the generated sample brightness, light stripe position, and distribution of interference elements are random, which can improve the diversity of the data set.

[0083] The pixel distribution histogram of the generated data and the training data is as follows Figure 7 As shown in the figure. Both of them show the characteristics of high at both ends and low in the middle, and the pixels are mainly concentrated in low brightness, which means that the generated data meets the requirements of laser stripe image generation. Moreover, the pixel distribution of the generated data is more uniform, which can increase the diversity of samples and enhance the perception difference of different grayscale values ​​of the laser stripe segmentation model, thereby improving the generalization ability of the model.

[0084] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the claims.

Claims

1. The arc-flash image dataset expansion method based on diffusion model is characterized by: S1: training the diffusion model, the diffusion model is trained through an offline process; The offline process is as follows: the collected image is subjected to a diffusion step in sequence to make the original image noisy, and then the image covered by the noise is restored to the original image through a generation step to obtain a new data sample; S2: Input the randomly generated samples into the trained diffusion model, and generate data samples that meet the requirements through the generation steps that have been trained in the offline process.

2. The arc-flash image dataset expansion method based on diffusion model according to claim 1, characterized in that: The diffusion step is: input the original image x0 in the data set into the diffusion model, gradually add noise ε to the image, and finally add noise to it after T steps to become the noise image x T , where the noise ε comes from the noise sampler.

3. The arc-flash image data set expansion method based on diffusion model according to claim 2, characterized in that: The original image in the data set is input into the diffusion model: The original image x0~q(x0) in the data set is input into the diffusion model, and a total of T diffusion processes are performed. The diffusion process is a Markov chain. The data obtained after each step of the diffusion process is the data obtained through the previous step x t-1 According to formula (1), we can get the following after Gaussian sampling: in is the variance of the sampling noise in each diffusion process, its range is (0,1), and β1<β2<…<β T , indicating that the added noise will become larger and larger, t∈T is the preset fixed sampling number, which is equivalent to the sampling time point, x t is from the mean The variance is β t It is obtained from the Gaussian distribution sampling; Mathematical induction is used to expand each step of the diffusion process, so as to establish the image x at any time. t The relationship q(x t~T |x0): First, we adopt the re-parameterization technique, assuming that α t =1-β t , Then, according to formula (1), the following is obtained by step-by-step iteration: The random noise The noise ∈ at each step conforms to the Gaussian distribution; Based on Bayesian probability theory, it can be seen from formula (2) that the step-by-step iterative process satisfies Gaussian distribution, so that we can get x at any time from the initial x0 t The formula is: in and is the weighting coefficient of the two, further indicating that the weight system is composed of the known α t , β t get.

4. The arc-flash image data set expansion method based on diffusion model according to claim 1, characterized in that: In the generation step, the noise image x T Step-by-step denoising, using a noise prediction network to predict the noise that needs to be removed at each step Finally restore the image.

5. The arc-flash image data set expansion method based on diffusion model according to claim 3, characterized in that: According to the diffusion process, the original image x0 and q(x t |x t-1 ), combined with Bayesian probability theory, calculate the true distribution q(x t~1 |x t )The conditional probability of the process: Among them, q(x t~1 |x0)、q(x t |x0) are obtained from equation (3) during the diffusion process: Next, by substituting formula (5) into formula (4), we can obtain: Among them, for x t The probability distribution calculation of the time, C(x t ,x0) is a t-1 Irrelevant quantities, the final diffusion process satisfies According to the Gaussian distribution probability function, combined with formula (6), we can get the posterior probability q(x t~1 |x t ,x0) is:

6. The arc-flash image data set expansion method based on diffusion model according to claim 2, characterized in that: The noise sampler uses a cosine function to add noise:

7. The method for expanding the anti-arc flash image dataset based on the diffusion model according to claim 3, characterized in that: The noise prediction network adopts the ET-Unet network structure, in which a multi-layer perception layer (MLP) is used to encode time to distinguish noise at different times. The time code and the corresponding image together constitute the input of the network; The backbone of the network consists of an encoder on the left and a symmetrical decoder on the right. The encoder is responsible for encoding the noise image and time information, and the decoder is responsible for restoring the information and outputting the noise prediction result at the corresponding moment. When the network is deep, the multi-head self-attention mechanism in Transformer is added to improve the performance of the network.

Citation Information

Cited By

  • X-ray welding seam image recovery method based on deep learning

    CN119850475A