An AI-based appearance detection outlier processing method, system and storage medium
By adopting VAE model and data preprocessing technology in AI detection technology, the problem of outlier value recognition in PCB board detection is solved, the accuracy and efficiency of detection is improved, and misjudgment and false reporting are reduced.
Patent Information
- Application Number
- CN202411700878.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-26
AI Technical Summary
Existing AI detection technology cannot effectively identify and handle outliers in PCB board detection, resulting in system misjudgment and false reporting, affecting detection performance.
The outlier processing method based on the VAE model is adopted, and the objective function of the VAE model is set through data log normalization and normalization preprocessing, and the model is trained using reparameterization techniques and backpropagation algorithms, and the reconstruction probability is calculated and the detection threshold is set to identify outliers.
It improves the accuracy and efficiency of detection, alleviates data distribution unevenly and scale differences, eliminates the impact of data dimensions, effectively identify and process outliers, and reduces misjudgment and false reporting.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of AI image processing technology, and in particular relates to an AI-based appearance detection outlier processing method, system and storage medium. Background Art
[0002] In the inspection of PCB boards, AI's PCB board appearance inspection system achieves high-quality inspection of PCB boards. AI's PCB board appearance inspection system uses an example-based rather than a rule-based approach to solve the problem of PCB board inspection. AI uses neural networks to obtain information based on a large number of labeled image examples, and can automatically analyze defects, distinguish the differences between parts and defective parts, establish new defect types, and detect new defects. This method can improve the speed and accuracy of defect detection, reduce labor costs, and improve production efficiency.
[0003] Although AI detection technology has been widely used in PCB board inspection, it still faces the problem of being unable to identify detection outliers. Detection outliers are generally caused by changes in the PCB inspection environment and complex backgrounds, such as lighting conditions and background noise, or the difficulty in distinguishing the background and foreground of PCB defects. Such situations may affect the image quality and thus the detection performance of the model, resulting in outliers; or the system mistakenly marks normal images as abnormal, or marks abnormal images as normal, thereby generating outliers. In order to solve the problem that the existing technology cannot process outliers, which leads to subsequent misjudgments and false reports of the system and affects subsequent detection performance, we have specially proposed an AI-based appearance detection outlier processing method. Summary of the invention
[0004] The purpose of the present invention is to provide an AI-based appearance detection outlier processing method, system and storage medium, aiming to solve the problem that the number of outliers accumulates during the production and processing process, leading to production errors, because the prior art cannot provide an effective AI-based appearance detection outlier processing method.
[0005] In one aspect, the present invention provides an AI-based appearance detection outlier processing method, the method comprising the following steps:
[0006] Data logarithmic normalization: Stabilize the data variance and reduce the dynamic range of the data through a preset logarithmic normalization model;
[0007] Data standardization: adjust data to a unified data representation through a data standardization model;
[0008] Set the objective function of the VAE model: to maximize the marginal likelihood of the data, specifically by maximizing the evidence lower bound ELBO, where the evidence lower bound ELBO consists of two parts: the reconstruction error and the KL divergence of the latent space;
[0009] Reparameterization technique: The reparameterization technique is used to sample a noise variable from the standard normal distribution of the data and transform it into a latent variable Z, and the VAE model is trained by the back-propagation algorithm.
[0010] Reconstruction probability: Sample the latent variable z from the latent space of the VAE model to generate a reconstructed data point, calculate the log-likelihood between the reconstructed data point and the original data point, and take the average to obtain the reconstruction probability;
[0011] Anomaly detection: The detection threshold is set by the reconstruction probability calculated by the VAE model. If the reconstruction probability of a data point exceeds the threshold during detection, it is classified as an outlier.
[0012] In the present invention, the preset logarithmic normalization model is as follows: ;
[0013] Where y is the transformed value, x is the original data value, b is the base of the logarithmic function and takes the value of e or 10. is a constant greater than 0.
[0014] In the present invention, the data standardization model is as follows: ;
[0015] Where X is the value of the data point, is the mean value of the data set, is the standard deviation of the data set and Z is the value after the data is normalized.
[0016] In the present invention, the evidence lower bound ELBO formula is as follows:
[0017] ;
[0018] In the above formula:
[0019] Reconstruction error ;
[0020] KL divergence in latent space ;
[0021] Where n is the dimension of the data point, x is the original data, and x i is the reconstructed data, µk is the mean of the kth dimension, σk 2 is the variance of the kth dimension;
[0022] is the output of the encoder, representing the conditional distribution of the latent variable z given the input x;
[0023] is the conditional probability distribution of data x given the latent variable z given by the decoder;
[0024] p(z) is the prior distribution, assumed to be a standard normal distribution.
[0025] In the present invention, the transformation formula of the latent variable Z is as follows:
[0026] ;in is the mean of the latent variable z, is the standard deviation of the latent variable z, is the noise sampled from a standard normal distribution.
[0027] In the present invention, the reconstruction probability is the probability that the latent variable z sampled from the latent space of the VAE model can generate the original input data x, that is, the expected value of the log likelihood lnp(x|z), which is obtained by sampling the latent variable z multiple times from the posterior distribution q(z|x) and calculating the likelihood p(x|z) of each sample. The specific calculation formula is as follows:
[0028] Reconstruction probability ;
[0029] in, is the log-likelihood of the original data x;
[0030] is the number of samplings;
[0031] z(i) is the i-th sample sampled from the space of the latent variable z output by the encoder;
[0032] x is the original data.
[0033] On the other hand, the present invention also provides a computer control system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0034] On the other hand, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0035] The beneficial effect of the present invention lies in that, through the method of the present invention, the data preprocessing of PCB appearance AI detection outlier data is normalized, which alleviates the uneven distribution of data and reduces the scale difference between data. The data preprocessing of data standardization eliminates the dimensional influence of data and improves data analysis efficiency. The VAE model can learn the normal pattern of data and reconstruct and identify outliers, which greatly improves the accuracy and efficiency of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a flow chart of the implementation of the AI-based appearance detection outlier processing method of the method embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0038] The specific implementation of the present invention is described in detail below in conjunction with specific embodiments:
[0039] Embodiment 1
[0040] Figure 1 The implementation process of the AI-based appearance detection outlier processing method provided in the first embodiment of the present invention is shown. For the sake of convenience, only the part related to the embodiment of the present invention is shown, which is described in detail as follows:
[0041] Data logarithmic normalization: Apply logarithmic transformation to stabilize the variance of data and reduce the dynamic range of data, realize data preprocessing, alleviate data uneven distribution, reduce the scale difference between data, and improve detection performance;
[0042] Data standardization: adjust the data to a unified data representation through mathematical transformation, specifically adjust the mean of the data to 0 and the standard deviation to 1, so that the comparison and analysis of the data are more reasonable and accurate, eliminate the dimensional influence of the data, and improve the efficiency of data analysis and the accuracy of detection;
[0043] Set the objective function of the VAE model: The goal of the VAE model is to maximize the marginal likelihood of the data, which is usually achieved by maximizing the evidence lower bound ELBO, which consists of two parts: reconstruction error and KL divergence of the latent space;
[0044] Reparameterization trick: In order to be able to train the VAE model through the back-propagation algorithm, the reparameterization trick is introduced, which involves sampling a noise variable from a standard normal distribution and then converting it into a latent variable z;
[0045] Reconstruction probability: The reconstruction probability is the probability that the latent variable z sampled from the latent space of the VAE model can generate the original input data x. It is the expected value of the log-likelihood lnp(x|z). L samples are sampled from the space where the latent variable z output by the encoder is located (the sampling parameters are the mean and variance), and then these latent variables z are converted back to the data space through the decoder to generate reconstructed data points. The reconstruction probability is obtained by calculating the log-likelihood between the reconstructed data points and the original data points and averaging them.
[0046] Anomaly detection: Set the detection threshold range according to the reconstruction probability calculated by the trained VAE model (generally 90%~100% of the VAE model data reconstruction probability). If the reconstruction probability of a data point exceeds this threshold range during detection, it is classified as an outlier.
[0047] That is, the process of the above method steps can be classified into steps S1-S6, which are S1 data log normalization, S2 data standardization, S3 VAE target, S4 reparameterization technique, S5 reconstruction probability, and S6 anomaly detection processing. That is to say, in the anomaly detection implemented by the above process, the reconstruction probability can be used as an anomaly score to distinguish normal data from abnormal data. The lower the reconstruction probability of a data point, the greater the difference between it and the distribution of normal data learned by the VAE model, and therefore it is more likely to be an outlier.
[0048] In this embodiment, the preset logarithmic normalization model is as follows:
[0049] ;
[0050] Where y is the transformed value, x is the original data value, b is the base of the logarithmic function and takes the value of e or 10. is a constant greater than 0.
[0051] In this embodiment, the data standardization model is as follows:
[0052] ;
[0053] Where X is the value of the data point, is the mean value of the data set, is the standard deviation of the data set and Z is the value after the data is normalized.
[0054] In this embodiment, the evidence lower bound ELBO formula is as follows:
[0055] ;
[0056] In the above formula:
[0057] Reconstruction error ;
[0058] KL divergence in latent space ;
[0059] Where n is the dimension of the data point, x is the original data, and x i is the reconstructed data, µk is the mean of the kth dimension, σk 2 is the variance of the kth dimension;
[0060] is the output of the encoder, representing the conditional distribution of the latent variable z given the input x;
[0061] is the conditional probability distribution of data x given the latent variable z given by the decoder;
[0062] p(z) is the prior distribution, assumed to be a standard normal distribution.
[0063] In this embodiment, the transformation formula of the latent variable Z is as follows:
[0064] ;
[0065] in, is the mean of the latent variable z, is the standard deviation of the latent variable z, is the noise sampled from a standard normal distribution.
[0066] In this embodiment, the reconstruction probability is the probability that the latent variable z sampled from the latent space of the VAE model can generate the original input data x, that is, the log likelihood The expected value of The latent variable z is sampled multiple times and the likelihood of each sample is calculated To obtain, the specific calculation formula is as follows:
[0067] Reconstruction probability ;
[0068] in, is the log-likelihood of the original data x;
[0069] is the number of samplings;
[0070] z(i) is the i-th sample sampled from the space of the latent variable z output by the encoder;
[0071] x is the original data.
[0072] Through the method of the present invention, the data preprocessing of PCB appearance AI detection abnormal value data is normalized, which alleviates the uneven distribution of data and reduces the scale difference between data. The data preprocessing of data standardization eliminates the dimensional influence of data and improves data analysis efficiency. The VAE model can learn the normal pattern of data and reconstruct and identify abnormal values, which greatly improves the accuracy and efficiency of detection. Embodiment 2
[0073] In an embodiment of the present invention, a computer control system is provided. For ease of description, only parts related to the embodiment of the present invention are shown.
[0074] The computer control system of the embodiment of the present invention includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the embodiment of the method for processing abnormal values of appearance detection based on AI are implemented. Embodiment 3
[0075] In an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps in the embodiment of the above-mentioned AI-based appearance detection outlier processing method are implemented.
[0076] The computer-readable storage medium of the embodiment of the present invention may include any entity or device or recording medium capable of carrying computer program code, for example, ROM / RAM, magnetic disk, optical disk, flash memory and other memories.
[0077] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An AI-based appearance detection outlier processing method, characterized in that: The method comprises the following steps: Data logarithmic normalization: Stabilize the data variance and reduce the dynamic range of the data through a preset logarithmic normalization model; Data standardization: adjust data to a unified data representation through a data standardization model; Set the objective function of the VAE model: to maximize the marginal likelihood of the data, specifically by maximizing the evidence lower bound ELBO, where the evidence lower bound ELBO consists of two parts: the reconstruction error and the KL divergence of the latent space; Reparameterization technique: The reparameterization technique is used to sample a noise variable from the standard normal distribution of the data and transform it into a latent variable Z, and the VAE model is trained by the back-propagation algorithm. Reconstruction probability: Sample the latent variable z from the latent space of the VAE model to generate a reconstructed data point, calculate the log-likelihood between the reconstructed data point and the original data point, and take the average to obtain the reconstruction probability; Anomaly detection: The detection threshold is set by the reconstruction probability calculated by the VAE model. If the reconstruction probability of a data point exceeds the threshold during detection, it is classified as an outlier; The preset logarithmic normalization model is as follows: ; Where y is the transformed value, x is the original data value, b is the base of the logarithmic function and takes the value of e or 10. is a constant greater than 0; The evidence lower bound ELBO formula is as follows: ; In the above formula: Reconstruction error ; KL divergence in latent space ; Where n is the dimension of the data point, x is the original data, and x i is the reconstructed data, µk is the mean of the kth dimension, σk 2 is the variance of the kth dimension; is the output of the encoder, representing the conditional distribution of the latent variable z given the input x; is the conditional probability distribution of data x given the latent variable z given by the decoder; p(z) is the prior distribution, assumed to be a standard normal distribution.
2. The AI-based appearance detection outlier processing method according to claim 1, characterized in that: The data normalization model is as follows: ; Where X is the value of the data point, is the mean value of the data set, is the standard deviation of the data set and Z is the value after the data is normalized.
3. The AI-based appearance detection outlier processing method according to claim 1, characterized in that: The transformation formula of the latent variable Z is as follows: ; in, is the mean of the latent variable z, is the standard deviation of the latent variable z, is the noise sampled from a standard normal distribution.
4. The AI-based appearance detection outlier processing method according to claim 3, characterized in that: The reconstruction probability is the probability that the latent variable z sampled from the latent space of the VAE model can generate the original input data x, that is, the expected value of the log likelihood lnp(x|z), which is obtained by sampling the latent variable z multiple times from the posterior distribution q(z|x) and calculating the likelihood p(x|z) of each sample. The specific calculation formula is as follows: Reconstruction probability ; in, is the log-likelihood of the original data x; is the number of samplings; z(i) is the i-th sample sampled from the space of the latent variable z output by the encoder; x is the original data.
5. A computer control system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Organic gas leakage diffusion real-time intelligent early warning method considering uncertainty reasoning
CN113962164A
Time sequence anomaly detection method and device based on decoupling representation learning
CN118035919A