An interference-robust anomaly detection method based on dynamic whitening regularization
By employing dynamic whitening regularization and directional isotropic regularization, the generalization problem of unsupervised anomaly detection models under distribution shift is solved, improving the robustness and detection accuracy of the models. In particular, it effectively addresses distribution shift caused by changes in lighting and equipment aging in industrial appearance defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING JIAOTONG UNIV
- Filing Date
- 2026-01-30
- Publication Date
- 2026-06-05
AI Technical Summary
Existing unsupervised anomaly detection methods have poor generalization ability and robustness when faced with invisible distributional shifts between test samples and training data. This is especially true in industrial appearance defect detection, where factors such as changes in lighting and equipment aging can cause the model to be unable to effectively distinguish between normal and abnormal, resulting in a high false detection rate.
A dynamic whitening regularization method is adopted. By dynamically dividing the channel and directional isotropic regularization, the isotropy of the feature map is forced. The learnable bottleneck head and decoder reconstruction are used, combined with multi-scale alignment loss, to selectively punish the correlation of unstable channels and form a robust normal feature space.
It significantly improves the model's generalization ability when faced with invisible distribution shifts, reduces the false alarm rate, maintains detection performance under the standard distribution, avoids dependence on target domain data, and enhances the model's robustness against interference.
Smart Images

Figure CN122156068A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial appearance defect detection technology, specifically to an interference-robust anomaly detection method and system based on dynamic whitening regularization. Background Technology
[0002] The core objective of Active Directory (AD) is to accurately identify a very small number of abnormal patterns (such as scratches and cracks in industrial anomaly detection, and lumps and lesions in medical imaging tasks) from a massive amount of normal patterns. Because abnormal samples are extremely difficult to collect and the types of anomalies are unpredictable in practical applications, existing User-Augmented Detection (UAD) models are typically trained only on normal datasets. They construct a normal representation space by extracting strong discriminative features and use the difference between the test sample and the normal description to detect anomalies. The basic principle is: any sample not in the normal representation space is considered an anomaly. To address this problem, existing common UAD algorithms fall into two main categories: The first is the "discriminative embedding" method. This type of method uses a network pre-trained on a large-scale dataset (such as ImageNet) to extract image features, then stores a representative subset of normal features in a memory bank, and combines this with nearest neighbor search to detect anomalies; or it uses normalizing flows to estimate the density of normal features and identifies low-likelihood samples as anomalies. The second type is the "reconstruction-based" method. These methods aim to train models to reconstruct normal features and detect anomalies through high reconstruction errors on abnormal samples. Classical methods employ autoencoders or GANs. Recently, diffusion models have been widely used across various fields as powerful production tools, with methods like DiAD utilizing diffusion models to recover damaged images for defect detection. Furthermore, RD4AD utilizes knowledge distillation techniques to train a student network to replicate the feature representations of a pre-trained teacher network, using the feature differences between the student and teacher outputs as anomaly scores. Other methods learn a decision boundary to refine anomaly localization by training a classifier on synthetic anomalies to distinguish them from real samples.
[0003] The two mainstream methods mentioned above are based on an ideal assumption: that test samples and training samples satisfy the i-id condition. However, in real-world application deployment scenarios, significant challenges arise due to dynamic environmental changes, such as variations in ambient lighting, aging of data acquisition equipment, and jitter, all of which can lead to distribution shifts between test and training data. To address this issue and improve the robustness of models in real-world deployments, a common strategy is to treat anomaly detection under distribution shifts as an out-of-distribution (OOD) generalization problem, aiming to enhance the consistency between the features of the original data and the out-of-distribution data. For example, GNL uses data augmentation to simulate out-of-distribution data, while minimizing the feature embedding gap between the original data and normal out-of-distribution samples during training and inference phases to learn a distribution-invariant normality representation, enabling the model to learn the generalized semantics of normal training data at different feature levels. Another common strategy is to borrow from domain adaptation (DA) methods, aiming to align the source distribution with a specific target distribution. For example, RoDA first fits a representative subset feature library, Memory Bank, using features from normal samples in the source domain as a source distribution reference. Then, in the target domain, using a small amount of unlabeled data, it calculates the soft assignment of the target patch to the representative embedding through optimal transfer (Sinkhorn distance) and minimizes the alignment loss to achieve distribution alignment. At the same time, it binarizes the soft assignment of the Sinkhorn and enhances the target data to generate multiple views to avoid abnormal patches mixed in from the target domain dominating the alignment process, thus producing a more robust alignment.
[0004] For traditional User Adaptive Disclosure (UAD) techniques, the effectiveness of "discriminative embedding-based" methods largely depends on the quality and robustness of the learned feature embeddings. "Reconstruction-based" methods, on the other hand, often suffer from overgeneralization, where the model becomes powerful enough to accurately reconstruct anomalies, thus weakening the anomalous signal. Furthermore, both types of methods rely on the assumption that the training and test sets are independently and identically distributed; when there is an invisible distribution shift in the test samples, these models perform poorly.
[0005] To address the issue of invisible distribution offsets between test samples and training data in real-world scenarios, existing unsupervised anomaly detection methods for improving generalization fall into two main paradigms. As mentioned above, one approach treats the anomaly detection task under distribution offset as an OOD generalization task. A significant drawback of this approach is the need for a TTA step, where a normal sample query is randomly selected from the training set during testing as a "training domain style reference." Feature distribution matching is then performed on the test sample 't' in an intermediate layer, "injecting" the training domain distribution into the test features. This obviously introduces additional computational overhead. The other approach aligns the target domain distribution with the source domain distribution. This approach requires access to target domain samples during training, which is often impractical in real-world deployments where the offset is unknown. Summary of the Invention
[0006] The purpose of this invention is to provide an interference-robust anomaly detection method and system based on dynamic whitening regularization, so as to solve at least one of the technical problems existing in the background art.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] In a first aspect, the present invention provides an interference-robust anomaly detection method based on dynamic whitening regularization, comprising:
[0009] Acquire the image to be detected;
[0010] The acquired image to be detected is processed using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model consists of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
[0011] As a further limitation of the first aspect of the present invention, the stability of the feature channels changes with the iteration of the training process. A dynamic channel partitioning strategy is adopted, that is, dynamic whitening regularization is independently performed on each layer of potential features in L every N cycles to adapt to the model's learning process; for each original image... And “damaged” images with slight color-changing perturbations are used to extract their multi-scale latent features. Then, they are stitched together along the dimensional direction, and their channel covariance matrix, i.e., the correlation between channels, is calculated.
[0012] As a further limitation of the first aspect of the invention, in order to capture "sensitive" relevant terms, the variance of the channel covariance matrix is calculated along the batch dimension. To derive the batch-specific sensitivity scores for all samples at each scale, these unstable scores are aggregated using the following formula: [Formula omitted for brevity]. Layer average variance Defined as:
[0013] ;
[0014] Where n is the number of batches, that is, the sample set is divided into more than one small sample batch.
[0015] As a further limitation of the first aspect of the invention, the directional isotropic regularization includes: defining a directional isotropic regularization loss using a specific-scale binary mask derived from the partitioning stage; for For each layer of latent features, the sample covariance matrix from a batch of channel-normalized features is first calculated. The main goal of this regularization is to force decorrelation, specifically for channels identified as unstable, since inter-channel dependencies are a key component of anisotropy.
[0016] As a further limitation of the first aspect of the invention, a loss function is defined that explicitly penalizes the off-diagonal elements of the covariance matrix, but only for channel pairs in unstable subspaces, starting from the vector mask. Constructing a matrix mask The total isotropic loss is the average of the off-diagonal covariance elements after masking at all scales. Norm:
[0017] ;
[0018] in Set the diagonal elements to zero. It is a Hadama pile;
[0019] This loss directly drives the correlation between unstable channels to zero. By selectively targeting only these unstable relation subspaces at each scale, regularization promotes multi-scale isotropy where robustness is most needed, while preserving the structure encoded in stable channel relations.
[0020] As a further limitation of the first aspect of the present invention, the overall training objective is as follows: combining multi-scale alignment loss and the proposed directional isotropic regularization, the final loss function... It is the weighted sum of these two parts:
[0021]
[0022] Among them, hyperparameters Alignment loss is used to balance reconstruction fidelity with feature anisotropy. It is the sum of cosine distances defined at each scale.
[0023] Secondly, the present invention provides an interference-robust anomaly detection system based on dynamic whitening regularization, comprising:
[0024] The acquisition module is used to acquire the image to be detected;
[0025] The processing module is used to process the acquired image to be detected using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model is composed of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
[0026] Thirdly, the present invention provides a non-transitory computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the interference robust anomaly detection method based on dynamic whitening regularization as described in the first aspect.
[0027] Fourthly, the present invention provides a computer device including a memory and a processor, wherein the processor and the memory communicate with each other, the memory stores program instructions executable by the processor, and the processor invokes the program instructions to execute the interference robust anomaly detection method based on dynamic whitening regularization as described in the first aspect.
[0028] Fifthly, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to cause the electronic device to execute instructions for implementing the interference robust anomaly detection method based on dynamic whitening regularization as described in the first aspect.
[0029] Terminology Explanation:
[0030] Anomaly Detection (AD): Identifies data that does not conform to expected patterns or falls outside of a concentrated distribution, commonly used in industrial quality inspection and medical impact analysis. Unsupervised Anomaly Detection (UAD): Trains a model on a completely unlabeled normal dataset to fit a normal feature distribution, and then uses it to test both normal and anomalous samples simultaneously. Unseen Distribution Shift (UDS): Differences in statistical distribution between test and training data caused by environmental influences (such as changes in lighting) or sensor noise (such as changes in data acquisition equipment). Feature Anisotropy: Uneven variance distribution of feature vectors across different dimensions, typically manifested as feature embeddings collapsing into a narrow cone or fan-shaped region. Feature Isotropy: Uniform variance distribution of feature vectors in all directions, resulting in a spherical feature space. Dynamic Whitening Regularization (DW): A regularization strategy proposed in this invention that removes redundancy and promotes isotropy by dynamically analyzing the correlation of feature channels.
[0031] The beneficial effects of this invention are as follows: Firstly, it systematically explores and analyzes feature anisotropy as a key bottleneck in robust anomaly detection, providing a new geometric perspective on the generalization failure of AD models. Secondly, the core algorithm of this invention, CRAD, is a novel training paradigm with dynamic whitening (DW) regularization, which selectively and adaptively promotes feature isotropy in normal representations. CRAD significantly outperforms existing state-of-the-art algorithms in robustness against unseen corruption, while maintaining or exceeding their performance on benchmarks within standard distributions.
[0032] The advantages of additional aspects of the invention will be set forth more clearly in the following description or will be learned by practice of the invention. Attached Figure Description
[0033] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a schematic diagram illustrating the anisotropic defect vs. isotropic optimization described in an embodiment of the present invention.
[0035] Figure 2 This is a flowchart illustrating the interference robustness of the anomaly detection method based on dynamic whitening regularization as described in an embodiment of the present invention. Detailed Implementation
[0036] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0037] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0038] It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with their meanings in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless defined as here.
[0039] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, and / or groups thereof.
[0040] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0041] To facilitate understanding of the present invention, the present invention will be further explained and described below with reference to the accompanying drawings and specific embodiments. However, the specific embodiments do not constitute a limitation on the embodiments of the present invention.
[0042] Those skilled in the art should understand that the accompanying drawings are merely schematic diagrams of embodiments, and the components in the drawings are not necessarily essential for implementing the present invention.
[0043] Due to the scarcity and non-enumerability of anomalous samples, models model the distribution characteristics of normal samples and identify anomalies by recognizing the differences between test samples and the normal distribution. Classical UAD models are typically built based on the assumption that training and test data satisfy independent and identically distributed (i.i.d.). However, in practical applications, external factors (such as changes in lighting or aging image acquisition equipment) often cause invisible distribution shifts in test data. Existing algorithms often learn features with anisotropy; when faced with such distribution shifts, they cannot effectively distinguish between "normal neighborhood changes" and "true structural anomalies," causing normal test samples to deviate from the model's pre-built normal feature space, resulting in higher anomaly scores and ultimately serious false detection problems. This leads to poor generalization ability and robustness of the model when facing invisible distribution shifts. Therefore, this invention provides an interference-robust anomaly detection method based on dynamic whitening regularization. The core problem to be solved is: how to break the limitation of the independent and identically distributed assumption and learn an isotropic normal feature space when only normal training data is available, so that the features can still be correctly represented when faced with invisible distribution shifts, thereby significantly improving the generalization ability of the anomaly detection model in complex real-world scenarios.
[0044] Example 1
[0045] In this embodiment 1, an interference-robust anomaly detection system based on dynamic whitening regularization is first provided, including: an acquisition module for acquiring an image to be detected; and a processing module for processing the acquired image to be detected using a pre-trained anomaly detection model to obtain anomaly detection results.
[0046] In this embodiment, the above-described system is used to implement an interference-robust anomaly detection method based on dynamic whitening regularization, including: acquiring an image to be detected using an acquisition module; and processing an application module processing the acquired image to be detected using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model is composed of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
[0047] As the training process iterates, the stability of the feature channels changes accordingly. A dynamic channel partitioning strategy is adopted, whereby dynamic whitening regularization is performed independently on each layer of latent features in L every N cycles to adapt to the model's learning process. For each original image... And “damaged” images with slight color-changing perturbations are used to extract their multi-scale latent features. Then, they are stitched together along the dimensional direction, and their channel covariance matrix, i.e., the correlation between channels, is calculated.
[0048] To capture "sensitive" relevant terms, the variance of the channel covariance matrix is calculated along the batch dimension. To derive the batch-specific sensitivity scores for all samples at each scale, these unstable scores are aggregated using the following formula: [Formula omitted for brevity]. Layer average variance Defined as:
[0049] ;
[0050] Where n is the number of batches, that is, the sample set is divided into more than one small sample batch.
[0051] Directed isotropic regularization includes: defining a directed isotropic regularization loss using a specific-scale binary mask derived from the partitioning stage; for For each layer of latent features, the sample covariance matrix from a batch of channel-normalized features is first calculated. The main goal of this regularization is to force decorrelation, specifically targeting channels identified as unstable, since inter-channel dependencies are a key component of anisotropy. A loss function is formulated to explicitly penalize off-diagonal elements of the covariance matrix, but only for channel pairs in the unstable subspace, starting from the vector mask. Constructing a matrix mask The total isotropic loss is the average of the off-diagonal covariance elements after masking at all scales. Norm:
[0052] ;
[0053] in Set the diagonal elements to zero. It is a Hadama pile;
[0054] This loss directly drives the correlation between unstable channels to zero. By selectively targeting only these unstable relation subspaces at each scale, regularization promotes multi-scale isotropy where robustness is most needed, while preserving the structure encoded in stable channel relations.
[0055] Ultimately, the overall training objective is as follows: combining multi-scale alignment loss and the proposed directional isotropic regularization, the final loss function is... It is the weighted sum of these two parts:
[0056]
[0057] Among them, hyperparameters Alignment loss is used to balance reconstruction fidelity with feature anisotropy. It is the sum of cosine distances defined at each scale.
[0058] Example 2
[0059] Based on the shortcomings of the two mainstream paradigms for addressing the generalization problem of invisible distribution offset models as described in the background section, this embodiment aims to shift the focus from model architecture design to the geometry of the learned normal feature space, starting from understanding the root cause of model fragility. From this perspective, feature anisotropy is a limiting factor for robust generalization. The anisotropy problem has been extensively studied in the field of natural language processing, and it is known to lead to representation collapse and reduce semantic expressiveness. Although the generative factors differ in anomaly detection tasks, this problem is not accidental, but a natural consequence of the single-class anomaly detection paradigm itself, stemming from two intrinsic factors: (i) data-level regularity (background, lighting, contour) acts as a "shortcut," which the model compresses into shared directions, resulting in highly anisotropic embeddings. (ii) in the absence of negative samples, the optimization process tends to produce overly compact normal embeddings, with little incentive to form boundaries for possible biases. This inherent anisotropy makes the model fragile, resulting in a narrow and brittle representation of "normality." As a result, benign, unseen damage may be mapped to locations far from the normal feature distribution, leading to an increased false alarm rate and hindering the actual deployment of anomaly detection.
[0060] For ease of understanding, anisotropy and isotropy are like... Figure 1 As shown.
[0061] Therefore, this embodiment proposes a Corruption-Robust Anomaly Detection via Dynamic Whitening Regularization (CRAD) algorithm to address the anisotropy problem in anomaly detection models, thereby improving the model's generalization ability on invisible anomaly distribution shifts. This is a novel training paradigm aimed at explicitly enforcing feature isotropy. The key to CRAD is a novel Dynamic Whitening (DW) regularization applied to multi-scale latent features. This mechanism identifies "unstable" feature channel subsets whose inter-channel correlations are sensitive to corruption by periodically using image perturbations (damage) as probes. Subsequently, an adaptive mask is constructed to selectively penalize correlations only within this unstable subspace. By dynamically targeting and suppressing sources of anisotropy, CRAD encourages the model to learn a more uniform and robust normal data space.
[0062] To verify the hypothesis that feature isotropy is key to robustness against damage, this embodiment instantiates the network within the standard teacher-student reconstruction framework without adding or modifying any additional modules. The specific network structure is as follows: Figure 2 As shown. Formally, it consists of a pre-trained, frozen visual backbone network. Composition, in Extracting hierarchical feature maps at various scales These multi-scale features are then aggregated (e.g., by resizing and concatenating) to form a unified representation, which is then fed into a learnable student decoder. Reconstruction is performed. The training process minimizes the student's multi-scale reconstruction. With teacher's original characteristic level The differences between them are subject to supervisory constraints. The alignment loss is defined as the sum of cosine distances at each scale:
[0063] ;
[0064] For each scale In this embodiment, the cosine similarity between the reconstructed features and the original encoded features is calculated after vectorization, and then averaged over all spatial locations.
[0065] Next, the CRAD model proposed in this embodiment will be described in detail.
[0066] First, we introduce the proposed dynamic whitening regularization strategy. While whitening is a classic method for addressing feature anisotropy, simply applying global whitening performs poorly in anomaly detection. In this embodiment, we analyze and find two main reasons. First, key anomaly clues and semantics are often entangled in feature channels, and global decorrelation risks over-regularization and compression of useful expressive power. Second, for multi-scale architectures, the student decoder relies on the hierarchical structure of latent features to reconstruct the normal representation space across different feature extraction levels. Applying global whitening variations to all these features may disrupt the rich semantic geometry required for accurate reconstruction.
[0067] Therefore, this embodiment proposes Dynamic Whitening (DW) regularization to selectively enforce isotropy. However, a key challenge in this task is the teacher characteristics. It's frozen and cannot be directly optimized. To overcome this, we first introduce a set of learnable bottleneck heads. Each head is a simple non-linear projection that freezes the teacher's feature map. Mapping to the corresponding optimizable latent features :
[0068] ;
[0069] Then these latent features As the target of DW regularization, this regularization is applied independently at each scale. Subsequently, the regularized latent features are aggregated and passed to the student decoder. This two-step approach of "projection first, then regularization" allows for the reshaping of the geometry of the feature space without altering the original teacher-encoded embeddings, thereby precisely enforcing isotropy to enhance robustness.
[0070] Furthermore, as the training process iterates, the stability of the feature channels will change accordingly. Therefore, this embodiment adopts a dynamic channel partitioning strategy, that is, dynamic whitening regularization is performed independently on each potential feature in L every N cycles to adapt to the model's learning process.
[0071] An unstable channel is one whose correlation changes unpredictably under benign color perturbations. To quantify this, this embodiment measures each scale. The variability of the covariance matrix between channels. Specifically, for each original image And “damaged” images with slight color-changing perturbations. Extract their multi-scale latent features and Then, concatenate them along the dimensional direction to obtain... Then, its channel covariance matrix is calculated. Here, the covariance matrix represents the correlation between channels. Since the correlation between channels varies greatly across different instances, this embodiment analyzes the correlation along the batch dimension to capture "sensitive" correlation terms. Calculate the variance, and record the result as follows: To derive the sensitivity-related item scores for all samples at each scale, in batches, the following formula is used to aggregate these unstable scores, i.e., the... Layer average variance (denoted as ) is defined as:
[0072] ;
[0073] Here, n is the number of batches, meaning the sample set is divided into several smaller batches. Intuitively, we treat the original image and the perturbated image as similar sample sources and statistically analyze the fluctuation of their channel correlation across the sample dimensions. This fluctuation is often caused by the introduction of color change perturbations. Therefore, this fluctuation is a sensitive term that needs to be suppressed in subsequent optimizations. Then, at each scale... fractions Using K-Means (k = 2) independent clustering, semantic sets are generated. and unstable sets This process produces a set of binary masks at a specific scale. These masks remain fixed for the next N periods and are used for targeted multi-scale whitening regularization.
[0074] The following describes the Targeted Isotropy Regularization proposed in this embodiment. It uses a specific-scale binary mask derived from the partitioning stage. Defines the directional isotropic regularization loss. .for For each layer of latent features, the sample covariance matrix from a batch of channel-normalized features is first calculated. The main goal of this regularization is to enforce decorrelation, specifically targeting channels identified as unstable, since inter-channel dependencies are a key component of anisotropy. To achieve this in the most straightforward way, a loss function is formulated that explicitly penalizes off-diagonal elements of the covariance matrix, but only for channel pairs in the unstable subspace. This is first done using vector masks. Constructing a matrix mask The total isotropic loss is the average of the off-diagonal covariance elements after masking at all scales. Norm:
[0075] ;
[0076] in Set the diagonal elements to zero. It is the Hadamard product. This loss directly drives the correlation between unstable channels to tend to zero. By selectively targeting only these unstable relation subspaces at each scale, regularization promotes multi-scale isotropy where robustness is most needed, while preserving the structure encoded in stable channel relations.
[0077] The overall training objective is as follows: The complete training objective of this embodiment combines the main multi-scale alignment loss with the proposed directional isotropic regularization. The final loss function... It is the weighted sum of these two parts:
[0078] ;
[0079] Among them, hyperparameters This is used to balance reconstruction fidelity with feature anisotropy. The entire model, including the student decoder... and bottleneck End-to-end training is performed by minimizing the objective.
[0080] Example 3
[0081] This embodiment 3 provides a non-transitory computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, they implement the interference-robust anomaly detection method based on dynamic whitening regularization as described above. The method includes:
[0082] Acquire the image to be detected;
[0083] The acquired image to be detected is processed using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model consists of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
[0084] Example 4
[0085] This embodiment 4 provides a computer device, including a memory and a processor, wherein the processor and the memory communicate with each other, and the memory stores program instructions executable by the processor. The processor calls the program instructions to execute the interference robust anomaly detection method based on dynamic whitening regularization as described above, the method including:
[0086] Acquire the image to be detected;
[0087] The acquired image to be detected is processed using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model consists of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
[0088] Example 5
[0089] This embodiment 5 provides an electronic device, including: a processor, a memory, and a computer program; wherein, the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory to cause the electronic device to execute instructions implementing the interference robust anomaly detection method based on dynamic whitening regularization as described above. The method includes:
[0090] Acquire the image to be detected;
[0091] The acquired image to be detected is processed using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model consists of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
[0092] In summary, compared with existing UAD algorithms, the significant advantage of this invention is its strong generalization ability when facing invisible distribution shifts, breaking the traditional algorithm's assumption that the training and test sets satisfy independent and identical distributions, thus making it more robust. Furthermore, compared with existing models specifically designed for robustness issues in real-world deployments, this invention has the following significant advantages: significantly improved robustness against interference. Existing technologies further improve performance when facing invisible distribution shifts such as illumination changes and blurring. This invention forces isotropic representation of the feature space, making the flow of normal samples more compact and uniform. Experimental results show that, under harsh conditions on RobustAD, perturbated MVTecAD, and VisA datasets, this invention maintains extremely high detection performance with a significantly reduced false positive rate. It avoids the destruction of semantic features. While traditional global whitening methods (such as ZCA whitening) can address anisotropy, they often "clean up" semantic information that is helpful for reconstruction. The selective masking mechanism of this invention precisely targets only redundant correlations that lead to instability, while perfectly preserving stable features used to describe normal texture structures. This improves robustness without sacrificing fundamental performance on standard test sets (such as MVTecAD). No target domain data or extensive augmentation is required. Many domain-adaptive methods require fine-tuning with samples from the target domain, while this invention utilizes only normal data from the source domain for training. Through inherent geometric constraints (isotropy), the model naturally acquires the ability to generalize to unknown variations without requiring dedicated data augmentation training for every possible perturbation.
[0093] In practical applications, the variance of the covariance matrix is used as a measure of instability. Alternatively, the gradient sensitivity of feature channels, the change in mutual information, or the variance of feature amplitude can be used to identify unstable channels. Alternatives to perturbation types: In this example, color jitter is used as the probing perturbation. Alternatively, Gaussian noise, geometric transformations (rotation / scaling), or perturbations generated by adversarial attacks can be used to induce feature instability. Alternatives to regularization forms: In this example, the L1 norm is used to penalize off-diagonal elements. Alternatively, the Frobenius norm or eigenvalue-based regularization (penalizing the skewness of the eigenvalue distribution) can be used to achieve decorrelation. Alternatives to network architecture: Although this invention is based on a teacher-student architecture, this dynamic whitening regularization idea can also be embedded in the latent space training of autoencoders or generative adversarial networks (GANs) to constrain the distribution shape of their latent variables.
[0094] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0095] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0096] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0097] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment, whereby a series of operational steps are performed to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0098] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that, based on the technical solutions disclosed in the present invention, various modifications or variations that can be made by those skilled in the art without creative effort should be included within the scope of protection of the present invention.
Claims
1. An interference-robust anomaly detection method based on dynamic whitening regularization, characterized in that, include: Acquire the image to be detected; The acquired image to be detected is processed using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model consists of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
2. The interference-robust anomaly detection method based on dynamic whitening regularization according to claim 1, characterized in that, As the training process iterates, the stability of the feature channels changes. A dynamic channel partitioning strategy is adopted, where dynamic whitening regularization is performed independently on each layer of latent features in L every N cycles to adapt to the model's learning process. For each original image... And “damaged” images with slight color-changing perturbations are used to extract their multi-scale latent features. Then, they are stitched together along the dimensional direction, and their channel covariance matrix, i.e., the correlation between channels, is calculated.
3. The interference-robust anomaly detection method based on dynamic whitening regularization according to claim 2, characterized in that, To capture "sensitive" relevant terms, the variance of the channel covariance matrix is calculated along the batch dimension. To derive the batch-specific sensitivity scores for all samples at each scale, these unstable scores are aggregated using the following formula: [Formula omitted for brevity]. Layer average variance Defined as: ; Where n is the number of batches, that is, the sample set is divided into more than one small sample batch.
4. The interference-robust anomaly detection method based on dynamic whitening regularization according to claim 3, characterized in that, Directed isotropic regularization includes: defining a directed isotropic regularization loss using a specific-scale binary mask derived from the partitioning stage; for For each layer of latent features, the sample covariance matrix from a batch of channel-normalized features is first calculated. The main goal of this regularization is to force decorrelation, specifically for channels identified as unstable, since inter-channel dependencies are a key component of anisotropy.
5. The interference-robust anomaly detection method based on dynamic whitening regularization according to claim 4, characterized in that, A loss function is defined that explicitly penalizes off-diagonal elements of the covariance matrix, but only for channel pairs in unstable subspaces, starting from the vector mask. Constructing a matrix mask The total isotropic loss is the average of the off-diagonal covariance elements after masking at all scales. Norm: ; in Set the diagonal elements to zero. It is a Hadama pile; This loss directly drives the correlation between unstable channels to zero. By selectively targeting only these unstable relation subspaces at each scale, regularization promotes multi-scale isotropy where robustness is most needed, while preserving the structure encoded in stable channel relations.
6. The interference-robust anomaly detection method based on dynamic whitening regularization according to claim 5, characterized in that, The overall training objective is as follows: combining multi-scale alignment loss and the proposed directional isotropic regularization, the final loss function is... It is the weighted sum of these two parts: Among them, hyperparameters Alignment loss is used to balance reconstruction fidelity with feature anisotropy. It is the sum of cosine distances defined at each scale.
7. An interference-robust anomaly detection system based on dynamic whitening regularization, characterized in that, include: The acquisition module is used to acquire the image to be detected; The processing module is used to process the acquired image to be detected using a pre-trained anomaly detection model to obtain anomaly detection results; wherein, the anomaly detection model is composed of a visual backbone network. The process involves extracting hierarchical feature maps at multiple scales, then aggregating these multi-scale hierarchical feature maps to form a unified representation, which is then reconstructed using a decoder. The training process is supervised by minimizing the difference between the student's multi-scale reconstruction and the teacher's original feature hierarchy. In the reconstruction, dynamic whitening regularization is used to selectively enforce the isotropy of the hierarchical feature maps. This includes: firstly, introducing a set of learnable bottleneck heads, each of which is a simple non-linear projection that maps the frozen teacher feature map to the corresponding optimizable latent features, which are then used as the target of dynamic whitening regularization. Subsequently, the regularized latent features are aggregated and passed to the student decoder.
8. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium is used to store computer instructions, which, when executed by a processor, implement the interference robust anomaly detection method based on dynamic whitening regularization as described in any one of claims 1-6.
9. A computer device, characterized in that, The method includes a memory and a processor, the processor and the memory communicating with each other, the memory storing program instructions executable by the processor, and the processor calling the program instructions to execute the interference robust anomaly detection method based on dynamic whitening regularization as described in any one of claims 1-6.
10. An electronic device, characterized in that, include: The device includes a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to cause the electronic device to execute instructions that implement the interference robust anomaly detection method based on dynamic whitening regularization as described in any one of claims 1-6.