Error reduction in reconstructed images in defect detection method, electronic device and storage medium
AssigneeHon Hai Precision Industry Co., Ltd.
InventorsChin-Pin Kuo, Tung-Tso Tsai, Shih-Chao Chien
Life of this patent
Estimating the term…
Abstract
A defect detection method based on an image of products and an electronic device can accurately determine the error threshold by determining the reconstruction error generated during image reconstruction and by determining the estimated probability generated by the Gaussian mixture model. The test error can then be compared with the error, since the test error and the error threshold are compared numerically, the existence of subtle defects are revealed in the product image, thereby improving the accuracy of defect detection.
Claims20
A defect detection method, the method comprising:
- in response to receiving a defect detection request, acquiring a product image and a plurality of positive sample images according to the defect detection request;
- encoding the product image to obtain a target vector corresponding to the product image by using an encoder, encoding the plurality of positive sample images to obtain a plurality of latent vectors corresponding to the plurality of positive sample images by using the encoder;
- decoding the target vector to obtain a target image corresponding to the product image by using a decoder corresponding to the encoder, decoding the plurality of latent vectors to obtain a plurality of reconstructed images corresponding to the plurality of positive sample images by using the decoder;
- comparing the target image with the product image to obtain a target error, comparing each of the plurality of reconstructed images with the corresponding positive sample image to obtain a reconstruction error;
- inputting the target vector into a Gaussian mixture model to obtain a test probability of the product image, inputting the plurality of latent vectors into the Gaussian mixture model to obtain an estimated probability of each corresponding positive sample image;
- determining a test error of the product image according to the target error and the test probability, and determining a sample error of each positive sample image according to the corresponding reconstruction error and the corresponding estimated probability;
- selecting an error threshold from a plurality of the sample errors and obtaining a detection result of defect detection in the product image according to the test error and the error threshold.
An electronic device comprising a memory and a processor, the memory stores at least one computer-readable instruction, which when executed by the processor causes the processor to:
- in response to receiving a defect detection request, acquire a product image and a plurality of positive sample images according to the defect detection request;
- encode the product image to obtain a target vector corresponding to the product image by using an encoder, encode the plurality of positive sample images to obtain a plurality of latent vectors corresponding to the plurality of positive sample images by using the encoder;
- decode the target vector to obtain a target image corresponding to the product image by using a decoder corresponding to the encoder, decode the plurality of latent vectors to obtain a plurality of reconstructed images corresponding to the plurality of positive sample images by using the decoder;
- compare the target image with the product image to obtain a target error, compare each of the plurality of reconstructed images with the corresponding positive sample image to obtain a reconstruction error;
- input the target vector into a Gaussian mixture model to obtain a test probability of the product image, input the plurality of latent vectors into the Gaussian mixture model to obtain an estimated probability of each corresponding positive sample image;
- determine a test error of the product image according to the target error and the test probability, and determine a sample error of each positive sample image according to the corresponding reconstruction error and the corresponding estimated probability;
- select an error threshold from a plurality of the sample errors and obtain a detection result of defect detection in the product image according to the test error and the error threshold.
A non-transitory storage medium having stored thereon at least one computer-readable instructions that, when the at least one computer-readable instructions are executed by a processor to implement a defect detection method, which comprises:
- in response to receiving a defect detection request, acquiring a product image and a plurality of positive sample images according to the defect detection request;
- encoding the product image to obtain a target vector corresponding to the product image by using an encoder, encoding the plurality of positive sample images to obtain a plurality of latent vectors corresponding to the plurality of positive sample images by using the encoder;
- decoding the target vector to obtain a target image corresponding to the product image by using a decoder corresponding to the encoder, decoding the plurality of latent vectors to obtain a plurality of reconstructed images corresponding to the plurality of positive sample images by using the decoder;
- comparing the target image with the product image to obtain a target error, comparing each of the plurality of reconstructed images with the corresponding positive sample image to obtain a reconstruction error;
- inputting the target vector into a Gaussian mixture model to obtain a test probability of the product image, inputting the plurality of latent vectors into the Gaussian mixture model to obtain an estimated probability of each corresponding positive sample image;
- determining a test error of the product image according to the target error and the test probability, and determining a sample error of each positive sample image according to the corresponding reconstruction error and the corresponding estimated probability;
- selecting an error threshold from a plurality of the sample errors and obtaining a detection result of defect detection in the product image according to the test error and the error threshold.
Dependencies are inferred from the claim text.