Pipeline magnetic flux leakage defect image generation method based on improved DCGAN

CN119295579APending Publication Date: 2025-01-10SHENYANG AEROSPACE UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411319154.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-21
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In the expansion of pipeline magnetic leakage defect image data sets in the prior art, traditional data expansion methods lead to high similarity between the generated samples and the original samples, which cannot effectively improve the model training effect, and may even aggravate the overfitting of the model.

Method used

The residual network and attention mechanism are fused into a basic block and embedded in the DCGAN model to improve the model's feature extraction capability and enhance image generation through pseudo-color processing technology and CBAM module.

Benefits of technology

The generated pipeline leakage defect image quality is higher, and the model can extract deeper features, suppress useless noise information, effectively expand the data set, and solve the problem of small samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295579A_ABST
    Figure CN119295579A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of image processing, and discloses an improved DCGAN-based pipeline magnetic flux leakage defect image generation model, which comprises the following steps: S1, acquiring a magnetic flux leakage signal in a pipeline through a magnetic flux leakage detector; s2, carrying out image enhancement by adopting a pseudo-color processing technology, and carrying out pseudo-color enhancement by adopting density segmentation; s3, a residual network and an attention mechanism are embedded into the DCGAN model, and the extraction capability of model features is improved; and S4, generating a pipeline magnetic flux leakage defect image through the improved model. The algorithm proposed by the pipeline magnetic flux leakage defect image generation model based on the improved DCGAN can stably generate a pipeline magnetic flux leakage defect image with better quality, an effective way is provided for expansion of a pipeline magnetic flux leakage defect sample data set, and the problem of small samples faced by development of deep learning in the field of defect detection can be effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular relates to a pipeline magnetic leakage defect image generation method based on improved DCGAN. Background Art

[0002] At present, the recognition of pipeline magnetic leakage signals is often based on deep learning. However, in actual industrial production, due to the complex defect image collection process, pipeline magnetic leakage defect images are seriously insufficient and the relevant data sets are very limited. Data expansion is an effective way to solve the above problems. Traditional data expansion methods generate new samples by rotating, translating, scaling, adding noise, etc. to existing samples. Since the expanded samples have a high similarity with the original samples, it cannot be guaranteed that the newly generated samples are conducive to model training, and sometimes even aggravate the overfitting degree of the model. Therefore, how to expand the magnetic leakage data set while retaining more features is the focus of the present invention.

[0003] In order to facilitate the expansion of the pipe magnetic leakage defect dataset, the present invention proposes a pipeline magnetic leakage defect image generation method based on improved DCGAN, embeds the residual network and attention mechanism into the DCGAN model, and improves the model feature extraction capability. Summary of the invention

[0004] In order to solve the above problems, an improved DCGAN pipeline magnetic leakage defect image generation method is proposed. The new model used in this method integrates the attention mechanism and the residual network into a "basic block" and embeds it into the DCGAN network structure.

[0005] The present invention adopts the following technical solutions:

[0006] A pipeline magnetic leakage defect image generation method based on improved DCGAN includes the following steps:

[0007] S1. Obtain the magnetic flux leakage signal in the pipeline through the magnetic flux leakage detector;

[0008] S2. Use pseudo color processing technology to enhance the image, and use density segmentation to enhance pseudo color;

[0009] S3. Embed the residual network and attention mechanism into the DCGAN model to improve the model feature extraction capability;

[0010] S4. Generate pipeline magnetic flux leakage defect image using the improved model.

[0011] Preferably, in S3, the attention mechanism adopts the CBAM module, which supplements the information that cannot be learned by the traditional convolution operation, connects the information of two distant regions, captures more information, and better learns the relationship between global features.

[0012] Preferably, the CBAM module is composed of two parts: channel attention and spatial attention. Channel attention can make the neural network pay more attention to the pixel areas that play a key role in image generation and ignore insignificant areas, that is, to clarify the meaningful features in the features; spatial attention is used to process the distribution relationship between feature channels, that is, to clarify the location of meaningful features.

[0013] Preferably, the residual network is composed of multiple residual blocks connected linearly, and the attention mechanism CBAM module is embedded in the residual block, after the residual branch of each residual block and before aggregation.

[0014] Preferably, the residual block embedded with the CBAM module is called a basic block. The basic block is located before the Deconv layer. The addition of the basic block only improves the network feature extraction capability without changing the size and number of channels of the output feature map.

[0015] Compared with the prior art, the present invention has the following beneficial effects:

[0016] The new model used in the pipeline magnetic leakage defect image generation method based on the improved DCGAN in the present invention can stably generate pipeline magnetic leakage defect images with better quality; the addition of the residual network increases the network depth, enabling the model to extract deeper image features; the attention mechanism has the characteristic of automatically allocating weights, enabling the network to learn more useful texture information and suppress useless noise information; the present invention provides an effective way to expand the pipeline magnetic leakage defect sample data set, which helps to effectively solve the small sample problem faced by the development of deep learning in the field of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a network structure diagram of the present invention;

[0018] Figure 2 It is a magnetic flux leakage data set designed to verify the method provided by the present invention;

[0019] Figure 3 is the experimental result of generating images. DETAILED DESCRIPTION

[0020] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0021] The present invention provides a pipeline magnetic leakage defect image generation method based on improved DCGAN, comprising the following steps:

[0022] S1: Obtain the magnetic flux leakage signal in the pipeline through the magnetic flux leakage detector:

[0023] Pipeline magnetic flux leakage internal detection uses a permanent magnet to fully magnetize the ferromagnetic pipeline through a rigid brush to make it saturated or close to saturation, and judges whether the pipeline has defects by the change of magnetic induction lines. If there are no defects in the pipe wall, the magnetic induction lines are parallel to the inside of the pipe; if there are defects in the pipe wall, the magnetic induction lines will leak from the surface of the pipe, causing magnetic leakage. The magnetic leakage signal collected by the magnetic sensor is imaged to determine the characteristics and location of the defect.

[0024] S2: Use pseudo color processing technology for image enhancement and density segmentation for pseudo color enhancement:

[0025] After the magnetic flux leakage image is input, since the magnetic flux leakage signal is a three-dimensional signal, the curve and grayscale image cannot fully display all the data information. Pseudo-color processing technology is an effective image enhancement method. It can improve the resolution of image details and obtain a clear and natural image. The color value can be used as a three-dimensional feature of the magnetic flux leakage signal, so that the complete data of the magnetic flux leakage signal can be displayed by color. The present invention uses pseudo-color processing technology for image enhancement and density segmentation for pseudo-color enhancement. The grayscale level of the image is divided into N intervals I from 0 to M0. i (i=1,2,3,...N), and set the color C i Assigned to each interval, so that a pseudo-color image can be generated. Assuming that the grayscale range of the original grayscale image is 0≤f(x,y)≤50, the grayscale range is divided into k segments, [(I0, I1, ..., I k ),I0=0,I k =L] to map each gray level to a color, and the mapping relationship is as follows:

[0026]

[0027] Among them, g(x,y) is the output pseudo-color image; C i To map the color.

[0028] S3: Embed the residual network and attention mechanism into the DCGAN model to improve the model feature extraction capability; S4. Generate pipeline magnetic leakage defect images using the improved model:

[0029] When traditional convolutional neural networks are used as generators to generate images, the size of the convolution kernel is fixed and limited, and the area of ​​focus is limited. It is impossible to connect two pixels that are far apart. During the training process, it can usually only learn local information of the image, which easily leads to errors in the generated samples. The addition of the attention mechanism CBAM module can supplement the information that traditional convolution operations cannot learn, connect the information of two distant regions, capture more information, and better learn the relationship between global features.

[0030] The attention mechanism CBAM module consists of two parts: channel attention and spatial attention. Channel attention can make the neural network pay more attention to the pixel areas that play a key role in image generation and ignore insignificant areas, that is, to clarify which features are meaningful; spatial attention is used to process the distribution relationship between feature channels, that is, to clarify where the meaningful features are.

[0031] The characteristic of channel attention is that it can keep the channel dimension of the input feature map unchanged and compress the spatial dimension. First, the feature map F is used as input, and global maximum pooling and global mean pooling operations are performed based on space to obtain two 1×1 channel weight matrices, which are then input into the multi-level perception network; then, the output features are summed and Sigmod activation operations are performed to obtain the channel attention feature weight Mc. The process is as follows:

[0032] M c (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F)))=σ(W1(W0(F) Avg ))+W1(W0(F Max ))) (2)

[0036] Multiply the channel attention feature weights by the original input features to obtain the input F′ of the spatial attention. The process is as follows:

[0037]

[0038] The characteristic of spatial attention is to keep the spatial dimension of the feature map unchanged and compress the channel dimension. First, the input feature map F′ is subjected to channel-based maximum pooling and average pooling operations to obtain two two-dimensional vector concatenations; then, after convolution calculation and Sigmod activation operations, the spatial attention feature weight Ms is generated. The process is as follows:

[0039] M c (F) = σ(f 7×7 ([AvgPool(F); MaxPool(F)]))

[0040] =σ(f 7×7 ([F′ Avg ; F′ Max ])) (4)

[0042] Ideally, for neural networks, the deeper the number of layers, the better the performance. However, in actual training, as the network becomes deeper, it is often accompanied by problems such as unstable gradients, training difficulties, and network degradation. The core of Resnet is the introduction of residual blocks, which use skip connections or shortcuts to skip certain convolutional layers. Multiple residual blocks are linearly connected to form a residual network.

[0043] Traditional generative adversarial networks have problems such as too few convolutional layers and incomplete feature extraction. However, simply increasing the number of network layers will lead to problems such as slow model calculation speed, gradient explosion, and network degradation. Therefore, residual networks with skip connection structures are introduced to suppress gradient explosion and network degradation. However, residual networks do not have a direct advantage in extracting features, but achieve the most ideal effect by continuously characterizing more features layer by layer.

[0044] To address this problem, it is proposed to embed the attention mechanism CBAM module into the residual block, and use the characteristic of the attention mechanism to automatically assign weights to make up for the deficiency of the residual network in feature representation, extract more features through as few residual blocks as possible, and make the network more lightweight. According to the "plug and play" characteristic of the attention mechanism and the principle of not destroying the original structure of the network, the attention mechanism CBAM module is chosen to be embedded after the residual branch of each residual block and before aggregation. In this model, the residual block embedded with the CBAM module is called the "basic block".

[0045] The generator is the core of the entire network, and its purpose is to generate pipeline magnetic leakage defect images. A 100-dimensional linear vector is input into the network, and reconstructed into a 256*8*8 feature map through the linear layer. The "basic block" is introduced before the feature map is sent to the Deconv layer. The addition of the "basic block" only improves the network's feature extraction capability and does not change the size and number of channels of the output feature map. The output feature map is sent to the Dencov layer, BN layer, and Relu activation function layer in sequence to obtain a 128*16*16 feature map. Then repeat the above operation twice. Except for the end of the network, Tanh is used as the activation function, and the others use Relu as the activation function to obtain a 3*64*64 feature map as the output of the generator.

[0046] The input of the discriminator is the output image of the generator. The discriminator contains 3 convolutional layers. The input 3*64*64 feature map is transformed into a 256*8*8 feature map through continuous convolution. The activation function of the 3 convolutional layers all uses LeakyRelu. A "basic block" is added before the 2nd and 3rd convolution layers and a BN layer is added. A Dropout layer is added after the 1st and 3rd convolutional layers to prevent the discriminator from being over-optimized and causing overfitting in training. Finally, the 256*8*8 feature map is passed through a Sigmoid activation function to obtain the probability of the sample generated by the generator being true or false.

[0047] The pipeline magnetic leakage defect image generation model based on the improved DCGAN provided by the present invention is tested below.

[0048] exist Figure 2 In the experiment, the running environment is the Pytorch1.10.2 framework based on Python3.9, and the GPU used is NVIDIA3070ti. Adam is used as the optimizer for this experiment, the learning rate of the generator is set to 0.001, the batch-size is 4, the penalty parameter λ is 10, and the training is stopped after 1000 epochs. The experimental data comes from the self-built dataset. In order to ensure the accuracy of the image, the collected real pipeline magnetic leakage defect images are used. The high-resolution tire images are cropped to obtain pipeline magnetic leakage defect samples with an image size of 64*64, and then the defect training set is obtained through manual screening. The experimental dataset includes 600 pipeline magnetic leakage pseudo-color images, each with a size of 140×320. Some self-made datasets are shown in the figure.

[0049] exist Figure 3 In the figure, the experimental results of generating pipeline magnetic flux leakage defect images are shown. In order to show the effect of the images generated by different iterations in more detail, a generated image is extracted every 200 iterations during the training process as a display. Figure 3 As shown. Figure 3 It can be seen that the improved model can generate defects when it iterates 400 times, but the generated image is seriously distorted; when it iterates 600 times, there is a great improvement, but the background gridding is very serious; when it iterates 800 times, except for some grids on the edge of the image, the generated image is close to the real image; when it iterates 1000 times, the generated image is very close to the real image.

[0050] Although the embodiments of the present invention have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the above embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A pipeline magnetic leakage defect image generation method based on improved DCGAN, characterized in that: The following steps are involved: S1. Obtain the magnetic flux leakage signal in the pipeline through the magnetic flux leakage detector; S2. Use pseudo color processing technology to enhance the image, and use density segmentation to enhance pseudo color; S3. Embed the residual network and attention mechanism into the DCGAN model to improve the model feature extraction capability; S4. Generate pipeline magnetic flux leakage defect image using the improved model.

2. According to the method for generating pipeline magnetic flux leakage defect images based on improved DCGAN in claim 1, it is characterized in that: In S3, the attention mechanism adopts the CBAM module. The addition of the CBAM module supplements the information that cannot be learned by traditional convolution operations, connects the information of two distant regions, captures more information, and better learns the relationship between global features.

3. According to claim 2, a pipeline magnetic flux leakage defect image generation method based on improved DCGAN is characterized in that: The CBAM module consists of two parts: channel attention and spatial attention. Channel attention can make the neural network pay more attention to the pixel areas that play a key role in image generation and ignore insignificant areas, that is, to clarify the meaningful features in the features; spatial attention is used to process the distribution relationship between feature channels, that is, to clarify the location of meaningful features.

4. According to the method for generating pipeline magnetic flux leakage defect images based on improved DCGAN in claim 2, it is characterized in that: The residual network is composed of multiple residual blocks connected linearly, and the attention mechanism CBAM module is embedded in the residual block, after the residual branch of each residual block and before aggregation.

5. According to the method for generating pipeline magnetic flux leakage defect images based on improved DCGAN according to claim 4, It is characterized in that The residual block embedded with the CBAM module is called the basic block, which is located before the Deconv layer. The addition of basic blocks only improves the network's feature extraction capability without changing the size and number of channels of the output feature map.

Citation Information

Cited By

  • Industrial defect image generation method, terminal equipment and storage medium

    CN120931643A

  • Pipeline defect detection method and device, storage medium and computer equipment

    CN121278541A