Gaussian mixture distribution defect detection method based on normalized stream

Through the hybrid Gaussian distribution defect detection method based on normalized flow, the Gaussian parameters are updated using clustering algorithms and loss functions, the problem of poor adaptability of feature distribution modeling in the existing technology is solved, and higher detection accuracy and stronger model generalization capabilities are achieved.

CN120495209APending Publication Date: 2025-08-15ARMOR ACADEMY OF CHINESE PEOPLES LIBERATION ARMY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510564703.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing normalized flow method has poor adaptability in feature distribution modeling, resulting in low image defect detection accuracy, ignoring the difference in feature distribution between different data sets, and the mapped distribution does not comply with the standard Gaussian distribution, affecting detection performance.

Method used

The hybrid Gaussian distribution defect detection method based on normalized flow is used to determine multiple Gaussian function parameters through the clustering algorithm, fuse multiple Gaussian functions and calculate the probability value of the input features on the mixed Gaussian distribution. In the training stage, the Gaussian parameters are updated through the set loss function and training strategy, and the data is dynamically changed, and the mixed Gaussian distribution function is obtained, and the detection score of the image to be detected is calculated.

Benefits of technology

It improves the accuracy of defect detection and the generalization ability of the model, can better express the feature distribution in complex scenarios, and improves detection accuracy and positioning performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495209A_ABST
    Figure CN120495209A_ABST
Patent Text Reader

Abstract

The invention discloses a Gaussian mixture distribution defect detection method based on a normalized stream, and belongs to the field of industrial part defect detection. Comprising the following steps: in a training stage, selecting proper parameters for Gaussian mixture distribution by utilizing a clustering algorithm; in the test stage, the probability values of the features on the Gaussian mixture distribution are used for sample classification and defect area positioning. The Gaussian mixture distribution has a strong expression capability, and can better express the feature distribution of the normal pavement image in a complex scene, thereby improving the accuracy of defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial parts defect detection, and more particularly to a normalized flow-based mixed Gaussian distribution defect detection method. Background Art

[0002] Image defect detection is one of the important research directions in the field of computer vision, and is mainly achieved using unsupervised learning methods.

[0003] Currently, the DifferNet model utilizes the normalized flow architecture proposed by RealNVP to map the original feature distribution to a standard Gaussian distribution. During the test phase, it determines whether a sample is a defect based on its probability within this distribution. The CFlow model extends the normalized flow architecture to pixel-level detection, establishing a probability distribution for each feature map pixel position, thereby achieving more accurate pixel-level defect localization. To further improve the performance of the normalized flow network, researchers have proposed various improved models. The FastFlow model replaces the 1×1 convolution in the normalized flow network with an alternating 1×1 and 3×3 convolution structure to capture more neighborhood information. The PyramidFlow model introduces a contrastive learning-based training method to reduce the differences between normal image features, while combining multi-scale mapping and fusion modules to improve the model's generalization capabilities. The MSFlow model proposes an asymmetric parallel normalized flow framework to effectively process features at different levels of the feature pyramid. Furthermore, MSFlow uses a fusion flow network to integrate information from features at different levels, further improving detection performance.

[0004] To enable the normalized flow network to capture more neighborhood information, the FastFlow model modifies the 1×1 convolution in the normalized flow network into an architecture that alternates 1×1 and 3×3 convolutions. To reduce inter-image differences, the PyramidFlow model employs a training method based on contrastive learning, which can reduce the differences between normal image features. Furthermore, a multi-scale mapping and fusion module is designed to increase model generalization. To address the differences between features at different levels in the feature pyramid, the MSFlow model employs a parallel normalized flow framework with an asymmetric structure to process features at different levels. Subsequently, by using a fusion flow network, MSFlow effectively integrates information from features at different levels.

[0005] However, existing normalized flow methods still have certain problems in feature distribution modeling. Traditional methods usually map the original feature distribution to a fixed standard Gaussian distribution, but this method has two major flaws. First, this mapping method ignores the differences in feature distributions between different data sets and fails to fully consider the diversity of data; second, the mapping ability of the normalized flow network is often overestimated, making it difficult to accurately convert all original feature distributions into a standard Gaussian distribution. In practical applications, the distribution after mapping the normalized flow network often does not perfectly conform to the standard Gaussian distribution, and mean shift and other situations may occur. Especially in the testing phase, when the model performs defect detection based on the probability value of the feature in the distribution, the more compact the mapped Gaussian distribution, the better the detection performance of the model is generally. Therefore, compared with mapping the original feature distribution to a standard Gaussian distribution, choosing a more compact target distribution as the mapping target is more helpful in improving detection accuracy and optimizing the recognition effect of defect samples.

[0006] Therefore, how to provide a mixed Gaussian distribution defect detection method based on normalized flow is a problem that technical personnel in this field urgently need to solve. Summary of the Invention

[0007] In view of this, the present invention provides a mixed Gaussian distribution defect detection method based on normalized flow, which is used to solve the problem that the standard Gaussian distribution in the traditional normalized flow model has poor adaptability and affects the accuracy of image defect detection.

[0008] In order to achieve the above object, the present invention provides the following technical solutions:

[0009] A mixed Gaussian distribution defect detection method based on normalized flow, comprising:

[0010] Use the pre-trained feature extractor to extract features of the training set samples;

[0011] Determine multiple Gaussian function parameters through clustering algorithm, fuse multiple Gaussian functions and calculate the probability value of input features on the mixed Gaussian distribution;

[0012] During the training phase, the features distributed on both sides of the mean are pulled towards the mean through the set loss function to indirectly adjust the variance, and the Gaussian parameters are updated through the set training strategy to adapt to the dynamic changes of the data, thereby obtaining a mixed Gaussian distribution function;

[0013] The detection scores of all pixel positions on the image to be detected are calculated using a mixed Gaussian distribution function, and the maximum value of the detection score is used as the image-level detection score.

[0014] Furthermore, the calculation formula of the clustering algorithm is:

[0015] C,L=cluster(y,K)

[0016] Where cluste(·,·) represents the clustering operation, C={c1,c2,…c k} represents the cluster center vector set after clustering, K represents the number of cluster categories, L={l1,l2,…l k} is the set after the features are divided according to the class center, where l k Represents the classification into the cluster center c k .

[0017] Furthermore, the process of determining the Gaussian parameters is as follows:

[0018] The number of Gaussian functions in the mixed Gaussian distribution corresponds to the number of categories k in the clustering operation. The optimal hyperparameter k is selected through multiple experiments.

[0019] The cluster center vector C after clustering the original features is C={c1,c2,…c k} as the mean of different Gaussian functions μ={μ1,μ2,…μ k}, the formula is:

[0020] μ k =c k

[0021] Calculate the feature set L contained in each cluster center after the original feature clustering is L = {l1,l2,…l k}'s variance σ={σ1,σ2,…σ k}, as the variance of the Gaussian function, the formula is:

[0022] σ k =var(l k )

[0023] Where μ k represents the mean of the kth Gaussian function, c k Represents the k-th cluster center vector after the original features are clustered; σ k represents the variance of the kth Gaussian function; l k Represents the feature set contained in the kth cluster center after the original features are clustered.

[0024] Furthermore, the Gaussian function fusion formula for fusing multiple Gaussian functions is:

[0025]

[0026]

[0027] Among them, α k is the Gaussian function h in the fusion of multiple Gaussian functions kThe corresponding weight, num(·) is the operation for calculating the number of elements in the set, h(z) is the mixed Gaussian distribution, and z is the mapped feature.

[0028] Furthermore, the set loss function includes:

[0029] For the original feature p Y The transformation of (y) is as follows:

[0030]

[0031] The expression of the loss function is:

[0032]

[0033] Where p Y (y) represents the original feature, h(z) is the mixed Gaussian distribution, μ k represents the mean of the kth Gaussian function, σ k represents the variance of the k-th Gaussian function.

[0034] Furthermore, the set training strategy is a training strategy of updating distribution parameters by using a clustering algorithm every m generations.

[0035] Furthermore, the detection scores of all pixel positions on the image to be detected are calculated using the mixed Gaussian distribution function, and the calculation formula is:

[0036]

[0037] Among them, z t is the pixel-level feature on the test sample feature map, S map It is the detection score map of each pixel position on the feature map.

[0038] Furthermore, taking the maximum value of the detection score as the image-level detection score includes: using the maximum value of the detection scores of all pixel positions on the entire image as the image-level detection score, and the calculation formula is:

[0039] S image =max(S map )

[0040] Where S map It is the detection score map of each pixel position on the feature map.

[0041] It can be seen from the above technical solution that compared with the existing technology, the present invention discloses a mixed Gaussian distribution defect detection method based on normalized flow, and the single Gaussian distribution modeling method based on the adaptive feature distribution model of normalized flow is extended to multiple Gaussian distributions to adapt to the multi-defect feature distribution in complex situations, and the generalization of the model is further enhanced through adaptive mixed Gaussian distribution parameter estimation. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0043] Figure 1 Schematic diagram of the method flow of the present invention;

[0044] Figure 2 A schematic diagram of the process of clustering the input sample data and then using the clustering results to construct multiple Gaussian functions and mixed Gaussian functions;

[0045] Figure 3 The figure shows a comparison of test scores calculated based on a single Gaussian distribution function and a mixed Gaussian distribution function. DETAILED DESCRIPTION

[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0047] Example 1:

[0048] See also Figure 1 The embodiment of the present invention discloses a method for defect detection based on a mixture Gaussian distribution of normalized flow, comprising:

[0049] Use the pre-trained feature extractor to extract features of the training set samples;

[0050] Determine multiple Gaussian function parameters through clustering algorithm, fuse multiple Gaussian functions and calculate the probability value of input features on the mixed Gaussian distribution;

[0051] During the training phase, the features distributed on both sides of the mean are pulled towards the mean through the set loss function to indirectly adjust the variance, and the Gaussian parameters are updated through the set training strategy to adapt to the dynamic changes of the data, thereby obtaining a mixed Gaussian distribution function;

[0052] The detection scores of all pixel positions on the image to be detected are calculated using a mixed Gaussian distribution function, and the maximum value of the detection score is used as the image-level detection score.

[0053] Specifically, the training set of the present invention can be an industrial parts image training set, a medical image training set, etc. The present invention does not rely on a specific data set and can use any scene data for training.

[0054] Specifically, the technical solution steps of the present invention are as follows:

[0055] Step 1: Gaussian parameter selection;

[0056] S11 input: Use the pre-trained feature extractor to extract features of all samples in the training set;

[0057] S12 clustering algorithm: Use clustering algorithm to determine the parameters of multiple Gaussian functions;

[0058] S13 Gaussian function fusion: fuse multiple Gaussian functions and then calculate the probability value of the input feature on the mixed Gaussian distribution;

[0059] Step 2: Loss function and training strategy;

[0060] S21 designs a loss function: pulls features distributed on both sides of the mean toward the mean, thereby indirectly adjusting the variance;

[0061] S22 training strategy: A strategy that uses a clustering algorithm to update the distribution parameters every m generations;

[0062] Step 3: Calculation of detection scores;

[0063] S31 detection score: The maximum value of the detection scores of all pixel positions in the entire image is used as the image-level detection score.

[0064] In a specific embodiment, the clustering algorithm process is as follows:

[0065] The present invention determines the parameters of multiple Gaussian functions by using a clustering algorithm. The calculation formula is as follows:

[0066] C,L=cluster(y,K)

[0067] Where cluster(·,·) represents the clustering operation, C={c1,c2,…c k} represents the cluster center vector set after clustering, K represents the number of cluster categories, L={l1,l2,…l k} is the set after the features are divided according to the class center, where l k Represents the classification into the cluster center c k .

[0068] In a specific embodiment, the Gaussian parameter selection process is as follows:

[0069] Quantity: The number of Gaussian functions in the mixed Gaussian distribution corresponds to the number of categories k in the clustering operation. The optimal hyperparameter k is selected through multiple experiments;

[0070] Mean: The cluster center vector C after clustering the original features = {c1,c2,…c k} as the mean of different Gaussian functions μ={μ1,μ2,…μ k},Right now:

[0071] μ k =c k

[0072] Variance: Calculate the feature set L contained in each cluster center after the original feature clustering = {l1,l2,…l k}'s variance σ={σ1,σ2,…σ k}, as the variance of the Gaussian function. That is:

[0073] σ k =var(l k )

[0074] In a specific embodiment, the Gaussian function fusion strategy process is as follows:

[0075] When performing Gaussian function fusion, we must consider the different number of features contained in the categories corresponding to different Gaussian functions, as well as the convenience of calculation during the gradient descent process. In summary, the Gaussian function fusion formula is designed as follows:

[0076]

[0077] Among them, α k is the Gaussian function h in the fusion of multiple Gaussian functions k The corresponding weight, num(·) is the operation of calculating the number of elements in the set, h(z) is the mixed Gaussian distribution, and z is the mapped feature. Weight α k The design takes into account the influence of the number of features on the Gaussian function, making the influence of each Gaussian function on the mixed Gaussian distribution more reasonable.

[0078] In a specific embodiment, the loss function process is as follows:

[0079] The target distribution after normalized flow network mapping selects mixed Gaussian distribution, that is, the target distribution p Z (z)=h(z). Therefore, for the original feature p Y The transformation of (y) is as follows:

[0080]

[0081] In a specific embodiment, the loss function is designed as follows:

[0082]

[0083] Where p Y (y) represents the original feature, h(z) is the mixed Gaussian distribution, μ k represents the mean of the kth Gaussian function, σ k represents the variance of the k-th Gaussian function.

[0084] In a specific embodiment, the training strategy process is as follows:

[0085] The Gaussian mixture distribution proposed in this paper consists of multiple Gaussian functions, whose parameters are obtained using a clustering algorithm. If the clustering algorithm is used alone to initialize the parameters of the Gaussian mixture functions without subsequent parameter adjustments, as the model undergoes iterative training, the parameters obtained from the original initialization may no longer be applicable in subsequent iterations. Therefore, this paper proposes a strategy that uses a clustering algorithm to update the distribution parameters every m generations.

[0086] In a specific embodiment, the detection score calculation process is as follows:

[0087] The probability value of the feature on the mixed Gaussian distribution function is used as the detection score. The calculation formula is as follows:

[0088]

[0089] Among them, z t is the pixel-level feature on the test sample feature map, S map It is the detection score map of each pixel position on the feature map.

[0090] In a specific embodiment, the image-level detection score is calculated by using the maximum value of the detection scores of all pixel positions in the entire image as the image-level detection score. The calculation formula is as follows:

[0091] S image =max(S map )

[0092] Where S map It is the detection score map of each pixel position on the feature map.

[0093] When the image-level detection score exceeds the set threshold, it can be judged as a defect; otherwise, it is normal.

[0094] Specifically, the present invention utilizes the aforementioned scheme to use a mixed Gaussian distribution as the target distribution after normalized flow network mapping. During the training phase, clustering algorithms are used to select appropriate parameters for the mixed Gaussian distribution. During the testing phase, the probability values of features in the mixed Gaussian distribution are used to classify samples and locate defect areas. The mixed Gaussian distribution has powerful expressive power and can better represent the feature distribution of normal road surface images in complex scenarios, thereby improving the accuracy of defect detection.

[0095] Example 2:

[0096] To accurately evaluate the present invention, this example experiments with a normalized flow-based mixed Gaussian distribution defect detection method on the MVTec AD dataset. This dataset is an unsupervised defect detection dataset for industrial visual inspection, primarily used to train and evaluate deep learning models in the classification of defect-free and defective samples. It contains high-resolution images of industrial products from 15 different categories, such as bottles, cables, screws, and tiles. Each category includes both normal samples and various defect samples (such as scratches, cracks, and deformations). This dataset is commonly used in research in the fields of unsupervised defect detection, defect detection, and quality control.

[0097] like Figure 2 As shown in Figure 1, it shows the process of clustering the input sample data and then using the clustering results to construct multiple Gaussian functions and mixed Gaussian functions. The function with black lines in the figure is the result of fusing different Gaussian functions.

[0098] like Figure 3 As shown in the figure, examples of calculating detection scores based on a single Gaussian distribution function and a mixed Gaussian distribution function are shown. The green elements in the figure represent data after normalized flow network mapping. It can be found that when the value of the input data is 2.8, if the probability value of the data on the single Gaussian distribution function is used as the detection score, this does not match the actual distribution of the data. That is, the sample with an eigenvalue of 2.8 is not in the dense distribution of data and is an outlier. The actual probability value should be lower than the current probability value calculated based on the single Gaussian distribution. Compared with the single Gaussian distribution, the data has a lower probability value on the mixed Gaussian distribution, which is more in line with the actual distribution of the data, that is, the data is in the middle of the two dense distributions.

[0099] As shown in Table 1, in terms of the Image-AUROC metric, the present invention achieved the best experimental results for the crack, pothole, and patch categories, with performance scores of 99.7%, 99.5%, and 100%, respectively. Furthermore, for both crack and pothole road defect types, the present invention achieved a 0.2% improvement over the existing ADNF model based on a single Gaussian distribution. Compared to several other normalized flow-based models, particularly the PyramidFlow model, the present invention had significant advantages in detecting all four different defect types. In terms of the Pixel-AUROC metric, the present invention achieved the best experimental results for the crack, patch, and crack categories, with scores of 97.2%, 97.0%, and 96.4%, respectively. While the present invention's model did not achieve the best result for the pothole category, it was only 0.1% lower than the 97.1% achieved by the MBMF model. Compared to the ADNF model, the present invention achieved 0.5%, 0.2%, and 0.4% improvements for the pothole, patch, and crack categories, respectively, with an average improvement of 0.4% across all categories. Compared with several other methods based on normalized flow, the present invention also has advantages in pixel-level indicators. This fully demonstrates that the mixed Gaussian distribution proposed in the present invention has more powerful performance than the single Gaussian distribution in locating road defect areas.

[0100] Table 1 Experimental results of road damage data

[0101]

[0102] Table 2 shows the experimental results of the present invention for image-level defect classification and pixel-level defect area localization on the MVTecAD dataset. Overall, the present invention outperforms the six compared methods in terms of average performance across 15 image classes in the MVTecAD dataset, achieving Image-AUROC and Pixel-AUROC scores of 99.6% and 98.9%, respectively.

[0103] Table 2 Experimental results on the MVTec AD dataset

[0104]

[0105] Specifically, in terms of the Image-AUROC indicator, the present invention achieved the best experimental results in 6 categories. Compared with the ADNF model, the average indicator of the present invention increased by 0.1%, and the experimental performance was improved in 6 categories. Compared with several other models based on normalized flow networks, the present invention is better than CFlow, CS-Flow and PyramidFlow in terms of both the average performance of all categories and the number of categories with the best performance. This verifies the effectiveness of the mixed Gaussian distribution strategy in category detection tasks. Compared with the Image-AUROC indicator, the present invention has a more obvious advantage in the Pixel-AUROC indicator and achieved the best experimental results in 7 categories. Compared with the ADNF model, the average indicator was improved by 0.1%, and the experimental performance was improved in 8 categories. Since the present invention adopts a more expressive mixed Gaussian distribution strategy, the model has a stronger generalization ability, and the positioning performance for different categories is more average. The index between the category with the best positioning performance and the category with the worst positioning performance is 2.6%, while CFLOW and ADNF are 3.0% and 3.1% respectively. The average indicators of the latter two are 0.3% and 0.1% lower than those of the present invention.

[0106] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.

[0107] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A mixed Gaussian distribution defect detection method based on normalized flow, characterized in that: include: Use the pre-trained feature extractor to extract features of the training set samples; Determine multiple Gaussian function parameters through clustering algorithm, fuse multiple Gaussian functions and calculate the probability value of input features on the mixed Gaussian distribution; During the training phase, the features distributed on both sides of the mean are pulled towards the mean through the set loss function to indirectly adjust the variance, and the Gaussian parameters are updated through the set training strategy to adapt to the dynamic changes of the data, thereby obtaining a mixed Gaussian distribution function; The detection scores of all pixel positions on the image to be detected are calculated using a mixed Gaussian distribution function, and the maximum value of the detection score is used as the image-level detection score.

2. The method for defect detection based on mixed Gaussian distribution of normalized flow according to claim 1, characterized in that: The calculation formula of the clustering algorithm is: C,L=cluster(y,K) Among them, cluster(·,·) represents the clustering operation, C={c1,c2,···c k } represents the cluster center vector set after clustering, K represents the number of cluster categories, L={l1,l2,···l k } is the set after the features are divided according to the class center, where l k Represents the classification into the cluster center c k .

3. The method for defect detection based on mixed Gaussian distribution of normalized flow according to claim 1, characterized in that: The determination process of the Gaussian parameters is: The number of Gaussian functions in the mixed Gaussian distribution corresponds to the number of categories k in the clustering operation. The optimal hyperparameter k is selected through multiple experiments. The cluster center vector C after clustering the original features is C={c1,c2,···c k } as the mean of different Gaussian functions μ={μ1,μ2,···μ k }, the formula is: m k =c k Calculate the feature set L contained in each cluster center after the original feature clustering = {l1,l2,···l k The variance σ of}={σ1,σ2,···σ k }, as the variance of the Gaussian function, the formula is: σ k =var(l k ) Where μ k represents the mean of the kth Gaussian function, c k Represents the k-th cluster center vector after the original features are clustered; σ k represents the variance of the kth Gaussian function; l k Represents the feature set contained in the kth cluster center after the original features are clustered.

4. The method for defect detection based on mixed Gaussian distribution of normalized flow according to claim 3, characterized in that: The Gaussian function fusion formula for fusing multiple Gaussian functions is: Among them, α k is the Gaussian function h in the fusion of multiple Gaussian functions k The corresponding weight, num(·) is the operation for calculating the number of elements in the set, h(z) is the mixed Gaussian distribution, and z is the mapped feature.

5. The defect detection method based on mixed Gaussian distribution of normalized flow according to claim 1, characterized in that: The loss function of the setting includes: For the original feature p Y The transformation of (y) is as follows: The expression of the loss function is: Where p Y (y) represents the original feature, h(z) is the mixed Gaussian distribution, μ k represents the mean of the kth Gaussian function, σ k represents the variance of the k-th Gaussian function.

6. The method for defect detection based on mixed Gaussian distribution of normalized flow according to claim 1, characterized in that: The set training strategy is a training strategy of updating distribution parameters by using a clustering algorithm every m generations.

7. The method for defect detection based on mixed Gaussian distribution of normalized flow according to claim 1, characterized in that: The detection scores of all pixel positions on the image to be detected are calculated by the mixed Gaussian distribution function, and the calculation formula is: Among them, z t is the pixel-level feature on the test sample feature map, S map It is the detection score map of each pixel position on the feature map.

8. The method for defect detection based on mixed Gaussian distribution of normalized flow according to claim 1, characterized in that: The maximum value of the detection score as the image-level detection score includes: using the maximum value of the detection scores of all pixel positions on the entire image as the image-level detection score, and the calculation formula is: S image =max(S map ) Where S map It is the detection score map of each pixel position on the feature map.