Industrial anomaly detection method based on codec architecture
By designing an abnormality detection method based on the codec architecture in industrial abnormality detection, using an abnormality generation algorithm and image feature extraction and fusion method, the problem of limited detection effect of traditional supervised learning methods in the case of rare abnormal samples is solved, and higher detection accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202411924348.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-25
AI Technical Summary
In the field of industrial anomaly detection, traditional supervised learning methods cannot effectively utilize rare anomaly samples due to relying on a large number of labeled samples, resulting in limited detection effects.
An industrial anomaly detection method based on a codec architecture is designed. An abnormality sample is introduced through an exception generation algorithm, and an image feature extraction and fusion method is used to extract advanced features from normal samples as memory information. It combines a multi-scale feature fusion strategy and a semantic transmission model of a generative adversarial network to perform industrial anomaly detection.
It effectively alleviates the problem of uneven positive and negative samples, improves the generalization ability and robustness of the model, enhances the perception ability of small-area anomalies, and improves the accuracy and efficiency of abnormal detection.
Smart Images

Figure CN119863438A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of industrial anomaly detection and relates to an industrial anomaly detection method based on a codec architecture. Background Art
[0002] Industrial anomaly detection has become a vital part of the development of industrial intelligence. In today's fiercely competitive industrial field, product quality is the foundation of enterprises, production efficiency is related to the benefits of enterprises, and production stability is the basis for ensuring the orderly operation of the entire production chain. The core purpose of industrial anomaly detection is to accurately detect and locate the defects that may occur in various industrial products in complex production processes. However, in the actual industrial production environment, normal samples account for the vast majority, while abnormal samples are not only scarce in number, but also have various forms of expression and are unpredictable, which makes the traditional supervised learning method very limited in effect. Traditional supervised learning relies heavily on a large amount of sample data with clear labels for model training, but in the field of industrial anomaly detection, the scarcity of abnormal samples cannot meet the needs of traditional supervised learning. For this reason, the current research direction in this field is mainly focused on self-supervised learning methods to carry out industrial anomaly detection. Self-supervised learning has unique advantages. It does not need to rely on manual labeling of data like traditional supervised learning, but cleverly uses the structural characteristics contained in the data itself and the correlation between data to autonomously generate supervision signals, thereby providing strong support for accurate industrial anomaly detection.
[0003] With the development of deep learning technology, the research on industrial image anomaly detection can be divided into two categories: reconstruction-based methods and embedding-based methods. In current research, most reconstruction-based methods are based on the encoder-decoder architecture to train the network to reconstruct the input image, and the larger the error, the more abnormal the area. OCR-GAN introduces a frequency decoupling module to decouple the input image into different frequency components and reconstruct the image from the frequency perspective. RealNet generates abnormal samples of different degrees based on the diffusion process, integrates feature selection strategy and reconstruction process, and improves the performance of anomaly detection. However, in practical applications, neural networks can also reconstruct abnormal areas well due to their strong learning ability. Embedding-based methods usually use pre-trained networks trained on the ImageNet dataset to extract high-level features from the original image, and calculate the anomaly score by measuring the distance between the test samples and normal samples based on these features to identify abnormal areas. Direct use of pre-trained networks may lead to domain mismatch problems. Patchcore creates a core memory library from the extracted normal features to establish an outlier detection model for anomaly detection. FYD designs a coarse-to-fine feature alignment network to learn the dense and compact feature distribution of normal images. Embedding-based models have been widely used for their simplicity and effectiveness. However, these methods ignore the intrinsic differences between industrial anomaly detection datasets and the ImageNet dataset.
[0004] To address these issues, this method proposes an industrial anomaly detection model. In the training phase, an image processing algorithm is used to add two-dimensional Perlin noise to the images in the MVTec dataset, thereby introducing artificially simulated anomalies to obtain defective sample images, alleviating the deficiency that supervised learning can only use normal samples. In the inference phase of the model, by comparing the differences between the input samples and the memory samples in the memory library, more effective information is provided for the location of abnormal areas. At the same time, an industrial image semantic transmission model based on a generative adversarial network is designed. The image is compressed into low-dimensional latent semantics through the encoding end, which greatly reduces the amount of data transmission while retaining semantic information. The MVTec dataset is a standard dataset for machine vision anomaly detection, containing many different types of industrial product images, such as mechanical parts, electronic components, textiles, etc. The dataset was created and maintained by the machine vision team of the Technical University of Munich in Germany. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide an industrial anomaly detection method based on a codec architecture. In the field of industrial anomaly detection, the present invention designs an industrial anomaly detection method based on a codec architecture. In view of the problem that traditional supervised learning methods cannot be trained when the number of positive and negative samples is extremely unbalanced, an abnormal sample generation method is designed, which uses a two-dimensional Perlin noise generation map and an abnormal texture data set, and uses an image processing algorithm to produce a negative sample data set. Considering the problem that the information in the image cannot be fully utilized during image feature extraction, an image feature extraction and fusion method is designed, and normal samples are randomly selected from each industrial product set as memory samples, and the codec network architecture is used to extract high-level features of the memory samples as memory information to assist in model training. Considering the problem that small-area anomalies are difficult to perceive in the field of industrial anomaly detection, a multi-scale feature fusion strategy is used to fully fuse feature maps with different scales to alleviate the problem of imbalance and prediction of the area between normal and abnormal areas in the image.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] An industrial anomaly detection method based on a codec architecture comprises the following steps:
[0008] S1: The industrial product images in the MVTec dataset are divided into a training set and a test set, and artificially simulated abnormal image blocks are added through an abnormal generation algorithm to produce an abnormal image dataset;
[0009] S2: Randomly select a small number of normal samples from each industrial product set as memory samples, and use the encoder-decoder network architecture to extract high-level features of the memory samples as memory information to assist in model training;
[0010] S3: Use multi-scale feature fusion strategy to fully integrate feature maps with different scales to alleviate the problem of small-area anomalies being difficult to perceive in the field of industrial anomaly detection;
[0011] S4: Use the loss function of the end-to-end industrial anomaly detection model to alleviate the problem of area imbalance and prediction between normal and abnormal areas in the image, while retaining most of the edge information of the resulting segmented image, thereby completing the training of the industrial anomaly detection model;
[0012] S5: We designed an industrial image semantic transmission model based on generative adversarial networks, which compresses the image into low-dimensional semantic information at the encoding end and decodes the semantic information transmitted through the channel at the decoding end to reconstruct a high-quality image.
[0013] Furthermore, the anomaly generation algorithm described in S1 specifically includes:
[0014] S11: Generate a two-dimensional Gaussian noise image P, and then use a randomly uniformly sampled threshold to binarize the image P to obtain a mask image M P ; Perlin noise has multiple random peaks, and the mask image M generated by it P Extract continuous area blocks in the image;
[0015] S12: Binarize the input image I to obtain a mask image I M , and use the image opening and closing operations to remove the noise generated during the binarization process, that is, discrete noise points;
[0016] S13: The two mask images M are obtained by P with I M Perform element-wise multiplication to obtain the final mask image M;
[0017] S14: Obtaining a noise image N I , which is taken from the abnormal texture dataset and is used to simulate the texture anomalies of industrial products;
[0018] S15: The mask image M and the noise image N I Perform element-by-element product to obtain the noise image N I The foreground area in , i.e. the area of the image occupied by the main body of the industrial component;
[0019] S16: Use Formula N I ′=σ(M⊙N I )+(1-σ)(M⊙I), generate a noisy foreground image N I ′; for σ, its value is randomly and uniformly sampled from [0.2, 0.8];
[0020] S17: Invert the mask image M to obtain an image Then the inverted mask image Perform element-wise multiplication with the original image I to obtain image I′;
[0021] S18: According to the formula: The data-enhanced image is obtained by fusing image I and image I′, i.e., the simulated abnormal image I A ;I A Take the original input image I as the background and the noise image N extracted by the mask image M I The industrial products area in the foreground.
[0022] Furthermore, in S2, an encoder-decoder network architecture is used to extract high-level features of the memory sample as memory information, specifically including:
[0023] S21: In order to obtain memory information, firstly, N normal images are randomly selected from each category in the training data as memory samples and input into the encoder;
[0024] S22: Obtain features with different resolution sizes from the first, second, and third layers of the pre-trained ResNet50 network on the ImageNet dataset, and together form a memory information library;
[0025] S23: Freeze the model parameters of the first, second, and third layers of the network in ResNet50 to obtain information and high-level features of the input image and the memory sample image;
[0026] S24: For the input image in the training stage, the encoder directly extracts the high-level features of the input image, and obtains feature maps with different resolution sizes through the first, second and third layers of the network; these three feature maps with different resolutions store different scale semantic information of the input image II;
[0027] S25: Calculate the L2 distance between the input image II information and the memory image MI information at different resolutions to obtain the difference information DI between the input image and the memory sample: Where N is the number of memory samples; the difference information DI records the similarities and differences between the input image and the memory samples;
[0028] S26: For N differential information, the minimum sum of all elements in each DI is used as the standard to obtain the optimal differential information DI′ between II and MI, that is: Where i∈[1, N]; the best difference information DI′ contains the difference between the input sample and its most similar memory sample;
[0029] S27: The best differential information DI′ is added to the high-level features extracted by the encoder to obtain the concatenated information CI 1 , CI 2 and CI 3 .
[0030] Furthermore, in S3, a multi-scale feature fusion strategy is used to fully fuse feature maps with different scales, specifically including:
[0031] S31: For CI 1 , CI 2 and CI 3 The features of three different dimensions are processed through 3×3 convolution blocks and reverse convolution operations while maintaining the number of channels to obtain feature maps with different resolution sizes;
[0032] S32: for the feature maps obtained in S31, align the dimensions by upsampling respectively, so that the dimensions of the three feature maps are the dimensions of the largest feature map;
[0033] S33: Use convolution to align the three feature maps with the same dimension in terms of the number of channels, so that the dimensions and number of channels of the three feature maps are the same, so as to facilitate the subsequent addition operation;
[0034] S34: perform element-by-element addition operation on the feature map obtained in S33 to achieve multi-scale feature fusion, and transmit it to the industrial anomaly detection discriminator.
[0035] Furthermore, in S4, the problem of imbalance and prediction of the area between normal and abnormal regions in the image is alleviated, and the loss function of the end-to-end industrial anomaly detection model is defined as:
[0036]
[0037] The loss function of the end-to-end industrial anomaly detection model is a fusion of the L2 loss function and the focal loss function, where p and are the groundtruth image and the model inference image respectively; 1 and λ 2 It is a balancing hyperparameter that controls the fusion of the L2 loss function and the focal loss function; α is a balancing factor used to adjust the influence between positive and negative samples; γ is a focal factor used to adjust the weight of abnormal areas in the sample image.
[0038] Further, in S5, the image is compressed into semantic information at the encoding end, and the semantic information transmitted through the channel is decoded at the decoding end to reconstruct a high-quality image, which specifically includes:
[0039] S51: The structure of the semantic encoder is an autoencoder network architecture. The input image is processed by the semantic encoder, and the high-dimensional image information is calculated to obtain the low-dimensional semantic information. The mathematical expression of the encoding process is as follows:
[0040] y i =f θ (x) = h(Ax + b)
[0041] where y i is the output of semantic encoding, θ = (A, b) is the parameter of the encoder network, h is the activation function, A is the weight matrix, x is the input image, and b is the bias vector;
[0042] S52: After performing LDPC channel coding on the low-dimensional semantic information calculated in S51, the information is transmitted through the physical channel. In the model training stage, the additive white Gaussian noise model is selected as the simulation channel model for training. The mathematical expression of the coding process is as follows:
[0043]
[0044] Among them is the output of LDPC channel coding, e is the channel gain, and n is the additive white Gaussian noise;
[0045] S51: Use the original image x and the generated image y at the same time to train a semantic decoder based on the generative adversarial network architecture; through the training of the semantic decoder, the features of the original image distribution can be effectively extracted to reconstruct the original image x.
[0046] The beneficial effects of the present invention are:
[0047] (1) Through the anomaly generation algorithm, we use the two-dimensional Perlin noise and anomaly texture datasets to artificially simulate abnormal images, which effectively alleviates the problem of extremely unbalanced number of positive and negative samples in the field of industrial anomaly detection, provides more training data for the anomaly detection model based on supervised learning, and improves the generalization ability and robustness of the model.
[0048] (2) Through image feature extraction and fusion methods, high-level features are extracted from normal samples as memory information and fused with the features of the input image, which effectively utilizes the information in the input image, improves the feature expression ability of the model, and enhances the model's anomaly detection ability.
[0049] (3) Through the multi-scale feature fusion strategy, feature maps with different scales are fully integrated, semantic information of different scales is effectively integrated, the model's perception ability of small-area anomalies is improved, and the challenge of small-area anomalies being difficult to capture in the field of industrial anomaly detection is solved.
[0050] (4) Through the loss function of the end-to-end industrial anomaly detection model, the problem of area imbalance and prediction between normal and abnormal areas in the image is alleviated, while most of the edge information of the segmented image is retained, thereby improving the quality and accuracy of the segmented image.
[0051] (5) Through the industrial image semantic transmission model based on generative adversarial networks, the image is compressed into low-dimensional semantic information, which greatly reduces the data transmission volume while retaining the semantic information. It is suitable for the actual situation of poor communication signals, strong channel interference, and low bandwidth in complex industrial scenarios, and improves the real-time performance and efficiency of the anomaly detection model.
[0052] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0054] Figure 1 The present invention is a flowchart of an industrial anomaly detection method based on a codec architecture;
[0055] Figure 2 The industrial image semantic transfer model diagram based on generative adversarial network designed for this invention;
[0056] Figure 3 A diagram of an industrial anomaly detection model based on a codec architecture provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0058] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0059] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0060] like Figure 1 Shown is a detection flow chart of an industrial anomaly detection method based on a codec architecture.
[0061] in Figure 2 Shown is a diagram of an abnormal sample generation method combined with two-dimensional Perlin noise.
[0062] Figure 3 The following is a diagram of an industrial anomaly detection model based on a codec architecture, which includes the following steps:
[0063] S1: The industrial product images in the MVTec dataset are divided into a training set and a test set, and artificially simulated abnormal image blocks are added through an abnormal generation algorithm to produce an abnormal image dataset;
[0064] S2: Randomly select a small number of normal samples from each industrial product set as memory samples, and use the encoder-decoder network architecture to extract high-level features of the memory samples as memory information to assist in model training.
[0065] S3: Use a multi-scale feature fusion strategy to fully fuse feature maps with different scales to alleviate the problem of small-area anomalies being difficult to perceive in the field of industrial anomaly detection.
[0066] S4: Use the loss function of the end-to-end industrial anomaly detection model to alleviate the problem of area imbalance and prediction between normal and abnormal areas in the image, while retaining most of the edge information of the resulting segmented image, thereby completing the training of the industrial anomaly detection model.
[0067] S5: We designed an industrial image semantic transmission model based on generative adversarial networks, which compresses the image into low-dimensional semantic information at the encoding end and decodes the semantic information transmitted through the channel at the decoding end to reconstruct a high-quality image.
[0068] The anomaly generation algorithm described in S1 specifically includes:
[0069] S11: Generate a two-dimensional Gaussian noise image P, and then use a randomly uniformly sampled threshold to binarize the image P to obtain a mask image M P Perlin noise has multiple random peaks, and the mask image M generated by it P Continuous area blocks in the image can be extracted.
[0070] S12: Binarize the input image I to obtain a mask image I M , and use the image opening and closing operations to remove the noise generated in the binarization process, that is, discrete noise points.
[0071] S13: The two mask images M are obtained by P with I M Perform element-wise multiplication to obtain the final mask image M.
[0072] S14: Obtaining a noise image NI , which is taken from the abnormal texture dataset and is used to simulate the texture anomalies of industrial products.
[0073] S15: The mask image M and the noise image N I Perform element-by-element product to obtain the noise image N I The foreground area in the image is the area of the image occupied by the main body of the industrial component.
[0074] S16: Use Formula N I ′=σ(M⊙N I )+(1-σ)(M⊙I), generate a noisy foreground image N I ′. For σ, its value is randomly and uniformly sampled from [0.2, 0.8].
[0075] S17: Invert the mask image M to obtain an image Then the inverted mask image Perform element-wise multiplication with the original image I to obtain image I′.
[0076] S18: According to the formula: The data-enhanced image is obtained by fusing image I and image I′, i.e., the simulated abnormal image I A I A Take the original input image I as the background and the noise image N extracted by the mask image M I The industrial products area in the foreground.
[0077] S2 uses an encoder-decoder network architecture to extract high-level features of memory samples as memory information, including:
[0078] S21: In order to obtain memory information, first randomly select N normal images from each category in the training data as memory samples and input them into the encoder.
[0079] S22: Features with different resolution sizes are obtained from the first, second, and third layers of the pre-trained ResNet50 network on the ImageNet dataset, and together they constitute a memory information library.
[0080] S23: Freeze the model parameters of the first, second, and third network layers in ResNet50 to obtain information and high-level features of the input image and the memory sample image.
[0081] S24: For the input image in the training stage, the encoder directly extracts the high-level features of the input image, and obtains feature maps with different resolution sizes through the first, second and third layers of the network. These three feature maps with different resolutions store different scale semantic information of the input image II.
[0082] S25: Calculate the L2 distance between the input image II information and the memory image MI information at different resolutions to obtain the difference information DI between the input image and the memory sample: Where N is the number of memory samples. The difference information DI records the similarities and differences between the input image and the memory samples.
[0083] S26: For N differential information, the minimum sum of all elements in each DI is used as the standard to obtain the optimal differential information DI′ between II and MI, that is: Where i∈[1,N]. The best difference information DI′ contains the difference between the input sample and its most similar memory sample.
[0084] S27: The best differential information DI′ is added to the high-level features extracted by the encoder to obtain the concatenated information CI 1 , CI 2 and CI 3 .
[0085] S3 uses a multi-scale feature fusion strategy to fully fuse feature maps with different scales, including:
[0086] S31: For CI 1 , CI 2 and CI 3 Features of three different dimensions are obtained through 3×3 convolution blocks and reverse convolution operations while maintaining the number of channels to obtain feature maps with different resolution sizes.
[0087] S32: For the feature maps obtained in S31, upsampling is used to align the dimensions so that the dimensions of the three feature maps are the dimensions of the largest feature map.
[0088] S33: Use convolution to align the three feature maps with the same dimension in terms of the number of channels, so that the dimensions of the three feature maps are the same as the number of channels, so as to facilitate the subsequent addition operation.
[0089] S34: perform element-by-element addition operation on the feature map obtained in S33 to achieve multi-scale feature fusion, and transmit it to the industrial anomaly detection discriminator.
[0090] The loss function of the end-to-end industrial anomaly detection model is defined as:
[0091]
[0092] The loss function of the end-to-end industrial anomaly detection model is a fusion of the L2 loss function and the focal loss function, where p and are the groundtruth image and the model inference image respectively; 1 and λ2 It is a balancing hyperparameter that controls the fusion of the L2 loss function and the focal loss function; α is a balancing factor used to adjust the influence between positive and negative samples; γ is a focal factor used to adjust the weight of abnormal areas in the sample image.
[0093] S5 compresses the image into semantic information at the encoding end, decodes the semantic information transmitted through the channel at the decoding end, and reconstructs a high-quality image, including:
[0094] S51: The structure of the semantic encoder is an autoencoder network architecture. The input image is processed by the semantic encoder, and the high-dimensional image information is calculated to obtain the low-dimensional semantic information. The mathematical expression of the encoding process is as follows:
[0095] y i =f θ (x) = h(Ax + b)
[0096] where y i is the output of the semantic code, θ = (A, b) is the parameter of the encoder network, h is the activation function, A is the weight matrix, x is the input image, and b is the bias vector.
[0097] S52: After performing LDPC channel coding on the low-dimensional semantic information calculated in S51, the information is transmitted through the physical channel. In the model training stage, the additive white Gaussian noise model is selected as the simulation channel model for training. The mathematical expression of the coding process is as follows:
[0098]
[0099] Among them is the output of LDPC channel coding, e is the channel gain, and n is the additive white Gaussian noise.
[0100] S51: Using the original image x and the generated image y at the same time, train a semantic decoder based on the generative adversarial network architecture. Through the training of the semantic decoder, the features of the original image distribution can be effectively extracted to reconstruct the original image x.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. An industrial anomaly detection method based on a codec architecture, characterized in that: The following steps are involved: S1: The industrial product images in the MVTec dataset are divided into a training set and a test set, and artificially simulated abnormal image blocks are added through an abnormal generation algorithm to produce an abnormal image dataset; S2: Randomly select a small number of normal samples from each industrial product set as memory samples, and use the encoder-decoder network architecture to extract high-level features of the memory samples as memory information to assist in model training; S3: Use multi-scale feature fusion strategy to fully integrate feature maps with different scales to alleviate the problem of small-area anomalies being difficult to perceive in the field of industrial anomaly detection; S4: Use the loss function of the end-to-end industrial anomaly detection model to alleviate the problem of area imbalance and prediction between normal and abnormal areas in the image, while retaining most of the edge information of the resulting segmented image, thereby completing the training of the industrial anomaly detection model; S5: We designed an industrial image semantic transmission model based on generative adversarial networks, which compresses the image into low-dimensional semantic information at the encoding end and decodes the semantic information transmitted through the channel at the decoding end to reconstruct a high-quality image.
2. The industrial anomaly detection method based on codec architecture according to claim 1, characterized in that: The anomaly generation algorithm described in S1 specifically includes: S11: Generate a two-dimensional Gaussian noise image P, and then use a randomly uniformly sampled threshold to binarize the image P to obtain a mask image M P ; Perlin noise has multiple random peaks, and the mask image M generated by it P Extract continuous area blocks in the image; S12: Binarize the input image I to obtain a mask image I M , and use the image opening and closing operations to remove the noise generated during the binarization process, that is, discrete noise points; S13: The two mask images M are obtained by P with I M Perform element-wise multiplication to obtain the final mask image M; S14: Obtaining a noise image N I , which is taken from the abnormal texture dataset and is used to simulate the texture anomalies of industrial products; S15: Combine the mask image M and the noise image N I Perform element-by-element product to obtain the noise image N I The foreground area in , i.e. the area of the image occupied by the main body of the industrial component; S16: Use Formula N I ′=σ(M⊙N I )+(1-σ)(M⊙I), generate a noisy foreground image N I ′; for σ, its value is randomly and uniformly sampled from [0.2, 0.8]; S17: invert the mask image M to obtain image M, and then perform element-by-element product of the inverted mask image M and the original image I to obtain image I′; S18: According to the formula: The data-enhanced image is obtained by fusing image I and image I′, i.e., the simulated abnormal image I A ;I A Take the original input image I as the background and the noise image N extracted by the mask image M I The industrial products area in the foreground.
3. The industrial anomaly detection method based on codec architecture according to claim 1, characterized in that: In S2, an encoder-decoder network architecture is used to extract high-level features of the memory sample as memory information, specifically including: S21: In order to obtain memory information, firstly, N normal images are randomly selected from each category in the training data as memory samples and input into the encoder; S22: Obtain features with different resolution sizes from the first, second, and third layers of the pre-trained ResNet50 network on the ImageNet dataset, and together form a memory information library; S23: Freeze the model parameters of the first, second, and third layers of the network in ResNet50 to obtain information and high-level features of the input image and the memory sample image; S24: For the input image in the training stage, the encoder directly extracts the high-level features of the input image, and obtains feature maps with different resolution sizes through the first, second and third layers of the network; these three feature maps with different resolutions store different scale semantic information of the input image II; S25: Calculate the L2 distance between the input image II information and the memory image MI information at different resolutions to obtain the difference information DI between the input image and the memory sample: Where N is the number of memory samples; the difference information DI records the similarities and differences between the input image and the memory samples; S26: For N differential information, the minimum sum of all elements in each DI is used as the standard to obtain the optimal differential information DI′ between II and MI, that is: Where i∈[1, N]; the best difference information DI′ contains the difference between the input sample and its most similar memory sample; S27: The optimal differential information DI′ is added to the high-level features of the input image II extracted by the encoder to obtain series information CI1, CI2 and CI3.
4. The industrial anomaly detection method based on codec architecture according to claim 1, characterized in that: In S3, a multi-scale feature fusion strategy is used to fully fuse feature maps with different scales, specifically including: S31: For features of three different dimensions, CI1, CI2 and CI3, a 3×3 convolution block and a reverse convolution operation are performed while maintaining the number of channels to obtain feature maps with different resolution sizes. S32: for the feature maps obtained in S31, align the dimensions by upsampling respectively, so that the dimensions of the three feature maps are the dimensions of the largest feature map; S33: Use convolution to align the three feature maps with the same dimension in terms of the number of channels, so that the dimensions and number of channels of the three feature maps are the same, so as to facilitate the subsequent addition operation; S34: perform element-by-element addition operation on the feature map obtained in S33 to achieve multi-scale feature fusion, and transmit it to the industrial anomaly detection discriminator.
5. The industrial anomaly detection method based on codec architecture according to claim 1, characterized in that: In S4, the problem of imbalance and prediction of the area between normal and abnormal areas in the image is alleviated, and the loss function of the end-to-end industrial anomaly detection model is defined as: The loss function of the end-to-end industrial anomaly detection model is a fusion of the L2 loss function and the focal loss function, where p and are the groundtruth image and the model inference image respectively; λ1 and λ2 are the balancing hyperparameters that control the fusion of the L2 loss function and the focal loss function; α is the balancing factor used to adjust the influence between positive and negative samples; γ is the focal factor used to adjust the weight of the abnormal area in the sample image.
6. The industrial anomaly detection method based on codec architecture according to claim 1, characterized in that: In S5, the image is compressed into semantic information at the encoding end, and the semantic information transmitted through the channel is decoded at the decoding end to reconstruct a high-quality image, which specifically includes: S51: The structure of the semantic encoder is an autoencoder network architecture. The input image is processed by the semantic encoder, and the high-dimensional image information is calculated to obtain the low-dimensional semantic information. The mathematical expression of the encoding process is as follows: y i =f θ (x)=h(Ax+b) where y i is the output of semantic encoding, θ = (A, b) is the parameter of the encoder network, h is the activation function, A is the weight matrix, x is the input image, and b is the bias vector; S52: After performing LDPC channel coding on the low-dimensional semantic information calculated in S51, the information is transmitted through the physical channel. In the model training stage, the additive white Gaussian noise model is selected as the simulation channel model for training. The mathematical expression of the coding process is as follows: Among them is the output of LDPC channel coding, e is the channel gain, and n is the additive white Gaussian noise; S51: Use the original image x and the generated image y at the same time to train a semantic decoder based on the generative adversarial network architecture; through the training of the semantic decoder, the features of the original image distribution can be effectively extracted to reconstruct the original image x.
Citation Information
Patent Citations
End-to-end semi-supervised image surface defect detection method based on memory information
CN114677346A
Industrial product surface defect detection and positioning method and system based on generality and difference
CN115439442A
Welding quality anomaly detection method based on anomaly simulation
CN116580030A
Industrial product surface defect detection method based on memory information
CN118333981A
Cited By
Anomaly detection method and system based on RGB-D fusion and dual-time flow feature learning
CN121074851A
Abnormality detection method and system based on RGB-D fusion and double time flow feature learning
CN121074851B