CN117710371B - Method, device, equipment and storage medium for expanding defect sample - Google Patents

Method, device, equipment and storage medium for expanding defect sample Download PDF

Info

Publication number
CN117710371B
CN117710371B CN202410161232.9A CN202410161232A CN117710371B CN 117710371 B CN117710371 B CN 117710371B CN 202410161232 A CN202410161232 A CN 202410161232A CN 117710371 B CN117710371 B CN 117710371B
Authority
CN
China
Prior art keywords
defect
image
layer
vae model
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410161232.9A
Other languages
Chinese (zh)
Other versions
CN117710371A (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Shuzhilian Technology Co Ltd
Original Assignee
Chengdu Shuzhilian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Shuzhilian Technology Co Ltd filed Critical Chengdu Shuzhilian Technology Co Ltd
Priority to CN202410161232.9A priority Critical patent/CN117710371B/en
Publication of CN117710371A publication Critical patent/CN117710371A/en
Application granted granted Critical
Publication of CN117710371B publication Critical patent/CN117710371B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Image Analysis (AREA)

Abstract

The application provides a method, a device, equipment and a storage medium for expanding a defect sample, relates to the technical field of defect detection, and is used for solving the problem of fewer defect samples. The method comprises the following steps: image acquisition is carried out on the defects in the real panel, and an original defect image is obtained; inputting the original defect image into a trained VAE model for defect expansion to obtain an expanded defect image; the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model comprises an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module. Therefore, model convergence can be performed more quickly and more efficiently when model training is performed, model training time is shortened, indexes of the target detection model can be improved, and omission factor of the defect detection model is reduced.

Description

Method, device, equipment and storage medium for expanding defect sample
Technical Field
The application relates to the technical field of defect detection and provides a method, a device, equipment and a storage medium for expanding a defect sample.
Background
Along with the development of social economy and information technology, the application of panel glass gradually becomes a new trend in the future, and meanwhile, the panel products are updated at high frequency, so that higher and stricter requirements are brought to defect detection.
However, due to the problem of the production process, a large number of defects are exploded in a certain period of time, and therefore, the number of defects is large, and the detection effect of the model on such defects is good. However, for some special types of defects due to accidental operations, the number of collected defects is small because of low reproducibility, and thus, problems of model omission or difficult detection occur.
Therefore, how to expand the defect samples is a problem to be solved at present for defects with low occurrence rate and small number.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a storage medium for expanding a defect sample, which are used for solving the problem that the defect sample is fewer.
In one aspect, a method of augmenting a defect sample is provided, the method comprising:
Image acquisition is carried out on the defects in the real panel, and an original defect image is obtained;
Inputting the original defect image into a trained VAE model for defect expansion to obtain an expanded defect image; the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model comprises an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module.
The beneficial effects of the application are as follows: because the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, and the decoder comprises an up-sampling layer and a batch normalization layer, the loss function comprises a KL divergence calculation module, when the trained VAE model is adopted to expand defect samples, high-quality expanded defect images can be generated to expand a large number of samples, thereby being beneficial to improving the index of a target detection model and reducing the omission ratio of the defect detection model. Because the trained VAE model includes a convolution layer and an upsampling layer, the panel defect image extension for high resolution and larger dimensions is also very useful. In addition, because the Loss function in the trained VAE model comprises the KL divergence calculation module, namely, the calculation of the Loss function is optimized, the model convergence can be more quickly and more efficiently carried out when the model is trained, and the training time of the model is shortened.
In one implementation, before inputting the original defect image into the trained VAE model for defect augmentation, the method further includes:
Carrying out real-time image acquisition on various defects in the real panel to obtain a plurality of original defect images;
obtaining a training set and a testing set according to the preset proportion of the original defect images;
and training the improved VAE model by adopting the training set, and testing the improved VAE model by adopting the testing set to obtain a trained VAE model.
The beneficial effects of the application are as follows: because the real-time collected defect image is adopted to train and test the improved VAE model, the trained VAE model can be more in line with the current actual situation, and the obtained extended defect image can also have more reality.
In one implementation, before training the improved VAE model with the training set and testing the improved VAE model with the test set, the method further includes:
Replacing a full connection layer in an encoder of an original VAE model with a convolution layer and a batch normalization layer, and replacing Sigmod activation functions in the encoder with Leakyrelu activation functions to obtain a first VAE model;
constructing a characteristic mean value layer and an exponential function activation layer in an encoder of the first VAE model to obtain a second VAE model;
Replacing an initial full connection layer in a decoder of the second VAE model with an up-sampling layer and a batch normalization layer, and outputting a decoding result by adopting a Tanh activation function to obtain a third VAE model;
and adding a KL divergence calculation module into the loss function of the third VAE model to obtain the improved VAE model.
The beneficial effects of the application are as follows: because the full connection layer in the encoder of the original VAE model is replaced by the convolution layer and the batch normalization layer, and the Sigmod activation function in the encoder is replaced by the Leakyrelu activation function, in the application, the trained VAE model can be further expanded on the panel defect image with high resolution and larger size, the expressive force of the VAE model can be further increased, and the network nerves of the VAE model can be better fit with data, so that the convergence rate of the VAE model is further accelerated. Because the characteristic average value layer and the exponential function activation layer are also constructed in the encoder, in the application, an image characteristic similar to the original defect image characteristic can be obtained through the encoder so as to conveniently obtain an extended defect image. Because the initial full-connection layer in the decoder is replaced by the up-sampling layer and the batch normalization layer, and the Tanh activation function is adopted to output the decoding result, the method and the device can further enable the trained VAE model to be more suitable for panel defect images with high resolution and larger size, and further accelerate the convergence rate of the VAE model. In addition, since the KL divergence calculation module is added in the loss function, the training time of the model can be further shortened when the model is trained.
In one implementation, the step of inputting the original defect image into a trained VAE model to perform defect expansion and obtain an expanded defect image includes:
Inputting the original defect image into an encoder of the trained VAE model for encoding to obtain image characteristics with noise;
And inputting the noisy image features into a decoder of the trained VAE model for decoding to obtain the extended defect image.
The beneficial effects of the application are as follows: because the output image characteristics of the encoder of the trained VAE model are noisy image characteristics, the subsequently obtained extended defect image can be similar to the original defect image, so that the purpose of extending the defect sample is achieved.
In one implementation, the step of inputting the original defect image into an encoder of the trained VAE model for encoding to obtain noisy image features includes:
Processing the original defect image by adopting a convolution layer and a batch normalization layer in the encoder to obtain normalized image characteristics;
And processing the normalized image features by adopting a feature mean value layer and an exponential function activation layer in the encoder to obtain noisy image features.
The beneficial effects of the application are as follows: the obtained image features with noise are sequentially obtained through the convolution layer, the batch normalization layer, the feature mean layer and the exponential function activation layer, so that the trained VAE model can be further expanded for the panel defect image with high resolution and larger size, and the image features similar to the original defect image features can be further obtained through the encoder, so that the expanded defect image can be conveniently obtained later.
In one implementation, the step of processing the normalized image feature with a feature mean layer and an exponential function activation layer in the encoder to obtain a noisy image feature includes:
Adopting a characteristic average layer in the encoder to perform average processing on the normalized image characteristics to obtain average image characteristics;
Carrying out noise self-learning on the image features after the mean value by adopting an exponential function activation layer in the encoder to obtain a first image feature after self-learning and a second image feature after self-learning;
Carrying out Gaussian white noise learning on the self-learned first image characteristic to obtain a self-learned third image characteristic;
And obtaining the image characteristic with noise according to the second image characteristic after self-learning and the third image characteristic after self-learning.
The beneficial effects of the application are as follows: because the final noisy image features are obtained according to the noisy self-learned image features, the final noisy image features can be further matched with the actual defect image features so as to facilitate the subsequent acquisition of the extended defect image to be more practical.
In one implementation, the step of inputting the noisy image features into a decoder of the trained VAE model for decoding to obtain the extended defect image includes:
and obtaining the extended defect image according to an up-sampling layer and a batch normalization layer in the decoder.
The beneficial effects of the application are as follows: the up-sampling layer and the batch normalization layer in the decoder are used for obtaining the extended defect image, so that the decoded extended defect image can further meet the actual defect image conditions of high resolution and larger size.
In one implementation, the step of training the improved VAE model using the training set and testing the improved VAE model using the test set to obtain a trained VAE model includes:
Training the improved VAE model by adopting the training set, and determining potential spatial similarity of an original defect image and a disturbance defect image in the training set according to the KL divergence calculation module;
according to the potential spatial similarity, carrying out network weight adjustment on the improved VAE model to obtain an adjusted VAE model;
And testing the adjusted VAE model by adopting the test set to obtain the trained VAE model.
The beneficial effects of the application are as follows: because the potential spatial similarity is calculated by the KL divergence calculation module, the improved VAE model is subjected to network weight adjustment, and therefore, the training time of the model can be further shortened when the model is trained.
In one implementation, before the plurality of original defect images are obtained according to the preset proportion, the method further includes:
performing contrast enhancement on the original defect images to obtain enhanced defect images;
performing brightness transformation on the plurality of reinforced defect images to obtain a plurality of transformed defect images;
Performing malformation transformation on the plurality of transformed defect images to obtain a plurality of preprocessed defect images;
the step of obtaining the training set and the testing set by the plurality of original defect images according to a preset proportion comprises the following steps:
And obtaining a training set and a testing set according to the preset proportion by the plurality of preprocessed defect images.
The beneficial effects of the application are as follows: because the operations such as contrast enhancement, brightness transformation, deformity transformation and the like are performed on the original defect image, noise in the original defect image can be reduced so as to train the improved VAE model, and therefore, the training time of the VAE model is further shortened.
In one aspect, there is provided an apparatus for expanding a defect sample, the apparatus comprising:
the image acquisition unit is used for acquiring images of defects in the real panel to obtain original defect images;
the defect image expansion unit is used for inputting the original defect image into a trained VAE model to perform defect expansion to obtain an expanded defect image; the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model comprises an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module.
In one aspect, an electronic device is provided that includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing any of the methods described above when executing the computer program.
In one aspect, a computer storage medium having stored thereon computer program instructions which, when executed by a processor, implement any of the methods described above.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described, and it is apparent that the drawings in the following description are only embodiments of the present application, and other drawings may be obtained according to the provided drawings without inventive effort for those skilled in the art.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
FIG. 2 is a flow chart of a method for expanding a defect sample according to an embodiment of the present application;
FIG. 3 is a schematic diagram of obtaining noisy image features according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an apparatus for expanding a defect sample according to an embodiment of the present application.
The marks in the figure: 10-equipment for expanding defect samples, 101-a processor, 102-a memory, 103-an I/O interface, 104-a database, 40-a device for expanding defect samples, 401-an image acquisition unit, 402-a defect image expansion unit, 403-a model training unit and 404-an image preprocessing unit.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application. Embodiments of the application and features of the embodiments may be combined with one another arbitrarily without conflict. Also, while a logical order is depicted in the flowchart, in some cases, the steps depicted or described may be performed in a different order than presented herein.
Along with the development of social economy and information technology, the application of panel glass gradually becomes a new trend in the future, and meanwhile, the panel products are updated at high frequency, so that higher and stricter requirements are brought to defect detection.
However, due to the problem of the production process, a large number of defects are exploded in a certain period of time, and therefore, the number of defects is large, and the detection effect of the model on such defects is good. However, for some special types of defects due to accidental operations, the number of collected defects is small because of low reproducibility, and thus, problems of model omission or difficult detection occur.
Based on the above, the embodiment of the application provides a method for expanding a defect sample, in the method, image acquisition can be performed on defects in a real panel to obtain an original defect image; furthermore, the original defect image can be input into a trained VAE model for defect expansion to obtain an expanded defect image; the encoder in the trained VAE model can comprise a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model can comprise an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module. Therefore, in the embodiment of the application, since the encoder in the trained VAE model comprises the convolution layer, the characteristic average layer and the exponential function activation layer, and the decoder comprises the upsampling layer and the batch normalization layer, the loss function comprises the KL divergence calculation module, when the trained VAE model is adopted to expand the defect samples, the trained VAE model can generate high-quality expanded defect images to expand a large number of samples, thereby being beneficial to improving the index of the target detection model and reducing the omission ratio of the defect detection model. Because the trained VAE model includes a convolution layer and an upsampling layer, the panel defect image extension for high resolution and larger dimensions is also very useful. In addition, because the Loss function in the trained VAE model comprises the KL divergence calculation module, namely, the calculation of the Loss function is optimized, the model convergence can be more quickly and more efficiently carried out when the model is trained, and the training time of the model is shortened.
After the design idea of the embodiment of the present application is introduced, some simple descriptions are made below for application scenarios applicable to the technical solution of the embodiment of the present application, and it should be noted that the application scenarios described below are only used for illustrating the embodiment of the present application and are not limiting. In the specific implementation process, the technical scheme provided by the embodiment of the application can be flexibly applied according to actual needs.
Fig. 1 is a schematic diagram of an application scenario provided in an embodiment of the present application. The application scenario may include a device 10 that augments the defect samples.
The device 10 for expanding the defect sample can be used for expanding the defect sample of the panel product, for example, a personal computer (Personal Computer, PC), a server, a portable computer, etc. The apparatus 10 for augmenting a defect sample may include one or more processors 101, memory 102, I/O interfaces 103, and a database 104. In particular, the processor 101 may be a central processing unit (central processing unit, CPU), or a digital processing unit, or the like. The memory 102 may be a volatile memory (RAM), such as a random-access memory (RAM); the memory 102 may also be a non-volatile memory (non-volatile memory), such as a read-only memory (rom), a flash memory (flash memory), a hard disk (HARD DISK DRIVE, HDD) or a solid state disk (solid-state drive (STATE DRIVE, SSD); or memory 102, is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 102 may be a combination of the above. The memory 102 may store some program instructions of the method for expanding a defect sample according to the embodiment of the present application, where the program instructions can be used to implement the steps of the method for expanding a defect sample according to the embodiment of the present application when executed by the processor 101, so as to solve the problem of fewer defect samples. The database 104 may be used to store data related to the scheme provided by the embodiment of the present application, such as the original defect image, the extended defect image, the trained VAE model, the training set, and the test set.
In the embodiment of the present application, the device 10 for expanding the defect samples may acquire the original defect image through the I/O interface 103, and then the processor 101 of the device 10 for expanding the defect samples may solve the problem of fewer defect samples according to the program instructions of the method for expanding the defect samples provided in the embodiment of the present application in the memory 102. In addition, data such as the original defect image, the extended defect image, the trained VAE model, the training set, and the test set may also be stored in the database 104.
Of course, the method provided by the embodiment of the present application is not limited to the application scenario shown in fig. 1, but may be used in other possible application scenarios, and the embodiment of the present application is not limited. The functions that can be implemented by each device in the application scenario shown in fig. 1 will be described together in the following method embodiments, which are not described in detail herein. The method according to the embodiment of the present application will be described below with reference to the accompanying drawings.
As shown in fig. 2, a flowchart of a method for expanding a defect sample according to an embodiment of the present application may be implemented by the apparatus 10 for expanding a defect sample in fig. 1, and in particular, the flowchart of the method is described below.
Step 201: and acquiring an image of the defect in the real panel to obtain an original defect image.
In order to further improve the defect detection accuracy of the panel product, in the embodiment of the application, the defect detection accuracy of the panel product can be improved by expanding the defect image of the panel product, specifically, firstly, the image acquisition can be performed on the defects in the real panel to obtain the original defect image.
Step 202: and inputting the original defect image into a trained VAE model to perform defect expansion, and obtaining an expanded defect image.
In the embodiment of the application, the encoder in the trained VAE model can comprise a convolution layer, a characteristic average layer and an exponential function activation layer, the decoder in the trained VAE model can comprise an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model can comprise a KL divergence calculation module.
Furthermore, in order to expand the defect image of the panel product, after the original defect image of the real panel is obtained, the original defect image can be directly input into a trained VAE model for defect expansion to obtain an expanded defect image.
Based on the method, the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder comprises an up-sampling layer and a batch normalization layer, and the loss function comprises a KL divergence calculation module, so that when the trained VAE model is adopted to expand defect samples, high-quality expanded defect images can be generated to expand a large number of samples, and therefore, the method is beneficial to improving indexes of a target detection model and reducing the omission ratio of the defect detection model. Because the trained VAE model includes a convolution layer and an upsampling layer, the panel defect image extension for high resolution and larger dimensions is also very useful. In addition, because the Loss function in the trained VAE model comprises the KL divergence calculation module, namely, the calculation of the Loss function is optimized, the model convergence can be more quickly and more efficiently carried out when the model is trained, and the training time of the model is shortened.
In one possible implementation manner, in order to further expand the defect image of the panel product, in the embodiment of the present application, before inputting the original defect image into the trained VAE model to perform defect expansion, the improved VAE model may be trained before obtaining the expanded defect image, and the trained VAE model may be obtained.
Specifically, first, real-time image acquisition can be performed on various defects in a real panel to obtain a plurality of original defect images. Of course, in order to further expand the defect image of the panel product, in the embodiment of the present application, besides acquiring the original defect image corresponding to various defects, a defect-free image and a defect image with a low occurrence rate may be acquired. And the defect-free images and the defect images with low occurrence rate can be placed under the same folder to prepare for the subsequent image preprocessing; then, the plurality of original defect images (specifically, the defect images with high incidence, the defect images with low incidence and the defect-free images) can be obtained according to a preset proportion to obtain a training set and a testing set, and for example, the training set and the testing set can be divided according to a ratio of 7:3; finally, the improved VAE model may be trained using a training set and tested using a testing set, thereby obtaining a trained VAE model. Furthermore, because the real-time collected defect image is adopted to train and test the improved VAE model, the trained VAE model can be more in line with the current actual situation, and the obtained expanded defect image can also have more reality.
In one possible implementation manner, in order to further improve the quality of the extended defect image, in the embodiment of the present application, before the training set is used to train the improved VAE model and the test set is used to test the improved VAE model, the original VAE model may be further improved to obtain an improved VAE model.
Specifically, first, the full-join layer in the encoder of the original VAE model may be replaced with a convolutional layer and a batch normalization layer, and the Sigmod activation function in the encoder may be replaced with a Leakyrelu activation function to obtain the first VAE model. Furthermore, as the full connection layer in the encoder of the original VAE model is replaced by the convolution layer and the batch normalization layer and the Sigmod activation function in the encoder is replaced by the Leakyrelu activation function, in the application, the trained VAE model can be further expanded on the panel defect image with high resolution and larger size, the expressive force of the VAE model can be further increased, and the network nerves of the VAE model can be better fit with data, so that the convergence rate of the VAE model is further accelerated.
A feature mean layer and an exponential function activation layer may then be built in the encoder of the first VAE model to obtain a second VAE model. The feature mean layer may be represented by the following formula (1):
(1)
Where x represents the eigenvector and n represents the number of eigenvalue vectors.
The exponential function activation layer can be represented by the following formula (2):
(2)
furthermore, since the characteristic average value layer and the exponential function activation layer are also constructed in the encoder, in the application, an image characteristic similar to the original defect image characteristic can be obtained through the encoder so as to conveniently obtain an extended defect image.
Next, the initial full-connection layer in the decoder of the second VAE model may be replaced with an upsampling layer and a batch normalization layer, and the decoding result output may be performed using the Tanh activation function to obtain a third VAE model. Furthermore, the initial full-connection layer in the decoder is replaced by the up-sampling layer and the batch normalization layer, and the Tanh activation function is adopted to output the decoding result, so that the trained VAE model can be more suitable for panel defect images with high resolution and larger size, and the convergence rate of the VAE model can be further accelerated.
Finally, a KL divergence calculation module may be added to the loss function of the third VAE model to obtain an improved VAE model. Wherein, KL divergence can be expressed by the following formula (3):
(3)
Further, since the KL divergence calculation module is added to the loss function, the training time of the model can be further shortened when the model is trained.
In one possible implementation manner, in order to achieve the purpose of expanding a defect sample, in the embodiment of the present application, when an original defect image is input into a trained VAE model to perform defect expansion to obtain an expanded defect image, the original defect image may be specifically input into an encoder of the trained VAE model to perform encoding to obtain an image feature with noise; the noisy image features may then also be input into a decoder of the trained VAE model for decoding to obtain an extended defect image.
Furthermore, as the output image characteristics of the encoder of the trained VAE model are noisy image characteristics, the subsequently obtained extended defect image can be similar to the original defect image, so as to achieve the purpose of extending the defect sample.
In one possible implementation manner, in order to facilitate subsequent obtaining of the extended defect image, in the embodiment of the present application, when the original defect image is input into the encoder of the trained VAE model to be encoded, so as to obtain the image feature with noise, the convolution layer and the batch normalization layer in the encoder may be specifically adopted to process the original defect image, so as to obtain the normalized image feature; the normalized image features may then be processed using a feature mean layer and an exponential function activation layer in the encoder to obtain noisy image features.
Furthermore, the obtained image features with noise are sequentially obtained through the convolution layer, the batch normalization layer, the feature mean layer and the exponential function activation layer, so that the trained VAE model can be further expanded for the panel defect image with high resolution and larger size, and the image features similar to the original defect image features can be further obtained through the encoder, so that the expanded defect image can be conveniently obtained later.
In a possible implementation manner, in order to facilitate the subsequent obtaining of the extended defect image to be more practical, in the embodiment of the present application, when the normalized image features are processed by using the feature mean layer and the exponential function activation layer in the encoder to obtain the noisy image features, as shown in fig. 3, a schematic diagram of obtaining the noisy image features is provided in the embodiment of the present application.
Firstly, carrying out mean processing on normalized image features by adopting a feature mean layer in an encoder to obtain image features after mean; the averaged image features may then be noise self-learned using an exponential function activation layer in the encoder to obtain a self-learned first image feature and a self-learned second image feature, where the self-learned first image feature is a pair of images, as shown in FIG. 3Obtained after self-learning, the second image feature after self-learning is the pair/>Obtained after self-learning; next, gaussian white noise learning may be performed on the self-learned first image feature to obtain a self-learned third image feature, where the self-learned third image feature is the self-learned first image feature versus Gaussian white noise/>, as shown in FIG. 3Obtained after self-learning and the Gaussian white noise/>Can be used/>To represent; finally, noisy image features, such as shown in FIG. 3/>, may be obtained from the second image features after self-learning and the third image features after self-learning
Furthermore, as the final noisy image features are obtained according to the image features after self-learning of the noise, the final noisy image features can be further matched with the actual defect image features, so that the subsequent obtained expanded defect images are more in line with the actual situation.
In one possible implementation manner, in order to further make the decoded extended defect image conform to the actual defect image conditions of high resolution and larger size, in the embodiment of the present application, when the image features with noise are input into the decoder of the trained VAE model to perform decoding, to obtain the extended defect image, the extended defect image may be obtained specifically according to the upsampling layer and the batch normalization layer in the decoder.
Furthermore, the up-sampling layer and the batch normalization layer in the decoder are used for obtaining the extended defect image, so that the decoded extended defect image can further meet the actual defect image conditions of high resolution and larger size.
In one possible implementation manner, in order to shorten the training time of the model, in the embodiment of the present application, when the training set is used to train the improved VAE model and the test set is used to test the improved VAE model to obtain the trained VAE model, firstly, the training set may be used to train the improved VAE model, and the potential spatial similarity of the original defect image and the disturbance defect image in the training set is determined according to the KL divergence calculation module; then, according to the potential space similarity, the improved VAE model can be subjected to network weight adjustment to obtain an adjusted VAE model; finally, the adjusted VAE model may be tested using a test set to obtain a trained VAE model.
Furthermore, since the potential spatial similarity is calculated by the KL divergence calculation module to adjust the network weight of the improved VAE model, the training time of the model can be further shortened when the model is trained.
In one possible implementation manner, in order to further shorten the training time of the VAE model, in an embodiment of the present application, before the plurality of original defect images are obtained according to the preset proportion, a training set and a test set may further be preprocessed.
Specifically, first, the contrast enhancement may be performed on the plurality of original defect images to obtain a plurality of enhanced defect images; then, brightness transformation can be carried out on the plurality of reinforced defect images to obtain a plurality of transformed defect images; finally, the deformed transformation can be performed on the plurality of transformed defect images to obtain a plurality of preprocessed defect images.
Based on the above, when the training set and the testing set are obtained by using the plurality of original defect images according to the preset proportion, the training set and the testing set can be further obtained by using the plurality of preprocessed defect images according to the preset proportion. Further, since the original defect image is subjected to operations such as contrast enhancement, brightness conversion, and deformity conversion, noise in the original defect image can be reduced to train the improved VAE model, thereby further shortening the training time of the VAE model.
In summary, in the embodiment of the present application, since the encoder in the trained VAE model includes the convolution layer, the feature mean layer and the exponential function activation layer, and the decoder includes the upsampling layer and the batch normalization layer, the loss function includes the KL divergence calculation module, for the defects with lower occurrence rate and smaller number, when the trained VAE model is adopted to expand the defect samples, the trained VAE model can generate high-quality expanded defect images so as to expand a large number of samples, thereby being beneficial to improving the index of the target detection model and reducing the omission rate of the defect detection model. Because the trained VAE model includes a convolution layer and an upsampling layer, the panel defect image extension for high resolution and larger dimensions is also very useful. In addition, because the Loss function in the trained VAE model comprises the KL divergence calculation module, namely, the calculation of the Loss function is optimized, the model convergence can be more quickly and more efficiently carried out when the model is trained, and the training time of the model is shortened.
Based on the same inventive concept, an embodiment of the present application provides an apparatus 40 for expanding a defect sample, as shown in fig. 4, the apparatus 40 for expanding a defect sample includes:
An image acquisition unit 401, configured to perform image acquisition on a defect in a real panel, so as to obtain an original defect image;
A defect image expansion unit 402, configured to input an original defect image into a trained VAE model for performing defect expansion, so as to obtain an expanded defect image; the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model comprises an up-sampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module.
In one implementation, the apparatus 40 for expanding a defect sample further includes a model training unit 403, where the model training unit 403 is configured to:
Carrying out real-time image acquisition on various defects in a real panel to obtain a plurality of original defect images;
Obtaining a training set and a testing set according to a preset proportion by using a plurality of original defect images;
And training the improved VAE model by adopting a training set, and testing the improved VAE model by adopting a testing set to obtain the trained VAE model.
In one implementation, model training unit 403 is further configured to:
Replacing a full connection layer in an encoder of an original VAE model with a convolution layer and a batch normalization layer, and replacing Sigmod activation functions in the encoder with Leakyrelu activation functions to obtain a first VAE model;
Constructing a characteristic mean value layer and an exponential function activation layer in an encoder of the first VAE model to obtain a second VAE model;
Replacing an initial full connection layer in a decoder of the second VAE model with an up-sampling layer and a batch normalization layer, and outputting decoding results by adopting a Tanh activation function to obtain a third VAE model;
and adding a KL divergence calculation module into a loss function of the third VAE model to obtain the improved VAE model.
In one implementation, the defect image augmentation unit 402 is further configured to:
inputting the original defect image into an encoder of a trained VAE model for encoding to obtain image characteristics with noise;
And inputting the image characteristics with noise into a decoder of the trained VAE model for decoding to obtain the extended defect image.
In one implementation, the defect image augmentation unit 402 is further configured to:
processing the original defect image by adopting a convolution layer and a batch normalization layer in the encoder to obtain normalized image characteristics;
and processing the normalized image features by adopting a feature mean layer and an exponential function activation layer in the encoder to obtain noisy image features.
In one implementation, the defect image augmentation unit 402 is further configured to:
adopting a characteristic average layer in the encoder to perform average processing on the normalized image characteristics to obtain average image characteristics;
Carrying out noise self-learning on the image features after the mean value by adopting an exponential function activation layer in the encoder to obtain a first image feature after self-learning and a second image feature after self-learning;
Carrying out Gaussian white noise learning on the self-learned first image characteristic to obtain a self-learned third image characteristic;
and obtaining the image characteristic with noise according to the second image characteristic after self-learning and the third image characteristic after self-learning.
In one implementation, the defect image augmentation unit 402 is further configured to:
And obtaining an extended defect image according to the up-sampling layer and the batch normalization layer in the decoder.
In one implementation, model training unit 403 is further configured to:
training the improved VAE model by adopting a training set, and determining potential spatial similarity of an original defect image and a disturbance defect image in the training set according to the KL divergence calculation module;
According to the potential spatial similarity, carrying out network weight adjustment on the improved VAE model to obtain an adjusted VAE model;
And testing the adjusted VAE model by adopting a test set to obtain a trained VAE model.
In one implementation, the apparatus 40 for expanding a defect sample further includes an image preprocessing unit 404, where the image preprocessing unit 404 is configured to:
contrast enhancement is carried out on the original defect images to obtain enhanced defect images;
Performing brightness transformation on the plurality of reinforced defect images to obtain a plurality of transformed defect images;
performing malformation transformation on the plurality of transformed defect images to obtain a plurality of preprocessed defect images;
then, the step of obtaining a training set and a testing set by a plurality of original defect images according to a preset proportion comprises the following steps:
and obtaining a training set and a testing set according to the preset proportion by using the plurality of preprocessed defect images.
The device 40 for expanding a defect sample may be used to execute the method executed in the embodiment shown in fig. 2-3, and therefore, the description of the functions that can be implemented by each functional module of the device 40 for expanding a defect sample may be referred to in the embodiment shown in fig. 2-3, and will not be repeated.
In some possible implementations, aspects of the method provided by the present application may also be implemented in the form of a program product comprising program code for causing a computer device to carry out the steps of the method according to the various exemplary embodiments of the application described herein above, when said program product is run on the computer device, e.g. the computer device may carry out the method as carried out in the examples shown in fig. 2-3.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware associated with program instructions, where the foregoing program may be stored in a computer readable storage medium, and when executed, the program performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or optical disk, or the like, which can store program codes. Or the above-described integrated units of the invention may be stored in a computer-readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solutions of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (10)

1. A method of augmenting a defect sample, the method comprising:
Carrying out real-time image acquisition on various defects in a real panel to obtain a plurality of original defect images;
obtaining a training set and a testing set according to the preset proportion of the original defect images;
Replacing a full connection layer in an encoder of an original VAE model with a convolution layer and a batch normalization layer, and replacing Sigmod activation functions in the encoder with Leakyrelu activation functions to obtain a first VAE model;
constructing a characteristic mean value layer and an exponential function activation layer in an encoder of the first VAE model to obtain a second VAE model;
Replacing an initial full connection layer in a decoder of the second VAE model with an up-sampling layer and a batch normalization layer, and outputting a decoding result by adopting a Tanh activation function to obtain a third VAE model;
Adding a KL divergence calculation module into the loss function of the third VAE model to obtain an improved VAE model;
Training the improved VAE model by adopting the training set, and testing the improved VAE model by adopting the testing set to obtain a trained VAE model;
Image acquisition is carried out on the defects in the real panel, and an original defect image is obtained;
Inputting the original defect image into a trained VAE model for defect expansion to obtain an expanded defect image; the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model comprises an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module.
2. The method of claim 1, wherein the step of inputting the original defect image into a trained VAE model for defect augmentation to obtain an augmented defect image comprises:
Inputting the original defect image into an encoder of the trained VAE model for encoding to obtain image characteristics with noise;
And inputting the noisy image features into a decoder of the trained VAE model for decoding to obtain the extended defect image.
3. The method of claim 2, wherein the step of inputting the original defect image into an encoder of the trained VAE model for encoding to obtain noisy image features comprises:
Processing the original defect image by adopting a convolution layer and a batch normalization layer in the encoder to obtain normalized image characteristics;
And processing the normalized image features by adopting a feature mean value layer and an exponential function activation layer in the encoder to obtain noisy image features.
4. A method according to claim 3, wherein the step of processing the normalized image features using a feature mean layer and an exponential function activation layer in the encoder to obtain noisy image features comprises:
Adopting a characteristic average layer in the encoder to perform average processing on the normalized image characteristics to obtain average image characteristics;
Carrying out noise self-learning on the image features after the mean value by adopting an exponential function activation layer in the encoder to obtain a first image feature after self-learning and a second image feature after self-learning;
Carrying out Gaussian white noise learning on the self-learned first image characteristic to obtain a self-learned third image characteristic;
And obtaining the image characteristic with noise according to the second image characteristic after self-learning and the third image characteristic after self-learning.
5. The method of claim 2, wherein the step of inputting the noisy image features into a decoder of the trained VAE model for decoding to obtain the extended defect image comprises:
and obtaining the extended defect image according to an up-sampling layer and a batch normalization layer in the decoder.
6. The method of claim 1, wherein the step of training the improved VAE model using the training set and testing the improved VAE model using the test set to obtain a trained VAE model comprises:
Training the improved VAE model by adopting the training set, and determining potential spatial similarity of an original defect image and a disturbance defect image in the training set according to the KL divergence calculation module;
according to the potential spatial similarity, carrying out network weight adjustment on the improved VAE model to obtain an adjusted VAE model;
And testing the adjusted VAE model by adopting the test set to obtain the trained VAE model.
7. The method of claim 1, wherein prior to obtaining the training set and the test set from the plurality of original defect images at a predetermined scale, the method further comprises:
performing contrast enhancement on the original defect images to obtain enhanced defect images;
performing brightness transformation on the plurality of reinforced defect images to obtain a plurality of transformed defect images;
Performing malformation transformation on the plurality of transformed defect images to obtain a plurality of preprocessed defect images;
the step of obtaining the training set and the testing set by the plurality of original defect images according to a preset proportion comprises the following steps:
And obtaining a training set and a testing set according to the preset proportion by the plurality of preprocessed defect images.
8. An apparatus for augmenting a defect sample, the apparatus comprising:
The model training unit is used for acquiring real-time images of various defects in the real panel and acquiring a plurality of original defect images; obtaining a training set and a testing set according to the preset proportion of the original defect images; replacing a full connection layer in an encoder of an original VAE model with a convolution layer and a batch normalization layer, and replacing Sigmod activation functions in the encoder with Leakyrelu activation functions to obtain a first VAE model; constructing a characteristic mean value layer and an exponential function activation layer in an encoder of the first VAE model to obtain a second VAE model; replacing an initial full connection layer in a decoder of the second VAE model with an up-sampling layer and a batch normalization layer, and outputting a decoding result by adopting a Tanh activation function to obtain a third VAE model; adding a KL divergence calculation module into the loss function of the third VAE model to obtain an improved VAE model; training the improved VAE model by adopting the training set, and testing the improved VAE model by adopting the testing set to obtain a trained VAE model;
the image acquisition unit is used for acquiring images of defects in the real panel to obtain original defect images;
the defect image expansion unit is used for inputting the original defect image into a trained VAE model to perform defect expansion to obtain an expanded defect image; the encoder in the trained VAE model comprises a convolution layer, a characteristic mean layer and an exponential function activation layer, the decoder in the trained VAE model comprises an upsampling layer and a batch normalization layer, and the loss function in the trained VAE model comprises a KL divergence calculation module.
9. An electronic device, the device comprising:
A memory for storing program instructions;
A processor for invoking program instructions stored in the memory and for performing the method of any of claims 1-7 in accordance with the obtained program instructions.
10. A storage medium having stored thereon computer executable instructions for causing a computer to perform the method of any one of claims 1-7.
CN202410161232.9A 2024-02-05 2024-02-05 Method, device, equipment and storage medium for expanding defect sample Active CN117710371B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410161232.9A CN117710371B (en) 2024-02-05 2024-02-05 Method, device, equipment and storage medium for expanding defect sample

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410161232.9A CN117710371B (en) 2024-02-05 2024-02-05 Method, device, equipment and storage medium for expanding defect sample

Publications (2)

Publication Number Publication Date
CN117710371A CN117710371A (en) 2024-03-15
CN117710371B true CN117710371B (en) 2024-04-26

Family

ID=90146516

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410161232.9A Active CN117710371B (en) 2024-02-05 2024-02-05 Method, device, equipment and storage medium for expanding defect sample

Country Status (1)

Country Link
CN (1) CN117710371B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109886388A (en) * 2019-01-09 2019-06-14 平安科技(深圳)有限公司 A kind of training sample data extending method and device based on variation self-encoding encoder
CN111258992A (en) * 2020-01-09 2020-06-09 电子科技大学 Seismic data expansion method based on variational self-encoder
CN112017182A (en) * 2020-10-22 2020-12-01 北京中鼎高科自动化技术有限公司 Industrial-grade intelligent surface defect detection method
CN112767369A (en) * 2021-01-25 2021-05-07 佛山科学技术学院 Defect identification and detection method and device for small hardware and computer readable storage medium
CN113642822A (en) * 2020-12-04 2021-11-12 广东省建筑设计研究院有限公司 VAE-based sample set directional expansion method for evaluating building group structure safety
CN114399471A (en) * 2021-12-28 2022-04-26 昆明能讯科技有限责任公司 Power defect small sample generation method and storage medium
WO2022179822A1 (en) * 2021-02-25 2022-09-01 Siemens Aktiengesellschaft Generation of realistic data for training of artificial neural networks
WO2022230338A1 (en) * 2021-04-27 2022-11-03 株式会社日立ハイテク System for detecting defect and computer-readable medium
CN115409823A (en) * 2022-09-06 2022-11-29 长沙理工大学 Solar screen defect detection method based on generative countermeasure network
WO2022263839A1 (en) * 2021-06-17 2022-12-22 Monolith Ai Limited Computer implemented method for generating a 3d object
CN115661572A (en) * 2022-10-21 2023-01-31 华中科技大学 Casting defect recognition model training method, defect recognition method, device and system
CN116091362A (en) * 2023-03-31 2023-05-09 中国电子科技集团公司第五十四研究所 Remote sensing image data enhancement method based on variation self-encoder

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109886388A (en) * 2019-01-09 2019-06-14 平安科技(深圳)有限公司 A kind of training sample data extending method and device based on variation self-encoding encoder
CN111258992A (en) * 2020-01-09 2020-06-09 电子科技大学 Seismic data expansion method based on variational self-encoder
CN112017182A (en) * 2020-10-22 2020-12-01 北京中鼎高科自动化技术有限公司 Industrial-grade intelligent surface defect detection method
CN113642822A (en) * 2020-12-04 2021-11-12 广东省建筑设计研究院有限公司 VAE-based sample set directional expansion method for evaluating building group structure safety
CN112767369A (en) * 2021-01-25 2021-05-07 佛山科学技术学院 Defect identification and detection method and device for small hardware and computer readable storage medium
WO2022179822A1 (en) * 2021-02-25 2022-09-01 Siemens Aktiengesellschaft Generation of realistic data for training of artificial neural networks
WO2022230338A1 (en) * 2021-04-27 2022-11-03 株式会社日立ハイテク System for detecting defect and computer-readable medium
WO2022263839A1 (en) * 2021-06-17 2022-12-22 Monolith Ai Limited Computer implemented method for generating a 3d object
CN114399471A (en) * 2021-12-28 2022-04-26 昆明能讯科技有限责任公司 Power defect small sample generation method and storage medium
CN115409823A (en) * 2022-09-06 2022-11-29 长沙理工大学 Solar screen defect detection method based on generative countermeasure network
CN115661572A (en) * 2022-10-21 2023-01-31 华中科技大学 Casting defect recognition model training method, defect recognition method, device and system
CN116091362A (en) * 2023-03-31 2023-05-09 中国电子科技集团公司第五十四研究所 Remote sensing image data enhancement method based on variation self-encoder

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Autoencoder-based anomaly detection for surface defect inspection;Du-Ming Tsai等;《Advanced Engineering Informatics》;20210305;第1-13页 *
Diagnosing and Enhancing VAE Models;Bin Dai等;《arXiv preprint arxiv:1903.05789》;20191030;第1-44页 *
基于小样本学习的接触网零部件缺陷检测方法;郭思亮;《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》;20230715;正文第2.1节,3.4节 *
基于点集匹配的缺陷样本图像生成方法;高海洋 等;《智能系统学报》;20230930;第18卷(第05期);第1030-1038页 *
工业缺陷检测深度学习方法综述;罗东亮 等;《中国科学: 信息科学》;20220731;第52卷(第06期);第1002-1039页 *

Also Published As

Publication number Publication date
CN117710371A (en) 2024-03-15

Similar Documents

Publication Publication Date Title
CN109844773B (en) Processing sequences using convolutional neural networks
US11514694B2 (en) Teaching GAN (generative adversarial networks) to generate per-pixel annotation
CN109859113B (en) Model generation method, image enhancement method, device and computer-readable storage medium
US20230206396A1 (en) Image super-resolution reconstructing
CN111291825B (en) Focus classification model training method, apparatus, computer device and storage medium
CN112164008A (en) Training method of image data enhancement network, and training device, medium, and apparatus thereof
CN113610989B (en) Method and device for training style migration model and method and device for style migration
CN112884668A (en) Lightweight low-light image enhancement method based on multiple scales
CN112712537A (en) Video space-time super-resolution implementation method and device
CN115147402A (en) Self-contrast learning for image processing
CN117132461B (en) Method and system for whole-body optimization of character based on character deformation target body
CN117710371B (en) Method, device, equipment and storage medium for expanding defect sample
CN113409307A (en) Image denoising method, device and medium based on heterogeneous noise characteristics
CN113592008A (en) System, method, equipment and storage medium for solving small sample image classification based on graph neural network mechanism of self-encoder
TWI803243B (en) Method for expanding images, computer device and storage medium
CN113256528B (en) Low-illumination video enhancement method based on multi-scale cascade depth residual error network
WO2023056501A1 (en) Harmonizing diffusion tensor images using machine learning
CN115375715A (en) Target extraction method and device, electronic equipment and storage medium
WO2020241074A1 (en) Information processing method and program
CN114049939A (en) Pneumonia CT image generation method based on UNet-GAN network
CN110189272B (en) Method, apparatus, device and storage medium for processing image
US20230401670A1 (en) Multi-scale autoencoder generation method, electronic device and readable storage medium
CN114819149B (en) Data processing method, device and medium based on transforming neural network
CN114648646B (en) Image classification method and device
US20230298326A1 (en) Image augmentation method, electronic device and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant