A method for extracting industrial image features based on generative adversarial model

By adopting the adversarial training method of generating adversarial models in industrial image feature extraction, the problems of segmentation result errors and feature discontinuities in the UNet variant model are solved, and higher segmentation accuracy and feature continuity are achieved.

CN116824150BActive Publication Date: 2024-09-17SUZHOU MEIMAN INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310447614.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-24
Publication Date
2024-09-17
Estimated Expiration
2043-04-24

AI Technical Summary

Technical Problem

Existing industrial image feature extraction methods based on UNet variants have problems with segmentation result errors and discontinuous features, resulting in low segmentation accuracy.

Method used

The Improved DUNet model is built using a method based on the generative adversarial model, and the generator is jointly trained with the global discriminator and local discriminator through the adversarial training model. The generator and the discriminator are trained alternately to improve the continuity and accuracy of image feature extraction. .

Benefits of technology

It improves the accuracy and continuity of image segmentation, reduces similar feature segmentation errors, and improves the accuracy of industrial image feature extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116824150B
    Figure CN116824150B
Patent Text Reader

Abstract

The invention discloses an industrial image feature extraction method based on a generative adversarial model, comprising the following steps: preprocessing a Massachusetts feature image data set to obtain a data set; constructing an Improved DUNet model; importing the data set into the Improved DUNet model for training to obtain a generator; constructing a global discriminator and a local discriminator, and then forming an adversarial training model with the generator; based on the adversarial training model, the generator performs adversarial training with the global discriminator and the local discriminator respectively, and fine-tunes the image feature extraction result extracted by the generator; synthesizes the image feature extraction result of the generator and the image feature extraction result of the fine-tuned generator; and evaluates the image feature extraction result. The invention constructs an adversarial training model to fine-tune the image feature extracted by the generator, so that the extracted image feature is continuous and the segmentation accuracy is high, and the segmentation results of the model before and after the fine-tuning are synthesized to improve the extraction accuracy of the image feature.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of industrial image processing, and in particular relates to a method for extracting industrial image features based on a generative adversarial model. Background Art

[0002] Image feature extraction has important significance and applications in the fields of computer vision and image processing. By extracting features from images, the original pixel data can be converted into higher-level and more meaningful information, thereby realizing intelligent processing and analysis of images.

[0003] As deep learning has made great progress in computer vision tasks (image classification, semantic segmentation, and target detection), it has great application prospects in defect detection in engineering images. Due to its high segmentation accuracy and the absence of the need for manual feature extraction, deep learning algorithms have also been gradually introduced into industrial image feature extraction.

[0004] At present, almost all mainstream extraction models are improved based on UNet; for example, the residual module is added to the original UNet network to obtain the deep ResUNet; the attention gate is added to the decoder of UNet, and the Attention UNet model is proposed; the void convolution is added to UNet, and the DinkNet34 model is proposed; the UNet++ model is obtained by introducing nested and dense jump connections; the UNet3++ model is obtained by redesigning the mutual connections between the encoder and decoder and the internal connections between decoders, etc.

[0005] However, the above-mentioned industrial image feature extraction method based on UNet variant has some shortcomings: first, there are some similar features in the extracted image, which leads to incorrect segmentation results; second, the features in the image may be blocked by other objects, making the extracted image features discontinuous, resulting in reduced segmentation accuracy, thereby making the extracted industrial image features low in accuracy. Summary of the invention

[0006] The purpose of the present invention is to overcome the shortcomings of the prior art and provide an industrial image feature extraction method based on a generative adversarial model, which is used to make the segmentation result accurate, the extracted image features continuous, the segmentation accuracy high, and the industrial image feature extraction accuracy high.

[0007] To achieve the above object, the technical solution adopted by the present invention is: a method for extracting industrial image features based on a generative adversarial model, comprising the following steps:

[0008] The Massachusetts feature image dataset is preprocessed to obtain the dataset;

[0009] Build the Improved DUNet model;

[0010] Import the dataset into the Improved DUNet model for training to obtain a pre-trained model as a generator;

[0011] Build a global discriminator and a local discriminator, and then form an adversarial training model with the generator;

[0012] Based on the adversarial training model, the generator is trained adversarially with the global discriminator and the local discriminator respectively to fine-tune the image feature extraction results extracted by the generator;

[0013] Combine the image feature extraction results of the generator and the image feature extraction results of the fine-tuned generator;

[0014] Evaluate the image feature extraction results.

[0015] Further, the preprocessing is as follows:

[0016] S11 segmentation dataset: crop the 1500×1500 image to 512×512 image;

[0017] S12 deletes erroneous data: analyzes the cropped images, deletes the images with incorrect annotations, and divides the dataset into training set, validation set, and test set.

[0018] Furthermore, the steps to build the Improved DUNet model are as follows:

[0019] S21 The input image X first passes through the encoding layer Encoding to obtain the feature map F, F A It is the third-layer feature map after the attention mechanism Attention;

[0020] S22 performs normal convolution DoubleConv and dense dilated convolution DBlock on the third-layer feature map F and performs upsampling UpSample to obtain new feature maps X1 and X2. The feature map after dense dilated convolution needs to be element-by-element added to the convolved feature map before upsampling.

[0021] S23 concatenates the third-layer feature map of the encoder after the attention mechanism with the feature maps X1 and X2 respectively to obtain new X1 and X2;

[0022] S24 fuses the feature map obtained by X1 element by element (bitwise addition) to the feature map obtained by X2, and upsamples the new X1 and X2, and so on, until the feature map is restored to the original image resolution.

[0023] Furthermore, the constructed global discriminator and local discriminator are based on conditional GAN ​​and patchGAN respectively, which are used to determine whether the features extracted from each patch of the image are continuous. The difference between the global discriminator and the local discriminator is the size of the patch.

[0024] Furthermore, in the adversarial training between the generator and the global discriminator and the local discriminator respectively, the discriminator is trained once and then the generator is trained once.

[0025] Furthermore, the Wassertein distance is used to measure the distance between the data distribution and the true data distribution; the cGAN loss function is:

[0026]

[0027] Among them, G is the generator, D global is the global discriminator, D local is the local discriminator, G(x) is the segmentation result of the generator, and p data(x) is the real sample space;

[0028] The vgg topology loss function is:

[0029]

[0030] Where F is the pre-trained VGG model, G is the generator, G(x) is the output of the generator, and p data(x,y) is the real sample space.

[0031] Finally, the loss function of the adversarial training model is:

[0032]

[0033] +λ pixel L pixel (G)+λ vgg L vgg (G,F)

[0034] Among them, G* is the generator training weight, λ cGAN , pixel , vgg are all hyperparameters, G is the generator, D global is the global discriminator, D local is the local discriminator, F is the VGG training weight, L pixel is the L1 loss.

[0035] Furthermore, mIOU and mDC are used to evaluate the extraction results:

[0036]

[0037] Among them, p ii To predict the number of correct elements, p ij Indicates the number of true values ​​i that are predicted to be j, p ji Indicates that the true value is j, the number of predictions is i, and k represents the number of categories to be classified;

[0038]

[0039] Among them, assuming that Pre i Represents the segmentation result of the i-th image, GT i Represents the Ground Truth of the i-th image, and N represents the number of samples.

[0040] Due to the application of the above technical solution, the present invention has the following advantages compared with the prior art:

[0041] 1. Use the pre-trained model of Improved DUNet as the generator, and then build the global discriminator and local discriminator. After adversarial training between the generator and the discriminator, form an adversarial training model. Then, based on the adversarial training model, that is, train the discriminator once and then train the generator once, fine-tune the extraction results of Improved DUNet, so that the extracted image features are continuous, the segmentation accuracy is high, and the segmentation results are more continuous, thereby improving the accuracy of subsequent image feature extraction.

[0042] 2. The segmentation results of the model before fine-tuning and the model after fine-tuning are combined to obtain the segmentation advantages of the two models, thereby avoiding segmentation errors of similar features, thereby reducing the wrong segmentation areas and further improving the segmentation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The technical solution of the present invention is further described below in conjunction with the accompanying drawings:

[0044] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention;

[0045] Figure 2 is a network structure diagram of Improved DUNet in one embodiment of the present invention;

[0046] Figure 3 is an overall structural diagram of the attention module in Improved DUNet according to an embodiment of the present invention;

[0047] Figure 4 1 is a structural diagram of a channel attention module in an attention module in Improved DUNet according to an embodiment of the present invention;

[0048] Figure 51 is a structural diagram of a spatial attention module in an attention module in Improved DUNet according to an embodiment of the present invention;

[0049] Figure 6 An overall structural diagram of generating an adversarial training model in one embodiment of the present invention;

[0050] Figure 7 A schematic diagram comparing the mIOU and mDC accuracies of different models in the Massachusetts feature image dataset. DETAILED DESCRIPTION

[0051] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0052] The present invention provides a method for extracting industrial image features based on a generative adversarial model to solve the problem that the extraction model in the prior art has insufficient segmentation accuracy, thereby resulting in low accuracy of the extracted industrial image.

[0053] See also Figure 1 , a method for extracting industrial image features based on a generative adversarial model in an embodiment of the present application comprises the following steps:

[0054] S1, preprocessing the Massachusetts feature image dataset to obtain the dataset;

[0055] The preprocessing method includes the following steps: S11, dividing the data set; S12, deleting erroneous data.

[0056] In the above segmented data set, the original 1500×1500 image cannot be directly trained due to its high resolution, and it needs to be cropped into 512×512 images. The specific division method is to first take a 512×512 bounding box template, slide this template on the 1500×1500 image, first crop the four corners and the middle image, and then take the image between each two adjacent templates in the four bounding boxes at the four corners in turn. The areas of these 9 images overlap with each other.

[0057] In the above-mentioned deletion of erroneous data, the cropped images are analyzed and the images with incorrect annotations are deleted. Finally, 8,960 images of size 512×512 are obtained. According to the division of the original data set into training set, verification set and test set, 8,361 training images, 126 verification images and 433 test images are obtained respectively. The training images are used for various training in the present invention, the verification images are used to verify the trained model, and the test images are used to test the trained model.

[0058] S2. Build the Improved DUNet model;

[0059] See also Figure 2 , the steps to construct the Improved DUNet model are as follows:

[0060] S21: The input image X first passes through the encoding layer to obtain the feature map F, F A This is the third-layer feature map after the attention mechanism:

[0061] F=Encoding(X) (1)

[0062] F A =Attention(F) (2)

[0063] Among them, the overall structure of the attention module is as follows Figure 3 As shown, it contains the channel attention module as Figure 4 As shown in Figure 2, the spatial attention module is Figure 5 As shown;

[0064] S22: The third-layer feature map F is subjected to ordinary convolution DoubleConv, dense hole convolution DBlock and upsampled UpSample to obtain new feature maps X1 and X2:

[0065] X1=UpSample(DoubleConv(F)) (3)

[0066] X2=UpSample(DBlock(F)+DoubleConv(F)) (4)

[0067] Among them, the feature map after dense dilated convolution needs to be added element by element to the feature map after convolution, and then upsampled;

[0068] S23: Concatenate the third-layer feature map of the encoder after the attention mechanism with the feature maps X1 and X2 respectively to obtain new X1 and X2;

[0069] S24: The feature map obtained by X1 is fused element by element (bitwise addition) to the feature map obtained by X2, and the new X1 and X2 are upsampled again, and so on, until the feature map is restored to the original image resolution.

[0070] S3, import the data set into the Improved DUNet model for training to obtain a pre-trained model as a generator;

[0071] In the above steps, the segmented 512×512 Massachusetts dataset with some labeling errors removed is put into Improved DUNet for training to obtain a pre-trained model as a generator.

[0072] S4. Build a global discriminator and a local discriminator, and then form an adversarial training model with the generator;

[0073] In this step S4, the discriminator is based on conditional GAN ​​and patchGAN to determine whether the features extracted from each patch of the image are continuous. By default, the discriminator believes that the image in the ground truth is flawless, and the image extracted by the improved DUNet is defective. The difference between the global discriminator and the local discriminator is the size of the patch. The structure of the final generative adversarial training model (Improved-DUNet-wGAN) is as follows: Figure 6 As shown, the adversarial training model here is the adversarial training model used in step S5, and the image generated by the generator is compared and adjusted by the global discriminator and the local discriminator.

[0074] S5 is based on the adversarial training model. The generator and the global discriminator and the local discriminator are trained adversarially respectively to fine-tune the image feature extraction results extracted by the generator;

[0075] In the adversarial training between the generator and the global discriminator and the local discriminator respectively, the global discriminator and the local discriminator are trained once and then the generator is trained once.

[0076] Specifically, in Improved-DUNet-wGAN, since there are two discriminators, we let the segmentation results generated by the generator be trained against the global discriminator and the local discriminator respectively. Different from the original cGAN, in order to make the training more stable, the Wassertein distance is used to measure the distance between the data distribution and the real data distribution. The cGAN loss function is:

[0077]

[0078] Among them, G is the generator, D global is the global discriminator, Dlocal is the local discriminator, G(x) is the segmentation result of the generator, and p data(x) is the real sample space.

[0079] The delineation of curvilinear structures in computer vision is very important in many practical applications. Previous works have used pixel-level loss (BCE). Using only pixel-level loss is not suitable for such problems because they cannot reflect the influence of incorrect topology in the final prediction. Therefore, a new loss term is used to make up for the shortcomings of binary cross entropy loss.

[0080] The previous binary cross entropy is a local loss and cannot take into account very complex topological structures. In such problems, small local pixel errors may lead to large topological changes. The VGG topological loss function is:

[0081]

[0082] Where F is the pre-trained VGG model, G is the generator, G(x) is the output of the generator, and p data(x,y) is the real sample space.

[0083] Finally, the loss function of Improved-DUNet-wGAN is:

[0084]

[0085] Among them, G* is the generator training weight, λ cGAN , pixel , vgg are all hyperparameters, G is the generator, D global is the global discriminator, D local is the local discriminator, F is the VGG training weight, L pixel is the L1 loss.

[0086] S6 combines the image feature extraction result of the generator and the image feature extraction result after the generator is fine-tuned;

[0087] In step S6, by introducing a weight parameter, the trade-off between the image feature extraction results of the generator and the image feature extraction results after fine-tuning of the generator can be learned. Specifically, an additional network with a smaller learning rate can be used during the training process to learn these weights.

[0088] S7 evaluates the image feature extraction results.

[0089] The extraction results were evaluated using mIOU and mDC.

[0090] The implementation details of mIOU and mDC are as follows:

[0091]

[0092] Among them, p ii To predict the number of correct elements, p ij Indicates the number of true values ​​i that are predicted to be j, p ji It indicates that the true value is j and the predicted value is i, and k indicates the number of categories to be classified.

[0093]

[0094] Among them, assuming that Pre i Represents the segmentation result of the i-th image, GT i Represents the Ground Truth of the i-th image, and N represents the number of samples.

[0095] See also Figure 7 Compared with the prior art, the present invention applies the idea of ​​generative adversarial networks to the task of industrial image feature extraction. In this task, the mIOU and mDC of the Improved-DUNet-wGAN corresponding to the present invention exceed those of network models such as UNet, ResUNet, Attention UNet, LinkNet34, UNet++, UNet2++, UNet3++, and TransUNet, and the segmentation accuracy is high, which has great practical significance for the development of industrial production automation.

[0096] The method for extracting industrial image features based on a generative adversarial model of the present invention adopts a generative adversarial training model. The generative adversarial training model can be applied to different tasks and can achieve good results. After the generative adversarial training model is generated, the accuracy of defect detection is improved through adversarial training of the generator and the discriminator.

[0097] The present invention uses the pre-trained model of Improved DUNet as a generator, and then constructs a global discriminator and a local discriminator. An adversarial training model is formed through adversarial training of the generator and the discriminator. Then, based on the adversarial training model, that is, training the discriminator once and then training the generator once, the extraction result of Improved DUNet is fine-tuned, so that the extracted features are continuous, the segmentation accuracy is high, the segmentation results are more continuous, and the subsequent image feature extraction accuracy is improved.

[0098] Finally, the segmentation results of the model before fine-tuning and the model after fine-tuning are combined to obtain the segmentation advantages of the two models, thereby avoiding segmentation errors of similar features, thereby reducing the erroneous segmentation areas and further improving the segmentation accuracy.

[0099] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for extracting industrial image features based on a generative adversarial model. It is characterized in that The steps include: The Massachusetts feature image dataset is preprocessed to obtain the dataset; Build the Improved DUNet model; Import the dataset into the Improved DUNet model for training to obtain a pre-trained model as a generator; Build a global discriminator and a local discriminator, and then form an adversarial training model with the generator; Based on the adversarial training model, the generator is trained adversarially with the global discriminator and the local discriminator respectively to fine-tune the image feature extraction results extracted by the generator; Combine the image feature extraction results of the generator and the image feature extraction results of the fine-tuned generator; Evaluate the image feature extraction results; The steps to build the Improved DUNet model are as follows: S21 The input image X first passes through the encoding layer to obtain the third layer feature map F, F A It is the third-layer feature map after the attention mechanism Attention; S22 passes the third-layer feature map F through ordinary convolution DoubleConv, dense hole convolution DBlock and upsamples UpSample to obtain a new feature map X 1 and X 2 , where the feature map of the third layer feature map F after ordinary convolution DoubleConv is upsampled UpSample to obtain X1, and the feature map of the third layer feature map F after dense void convolution DBlock needs to be added element by element to the feature map of the third layer feature map F after ordinary convolution DoubleConv, and then upsampled UpSample to obtain X2; S23 passes the encoder through the third layer feature map F of the attention mechanism A Concatenate with feature maps X1 and X2 respectively to obtain new X1 and X2; S24 adds the feature map obtained by the new X1 in step S23 to the feature map obtained by the new X2 by element-by-element fusion and then upsamples, and so on, until the feature map is restored to the original image resolution.

2. The method for extracting industrial image features based on a generative adversarial model according to claim 1, It is characterized in that The preprocessing is as follows: S11 segmentation dataset: crop the 1500×1500 image to 512×512 image; S12 deletes erroneous data: analyzes the cropped images, deletes the images with incorrect annotations, and divides the dataset into training set, validation set, and test set.

3. The method for extracting industrial image features based on a generative adversarial model as claimed in claim 1, Features: The constructed global discriminator and local discriminator are based on conditional GAN ​​and patchGAN respectively, and are used to determine whether the features extracted from each patch of the image are continuous. The difference between the global discriminator and the local discriminator is the size of the patch.

4. The method for extracting industrial image features based on a generative adversarial model according to claim 1, Features: In the adversarial training between the generator and the global discriminator and the local discriminator respectively, the global discriminator and the local discriminator are trained once and then the generator is trained once.

5. The method for extracting industrial image features based on a generative adversarial model according to claim 1, Features: The Wassertein distance is used to measure the distance between the data distribution and the true data distribution; the cGAN loss function is: Among them, G is the generator, D global is the global discriminator, D local is the local discriminator, G(x) is the segmentation result of the generator, and p data(x) is the real sample space; The vgg topology loss function is: Where F is the pre-trained VGG model, G is the generator, G(x) is the output of the generator, and p data(x,y) is the real sample space; Finally, the loss function of the adversarial training model is: Among them, G* is the generator training weight, λ cGAN , pixel , vgg are all hyperparameters, G is the generator, D global is the global discriminator, D local is the local discriminator, F is the pre-trained VGG model, L pixel is the L1 loss.

6. The method for extracting industrial image features based on a generative adversarial model according to claim 1, It is characterized in that Use mIOU and mDC to evaluate the extraction results: Among them, P ii To predict the number of correct elements, P ij Indicates the number of true values ​​i that are predicted to be j, P ji Indicates that the true value is j, the number of predictions is i, and k represents the number of categories to be classified; Among them, assuming that Pre i Represents the segmentation result of the i-th image, GT i Represents the Ground Truth of the i-th image, and N represents the number of samples.