A Meta-Gated Anomaly Detection Method Based on Matrix Attention Segmentation and Multi-Branch Decomposition Convolution
By constructing a teacher-student network structure, introducing matrix attention segmentation and multi-branch decomposition convolution, and combining it with an alignment-aware meta-optimizer, the problems of non-global feature extraction and missing information in existing technologies are solved, achieving efficient anomaly detection results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI UNIVERSITY OF TECHNOLOGY
- Filing Date
- 2026-03-13
- Publication Date
- 2026-05-26
AI Technical Summary
Existing unsupervised anomaly detection methods cannot capture image information globally during feature extraction, resulting in low feature extraction accuracy and easy information loss, which affects the anomaly detection effect.
A meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution is adopted. A teacher-student network structure is constructed, and a segmentation network based on rectangular attention and a channel parallel convolution decomposition network are introduced. The model is trained by combining an alignment-aware meta-optimizer to improve the accuracy and stability of feature extraction.
It significantly improves the accuracy and comprehensiveness of feature extraction, prevents information loss, enhances the model's adaptability and generalization ability in data-scarce environments, and improves the accuracy of anomaly detection and training convergence speed.
Smart Images

Figure CN122090164A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of anomaly detection technology, and more specifically, relates to a meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution. Background Technology
[0002] In the field of industrial automation quality inspection, anomaly detection technology is key to improving product quality control capabilities. Industrial vision anomaly detection mainly targets the identification and location of defects on the surface or inside of products. Its goal is to determine whether a sample or pixel is normal or not from an image, thereby achieving efficient and accurate quality monitoring.
[0003] However, in real-world industrial scenarios, production lines often have high yield rates and scarce anomaly samples, making the acquisition of large-scale, high-quality training data both costly and extremely difficult. This data scarcity severely limits the effectiveness of traditional data-driven detection methods. To address this challenge, current research has increasingly focused on unsupervised learning anomaly detection techniques. By fully leveraging information from limited normal samples through unsupervised learning anomaly detection techniques, robust detection models can be constructed, achieving effective anomaly identification without relying on large amounts of labeled data. These techniques not only reduce dependence on data scale but also enhance the model's adaptability and generalization ability in data-scarce environments, providing a new solution for the practical implementation of industrial quality inspection.
[0004] Currently, existing research uses student-teacher network frameworks for unsupervised anomaly detection, determining the anomaly detection score by comparing the outputs of the student and teacher networks for anomalies. However, these methods often fail to capture global image information during feature extraction, reducing accuracy or causing information loss, thus affecting anomaly detection results. Summary of the Invention
[0005] This invention aims to provide a meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution. It adopts a teacher-student network structure detection model for anomaly detection, and introduces a segmentation network based on rectangular attention and a channel parallel convolution decomposition module into the student network. This can effectively improve the accuracy of feature extraction and prevent information loss, thus improving the accuracy of anomaly detection.
[0006] Furthermore, this invention introduces an alignment-aware meta-optimization mechanism during model training, which can effectively accelerate the convergence speed of model training and improve the stability of model training.
[0007] To achieve the above objectives, the technical solution provided by the present invention is as follows: The first aspect of this invention provides a meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution, comprising: S1. Construct the sample dataset; The sample dataset is taken from samples of various typical categories of items in industrial production. It includes a training set and a test set. The training set for each category contains only normal image samples, while the test set contains both normal image samples and various abnormal image samples. S2. Construct a network structure detection model for teachers and students; The teacher-student network structure detection model adopts a three-level network structure consisting of an expert network, a teacher network, and a student network. The student network includes a segmentation network based on rectangular attention, a first pointwise convolutional layer, a channel parallel convolution decomposition network, a 3×3 convolutional layer, and a second pointwise convolutional layer, which are connected in series. S3. Train and optimize the constructed teacher-student network structure detection model to obtain the optimized detection model; S4. Use the trained and optimized detection model to perform anomaly detection and localization on the image to be detected, and output the detection results.
[0008] According to any of the technical solutions described in the first aspect of the present invention, the processing procedure of the segmentation network based on rectangular attention includes: Input features of the student network respectively x Perform horizontal and vertical pooling operations to generate a horizontal vector. and vertical direction vector To capture global context information; Additive fusion of bidirectional feature vectors , Construct a rectangular attention region to obtain the vector after addition and fusion. : ; Shape calibration is performed on the rectangular attention region to better fit the foreground target contour. The calibrated features are then normalized and activated to obtain the calibrated attention features. ; calibrated attention features Input features x Perform deep fusion to obtain the deep fusion features. ; Features after deep fusion Batch Normalization (BN) and Multiprocessing (MLP) are performed sequentially, and finally the input features are compared again. x Additive fusion is performed to obtain the final output features after optimization processing by a segmentation network based on rectangular attention.
[0009] Furthermore, the shape calibration of the rectangular attention region specifically involves performing shape calibration on the rectangular attention region based on a large kernel strip convolution module, that is, calibrating the shape of the vector after addition and fusion. First, adjust the row direction shape using horizontal strip convolution, and then apply vertical strip convolution to adjust the column direction shape.
[0010] Furthermore, the calibrated attention features Input features x Deep fusion includes: using deep learning to extract input features x The local details are then processed using Hadamard product-weighted attention features, specifically as follows: ; in, represents depthwise convolution, and e represents the Hadamard product.
[0011] According to any of the technical solutions described in the first aspect of the present invention, the processing procedure of the channel parallel convolution decomposition network includes: Will x The input channel parallel convolutional decomposition network is decomposed into four branches along the channel dimension, as follows:
[0012] Where Split represents the input image features of the channel-parallel convolution decomposition network. x 1. Divide evenly along 4 channels. x hw Features representing horizontal and vertical directions x h Characteristics representing horizontal branches, x w The characteristics representing vertical branches, and x indep The characteristics representing identity mappings; Subsequently, the features of each decomposed branch were analyzed. x g Simultaneously, perform appropriate depthwise convolution processing. x hw Used for small square kernel convolution x h Used for horizontal strip convolution x w Used for vertical strip convolution, while x indep No operation is performed for the identity mapping, which is represented by the following formula: ; Where DWConv represents depthwise convolution, and , , , These represent the features after the convolution operation; Finally, the features obtained after depthwise convolution are... , , , By concatenating the features along the channel dimension, we obtain the output features of the channel-parallel convolution decomposition network. As shown in the following formula: , where Concat represents the concatenation operation.
[0013] According to any of the technical solutions described in the first aspect of the present invention, when training the constructed teacher-student network structure detection model, the teacher network is optimized using the Adam optimizer, and the student network is optimized using the alignment-aware optimizer.
[0014] According to any of the technical solutions described in the first aspect of the present invention, the input of the student network first enters a segmentation network based on rectangular attention for processing, then undergoes a first pointwise convolution, normalization and activation process, and then enters a channel parallel convolution decomposition network for processing.
[0015] According to any of the technical solutions described in the first aspect of the present invention, in the student network, the output features of the channel parallel convolution decomposition network are sequentially subjected to 3×3 convolution, normalization and activation processing, and then subjected to a second pointwise convolution processing and normalization processing. The normalized features are then added and fused with the input of the student network to obtain the output of the student network.
[0016] According to any of the technical solutions described in the first aspect of the present invention, when using the trained and optimized detection model to perform anomaly detection on the image to be detected, a pixel-level anomaly map is generated by calculating the difference between the output features of the teacher network and the reconstructed features of the student network; each pixel value in the anomaly map represents the probability or score that the position is an anomaly, and the higher the value, the greater the probability of an anomaly.
[0017] A second aspect of the present invention also provides a meta-gated anomaly detection system based on matrix attention segmentation and multi-branch decomposition convolution, comprising: The sample dataset construction module is used to build sample datasets, including training sets and test sets. The training set for each category contains only normal image samples, while the test set contains both normal image samples and various abnormal image samples. The module for constructing a teacher-student network structure detection model is used to construct a teacher-student network structure detection model. The teacher-student network structure detection model adopts a three-level network structure consisting of an expert network, a teacher network, and a student network. The student network includes a segmentation network based on rectangular attention, a first pointwise convolutional layer, a channel parallel convolution decomposition network, a 3×3 convolutional layer, and a second pointwise convolutional layer, which are connected in series. The model training module is used to train and optimize the constructed teacher-student network structure detection model to obtain the optimized detection model. The detection module is used to perform anomaly detection and localization on the image to be detected based on the trained and optimized detection model, and output the detection results.
[0018] Compared with the prior art, the technical solution provided by this invention has the following advantages: (1) This invention uses an expert-teacher-student three-level network for anomaly detection, and introduces a segmentation network based on rectangular attention and a channel parallel convolution decomposition network into the student network. This can solve the problems of low accuracy of feature extraction and easy information loss in the existing student network, greatly improve the accuracy and comprehensiveness of feature extraction, and help ensure the accuracy of anomaly detection.
[0019] (2) In the process of training the model, this invention introduces an alignment perceptron optimizer to replace the traditional Adam optimizer for optimizing and controlling the student network, based on the existing Adam optimizer. That is, the Adam optimizer and the alignment perceptron optimizer are used to train and optimize the teacher network and the student network respectively, thereby solving the problem of using the Adam optimizer in the existing technology, accelerating the convergence speed of model training, and improving the stability of training. Attached Figure Description
[0020] Figure 1 This is a flowchart of a meta-gated anomaly detection based on matrix attention segmentation and multi-branch decomposition convolution according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the teacher-student network structure detection model according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the student network structure according to an embodiment of the present invention; Figure 4 This is a flowchart of the segmentation network based on rectangular attention in an embodiment of the present invention; Figure 5 This is a flowchart of the processing of the channel parallel convolution decomposition network in an embodiment of the present invention; Figure 6 The figure shows the experimental results of the MVTec-AD optimization rate η in the example; Figure 7The figure shows the experimental results of the MPDD optimization rate η in the example. Detailed Implementation
[0021] To further understand the present invention, specific embodiments are now described in detail. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of this disclosure.
[0022] The terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined, and these terms are merely for describing particular embodiments and are not intended to limit this disclosure. For example, terms such as “comprising” or “including” indicate the presence of the said features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0023] Combination Figure 1 As shown, this invention provides a meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution, employing a teacher-student network structure detection model for anomaly detection, specifically including the following steps: S1. Construct a sample dataset, which includes a training set and a test set; The sample data comes from real industrial objects and textures. In this embodiment of the invention, the data was obtained by capturing images under various lighting conditions using a high-resolution industrial camera in a top-tier industrial vision laboratory environment. To further simulate a real industrial environment, it is preferable to use different camera angles and distances.
[0024] This dataset collects samples of typical categories of items in industrial production. Unlike conventional classification datasets, this dataset is designed structurally for unsupervised anomaly detection tasks: the training set for each category contains only normal image samples, while the test set contains both normal image samples and various types of anomaly image samples. The test set provides accurate segmentation image masks for each anomaly by manually simulating real defects (such as scratches, contamination, assembly errors, etc.) and supplementing them with costly manual pixel-level annotations. This is used to evaluate the model's detection and generalization capabilities under unsupervised settings.
[0025] S2. Construct a network structure detection model for teachers and students and train and optimize the model to obtain the optimized detection model; Combination Figure 2As shown, the teacher-student network structure detection model adopts a three-level expert-teacher-student network structure consisting of an expert network, a teacher network, and a student network. Specifically, this invention adopts an improved expert-teacher-student three-level network structure, that is, based on the existing expert-teacher-student three-level network structure (for example, it can be constructed using the method in an academic paper entitled "Unlocking the Potential of Reverse Distillation for Anomaly Detection" presented at the 2025 international top academic conference AAAI), the student network is further improved by introducing a segmentation network based on rectangular attention and a channel-parallel convolution decomposition network into the student network.
[0026] The expert network structure is identical to the teacher network structure, but the expert network only accepts normal images as input, its parameters are frozen, and it does not participate in the training process. That is, the expert network is only responsible for processing normal training images, and its output features are treated as normal feature representations, and are processed through its loss function. LOSS ET This addresses issues such as insufficient network awareness among teachers and ineffective noise reduction for students' networks.
[0027] The teacher network is a trainable network whose input includes a normal image, a corresponding synthesized anomalous image generated by performing an anomalous synthesis operation on the normal image, and a binary mask of the anomalous region (i.e., ground truth). Therefore, the teacher network is trained such that its output features are similar to those of the expert network in normal regions, and significantly deviate from those of the expert network in anomalous regions. In some embodiments, the synthesized anomalous image input to the teacher network is generated by performing a Berlin anomalous synthesis operation, and the binary mask of the anomalous region is automatically generated simultaneously with the synthesis of the anomalous image.
[0028] The student network is essentially a decoder, responsible for reconstructing the multi-scale features output by the teacher network, and applying the loss function of the student network. LOSS ES loss function of teacher network LOSS TS This ensures that no abnormal features are generated regardless of whether the input features are normal or abnormal, and the anomaly detection result is obtained by comparing the output of the student network with that of the teacher network. Therefore, the student network is crucial. Existing student networks typically use the ResNet structure to perform feature extraction operations on the input image. However, even within the ResNet structure, pointwise convolution and conventional convolution are still used, which reduces the accuracy of feature extraction and easily leads to information loss.
[0029] Based on the above, this application incorporates a rectangular attention-based segmentation network and a channel-parallel convolution decomposition network into the existing ResNet network, thereby effectively improving the accuracy and comprehensiveness of feature extraction and preventing information loss. Specifically, combined with... Figure 3 As shown, the student network includes a first pointwise convolutional layer, a 3×3 convolutional layer, and a second pointwise convolutional layer connected in series. A segmentation network based on rectangular attention is added to the input of the ResNet network, i.e., the input of the first pointwise convolutional layer, and a channel-parallel convolution decomposition network is added to the input of the 3×3 convolutional layer.
[0030] Furthermore, combining Figure 4 As shown, the segmentation network based on rectangular attention includes a pooling layer, a bidirectional feature fusion layer, a feature calibration layer, a deep feature fusion layer, a BN layer, and an MLP layer.
[0031] Specifically, the pooling layer includes a horizontal pooling layer and a vertical pooling layer. The horizontal pooling layer and the vertical pooling layer perform pooling operations on the input features in the horizontal and vertical directions, respectively, to generate a horizontal vector. and vertical direction vector Capture global context information: ; ; in Represents horizontal pooling. Represents vertical pooling; used to capture global context information.
[0032] The bidirectional feature fusion layer is used to fuse bidirectional feature vectors through broadcast addition. , Construct a rectangular attention region to enhance spatial localization capabilities: ; The feature calibration layer includes a large kernel strip convolution module and a normalization and activation module. The large kernel strip convolution module is used to perform shape calibration on the rectangular attention region. Specifically, it performs shape calibration on the summed and fused vectors. First, horizontal strip convolution is used to adjust the shape of the rows, and then vertical strip convolution is applied to adjust the shape of the columns, making them fit the outline of the foreground target better and improving feature alignment capability. The normalization and activation module is used to normalize and activate the features after shape calibration to obtain calibrated attention features. : ; in, This represents horizontal and vertical strip convolution, where k represents the strip convolution kernel size. Represents the normalization of the ReLU activation function. This represents the Sigmoid function.
[0033] The deep feature fusion layer is used to further integrate the calibrated attention features. Input features x The fusion process involves using deep learning to extract input features. x Local details are extracted, and Hadamard product-weighted attention features are used to obtain deeply fused features. .
[0034] Features after deep fusion Batch Normalization (BN) and Multiprocessing Library (MLP) are performed sequentially, and finally the input features are compared. x Performing additive fusion yields the final output features after optimization by a segmentation network based on rectangular attention. : ; ; in, Represents depthwise convolution, and 'e' represents the Hadamard product. Represents the BN process. This represents the MLP process.
[0035] Furthermore, the final output features after optimization by a segmentation network based on rectangular attention... After sequential pointwise convolution, normalization, and activation processing, the following is obtained: x 1. Then it enters the channel parallel convolution decomposition network for processing.
[0036] Combination Figure 5 As shown, the channel-parallel convolution decomposition network includes a feature decomposition module, a depthwise convolution module, and a concatenation module. Its processing specifically includes: Will x 1. The input is fed into the feature decomposition module and decomposed into four branches along the channel dimension: square convolution, horizontal strip convolution, vertical strip convolution, and identity mapping branch.
[0037] Where Split represents the input image features x 1. Divide evenly along 4 channels. x hw Features representing horizontal and vertical directions x h Characteristics representing horizontal branches, x w The characteristics representing vertical branches, and x indepThe characteristics representing identity mappings.
[0038] Then, the depthwise convolution module is used to process each decomposed group x g Simultaneously, perform the corresponding convolution processing. x hw Features used for small square kernel convolution branches x h Features used for horizontal convolutional branches with kernels x w Features used for vertical convolutional branches with kernels, and x indep No operation is performed. The above process is represented by the following formula: ; Where DWConv represents depthwise convolution, and , , , These represent the features after the convolution operation.
[0039] Finally, the features obtained after depthwise convolution are combined using the concatenation module. , , , The features are concatenated along the channel dimension to form the final output features. As shown in the following formula: , where Concat represents the concatenation operation.
[0040] The above operations can also effectively expand the spatial receptive field and improve the accuracy of the model.
[0041] In the original model training process, both the teacher network and the student network used the traditional Adam optimizer. Although the Adam optimizer is widely used as a standard choice in deep learning, it has inherent limitations: the inertia effect introduced by its momentum mechanism causes the update direction to be inconsistent with the gradient direction, thereby causing a temporary increase in the loss function and oscillations and overshoots during the convergence process. This not only slows down the convergence speed, but also makes the training stability highly dependent on fine hyperparameter tuning, and cannot guarantee the monotonic decrease of the loss function.
[0042] Therefore, this application further preferably introduces a nonlinear mapping based on the local consistency of the gradient vector field and the update vector field to correct the dynamic system of the original optimizer, thereby ensuring that the iterative process has a more stable descent characteristic in the loss function landscape. That is, in the teacher network, this application still retains the use of the Adam optimizer for optimization. The adaptive learning rate and momentum mechanism of the Adam optimizer can quickly respond to gradient changes, which is crucial for quickly establishing sensitivity to abnormal patterns in the early stage of training and can better help the teacher network separate normal and abnormal features. However, in the student network, this application preferably adopts the alignment-aware optimizer. By using the mechanism in this optimizer, those "noise" interferences can be effectively filtered out, making the differences between the reconstruction results clearer and more significant.
[0043] To compare with existing technologies, this paper conducts experiments on the optimization rate η in the alignment-aware optimizer and obtains the corresponding results, as follows: Figure 6 , Figure 7 As shown. Combined with Figure 6 , Figure 7 It can be seen that the best results are achieved when the optimization rate η is 0.005.
[0044] First, consider this optimization algorithm process as a Hamiltonian system, whose continuous-time dynamics formula is: ; ; in, For model parameter vectors, It is the internal state vector of the optimizer. It is a loss function. Represents the kinetic energy function. Represents gradient, Represents element-wise product. and Represents a dissipative mapping. This represents the direction alignment signal. Represents the meta-control function.
[0045] The meta-control function is key to the optimizer; it receives the orientation alignment signal. As input and outputting a modulation factor, the process is as follows: ; ; in I It is an indicator function, specifically referring to the unit step function. It is an adaptive scaling factor. Representative vector Dimensions nnz Representative vector The number of elements greater than 0 in the set. γ It represents a very small positive number.
[0046] The first step in using the formula above is to calculate the adaptive scaling factor. It determines how many times the learning rate needs to be amplified to compensate for the loss based on the proportion of the effective updated dimensions. Then, it generates the final modulation vector. It combines the two steps of "direction filtering" and "amplitude compensation" into one for advanced optimization.
[0047] When the model is trained and tested, if the input is an abnormal image, the teacher network will generate abnormal features, while the student network will attempt to reconstruct these abnormal features into normal features. The difference between the two is used to calculate the result of the anomaly detection.
[0048] S3. Input the image of the sample to be detected into the trained and optimized detection model, and then output the detection result.
[0049] A pixel-level anomaly map is generated by calculating the difference between the teacher network output features and the student network reconstructed features. Each pixel value in the anomaly map represents the probability or score that the location is an anomaly, with higher values indicating a greater likelihood of an anomaly.
[0050] Anomaly detection results can be evaluated using the area under the ROC curve (AUC) and average precision (AP); while for anomaly localization, the evaluation metrics are AUROC, AP, and per-region-overlap (PRO). Specifically, the anomaly map, after smoothing, is compared with an anomaly image mask to evaluate detection accuracy. Using the anomaly scores and detection accuracy, image-level AUROC, AP, pixel-level AUROC, and pixel-level PRO are calculated; the higher the percentage of each metric, the better the detection performance.
[0051] Image-level AUROC is a core metric for evaluating a model's ability to correctly distinguish between normal and abnormal images at the overall image level. In image anomaly detection tasks, the model's goal is to determine whether a complete image is normal or contains anomalies. Image-level AUROC constructs an ROC curve by calculating the True Positive Rate (TPR) and False Positive Rate (FPR) at the image level, and then calculates the area under the curve. TPR represents the proportion of correctly identified anomalous images out of all actual anomalous images, while FPR represents the proportion of normal images incorrectly identified as anomalous. A higher image-level AUROC value (closer to 1) indicates better classification performance at the image level.
[0052] AP measures the accuracy of a model in the task of "identifying anomalous images" and is a core metric for evaluating the model's classification performance on the positive class (anomalies). It is highly sensitive to class imbalance. Its core lies in plotting the precision-recall curve (PR curve): by using a sliding decision threshold, the model outputs a set of images "judged as anomalous." Precision measures the purity of this set, while recall measures the coverage of all anomalous images. AP is the area under this PR curve, and its calculation, after discretization, is often expressed as a weighted average of precision at different recall levels. The closer the AP value is to 1, the better the model can maintain high precision (i.e., reliable alarm) while achieving high recall (i.e., low false negative rate), making it a key measure of the model's ability to "accurately capture" anomalies.
[0053] Pixel-level AUROC is used to evaluate a model's ability to identify anomalous regions in an image at the pixel level, which is typically associated with anomaly localization or image segmentation tasks. Unlike image-level AUROC, pixel-level AUROC focuses on the classification accuracy of each pixel in the image, i.e., determining whether each pixel belongs to a normal or anomalous region. When calculating pixel-level AUROC, the model generates an anomalous score for each pixel and then constructs an ROC curve based on these scores and the pixel-level ground truth labels (usually an image mask of the anomalous region). Similar to image-level AUROC, the closer the pixel-level AUROC value is to 1, the better the model's localization performance.
[0054] Pixel-level PRO is currently the most advanced and robust metric for evaluating the quality of anomaly region localization. Its core calculation process is as follows: First, each independent real anomaly connected region is identified. Then, at different confidence thresholds, the overlap rate between the binary mask predicted by the model and each real region is calculated. Finally, the average overlap rate of all real regions at different thresholds is integrated. The closer the PRO value is to 1, the more likely the model-generated anomaly heatmap, regardless of its absolute intensity, can produce binary segmentation that highly matches the shape of the real anomaly region at different thresholds.
[0055] Comparison of test results: This paper presents experiments on the MVTec-AD and MPDD datasets. To demonstrate the feasibility and superiority of the proposed method, the detection results are compared with those of some existing anomaly detection methods, including DeSTSeg, HyPAD, RD, RD++, THFR, and MKD.
[0056] For anomaly detection, the results in Table 1 show the image-level AUROC and AP of the MPDD dataset, and the results in Table 2 show the image-level AUROC and AP of the MVTec-AD dataset from left to right.
[0057] As can be seen from Table 1, the method in this application is compared only with the backdistillation method. Notably, it achieves the best results for all categories in the MPDD dataset compared to other methods. Specifically, image-level AUROC is improved by 1.1% compared to URD, while image-level AP is improved by 0.6%. This fully demonstrates the advantages of the proposed method in anomaly detection.
[0058] As shown in Table 2, compared with the DeSTSeg method in forward distillation, the image-level AUROC is improved by 0.9%. Compared with the reverse distillation method, both image-level AUROC and AP accuracy are improved. Specifically, compared with URD, image-level AUROC is improved by 0.6%, and image-level AP by 0.7%.
[0059] Table 1. Image-level anomaly detection results from the MPDD dataset.
[0060] Table 2. Image-level anomaly detection results for the MVTec-AD dataset.
Claims
1. A meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution, characterized in that, include: S1. Construct the sample dataset; The sample dataset is taken from samples of various typical categories of items in industrial production. It includes a training set and a test set. The training set for each category contains only normal image samples, while the test set contains both normal image samples and various abnormal image samples. S2. Construct a network structure detection model for teachers and students; The teacher-student network structure detection model adopts a three-level network structure consisting of an expert network, a teacher network, and a student network. The student network includes a segmentation network based on rectangular attention, a first pointwise convolutional layer, a channel parallel convolution decomposition network, a 3×3 convolutional layer, and a second pointwise convolutional layer, which are connected in series. S3. Train and optimize the constructed teacher-student network structure detection model to obtain the optimized detection model; S4. Use the trained and optimized detection model to perform anomaly detection and localization on the image to be detected, and output the detection results.
2. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to claim 1, characterized in that, The processing steps of the rectangular attention-based segmentation network include: Input features of the student network respectively x Perform horizontal and vertical pooling operations to generate a horizontal vector. and vertical direction vector To capture global context information; Additive fusion of bidirectional feature vectors , Construct a rectangular attention region to obtain the vector after addition and fusion. : ; Shape calibration is performed on the rectangular attention region to better fit the foreground target contour. The calibrated features are then normalized and activated to obtain the calibrated attention features. ; calibrated attention features Input features x Perform deep fusion to obtain the deep fusion features. ; Features after deep fusion Batch Normalization (BN) and Multiprocessing (MLP) are performed sequentially, and finally the input features are compared again. x Additive fusion is performed to obtain the final output features after optimization processing by a segmentation network based on rectangular attention.
3. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to claim 2, characterized in that, The shape calibration of the rectangular attention region specifically involves calibrating the shape of the rectangular attention region based on a large-kernel strip convolution module, that is, calibrating the shape of the vector after addition and fusion. First, adjust the row direction shape using horizontal strip convolution, and then apply vertical strip convolution to adjust the column direction shape.
4. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to claim 2, characterized in that, The calibrated attention features Input features x Deep fusion includes: using deep learning to extract input features x The local details are then processed using Hadamard product-weighted attention features, specifically as follows: ; in, represents depthwise convolution, and e represents the Hadamard product.
5. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to claim 1, characterized in that, The processing steps of the channel-parallel convolution decomposition network include: Will x The input channel parallel convolutional decomposition network is decomposed into four branches along the channel dimension, as follows: Where Split represents the input image features of the channel-parallel convolution decomposition network. x 1. Divide evenly along 4 channels. x hw Features representing horizontal and vertical directions, x h Characteristics representing horizontal branches, x w The characteristics representing vertical branches, and x indep Characteristics representing identity mappings; Subsequently, the features of each decomposed branch were analyzed. x g Simultaneously, perform appropriate depthwise convolution processing. x hw Used for small square kernel convolution x h Used for horizontal strip convolution x w Used for vertical strip convolution, while x indep No operation is performed for the identity mapping, which is represented by the following formula: ; Where DWConv represents depthwise convolution, and , , , These represent the features after the convolution operation; Finally, the features obtained after depthwise convolution are... , , , By concatenating the features along the channel dimension, we obtain the output features of the channel-parallel convolutional decomposition network. As shown in the following formula: , where Concat represents the concatenation operation.
6. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to any one of claims 1-5, characterized in that, When training the constructed teacher-student network structure detection model, the teacher network is optimized using the Adam optimizer, and the student network is optimized using the alignment-aware optimizer.
7. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to any one of claims 1-5, characterized in that, The input to the student network first enters a segmentation network based on rectangular attention for processing, then undergoes a first pointwise convolution, normalization, and activation process, and finally enters a channel-parallel convolution decomposition network for processing.
8. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to any one of claims 1-5, characterized in that, In the student network, the output features of the channel parallel convolution decomposition network are sequentially subjected to 3×3 convolution, normalization, and activation processing, and then subjected to a second pointwise convolution and normalization processing. The normalized features are then added to the input of the student network and fused to obtain the output of the student network.
9. The meta-gated anomaly detection method based on matrix attention segmentation and multi-branch decomposition convolution according to any one of claims 1-5, characterized in that, When using the trained and optimized detection model to detect anomalies in the image to be detected, a pixel-level anomaly map is generated by calculating the difference between the output features of the teacher network and the reconstructed features of the student network. Each pixel value in the anomaly map represents the probability or score that the location is an anomaly, and the higher the value, the greater the probability of an anomaly.
10. A meta-gated anomaly detection system based on matrix attention segmentation and multi-branch decomposition convolution, characterized in that, include: The sample dataset construction module is used to build sample datasets, including training sets and test sets. The training set for each category contains only normal image samples, while the test set contains both normal image samples and various abnormal image samples. The module for constructing a teacher-student network structure detection model is used to construct a teacher-student network structure detection model. The teacher-student network structure detection model adopts a three-level network structure consisting of an expert network, a teacher network, and a student network. The student network includes a segmentation network based on rectangular attention, a first pointwise convolutional layer, a channel parallel convolution decomposition network, a 3×3 convolutional layer, and a second pointwise convolutional layer, which are connected in series. The model training module is used to train and optimize the constructed teacher-student network structure detection model to obtain the optimized detection model. The detection module is used to perform anomaly detection and localization on the image to be detected based on the trained and optimized detection model, and output the detection results.