Search

CN-121982450-A - Training sample enhancement method, training sample enhancement device, training sample enhancement storage medium and training sample enhancement program product

CN121982450ACN 121982450 ACN121982450 ACN 121982450ACN-121982450-A

Abstract

The embodiment of the invention relates to the technical field of artificial intelligence, and discloses a training sample enhancement method, electronic equipment, a storage medium and a program product. The method comprises the steps of marking an original defect image, constructing an initial data set, cutting a defect area in the initial data set to obtain a defect target image block, training an improved depth convolution generation countermeasure network by utilizing the defect target image block to obtain a trained generator, generating a new defect image by inputting a random noise vector by utilizing the generator, and embedding the generated defect image into a defect-free background image by utilizing a Poisson fusion technology to generate a synthetic defect image. The embodiment of the invention can solve the problem of scarcity of the defect data of the small sample in the industrial quality inspection.

Inventors

  • SUN DAOZONG
  • ZHONG HONGSHENG
  • WEN WEIPENG
  • XU SHIMING

Assignees

  • 华南农业大学

Dates

Publication Date
20260505
Application Date
20260124

Claims (10)

  1. 1. A training sample enhancement method, the method comprising: Labeling the original defect image and constructing an initial data set; cutting the defect area in the initial data set to obtain a defect target image block; Training an improved deep convolution generation countermeasure network by utilizing the defect target image block to obtain a trained generator; generating a new defect image by inputting a random noise vector using the generator; and embedding the generated defect image into a non-defective background image by using a poisson fusion technology to generate a composite defect image.
  2. 2. The training sample enhancement method of claim 1, further comprising: Constructing a generator, wherein the generator is embedded with a self-attention module in a network deep layer, and the self-attention module is configured to dynamically calculate the correlation between any two positions in an image; constructing a discriminator, wherein the discriminator applies spectrum normalization to all convolution layers, and the spectrum normalization is used for restraining the Lipohsh constant of a weight matrix of the discriminator; Configuring a training loss function by adopting hinge loss; and obtaining the improved deep convolution generating countermeasure network based on the generator, the discriminator and the training loss function.
  3. 3. The training sample enhancement method according to claim 2, wherein training the modified deep convolution generation countermeasure network with the defective target image block results in a trained generator comprising: Training the arbiter for generating the countermeasure network by using the defect target image block as a real sample; training the generator that generates the countermeasure network using the random noise vector as an input; And (3) alternately optimizing the generator and the discriminator in the training process according to the hinge loss, iterating a preset round or until the loss function converges, and completing training to obtain a trained generator.
  4. 4. The training sample enhancement method according to claim 1, wherein said labeling the original defect image to construct an initial dataset comprises: Acquiring an original image of the surface of a middle frame of the mobile phone; screening the original image, and reserving a clear subgraph of the image; and carrying out bounding box marking and category marking on the defect area in the subgraph to form an initial data set.
  5. 5. The training sample enhancement method according to claim 1, wherein said cropping the defect area in the initial dataset to obtain a defect target image block comprises: reading the boundary box labels in each image in the initial dataset; And according to the boundary box label, each defect instance is segmented and cut out from the background of the corresponding image, and a defect target image block corresponding to each defect instance is obtained.
  6. 6. The training sample enhancement method of claim 1, further comprising: combining the synthetic defect image with the original defect image to obtain a data sample; And carrying out data enhancement operation on the data sample to obtain an enhanced data set.
  7. 7. The training sample enhancement method of claim 6, further comprising: Integrating a wavelet transformation convolution module in a backbone network by taking a real-time detection transducer-R18 model as a basic framework, and introducing a high-low frequency attention mechanism into an encoder to obtain a target detection model; Performing end-to-end training on the target detection model using the enhanced data set; and detecting the surface defect image of the middle frame of the mobile phone by using the trained model, and outputting a defect detection result.
  8. 8. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the training sample enhancement method of any one of claims 1 to 7.
  9. 9. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the training sample enhancement method of any of claims 1 to 7.
  10. 10. A computer program product, characterized in that it comprises a computer program or instructions for executing the steps of the training sample enhancement method according to any of claims 1-7 by a processor.

Description

Training sample enhancement method, training sample enhancement device, training sample enhancement storage medium and training sample enhancement program product Technical Field The embodiment of the invention relates to the technical field of artificial intelligence, in particular to a training sample enhancement method, training sample enhancement equipment, a storage medium and a program product. Background In the manufacturing process of the smart phone, the middle frame of the phone is used as a key part of the whole structure, and the appearance quality of the middle frame directly influences the yield of products and the satisfaction degree of users. At present, the industrial site generally adopts a manual visual inspection mode to detect the surface defects of the middle frame, and the problems of low efficiency, strong subjectivity and the like exist. Although the target detection technology based on deep learning is introduced into industrial vision quality inspection, the model generalization capability is insufficient due to the fact that real defect samples are scarce and the labeling cost is high, and the technology is difficult to stably apply to an actual production environment. In addition, the traditional data enhancement method cannot generate a defect sample with novel semantics, and the existing generation countermeasure network method still faces the difficult problems of fidelity and controllability when generating tiny defects. Disclosure of Invention The embodiment of the invention aims to provide a training sample enhancement method, a training sample enhancement device, electronic equipment and a storage medium, which can solve the problem of scarcity of small sample defect data in industrial quality inspection. In order to solve the above technical problems, an embodiment of the present invention provides a training sample enhancement method, including: Labeling the original defect image and constructing an initial data set; cutting the defect area in the initial data set to obtain a defect target image block; Training an improved deep convolution generation countermeasure network by utilizing the defect target image block to obtain a trained generator; generating a new defect image by inputting a random noise vector using the generator; and embedding the generated defect image into a non-defective background image by using a poisson fusion technology to generate a composite defect image. The embodiment of the invention also provides electronic equipment, which comprises at least one processor and a memory in communication connection with the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the training sample enhancement method. The embodiment of the invention also provides a computer readable storage medium, which stores a computer program, and the computer program realizes the training sample enhancement method when being executed by a processor. Embodiments of the invention also provide a computer program product, characterized in that the computer program product comprises a computer program or instructions for executing the steps of the training sample enhancement method according to any of claims 1-7 by a processor. In addition, the method further comprises: Constructing a generator, wherein the generator is embedded with a self-attention module in a network deep layer, and the self-attention module is configured to dynamically calculate the correlation between any two positions in an image; constructing a discriminator, wherein the discriminator applies spectrum normalization to all convolution layers, and the spectrum normalization is used for restraining the Lipohsh constant of a weight matrix of the discriminator; Configuring a training loss function by adopting hinge loss; and obtaining the improved deep convolution generating countermeasure network based on the generator, the discriminator and the training loss function. In addition, the training the improved depth convolution generating countermeasure network by using the defect target image block to obtain a trained generator includes: Training the arbiter for generating the countermeasure network by using the defect target image block as a real sample; training the generator that generates the countermeasure network using the random noise vector as an input; And (3) alternately optimizing the generator and the discriminator in the training process according to the hinge loss, iterating a preset round or until the loss function converges, and completing training to obtain a trained generator. In addition, each image in the initial dataset comprises at least one defect area with a boundary box mark; and clipping the defect area in the initial data set to obtain a defect target image block, including: Reading a boundary box label of each image in the