An industrial parts anomaly detection method based on SCFlow
Through the SCFlow framework, multi-level features were extracted and probability density estimation was carried out, which solved the problems of insufficient feature expression and low information fusion in unsupervised anomaly detection, and efficient abnormal detection and positioning of industrial parts were achieved, improving the accuracy and adaptability of detection.
Patent Information
- Application Number
- CN202411710985.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-11-27
AI Technical Summary
When dealing with industrial parts, the existing unsupervised abnormality detection methods have problems such as insufficient sensitivity to small image changes, insufficient feature expression capabilities and low information fusion efficiency, resulting in insufficient accuracy and reliability of abnormality detection.
Using the industrial parts anomaly detection method based on SCFlow, a multi-scale normalized flow framework is constructed by extracting multi-level features and incremental feature conversion using StepFlow and ConvergeFlow modules to capture the detailed features of the image, integrate local and global features, and perform probability density estimation to identify abnormalities.
It significantly improves the accuracy and accuracy of abnormal detection, can effectively identify and locate abnormal areas, adapt to multiple data sets, and improves the efficiency of industrial monitoring.
Smart Images

Figure CN119599998B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of industrial anomaly detection, and specifically relates to an industrial parts anomaly detection method based on SCFlow. Background Art
[0002] In modern industrial environments, anomaly detection is a key factor in ensuring production efficiency and equipment safety. With the development of intelligence, timely detection and processing of potential anomalies can reduce maintenance costs. Figure 1 As shown, anomalies include texture anomalies and functional anomalies. Texture anomalies can be detected through image processing, while functional anomalies require high-level semantic information. Supervised learning relies on large amounts of labeled data, which is not only time-consuming and labor-intensive, but also lacks accuracy. Unsupervised methods only require images of normal samples for training, leading to the continued development of research on unsupervised anomaly detection.
[0003] Current unsupervised anomaly detection methods are primarily categorized as image reconstruction-based and representation-based. Reconstruction-based methods are trained solely on normal images, enabling them to reconstruct normal images effectively. However, during the testing phase, they produce large reconstruction errors in defective areas of the image, thereby identifying anomalous samples. However, while reconstruction-based methods effectively capture normal image features, they are less sensitive to reconstruction errors when processing anomalous samples, leading to misjudgments and thus compromising the accuracy and reliability of anomaly detection.
[0004] Representation-based methods extract feature vectors through pre-trained models and perform anomaly detection by calculating the distance of data distribution. In recent years, normalized flows have gradually been applied to industrial anomaly detection. However, the first normalized flow introduced for anomaly detection compresses the two-dimensional image into one dimension by flipping and scaling the image before inputting it into the feature extractor for anomaly detection, resulting in the loss of position information, which may affect the accuracy of detection. Subsequent methods extend the original normalized flow to two-dimensional space, which can maintain the relative position in space to improve the performance of anomaly detection. However, some anomalies may be small, and using a single-scale input image for direct feature extraction cannot fully utilize the image information. In addition, current methods mainly focus on local features and ignore the relationship between local features and global features. Summary of the Invention
[0005] In response to the above technical problems, the present invention provides an industrial parts anomaly detection method based on SCFlow, which aims to effectively improve the performance of unsupervised anomaly detection. By extracting multi-level features and performing incremental feature conversion layer by layer, it solves the problems of existing methods such as insufficient sensitivity to slight changes in images, insufficient feature expression capabilities, and low information fusion efficiency, and achieves accurate identification and positioning of anomalies.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0007] An industrial parts anomaly detection method based on SCFlow includes the following steps:
[0008] S1: Prepare the dataset: Obtain the image dataset required for the unsupervised anomaly detection task. The images usually contain different types of industrial objects, some of which contain anomalies, while others are defect-free. Since unsupervised detection does not rely on defect labels, the training set usually only uses defect-free images.
[0009] S2: Model construction: Normal sample images are taken as input, and multi-scale features are extracted through the pre-trained feature extractor; the SCFlow module receives these multi-scale feature maps and performs probability density estimation;
[0010] S3: Unsupervised anomaly detection: After the model is built and trained, it is used to perform unsupervised anomaly detection and localization on the test set; the effectiveness of the model is verified by evaluating the detection performance indicators.
[0011] The dataset in S1 is selected from MVTec AD and BTAD.
[0012] The method for extracting multi-scale features in S2 is: using a feature extractor to extract multi-level features and constructing a multi-scale normalized flow SCFlow framework. SCFlow includes two key modules: StepFlow and ConvergeFlow.
[0013] The feature extractor uses a pre-trained Wide ResNet50 to extract features from a single-scale input image and generate a multi-scale feature map.
[0014] The StepFlow module in S2 encodes the input multi-scale feature map through a layer-by-layer incremental flow module to construct a stepped network architecture; the bottom-level flow module captures the detailed features of the image; the middle-level flow module extracts details and local features through a dual-branch structure to retain important information; the deep-level flow module integrates multi-level information through global attention to extract high-level semantic features.
[0015] The underlying flow module of the StepFlow module in S2 uses 3×3 convolution, layer normalization and ReLU activation function, and then applies a second 3×3 convolution layer to capture the detailed features of the image.
[0016] The middle-level flow module of the StepFlow module in S2 consists of two branch structures. The first branch structure is the same as the bottom-level flow module, and the second branch is a multi-branch depth-separable convolution module. This module is divided into the following branches. First, 1×1 convolution is used to extract channel-by-channel features. Then, 3×3 and 5×5 convolutions are used to further extract multi-scale features, and maximum pooling operations are used to retain important information of the image. By splicing the outputs of multiple branches, a feature representation with rich information is generated.
[0017] The top-level laminar flow module of the StepFlow module in S2 consists of three branch structures. The first two branch structures are the same as those of the middle-level flow module. The third branch adds global attention. The third branch combines the first two branches to extract features and integrate multi-level information.
[0018] The method for outputting the feature map in S2 is as follows: the ConvergeFlow module integrates the potential feature maps from StepFlow through multi-scale convolution operations; the input multi-layer feature maps are resized to the same scale size, and the fused feature map is added to the input feature map using residual connection, and finally the fused feature map is output.
[0019] The method for using the model to perform unsupervised anomaly detection and positioning on the test set in S3 is: using the model to estimate the probability density of the test set, and if the feature probability density of the abnormal image is significantly lower than that of the normal image, the image is determined to be abnormal.
[0020] Compared with the prior art, the present invention has the following beneficial effects:
[0021] This paper proposes a method for detecting anomalies in industrial parts based on SCFlow. By extracting multi-scale features, the model fully utilizes image information. Using SCFlow for probability density estimation significantly improves the accuracy of anomaly detection. The model also exhibits good adaptability and performs well across multiple datasets. Through the evaluation of detection performance indicators, this paper not only improves the accuracy of locating anomaly areas but also has important application value in fields such as industrial monitoring, accelerating the anomaly detection process and providing effective support for practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] 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 the embodiments or the description of the prior art. Obviously, the drawings described below are merely exemplary, and those skilled in the art can, without inventive effort, derive other implementation drawings based on the provided drawings.
[0023] The structures, proportions, sizes, etc. illustrated in this specification are intended solely to complement the contents disclosed herein and to facilitate understanding and reading by persons skilled in the art. They are not intended to limit the conditions under which the present invention may be implemented and therefore have no substantive technical significance. Any structural modifications, changes in proportions, or adjustments in sizes, without affecting the efficacy and objectives of the present invention, shall remain within the scope of the technical contents disclosed herein.
[0024] Figure 1 Schematic diagram of the process of an industrial parts anomaly detection method based on SCFlow of the present invention;
[0025] Figure 2 It is a network structure diagram of the present invention;
[0026] Figure 3 They are respectively the network structure diagrams of the underlying flow module of StepFlow in the present invention;
[0027] Figure 4 This is the network structure diagram of the middle-level flow module of StepFlow in the present invention;
[0028] Figure 5 This is the network structure diagram of the top-level flow module of StepFlow in the present invention;
[0029] Figure 6 This is the network structure diagram of ConvergeFlow in the present invention;
[0030] Figure 7 This is a diagram showing the abnormality detection results of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only part of the embodiments of this application, not all the embodiments. These descriptions are only to further illustrate the features and advantages of the present invention, rather than to limit the claims of the present invention. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0032] The following embodiments of the present invention are described in further detail with reference to the accompanying drawings and examples. The following embodiments are used to illustrate the present invention but are not intended to limit the scope of the present invention.
[0033] An industrial parts anomaly detection method based on SCFlow in an embodiment of the present invention is as follows: Figure 1 As shown, the following steps are included:
[0034] Step 1: Prepare the dataset: Obtain the image dataset required for the unsupervised anomaly detection task. The images typically contain different types of industrial objects, some of which contain anomalies (such as cracks, stains, or deformations), while others are defect-free. Since unsupervised detection does not rely on defect labels, the training set typically uses only defect-free images.
[0035] Step 2: Build the model: Normal sample images are taken as input, multi-scale features are extracted through the pre-trained feature extractor, and SCFlow receives these multi-scale feature maps and performs probability density estimation.
[0036] Step 3: Unsupervised Anomaly Detection: After building and training the model, use it to perform unsupervised anomaly detection and localization on the test set. Detection performance metrics are evaluated to verify the effectiveness of the model.
[0037] Furthermore, in step 1, the dataset is selected from MVTec AD and BTAD.
[0038] Further, in step 2, if Figure 2 As shown in the figure, a feature extractor is used to extract multi-level features and construct a multi-scale normalized flow (SCFlow) framework. SCFlow mainly includes two key modules: StepFlow and ConvergeFlow. Step 2 includes the following steps 2-1, 2-2 and 2-3:
[0039] Step 2-1: Feature extraction module: Use the pre-trained Wide ResNet50 as the feature extractor to extract features from the single-scale input image and generate a multi-scale feature map.
[0040] Step 2-2: StepFlow Module: StepFlow encodes the input multi-scale feature maps through a layer-by-layer flow module, building a ladder-like network architecture. The bottom-level flow module captures detailed image features. The middle-level flow module uses a dual-branch structure to extract details and local features, preserving important information. The deep-level flow module integrates multi-level information through global attention to extract high-level semantic features.
[0041] Furthermore, in step 2-2, if Figure 3 As shown in Figure 1, the underlying flow module of StepFlow uses 3×3 convolution, layer normalization and ReLU activation function, and then applies a second 3×3 convolution layer to capture the detailed features of the image.
[0042] Furthermore, in step 2-2, if Figure 4As shown in Figure 1, the mid-level flow module of StepFlow consists of two branches. The first branch is identical to the bottom-level flow module, while the second branch is a multi-branch depthwise separable convolutional module. This module is divided into the following branches: 1×1 convolution is used to extract channel-by-channel features. 3×3 and 5×5 convolutions are then used to further extract multi-scale features. Max pooling is then applied to preserve important image information. By concatenating the outputs of multiple branches, a feature representation rich in information is generated.
[0043] Furthermore, in step 2-2, if Figure 5 As shown in the figure, the deep flow module of StepFlow consists of three branch structures. The first two branch structures are the same as the middle flow module, and the third branch adds global attention. The third branch combines the first two branches to extract features and integrate multi-level information.
[0044] Step 2-3: ConvergeFlow module: Figure 6 As shown in Figure 1, ConvergeFlow integrates the latent feature maps from StepFlow through multi-scale convolution operations. The input multi-layer feature maps are resized to the same scale, and the fused feature maps are added to the input feature maps using residual connections. The fused feature maps are finally output.
[0045] Furthermore, in step 3, the model is used to estimate the probability density of the test set. The feature probability density of the abnormal image is significantly lower than that of the normal image, and the image is determined to be abnormal.
[0046] Furthermore, the prediction method of the present invention uses the area under the receiver operating characteristic curve (AUROC) as the main evaluation indicator.
[0047] Furthermore, the method of the present invention was implemented using PyTorch and trained using the Adam optimizer. After multiple experiments to adjust the parameters, the present invention set the learning rate to 1e-4, the batch size to 8, and ran each experiment for 25 cycles.
[0048] The present invention proposes an industrial parts anomaly detection method based on SCFlow, such as Figure 7 As shown in the figure, the AUROC values on two commonly used public data sets reach 0.998 and 0.978 respectively, which proves that the industrial parts anomaly detection method based on SCFlow proposed in the present invention has good anomaly detection capability.
[0049] This paper proposes a method for detecting anomalies in industrial parts based on SCFlow. By extracting multi-scale features, the model fully utilizes image information. Using SCFlow for probability density estimation significantly improves the accuracy of anomaly detection. Furthermore, the model exhibits excellent adaptability and performs well across multiple datasets. Through the evaluation of detection performance indicators, this paper not only improves the accuracy of locating anomaly areas but also has significant application value in fields such as industrial monitoring, accelerating the anomaly detection process and providing effective support for practical applications.
[0050] The above only describes in detail the preferred embodiments of the present invention, but the present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in this field without departing from the purpose of the present invention, and various changes should be included in the scope of protection of the present invention.
Claims
1. A method for detecting abnormalities in industrial parts based on SCFlow, characterized in that: The following steps are involved: S1: Prepare the dataset: Obtain the image dataset required for the unsupervised anomaly detection task. The images contain different types of industrial objects, some of which contain anomalies, while others are defect-free. Since unsupervised detection does not rely on defect labels, the training set only uses defect-free images. S2: Model construction: A normal sample image is used as input, and multi-scale features are extracted through a pre-trained feature extractor; the SCFlow module receives these multi-scale feature maps and performs probability density estimation; the method for extracting multi-scale features in S2 is as follows: using the feature extractor to extract multi-level features and constructing a multi-scale normalized flow SCFlow framework. SCFlow includes two key modules: StepFlow and ConvergeFlow; the feature extractor uses a pre-trained Wide ResNet50 to extract features from a single-scale input image and generate a multi-scale feature map; the underlying flow module of the StepFlow module in S2 uses 3×3 convolution, layer normalization, and ReLU activation function, and then applies a second 3×3 convolution layer to capture the detailed features of the image; The middle-layer flow module of the StepFlow module in the S2 is composed of two branch structures, the first branch structure is the same as the bottom-layer flow module, and the second branch is a multi-branch depth-separable convolution module; the module is divided into the following branches, the first branch uses 1×1 convolution to extract channel-by-channel features; the second branch is 3×3 convolution, and the third branch is 5×5 convolution to further extract multi-scale features; the fourth branch uses the maximum pooling operation to retain important information of the image; by splicing the outputs of multiple branches, a feature representation with rich information is generated; the top-layer flow module of the StepFlow module in the S2 is composed of three branch structures, the first two branch structures are the same as the middle-layer flow module, and the third branch adds global attention. The third branch extracts features by combining the first two branches and integrates multi-level information; S3: Unsupervised anomaly detection: After the model is built and trained, it is used to perform unsupervised anomaly detection and localization on the test set; the effectiveness of the model is verified by evaluating the detection performance indicators.
2. The method for detecting anomalies of industrial parts based on SCFlow according to claim 1, characterized in that: The dataset in S1 is selected from MVTec AD and BTAD.
3. The method for detecting abnormality of industrial parts based on SCFlow according to claim 1, characterized in that: The StepFlow module in S2 encodes the input multi-scale feature map through a layer-by-layer incremental flow module to build a ladder network architecture; the bottom flow module captures the detailed features of the image; The middle-level stream module extracts details and local features through a dual-branch structure and retains important information; the deep-level stream module integrates multi-level information through global attention and extracts high-level semantic features.
4. The method for detecting anomalies of industrial parts based on SCFlow according to claim 1, characterized in that: The method for outputting the feature map in S2 is as follows: the ConvergeFlow module integrates the potential feature maps from StepFlow through multi-scale convolution operations; the input multi-layer feature maps are resized to the same scale size, and the fused feature map is added to the input feature map using residual connection, and finally the fused feature map is output.
5. The method for detecting abnormality of industrial parts based on SCFlow according to claim 1, characterized in that: The method for using the model to perform unsupervised anomaly detection and positioning on the test set in S3 is: using the model to estimate the probability density of the test set, and if the feature probability density of the abnormal image is significantly lower than that of the normal image, the image is determined to be abnormal.
Citation Information
Patent Citations
Unsupervised anomaly positioning and detection method and device based on multi-scale standardized flow
CN115205650A