Industrial anomaly detection method and system based on pseudo-anomaly feature space optimization

By constructing an anomaly-driven denoising diffusion probability model and center-guided contrastive learning to optimize the feature space, high-fidelity pseudo-anomaly samples are generated, solving the problems of sample scarcity and texture distortion in industrial visual inspection, and achieving accurate detection of minute defects and improved model robustness.

CN122116004BActive Publication Date: 2026-07-03SHANDONG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG UNIV
Filing Date
2026-04-21
Publication Date
2026-07-03

Smart Images

  • Figure CN122116004B_ABST
    Figure CN122116004B_ABST
Patent Text Reader

Abstract

The application belongs to the field of industrial visual inspection, and particularly relates to an industrial anomaly detection method and system based on pseudo-anomaly feature space optimization. First, an anomaly-driven denoising diffusion probability model AD-DDPM is constructed, and Berlin noise disturbance is introduced in the reverse denoising process to synthesize pseudo-anomaly samples with real physical textures. Second, a "normal-anomaly-mask" triplet is constructed using the synthesized information, and a multi-scale feature selection module MSFS is used to select a feature subset with high discriminability. Then, a center-guided contrast learning mechanism is introduced, a global normal class center is set in the feature space, normal samples are gathered to the center, and pseudo-anomaly samples are pushed away from the center to optimize the decision boundary. Finally, the reconstruction residual containing the most anomaly information is selected to generate an anomaly score, and the precise positioning of defects is realized. The application effectively eliminates the dependence of the model on real anomaly data, and significantly improves the detection accuracy of small defects and the robustness of the model in a complex background.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of industrial visual inspection, specifically relating to an industrial anomaly detection method and system based on pseudo-anomaly feature space optimization. Background Technology

[0002] With the deepening development of intelligent manufacturing and Industry 4.0, surface defect detection based on computer vision has become a core technology for ensuring industrial product quality and improving production efficiency. In actual industrial production lines, timely detection and location of minute cracks, stains, or damage on product surfaces through vision inspection systems is of great significance for reducing enterprise costs and achieving automated quality inspection. Currently, anomaly detection algorithms based on deep learning, due to their powerful feature extraction capabilities, have gradually replaced traditional manual visual inspection and rule-based image processing methods.

[0003] In real industrial production lines, product yields are typically extremely high, leading to high costs and uneven distribution of defect samples. While existing technologies attempt to synthesize pseudo-anomaly images using generative adversarial networks (GANs) or autoencoders (AEs), the anomaly regions generated by these methods often suffer from texture distortion and harsh edges, making it difficult to simulate defect distributions with realistic physical characteristics. Consequently, the models exhibit poor generalization ability when faced with unknown types of real defects.

[0004] In the self-supervised learning framework, while conventional data augmentation strategies (such as random rotation and pruning) expand the sample size, they can also lead to an overly discrete distribution of features of normal samples in the latent space. This loose distribution causes normal samples to overlap with extremely similar samples with minor defects in the feature space, making it difficult to define clear decision boundaries and severely limiting the model's ability to capture minor anomalies in complex environments.

[0005] Therefore, the key to further improving the detection accuracy and robustness in the field of industrial vision inspection lies in how to construct a detection scheme that can generate high-fidelity pseudo-anomaly samples, adaptively select key discriminative features, and optimize the feature space distribution. Summary of the Invention

[0006] This invention provides an industrial anomaly detection method and system based on pseudo-anomaly feature space optimization, aiming to overcome the shortcomings of existing technologies, such as the extreme scarcity of industrial anomaly samples, redundant interference from high-dimensional pre-trained features, and the loose distribution of normal and anomaly samples in the latent space, resulting in ambiguous decision boundaries. This invention achieves end-to-end optimization at the data generation, feature selection, and spatial distribution stages, aiming to improve the accuracy, robustness, and engineering feasibility of detecting minute surface defects in industrial products in actual production lines.

[0007] To achieve the above objectives, the technical solution of the present invention is as follows:

[0008] An industrial anomaly detection method based on pseudo-anomaly feature space optimization includes the following steps:

[0009] S1. Generating pseudo-anomaly data;

[0010] S2. Multi-scale feature filtering;

[0011] S3. Center-guided contrastive learning feature space optimization;

[0012] S4. Feature Reconstruction and Anomaly Score Calculation: The image to be tested is input into the optimized feature extraction network to obtain the selected features, and the feature reconstruction network reconstructs the features; the multi-scale residual feature map between the original selected features and the reconstructed features is calculated, and global max pooling and global average pooling are performed on the residual map simultaneously to select the key residual element with the largest response value; the fused residual information is mapped back to the image-level resolution through the discriminator to generate an accurate pixel-level anomaly localization map and an image-level anomaly score.

[0013] Preferably, in step S1, an anomaly-driven denoising diffusion probability model AD-DDPM is constructed to synthesize pseudo-anomaly images in the absence of real defect samples. In the reverse denoising sampling stage, a random perturbation term guided by Berlin noise is introduced to shift the local features generated by the model towards the periphery of the normal distribution, generating pseudo-anomaly samples with real physical texture. Training triples are constructed by combining the original normal image and the generated anomaly mask. This provides a benchmark for subsequent feature selection. It's a normal image. It is an abnormal image. It is an anomaly mask image obtained by capturing various abnormal shapes using the Perlin noise generator and binarizing them.

[0014] Preferably, the anomaly-driven denoising diffusion probability model introduces Berlin noise perturbation in the reverse denoising sampling stage, and its iterative formula is as follows:

[0015] ;

[0016] in, For the first Noisy images of the steps, and These are hyperparameters used to control the denoising ratio at each step. For perturbation weights, This is an abnormal mask area. It is the Berlin noise matrix. This represents element-wise multiplication. The parameter is indicated. The denoising network at all times Noise residuals predicted based on the current noisy image;

[0017] Pseudo-anomaly samples Generated using image blending techniques, the formula is:

[0018] ;

[0019] in, These are anomalous images generated by AD-DDPM. It is an anomaly mask image obtained by capturing various anomalous shapes using a Perlin noise generator and binarizing them, resulting in the final anomaly image. While maintaining the consistency of the normal image background, it includes realistic and diverse anomalous areas.

[0020] Preferably, the triples constructed in step S1 are input into the pre-trained backbone network to extract multi-scale deep features at different spatial resolutions; and a multi-scale feature selection module MSFS is designed to calculate the second-order difference map between pseudo-abnormal features and normal features, and measure the consistency of the mapping between the difference map and the corresponding anomalous mask in the spatial dimension, thereby quantifying the defect discrimination power of each feature channel; and the feature channels are prioritized according to the selection loss from smallest to largest to select the core feature subset that is highly sensitive to anomalous signals.

[0021] Preferably, the specific process of multi-scale feature selection by the multi-scale feature selection module MSFS in step S2 includes:

[0022] Extracting the pre-trained backbone network Layer features are used to calculate the second-order difference between the features of the pseudo-anomaly image and the features of the normal image. After upsampling and normalization, a normalized difference map is obtained. ;

[0023] Calculate the normalized difference plot With the corresponding downsampling anomaly mask Consistent selection loss :

[0024] ;

[0025] in, Indicates the characteristic channel, Represents spatial coordinates, Total number of pixels Indicates feature level;

[0026] According to the choice of loss Sort each feature channel from smallest to largest, and retain the top channels with the smallest loss. Construct an optimal feature index set from each channel.

[0027] Preferably, in step S3, a nonlinear projection head is constructed at the back end of the feature extraction network to map the selected features to the latent embedding space; a learnable global normal class center vector is established in the latent space. Using a center-guided contrastive loss function The spatial constraints are applied, forcing all positive sample features to converge toward the center, while pushing the pseudo-abnormal negative sample features generated in step S1 away from the center and surrounding areas. This paradigm clarifies the decision boundary between normal and anomalous distributions.

[0028] Preferred, center-guided contrastive loss function Defined as:

[0029] ;

[0030] in, This represents the number of normal samples within the batch. The number of pseudo-anomaly samples generated. These are the projection features of normal samples. The projection features of the generated pseudo-anomaly samples, The learnable global normal class center vector. Represents cosine similarity. Temperature coefficient;

[0031] The center-guided contrastive loss function forcibly narrows down the features of all normal samples. With global center The distance induces the feature distribution to cluster towards the center, thus significantly reducing the within-class variance; simultaneously, it incorporates the pseudo-anomaly sample features of defect information. Forcibly pushed away from the central area and the normally distributed coverage boundary.

[0032] Preferably, step S4, multi-scale feature reconstruction and anomaly score calculation, specifically includes:

[0033] Calculate the first The residual feature map is obtained by analyzing the residual feature map between the layer-selected features and the reconstructed features.

[0034] Global max pooling and global average pooling are performed simultaneously on the residual feature map, and the top responses with the largest values ​​are selected respectively. There are n elements, denoted as 1, 2, 3, 4, 5, 6, 7, 8, 9, 1 ...2, 1, 1, 2, 3, 1, 2, 3, and ;

[0035] The selected features are cascaded and fused to obtain the fused reconstructed residual feature map. Its fusion formula is:

[0036] ;

[0037] in, This indicates a channel-level cascading operation.

[0038] Preferably, the anomaly score is obtained by inputting the aggregated residual information into the discriminator and mapping it back to the original resolution to generate a high signal-to-noise ratio anomaly heatmap. The maximum response value in the heatmap is selected as the final anomaly score of the image. Through Top-K filtering, low-response background redundancy is discarded, thus achieving accurate pixel-level positioning of industrial defect areas.

[0039] An industrial anomaly detection system based on pseudo-anomaly feature space optimization includes a pseudo-anomaly data generation module, a multi-scale feature screening module, a center-guided contrastive learning feature space optimization module, and a feature reconstruction and anomaly score calculation module.

[0040] The pseudo-anomaly data generation module constructs an anomaly-driven denoising diffusion probability model to synthesize pseudo-anomaly images in the absence of real defect samples. In the reverse denoising sampling stage, a random perturbation term guided by Berlin noise is introduced to shift the local features generated by the model towards the periphery of the normal distribution, generating pseudo-anomaly samples with realistic physical texture. Training triples are constructed by combining the original normal image with the generated anomaly mask. This provides a benchmark for subsequent feature selection;

[0041] Multi-scale feature selection module: The constructed triples are input into the pre-trained backbone network to extract multi-scale deep features at different spatial resolutions; and a multi-scale feature selection module is designed to calculate the second-order difference map between pseudo-abnormal features and normal features, and measure the consistency of the mapping between the difference map and the corresponding anomalous mask in the spatial dimension, thereby quantifying the defect discrimination power of each feature channel; the feature channels are prioritized according to the selection loss from smallest to largest, and the core feature subset that is highly sensitive to anomalous signals is selected.

[0042] The center-guided contrastive learning feature space optimization module constructs a non-linear projection head at the back end of the feature extraction network to map the selected features to the latent embedding space; and establishes a learnable global normal class center vector in the latent space. Using a center-guided contrastive loss function By imposing spatial constraints, all positive sample features are forced to converge toward the center, while pseudo-abnormal negative sample features are pushed away from the center and surrounding areas. This paradigm clarifies the decision boundary between normal and anomalous distributions.

[0043] Feature reconstruction and anomaly score calculation module: The image to be tested is input into the optimized feature extraction network to obtain the screening features, and the feature reconstruction network reconstructs the features. The reconstruction of normal samples and the reconstruction deviation of abnormal samples are used for discrimination. The multi-scale residual feature map between the original screening features and the reconstructed features is calculated, and global max pooling and global average pooling are performed on the residual map simultaneously to screen the key residual elements with the largest response values. The discriminator maps the fused residual information back to the image-level resolution to generate accurate pixel-level anomaly localization map and image-level anomaly score.

[0044] Compared with existing technologies, the beneficial effects are as follows:

[0045] A center-guided contrastive learning mechanism is introduced, establishing a global normal class center in the feature space. Normal samples are clustered towards the center, while pseudo-anomaly samples are pushed further away, thus optimizing the decision boundary. Finally, the reconstructed residual containing the most anomaly information is selected to generate anomaly scores, achieving accurate defect localization. This invention effectively eliminates the model's dependence on real anomaly data, significantly improving the detection accuracy and robustness of minute defects in complex backgrounds. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0047] Figure 1 This is an overall flowchart of an industrial anomaly detection method based on pseudo-anomaly feature space optimization disclosed in an embodiment of the present invention;

[0048] Figure 2 This is a diagram illustrating the architecture of an industrial anomaly detection model according to an embodiment of the present invention.

[0049] Figure 3 This is a schematic diagram of the data generation stage in an embodiment of the present invention;

[0050] Figure 4 This is a schematic diagram of the feature selection stage in an embodiment of the present invention;

[0051] Figure 5 This is a schematic diagram of the center-guided comparative learning phase in an embodiment of the present invention;

[0052] Figure 6 This is a schematic diagram of the reconstruction residual stage in an embodiment of the present invention. Detailed Implementation

[0053] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0054] This invention discloses an industrial anomaly detection method and system based on pseudo-anomaly feature space optimization, aiming to solve problems such as the scarcity of real anomaly samples, feature redundancy, and fuzzy decision boundaries for minor defects in actual industrial scenarios.

[0055] like Figure 1 As shown, an industrial anomaly detection method based on pseudo-anomaly feature space optimization includes the following steps:

[0056] (1) Pseudo-abnormal data synthesis:

[0057] This step aims to address the problem of the extreme scarcity and high cost of obtaining real defect samples in industrial scenarios by constructing an anomaly-driven generation mechanism to achieve autonomous expansion of high-fidelity samples. Specifically, this invention constructs an anomaly-driven denoising diffusion probability model (AD-DDPM). Unlike traditional diffusion models that aim to achieve accurate image reconstruction, this step introduces a Berlin noise perturbation term during the reverse denoising sampling stage of the diffusion process to induce anomaly generation.

[0058] The noise perturbation mechanism utilizes a Berlin noise generator to produce a noise matrix with continuous smooth characteristics and fractal distribution properties. Berlin noise can simulate random textures such as scratches, stains, and rust in the real world. Its iterative calculation formula is as follows:

[0059] ;

[0060] in, For the first Noisy images of the steps, and These are hyperparameters used to control the denoising ratio at each step. For perturbation weights, This is an abnormal mask area. This represents element-wise multiplication. At each denoising step... In the middle, by perturbing the weights and the preset abnormal mask area This process, applied to the sampling process, forces the local features generated by the model to shift towards a low-density space outside the normal distribution, thereby producing pseudo-anomaly regions with a physical sense of realism.

[0061] Image blending techniques will generate abnormal textures Compared with the original normal image Perform pixel-level fusion to ensure the synthesized image is free of artifacts. While maintaining absolute background consistency, the image exhibits diverse defect morphologies. Ultimately, a "normal-abnormal-mask" training triplet is constructed by combining the normal image, the pseudo-abnormal image, and their corresponding binarized masks. The implementation formula is as follows:

[0062] ;

[0063] in, It's a normal image. These are anomalous images generated by AD-DDPM. It is an anomaly mask image obtained by capturing various abnormal shapes using the Perlin noise generator and binarizing them.

[0064] (2) Feature selection stage:

[0065] This step removes redundant information unrelated to anomaly detection from a massive amount of high-dimensional pre-trained features. Industrial images often contain complex background textures and lighting fluctuations. If the full set of pre-trained features is used directly, small defect signals are easily overwhelmed by background noise. Therefore, this invention optimizes features through a multi-scale feature selection module. The triples generated in stage (1) are input into the pre-trained backbone network to extract multi-scale feature maps at different resolutions. The second-order difference between the pseudo-anomaly image features and the normal image features is calculated, which represents the sensitivity of the feature space to the anomaly signal. The anomaly mask produced in stage (1) is used as the ground truth benchmark to calculate the spatial mapping consistency loss between the difference map of each feature channel and the mask. .

[0066] ;

[0067] in, Indicates the characteristic channel, Represents spatial coordinates, The total number of pixels. The selection loss is as described. Sort each feature channel from smallest to largest, and retain the top channels with the smallest loss. Each channel constructs an optimal feature index set. This process achieves feature dimensionality reduction, allowing the model to focus only on the feature dimensions most sensitive to defects, significantly reducing the interference of complex industrial backgrounds on the detection results.

[0068] (3) Center-guided comparative learning stage:

[0069] This step aims to optimize the compactness of feature distribution through structured constraints in the deep feature space, thereby clarifying the decision boundary between normal and abnormal samples within the potential representation space.

[0070] In industrial image processing, while conventional data augmentation techniques (such as rotation, scaling, and color dithering) can improve the generalization ability of models, their side effect is that the features extracted from normal samples become too dispersed in the latent space, significantly increasing the intra-class variance. This dispersed distribution makes it easy for features of normal samples located at the distribution edges to overlap with features of anomalous samples with minor flaws, thus preventing the model from accurately defining nonlinear discrimination boundaries. To address this, this invention implements a center-guided contrastive learning (CCL) paradigm, the specific implementation details of which are as follows:

[0071] First, a learnable global normal class center vector is established in the feature space. During training, the center will dynamically evolve as the network parameters are updated to always anchor the core distribution area of ​​normal samples.

[0072] Secondly, the center-guided contrastive loss function is used. Strong constraints are applied to the characteristic topology of the latent space. The core calculation formula is as follows:

[0073] ;

[0074] in, This represents the number of normal samples within the batch. The number of pseudo-anomaly samples generated. These are the projection features of normal samples. The projection features of the generated pseudo-anomaly samples, The learnable global normal class center vector. Represents cosine similarity. This is the temperature coefficient.

[0075] Finally, this loss function will force all normal sample features to be more closely approximated. With global center The distance induces the feature distribution to cluster towards the center, thus significantly reducing the within-class variance. Simultaneously, it incorporates the pseudo-anomaly sample features of defect information. Forcibly pushed away from the central area and the normally distributed coverage boundary.

[0076] (4) Residual reconstruction stage:

[0077] This step aims to achieve pixel-level precise localization of defective areas through an efficient information aggregation mechanism. The steps are as follows:

[0078] 1. Feature-level reconstruction: Input the spatially optimized features to be tested into the reconstruction network and calculate the multi-scale residual feature map between the original selected features and the reconstructed features.

[0079] 2. Top-K Key Information Filtering: Considering that full residual calculation will introduce computational noise, this invention performs global max pooling (GMP) and global average pooling (GAP) in parallel on the residual graph.

[0080] 3. GMP is responsible for identifying and responding to the most significant point-like micro-defects; GAP is responsible for capturing regional defects that are widely distributed and have obvious color shifts.

[0081] 4. Information Aggregation: Select the top K key elements with the highest response values ​​from the pooled residual components and perform cascade fusion to construct a fused residual graph, the formula of which is as follows.

[0082] ;

[0083] in, This indicates a channel-level cascading operation, which combines the fused reconstructed residual feature map. The input is mapped back to the image-level resolution by the discriminator to generate a pixel-level anomaly heatmap, and the maximum value in the heatmap is selected as the final anomaly score for the image.

[0084] 5. Anomaly Scoring and Localization: The aggregated residual information is input into the discriminator and mapped back to the original resolution to generate a high signal-to-noise ratio anomaly heatmap. The maximum response value in the heatmap is selected as the final anomaly score for the image. Through Top-K filtering, low-response background redundancy is discarded, achieving precise pixel-level localization of industrial defect areas.

[0085] An industrial anomaly detection system based on pseudo-anomaly feature space optimization includes a pseudo-anomaly data generation module, a multi-scale feature screening module, a center-guided contrastive learning feature space optimization module, and a feature reconstruction and anomaly score calculation module.

[0086] The pseudo-anomaly data generation module constructs an anomaly-driven denoising diffusion probability model to synthesize pseudo-anomaly images in the absence of real defect samples. In the reverse denoising sampling stage, a random perturbation term guided by Berlin noise is introduced to shift the local features generated by the model towards the periphery of the normal distribution, generating pseudo-anomaly samples with realistic physical texture. Training triples are constructed by combining the original normal image with the generated anomaly mask. This provides a benchmark for subsequent feature selection;

[0087] Multi-scale feature selection module: The constructed triples are input into the pre-trained backbone network to extract multi-scale deep features at different spatial resolutions; and a multi-scale feature selection module is designed to calculate the second-order difference map between pseudo-abnormal features and normal features, and measure the consistency of the mapping between the difference map and the corresponding anomalous mask in the spatial dimension, thereby quantifying the defect discrimination power of each feature channel; the feature channels are prioritized according to the selection loss from smallest to largest, and the core feature subset that is highly sensitive to anomalous signals is selected.

[0088] The center-guided contrastive learning feature space optimization module constructs a non-linear projection head at the back end of the feature extraction network to map the selected features to the latent embedding space; and establishes a learnable global normal class center vector in the latent space. Using a center-guided contrastive loss function By imposing spatial constraints, all positive sample features are forced to converge toward the center, while pseudo-abnormal negative sample features are pushed away from the center and surrounding areas. This paradigm clarifies the decision boundary between normal and anomalous distributions.

[0089] Feature reconstruction and anomaly score calculation module: The image to be tested is input into the optimized feature extraction network to obtain the screening features, and the feature reconstruction network reconstructs the features. The reconstruction of normal samples and the reconstruction deviation of abnormal samples are used for discrimination. The multi-scale residual feature map between the original screening features and the reconstructed features is calculated, and global max pooling and global average pooling are performed on the residual map simultaneously to screen the key residual elements with the largest response values. The discriminator maps the fused residual information back to the image-level resolution to generate accurate pixel-level anomaly localization map and image-level anomaly score.

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

Claims

1. An industrial anomaly detection method based on pseudo-anomalous feature space optimization, characterized in that, Includes the following steps: S1. Generating pseudo-anomaly data; An anomaly-driven denoising diffusion probability model AD-DDPM is constructed to synthesize pseudo-anomaly images in the absence of real defect samples. In the reverse denoising sampling stage, a random perturbation term guided by Berlin noise is introduced to shift the local features generated by the model to the periphery of the normal distribution, thereby generating pseudo-anomaly samples with real physical texture. Training triples are constructed by combining the original normal image with the generated abnormal mask. This provides a benchmark for subsequent feature selection. It's a normal image. It is an abnormal image. It is an anomaly mask image obtained by binarizing various abnormal shapes; The anomaly-driven denoising diffusion probability model introduces Berlin noise perturbation in the reverse denoising sampling stage, and its iterative formula is as follows: ; in, For the first Noisy images of the steps, and These are hyperparameters used to control the denoising ratio at each step. For perturbation weights, This is an abnormal mask area. It is the Berlin noise matrix. This represents element-wise multiplication. The parameter is The denoising network at all times Noise residuals predicted based on the current noisy image; False anomaly samples Generated using image blending techniques, the formula is: ; in, These are anomalous images generated by AD-DDPM. It is an anomaly mask image obtained by binarizing various anomaly shapes, and the final anomaly image is obtained. While maintaining the consistency of the normal image background, it includes realistic and diverse abnormal areas; S2. Multi-scale feature filtering; The specific process of multi-scale feature selection by the Multi-Scale Feature Selection Module (MSFS) includes: Extracting the pre-trained backbone network Layer features are used to calculate the second-order difference between the features of the pseudo-anomaly image and the features of the normal image. After upsampling and normalization, a normalized difference map is obtained. ; Calculate the normalized difference plot With the corresponding downsampling anomaly mask Consistent selection loss : ; in, Indicates the characteristic channel, Represents spatial coordinates, Total number of pixels Indicates feature level; According to the choice of loss Sort each feature channel from smallest to largest, and retain the top channels with the smallest loss. Construct an optimal feature index set from each channel; S3. Center-guided contrastive learning feature space optimization; S4. Feature Reconstruction and Anomaly Score Calculation: The image to be tested is input into the optimized feature extraction network to obtain the selected features, and the feature reconstruction network reconstructs the features; the multi-scale residual feature map between the original selected features and the reconstructed features is calculated, and global max pooling and global average pooling are performed on the residual map simultaneously to select the key residual element with the largest response value; the fused residual information is mapped back to the image-level resolution through the discriminator to generate an accurate pixel-level anomaly localization map and an image-level anomaly score.

2. The industrial anomaly detection method based on pseudo-anomaly feature space optimization according to claim 1, characterized in that, The triples constructed in step S1 are input into the pre-trained backbone network to extract multi-scale deep features at different spatial resolutions. A multi-scale feature selection module (MSFS) is designed to quantify the defect discrimination power of each feature channel by calculating the second-order difference map between pseudo-abnormal features and normal features and measuring the consistency of the mapping between the difference map and the corresponding anomalous mask in the spatial dimension. The feature channels are prioritized according to the selection loss from smallest to largest to select the core feature subset that is highly sensitive to anomalous signals.

3. The industrial anomaly detection method based on pseudo-anomaly feature space optimization according to claim 1, characterized in that, Step S3 involves constructing a nonlinear projection head at the back end of the feature extraction network to map the selected features to the latent embedding space. Establish a learnable global normal class center vector in the latent space. Using a center-guided contrastive loss function The spatial constraints are applied, forcing all positive sample features to converge toward the center, while pushing the pseudo-abnormal negative sample features generated in step S1 away from the center and surrounding areas. This paradigm clarifies the decision boundary between normal and anomalous distributions.

4. The industrial anomaly detection method based on pseudo-anomaly feature space optimization according to claim 3, characterized in that, Center-guided contrastive loss function Defined as: ; in, This represents the number of normal samples within the batch. The number of pseudo-anomaly samples generated. These are the projection features of normal samples. The projection features of the generated pseudo-anomaly samples, The learnable global normal class center vector. Represents cosine similarity. Temperature coefficient; The center-guided contrastive loss function forcibly narrows down the features of all normal samples. With global center The distance induces the feature distribution to cluster towards the center, thus significantly reducing the within-class variance; simultaneously, it incorporates the pseudo-anomaly sample features of defect information. Forcibly pushed away from the central area and the normally distributed coverage boundary.

5. The industrial anomaly detection method based on pseudo-anomaly feature space optimization according to claim 1, characterized in that, Step S4, multi-scale feature reconstruction and anomaly score calculation, specifically includes: Calculate the first The residual feature map is obtained by analyzing the residual feature map between the layer-selected features and the reconstructed features. Global max pooling and global average pooling are simultaneously performed on the residual feature map, and the top responses with the largest values ​​are selected respectively. There are n elements, denoted as 1, 2, 3, 4, 5, 6, 7, 8, 9, 1 ...2, 1, 1, 2, 3, 1, 2, 3, and ; The selected features are cascaded and fused to obtain the fused reconstructed residual feature map. Its fusion formula is: ; in, This indicates a channel-level cascading operation.

6. The industrial anomaly detection method based on pseudo-anomaly feature space optimization according to claim 1, characterized in that, Anomaly Score: The aggregated residual information is input into the discriminator and mapped back to the original resolution to generate a high signal-to-noise ratio anomaly heatmap. The maximum response value in the heatmap is selected as the final anomaly score of the image. Through Top-K filtering, low-response background redundancy is discarded, achieving accurate pixel-level localization of industrial defect areas.

7. An industrial anomaly detection system based on pseudo-anomaly feature space optimization, adapted to the method described in any one of claims 1-6, characterized in that, It includes a pseudo-anomaly data generation module, a multi-scale feature filtering module, a center-guided contrastive learning feature space optimization module, and a feature reconstruction and anomaly score calculation module; Pseudo-anomaly data generation module: Constructs an anomaly-driven denoising diffusion probability model to synthesize pseudo-anomaly images in the absence of real defect samples; In the reverse denoising sampling stage, by introducing a random perturbation term guided by Berlin noise, the local features generated by the model are shifted to the periphery of the normal distribution, generating pseudo-anomaly samples with real physical texture. Training triples are constructed by combining the original normal image with the generated abnormal mask. This provides a benchmark for subsequent feature selection; Multi-scale feature selection module: Input the constructed triples into the pre-trained backbone network to extract multi-scale deep features at different spatial resolutions; A multi-scale feature selection module is designed to quantify the defect discrimination power of each feature channel by calculating the second-order difference map between pseudo-abnormal features and normal features and measuring the mapping consistency between the difference map and the corresponding anomalous mask in the spatial dimension. The feature channels are prioritized according to the selection loss from smallest to largest to select the core feature subset that is highly sensitive to anomalous signals. The center-guided contrastive learning feature space optimization module constructs a non-linear projection head at the back end of the feature extraction network to map the selected features to the latent embedding space. Establish a learnable global normal class center vector in the latent space. Using a center-guided contrastive loss function By imposing spatial constraints, all positive sample features are forced to converge toward the center, while pseudo-abnormal negative sample features are pushed away from the center and surrounding areas. This paradigm clarifies the decision boundary between normal and anomalous distributions. Feature reconstruction and anomaly score calculation module: The image to be tested is input into the optimized feature extraction network to obtain the filtered features, and the feature reconstruction network reconstructs the features. The reconstructibility of normal samples and the reconstruction deviation of abnormal samples are used for discrimination. Calculate the multi-scale residual feature map between the original screening features and the reconstructed features, and simultaneously perform global max pooling and global average pooling on the residual map to screen the key residual elements with the largest response values; The discriminator maps the fused residual information back to image-level resolution, generating accurate pixel-level anomaly localization maps and image-level anomaly scores.