Industrial product defect detection system and method based on multi-granularity auto-encoder
Through the multi-granularity autoencoder system, the problems of data quality, samples and defect location in industrial product inspection are solved, efficient and accurate defect detection and location are achieved, the cost is reduced, and it adapts to the needs of modern industrial production.
Patent Information
- Application Number
- CN202510734846.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-12
AI Technical Summary
Current industrial product quality inspection faces challenges in data quality and feature extraction, sample and defect issues, defect location difficulties, conflicts between real-time inspection and resources, and equipment cost obstacles, resulting in low inspection accuracy and efficiency, making it difficult to meet the needs of modern industrial production.
An industrial product defect detection system based on multi-granularity autoencoders is adopted. Through the reconstruction module, fusion module and defect detection and localization module, convolutional variational autoencoders, residual pyramid fusion autoencoders and multi-branch fusion attention autoencoders are combined to dynamically adjust the granularity weights. The graph attention network is combined for feature extraction and defect localization. The region growing algorithm is used to optimize the boundaries and display the heat map results.
It improves the accuracy and robustness of defect detection, accurately locates defect areas, reduces operation and maintenance costs, adapts to the needs of modern industrial production, provides friendly data visualization functions and cloud-edge collaboration modes, and improves production quality and efficiency.
Smart Images

Figure CN120635019A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of product detection, and specifically relates to an industrial product defect detection system and method based on a multi-granularity autoencoder. Background Art
[0002] Currently, industrial product quality testing faces many challenges:
[0003] (1) Data quality and feature extraction challenges: Industrial product image data comes from a wide range of sources, and its collection is affected by the environment and product characteristics, resulting in varying quality. Defects account for a small proportion of the image, and information is sparse. Effective feature extraction from high-dimensional image data is difficult, and products in different industrial fields vary greatly, making traditional feature extraction methods difficult to adapt. Multimodal or multi-level feature reduction also presents technical challenges.
[0004] (2) Sample and defect issues: In actual production, normal samples far outnumber abnormal samples. Traditional supervised learning has difficulty learning defect characteristics, resulting in missed detections and false detections. Industrial product defects are diverse in size, shape, and distribution. Labeling is costly, making it difficult to build large-scale labeled datasets, which affects the model's generalization ability.
[0005] (3) Dilemma of defect localization: The location and boundaries of industrial product defects are highly uncertain. In complex backgrounds or partial occlusions, traditional single-scale or single-feature detection methods are difficult to accurately identify and locate defects, resulting in a high false alarm rate.
[0006] (4) Conflict between real-time detection and resources: Industrial production requires that the detection system have high real-time performance so that defects can be discovered and repaired in a timely manner. However, it is difficult for the detection model to quickly complete defect identification and positioning under limited conditions, and the construction of related monitoring systems also faces challenges.
[0007] (5) Equipment cost barriers: Core hardware such as high-precision imaging equipment and edge computing equipment required for industrial testing has long relied on imports, and the procurement, maintenance, and upgrade costs are high. Small and medium-sized enterprises have limited funds and cannot afford it. They can only use inefficient methods such as manual testing, which cannot meet the automated testing needs of modern industrial production. Summary of the Invention
[0008] In response to the deficiencies in the prior art, the present invention provides an industrial product defect detection system and method based on a multi-granularity autoencoder, which can extract complex defect features, remove redundant information, improve the quality of feature expression, and accurately locate and display defect conditions.
[0009] The present invention provides the following technical solutions:
[0010] In a first aspect, an industrial product defect detection system based on a multi-granularity autoencoder is provided, comprising a business layer and a display layer, wherein the business layer comprises a reconstruction module, a fusion module, and a defect detection and positioning module;
[0011] The reconstruction module uses three autoencoders and their corresponding decoders to reconstruct the spatial granularity, feature granularity, and color granularity of the input product image to be inspected, and obtains the reconstruction error matrix for each granularity;
[0012] The fusion module fuses the reconstruction error matrices of each granularity to obtain a comprehensive reconstruction error map;
[0013] The defect detection and positioning module performs threshold segmentation on the comprehensive reconstruction error map according to the set threshold, preliminarily marks pixels exceeding the set threshold as defect areas, and uses the positioning algorithm to accurately obtain the boundaries of the preliminarily marked defect areas;
[0014] The display layer maps the precisely located defect area into an abnormality heat map and displays it after superimposing it with the original input image.
[0015] Optionally, it also includes:
[0016] Database, which stores industrial product image data, test results, user information, and model parameters saved after training;
[0017] The data operation layer can add, delete, query and modify the data in the database, and pass the database information to the reconstruction module and presentation layer.
[0018] Optionally, the three autoencoders and their corresponding decoders are used to reconstruct the spatial granularity, feature granularity, and color granularity of the input product image to be inspected, and a reconstruction error matrix of each granularity is obtained, specifically:
[0019] A convolutional variational autoencoder is used to extract spatial granularity features from the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the spatial granularity between the predicted image and the original image.
[0020] The residual pyramid fusion autoencoder is used to extract the feature granularity of the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the feature granularity of the predicted image and the original image;
[0021] A multi-branch fusion attention autoencoder is used to extract the color granularity features of the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the color granularity of the predicted image and the original image.
[0022] Optionally, the convolutional variational autoencoder is used to extract spatial granularity features from the input image of the product to be detected, specifically:
[0023]
[0024] Among them, p θ (x ′ |z1) is the Gaussian distribution of the feature map x′ and the latent space variable z1 obtained by convolution of the input image x, f θ (z1) is the output of the encoding part, σ 2 I is the noise variance term.
[0025] Optionally, the residual pyramid fusion autoencoder is used to perform feature extraction of the input product image to be detected at a feature granularity, specifically:
[0026]
[0027] Among them, z2 is the image feature after the residual pyramid fusion self-encoder processing, F i is the feature map extracted from the i-th scale, α i is the weight of the i-th scale feature, x is the input image, and N is the total number of feature maps of different scales generated by the input image through the ResNet convolution layer.
[0028] Optionally, the multi-branch fusion attention autoencoder is used to extract color granularity features from the input product image to be detected, specifically:
[0029]
[0030] Among them, z3 is the potential feature after processing by the multi-branch fusion attention autoencoder, which contains information of three color channels, α c is the weight of the color channel c, which controls the contribution of the channel in the final feature; f c (x c ): encoder output for color channel c, x c is the c-th color channel of the input image, representing the red, green, and blue channels.
[0031] Optionally, the fusion of the reconstruction error matrix of each granularity to obtain a comprehensive reconstruction error map is specifically as follows:
[0032] Using a graph attention network, a dynamic weight is assigned to the reconstruction error matrix of each granularity based on the Euclidean distance, cosine similarity, and cross-granularity feature interactions between each granularity. The reconstruction error matrices of each granularity are then fused according to the corresponding assigned dynamic weights to obtain a comprehensive reconstruction error graph.
[0033] The threshold segmentation is performed on the comprehensive reconstruction error map according to the set threshold, and the pixels exceeding the set threshold are preliminarily marked as defect areas. Specifically, the abnormality score ε of each pixel in the comprehensive reconstruction error map is calculated. total ,The pixels exceeding the threshold are preliminarily marked as defect areas;
[0034]
[0035] Among them, w g is the weight of the g-th granularity, ε g is the reconstruction error matrix of the g-th granularity, G is the granularity set, k is the granularity index variable (k∈G), ε g (i, j) represents the reconstruction error of the g-th granularity at position (i, j), H g and W g Respectively represent the height and width of the g-th granularity feature map;
[0036] The positioning algorithm is used to accurately obtain the boundary of the defective area of the initially calibrated defective area, specifically: a region growing algorithm is used to accurately obtain the boundary of the defective area of the initially identified defective area.
[0037] In a second aspect, a method for detecting industrial product defects based on a multi-granularity autoencoder is provided, comprising:
[0038] Using three autoencoders and their corresponding decoders, the input product image to be inspected is reconstructed at the spatial, feature, and color granularities to obtain the reconstruction error matrix for each granularity.
[0039] Fuse the reconstruction error matrices of each granularity to obtain a comprehensive reconstruction error map;
[0040] The integrated reconstruction error map is segmented according to the set threshold, and pixels exceeding the set threshold are preliminarily marked as defect areas. The positioning algorithm is then used to accurately obtain the boundaries of the preliminarily marked defect areas.
[0041] The precisely located defect area is mapped as an abnormality heat map and displayed after being superimposed with the original input image.
[0042] In a third aspect, a computer device is provided, comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the steps of the industrial product defect detection method based on a multi-granularity autoencoder described in the second aspect are implemented.
[0043] In a fourth aspect, a computer-readable storage medium is provided for storing a computer program; when the computer program is executed by a processor, the steps of the industrial product defect detection method based on a multi-granularity autoencoder described in the second aspect are implemented.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] (1) Improved feature extraction and detection capabilities: Traditional methods rely on manually designed features, making it difficult to capture tiny defects and having poor versatility; deep learning methods have shortcomings in terms of defect location accuracy. The multi-granularity feature reduction technology of this application can comprehensively extract complex defect features, remove redundant information, and improve the quality of feature expression. The defect detection technology based on multi-granularity autoencoders does not rely on a large number of defect samples. By dynamically adjusting the granularity weights, it improves the accuracy and robustness of complex defect detection.
[0046] (2) Improved defect location accuracy: Existing methods have shortcomings in defect location accuracy, especially in capturing subtle defects. This invention combines threshold segmentation, region growing algorithm, and heat map defect location technology to accurately locate defect areas, optimize boundary delineation, and intuitively display defect conditions, providing strong support for industrial quality control.
[0047] (3) The system architecture has obvious advantages: the system architecture designed by the present invention has good stability, high efficiency, scalability and low operation and maintenance costs, and provides a friendly human-computer interaction interface and rich data visualization functions to facilitate user operation and decision-making.
[0048] (4) Cloud-edge collaboration and closed-loop optimization: The cloud-edge collaboration model lowers the computing power threshold for small and medium-sized enterprises, and the cloud supports global optimization and iteration of models. The visual closed-loop solution builds a complete "detection-analysis-optimization" chain, which can continuously improve the detection process. Compared with traditional detection methods, it is more adapted to the needs of modern industrial production and effectively improves production quality and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 1 is an architectural diagram of an industrial product defect detection system based on a multi-granularity autoencoder according to the present invention;
[0050] Figure 2 It is a flow chart of the present invention for reconstructing multi-granularity data of an image;
[0051] Figure 3 is a flowchart of the steps of defect image positioning of the present invention;
[0052] Figure 4 is a schematic diagram of the coding of the spatial granularity of the present invention;
[0053] Figure 5 It is a schematic diagram of the coding of the characteristic granularity of the present invention;
[0054] Figure 6 It is a schematic diagram of the coding of color granularity of the present invention;
[0055] Figure 7 These are four defect detection results given in an embodiment of the present invention;
[0056] Figure 8 is a graph of the loss function of the multi-granularity autoencoder of the present invention;
[0057] Figure 9 It is the multi-granularity self-encoding verification precision graph of the present invention. DETAILED DESCRIPTION
[0058] The present invention will be further described below with reference to the accompanying drawings. The following examples are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention. It should be noted that the term "comprising" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0059] Example 1
[0060] like Figure 1-Figure 3 As shown, the industrial product defect detection system based on multi-granularity autoencoder includes: a business layer and a display layer. The business layer includes a reconstruction module, a fusion module, and a defect detection and positioning module.
[0061] The reconstruction module uses three autoencoders and their corresponding decoders to reconstruct the data of spatial granularity, feature granularity and color granularity of the input product image to be inspected, and obtains the reconstruction error matrix of each granularity.
[0062] Specifically include:
[0063] (1) Use the convolutional variational autoencoder (CVAE) to extract the spatial granularity features of the input product image to be inspected, and use the corresponding decoder to reconstruct the predicted image to obtain the reconstruction error matrix of the spatial granularity between the predicted image and the original image.
[0064] like Figure 4 As shown, the input image passes through multiple convolutional layers using convolutional kernels and nonlinear activation functions to capture the image's local texture and global structure, completing the initial extraction of spatial information. In the next stage of the encoder, a variational mechanism is introduced to map high-dimensional spatial features into a low-dimensional latent space. By learning the mean and variance of the latent variables, a latent representation following a Gaussian distribution is generated. Through convolutional extraction and variational compression, the encoder characterizes the diversity of spatial features and preserves the key spatial information of the image.
[0065] The specific encoding is:
[0066]
[0067] Among them, p θ (x′|z1) is the Gaussian distribution of the feature map x′ and the latent space variable z1 obtained by convolution of the input image x, f θ (z1) is the output of the encoding part, σ 2 I is the noise variance term.
[0068] (2) The residual pyramid fusion autoencoder (RPF-AE) is used to extract the feature granularity of the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the feature granularity of the predicted image and the original image.
[0069] like Figure 5 As shown in Figure 1, an input image passes through a series of ResNet convolutional layers to generate feature maps of different scales. Low-level feature maps contain detailed information, while high-level feature maps capture global semantic information. The FPN fuses high-level feature maps with low-level feature maps through a top-down upsampling process, gradually enhancing the feature maps at each layer to simultaneously contain feature information at different scales. Through this feature fusion, the FPN effectively achieves comprehensive modeling of feature information.
[0070] The specific encoding is:
[0071]
[0072] Among them, z2 is the image feature after the residual pyramid fusion self-encoder processing, F i is the feature map extracted from the i-th scale, α i is the weight of the i-th scale feature, reflecting top-down sampling and fusion, x is the input image, and N is the total number of feature maps of different scales generated by the input image through the ResNet convolution layer.
[0073] (3) Use a multi-branch fusion attention autoencoder to extract the color granularity features of the input product image to be tested, and use the corresponding decoder to reconstruct the predicted image to obtain the reconstruction error matrix of the color granularity of the predicted image and the original image.
[0074] like Figure 6As shown in the figure, the input image is decomposed into three independent channels (R, G, and B), each connected to three independent single-channel encoders. Each encoder extracts local and global features of the color channel through multi-layer convolution, completing the initial modeling of color information. A channel attention mechanism is introduced to dynamically calculate the importance weights of the three channels (R, G, and B), achieving weighted fusion of the channel features and generating a unified bottleneck layer representation. The fused bottleneck layer completes feature extraction and dimensionality reduction, restoring the compact features of the three channels and further integrating key information and global characteristics between the color channels.
[0075] The encoding expression is as follows:
[0076]
[0077] Among them, z3 is the potential feature after processing by the multi-branch fusion attention autoencoder, which contains information of three color channels, α c is the weight of the color channel c, which controls the contribution of the channel in the final feature; f c (x c ): encoder output for color channel c, x c is the c-th color channel of the input image, representing the red, green, and blue channels.
[0078] The fusion module fuses the reconstruction error matrices of each granularity to obtain the comprehensive reconstruction error map.
[0079] The decoder of the corresponding autoencoder is gradually reconstructed into a predicted image, and the (consistent) reconstruction mean square error matrix of each granularity is obtained and the degree of deviation is quantified. To dynamically adjust the contribution of different granularities to the comprehensive reconstruction error, we introduce a graph attention network (GAT). GAT uses the attention mechanism weight calculation module to generate adaptive attention weights based on the Euclidean distance, cosine similarity, and cross-granular feature interactions between each granularity feature, assigning a dynamic weight to the reconstruction error of each granularity. The feature fusion module then uses the obtained weighted strategy to fuse the reconstruction error matrices of each granularity into a comprehensive reconstruction error map to fully integrate multi-granularity defect information.
[0080] The defect detection and positioning module performs threshold segmentation on the comprehensive reconstruction error map according to the set threshold, preliminarily marks pixels exceeding the set threshold as defect areas, and uses the positioning algorithm to accurately obtain the boundaries of the preliminarily marked defect areas.
[0081] Specifically, based on the comprehensive reconstruction error map, the anomaly score (the weighted pixel error value of each granularity) is calculated and the threshold is set to 0.5-5.0 (the specific adjustment needs to be made according to the model output scale) to determine whether there is a defect.
[0082] Anomaly score ε of the comprehensive reconstruction error map total;
[0083]
[0084] Among them, w g is the weight of the g-th granularity, ε g is the reconstruction error matrix of the g-th granularity, G is the granularity set, k is the granularity index variable (k∈G), ε g (i, j) represents the reconstruction error of the g-th granularity at position (i, j), H g and W g They represent the height and width of the g-th granularity feature map respectively.
[0085] Based on the initially identified defect area, the region growing algorithm is applied starting from the seed point and gradually expanding according to the similarity criterion to accurately outline the defect boundary, significantly optimizing the defect positioning and providing higher accuracy for subsequent visualization.
[0086] S k+1 =S k ∪{p∈N(S k )|d(p,S k )<∈}
[0087] Among them, S k is the current region, N(S k ) is the neighborhood set, d(p,S k ) is the point p to region S k The distance between ∈ is the expansion threshold.
[0088] The display layer maps the precisely located defect area into an abnormality heat map and displays it after superimposing it with the original input image;
[0089] The optimized defect segmentation results are mapped to an abnormality heat map and superimposed with the original image. The location and severity of the defect area are intuitively displayed through color gradients, providing users with clear and intuitive defect visualization results.
[0090]
[0091] Among them, H(x,y) is the value of the heat map at the position (x,y), (x i ,y i ) is the position of the defect point, α i is the intensity of defect point i, and σ is the standard deviation of Gaussian distribution.
[0092] This application combines threshold segmentation, region growing algorithm and heat map mapping to meet the needs of rapid interpretation and analysis in actual scenarios.
[0093] In this embodiment, the industrial product defect detection system based on a multi-granularity autoencoder also includes a database and a data operation layer. The database stores industrial product image data, user information on detection results, and the parameters of each model saved after training (the convolutional variational autoencoder (CVAE) at spatial granularity, the residual pyramid fusion encoder (RPF-AE) at feature granularity, the multi-branch fusion attention autoencoder (MBFA-AE) at color granularity, and the parameters of the graph attention network (GAT) model). The data operation layer can add, delete, query, and modify data in the database and pass the database information to the reconstruction module and presentation layer.
[0094] Example 2
[0095] The industrial product defect detection method based on multi-granularity autoencoder includes the following steps:
[0096] Using three autoencoders and their corresponding decoders, the input product image to be inspected is reconstructed at the spatial, feature, and color granularities to obtain the reconstruction error matrix for each granularity.
[0097] Fuse the reconstruction error matrices of each granularity to obtain a comprehensive reconstruction error map;
[0098] The integrated reconstruction error map is segmented according to the set threshold, and pixels exceeding the set threshold are preliminarily marked as defect areas. The positioning algorithm is then used to accurately obtain the boundaries of the preliminarily marked defect areas.
[0099] The precisely located defect area is mapped as an abnormality heat map and displayed after being superimposed with the original input image.
[0100] For more specific details about the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be described again here.
[0101] Example 3
[0102] A specific example is provided, comprising the following steps:
[0103] Data preparation: Collect industrial product images, preprocess them, and mark defect areas to provide data support for subsequent model training.
[0104] Model Training and Validation: We trained a spatially scaled convolutional variational autoencoder (CVAE), a feature-scale residual pyramid fusion encoder (RPF-AE), a color-scale multi-branch fusion attention autoencoder (MBFA-AE), and a graph attention network (GAT). During training, we used cross-validation to evaluate model performance and adjust hyperparameters to optimize the model.
[0105] like Figure 8The loss shown continues to decrease, indicating that the multi-granularity autoencoder of this application has a high degree of effective feature learning, such as Figure 9 As shown, the multi-granularity autoencoder of the present application is getting closer and closer to 1, indicating that the coding features of the present application have good effectiveness in downstream defect recognition.
[0106] Defect detection and localization experiments: Images are reconstructed using the trained model, and the reconstruction error is calculated. GAT dynamically adjusts the weights of reconstruction errors of different granularities and fuses them to generate a comprehensive reconstruction error map. Anomaly scores are calculated based on the comprehensive reconstruction error map, and a threshold is set to determine whether an image has defects. For images identified as having defects, the defect boundaries are optimized using threshold segmentation and a region growing algorithm. The result is mapped into an anomaly heat map to achieve defect localization.
[0107] System Platform Development and Testing: Develop an industrial product defect monitoring system platform based on a multi-granularity autoencoder, integrating a MySQL database, data processing layer, business layer, and presentation layer. After development is complete, the system undergoes functional testing, performance testing, and user experience testing to ensure it meets actual application requirements.
[0108] Result analysis and optimization: Analyze the results of defect detection and localization, optimize and adjust the model and algorithm design based on evaluation indicators such as accuracy, recall rate, F1 score, IoU, and boundary accuracy, and visualize the results to facilitate user understanding and analysis.
[0109] like Figure 7 As shown in (a), the results of pitting surface defect detection are given. Figure 7 As shown in (b), the crack defect detection results are given. Figure 7 As shown in (c), the scratch defect detection results are given. Figure 7 As shown in (d), the patch defect detection result is given by Figure 7 It can be seen that this application can accurately identify various defects of industrial products.
[0110] Example 4
[0111] The present invention provides a computer device comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the steps of the above-mentioned industrial product defect detection method based on a multi-granularity autoencoder are implemented.
[0112] For more specific details about the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be described again here.
[0113] Example 5
[0114] The present invention provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the steps of the above-mentioned industrial product defect detection method based on a multi-granularity autoencoder are implemented.
[0115] For more specific details about the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be described again here.
[0116] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. References to the same or similar parts between the various embodiments will be sufficient. The systems, devices, and storage media disclosed in the embodiments are described briefly because they correspond to the methods disclosed in the embodiments. For relevant details, refer to the method description.
[0117] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus a necessary general-purpose hardware platform. Based on this understanding, the technical solutions in the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention or certain portions of the embodiments.
[0118] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions based on the principles of the present invention are within the scope of protection of the present invention. It should be noted that for those skilled in the art, various improvements and modifications that do not depart from the principles of the present invention should be considered within the scope of protection of the present invention.
Claims
1. An industrial product defect detection system based on a multi-granularity autoencoder, characterized by: It includes business layer and display layer. The business layer includes reconstruction module, fusion module, and defect detection and positioning module. The reconstruction module uses three autoencoders and their corresponding decoders to reconstruct the spatial granularity, feature granularity, and color granularity of the input product image to be inspected, and obtains the reconstruction error matrix for each granularity; The fusion module fuses the reconstruction error matrices of each granularity to obtain a comprehensive reconstruction error map; The defect detection and positioning module performs threshold segmentation on the comprehensive reconstruction error map according to the set threshold, preliminarily marks pixels exceeding the set threshold as defect areas, and uses the positioning algorithm to accurately obtain the boundaries of the preliminarily marked defect areas; The display layer maps the precisely located defect area into an abnormality heat map and displays it after superimposing it with the original input image.
2. The industrial product defect detection system based on multi-granularity autoencoder according to claim 1 is characterized in that: Also includes: Database, which stores industrial product image data, test results, user information, and model parameters saved after training; The data operation layer can add, delete, query and modify the data in the database, and pass the database information to the reconstruction module and presentation layer.
3. The industrial product defect detection system based on multi-granularity autoencoder according to claim 1 is characterized in that: The three autoencoders and their corresponding decoders are used to reconstruct the spatial granularity, feature granularity, and color granularity of the input product image to be detected, and the reconstruction error matrix of each granularity is obtained, which is specifically: A convolutional variational autoencoder is used to extract spatial granularity features from the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the spatial granularity between the predicted image and the original image. The residual pyramid fusion autoencoder is used to extract the feature granularity of the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the feature granularity of the predicted image and the original image; A multi-branch fusion attention autoencoder is used to extract the color granularity features of the input product image to be inspected, and the corresponding decoder is used to reconstruct the predicted image to obtain the reconstruction error matrix of the color granularity of the predicted image and the original image.
4. The industrial product defect detection system based on multi-granularity autoencoder according to claim 3 is characterized in that: The convolutional variational autoencoder is used to extract spatial granularity features from the input product image to be detected, specifically: Among them, p θ (x ′ |z1) is the feature map x obtained by convolution of the input image x ′ and the Gaussian distribution of the latent space variable z1, f θ (z1) is the output of the encoding part, σ 2 I is the noise variance term.
5. The industrial product defect detection system based on multi-granularity autoencoder according to claim 3 is characterized in that: The residual pyramid fusion autoencoder is used to extract the feature granularity of the input product image to be detected, specifically: Among them, z2 is the image feature after the residual pyramid fusion self-encoder processing, F i is the feature map extracted from the i-th scale, α i is the weight of the i-th scale feature, x is the input image, and N is the total number of feature maps of different scales generated by the input image through the ResNet convolution layer.
6. The industrial product defect detection system based on multi-granularity autoencoder according to claim 3 is characterized in that: The multi-branch fusion attention autoencoder is used to extract the color granularity features of the input product image to be detected, specifically: Among them, z3 is the potential feature after processing by the multi-branch fusion attention autoencoder, which contains information of three color channels, α c is the weight of the color channel c, which controls the contribution of the channel in the final feature; f c (x c ): encoder output for color channel c, x c is the c-th color channel of the input image, representing the red, green, and blue channels.
7. The industrial product defect detection system based on multi-granularity autoencoder according to claim 1 is characterized in that: The reconstruction error matrix of each granularity is integrated to obtain a comprehensive reconstruction error map, specifically: Using a graph attention network, a dynamic weight is assigned to the reconstruction error matrix of each granularity based on the Euclidean distance, cosine similarity, and cross-granularity feature interactions between each granularity. The reconstruction error matrices of each granularity are then fused according to the corresponding assigned dynamic weights to obtain a comprehensive reconstruction error graph. The threshold segmentation is performed on the comprehensive reconstruction error map according to the set threshold, and the pixels exceeding the set threshold are preliminarily marked as defect areas. Specifically, the abnormality score ε of each pixel in the comprehensive reconstruction error map is calculated. total ,The pixels exceeding the threshold are preliminarily marked as defect areas; Among them, w g is the weight of the g-th granularity, ε g is the reconstruction error matrix of the g-th granularity, G is the granularity set, k is the granularity index variable (k∈G), ε g (i, j) represents the reconstruction error of the g-th granularity at position (i, j), H g and W g Respectively represent the height and width of the g-th granularity feature map; The positioning algorithm is used to accurately obtain the boundary of the defective area of the initially calibrated defective area, specifically: a region growing algorithm is used to accurately obtain the boundary of the defective area of the initially identified defective area.
8. An industrial product defect detection method based on a multi-granularity autoencoder, characterized in that: include: Using three autoencoders and their corresponding decoders, the input product image to be inspected is reconstructed at the spatial, feature, and color granularities to obtain the reconstruction error matrix for each granularity. Fuse the reconstruction error matrices of each granularity to obtain a comprehensive reconstruction error map; The integrated reconstruction error map is segmented according to the set threshold, and pixels exceeding the set threshold are preliminarily marked as defect areas. The positioning algorithm is then used to accurately obtain the boundaries of the preliminarily marked defect areas. The precisely located defect area is mapped as an abnormality heat map and displayed after being superimposed with the original input image.
9. A computer device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, it implements the steps of the industrial product defect detection method based on multi-granularity autoencoder described in claim 8.
10. A computer-readable storage medium, characterized in that Used to store computer programs; when the computer program is executed by the processor, the steps of the industrial product defect detection method based on multi-granularity autoencoder described in claim 8 are implemented.
Citation Information
Cited By
MicroLED chip array detection method and system
CN121120635A
A method and system for detecting a micro-led chip array
CN121120635B