Defect detection method, system, device and computer-readable storage medium

Through the feature space defect editing strategy described by unsupervised defect detection network and support vector data, the problems of high cost and low efficiency in the existing technology are solved, and fast and accurate industrial parts defect detection is achieved.

CN118279280BActive Publication Date: 2025-08-26INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410477675.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-19
Publication Date
2025-08-26
Estimated Expiration
2044-04-19

AI Technical Summary

Technical Problem

The prior art relies on supervised learning to require a large number of pre-noted defect images, resulting in high production costs and difficulty in quickly adapting to new defect types, traditional manual detection is inefficient and limited accuracy.

Method used

Unsupervised defect detection network is adopted, and the binary cross entropy loss and Euclidean distance loss of normal features and synthetic defect features are trained through feature extractors, feature mappers and feature discriminators. Artificial defect data are generated by combining the feature space defect editing strategy described by support vector data to avoid real sample annotation.

Benefits of technology

No real defect sample annotation is required, which improves detection speed and accuracy, can quickly identify various significant and minor defects, and simplifies deployment difficulty and inference speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118279280B_ABST
    Figure CN118279280B_ABST
Patent Text Reader

Abstract

The present invention relates to the fields of deep learning and industrial appearance quality inspection technology, and discloses a defect detection method, system, device, and computer-readable storage medium; wherein the defect detection system uses an unsupervised defect detection network, which includes a feature extractor, a feature mapper, and a feature discriminator connected in sequence; during training, the overall training objectives of the unsupervised defect detection network include the binary cross entropy loss of normal features and synthetic defect features, and the Euclidean distance loss between the mapped normal features and the feature center; the synthetic defect features are obtained using a feature space defect editing strategy based on support vector data description. The present invention solves the technical defects of the prior art that constructs a training set by pre-labeling defect images, and solves the technical problem of low efficiency of abnormal data synthesis-assisted unsupervised defect detection in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning and industrial appearance quality inspection technology, and in particular to a defect detection method, system, device and computer-readable storage medium. Background Art

[0002] In traditional manufacturing, surface defects in industrial parts are crucial, with product quality directly impacting a company's market competitiveness and economic profitability. These defects are often caused by mechanical failure, improper machining, or mishandling of materials, resulting in very subtle and difficult-to-detect visual defects. Surface defect detection has long relied primarily on manual visual inspection, a method that is not only inefficient but also limited in accuracy by subjective judgment and fatigue, limiting product quality and production efficiency.

[0003] Currently, deep learning-based surface defect detection technologies have been proposed and applied. However, most existing methods rely on supervised learning and require a large number of pre-labeled defect images to construct training sets. This pixel-level labeling not only significantly increases production costs but also prolongs the project's initial preparation phase. Furthermore, in real-world production environments, new defect types can emerge at any time, making it difficult for existing supervised learning methods to quickly adapt and detect these unknown defect types. Summary of the Invention

[0004] The purpose of the present invention is to provide a defect detection method, system, device, and computer-readable storage medium to address one or more of the above-mentioned technical problems. The technical solution provided by the present invention eliminates the need to rely on the annotation of real defect samples, resolving the technical drawbacks of the prior art of constructing a training set by pre-annotating defect images. Furthermore, the present invention utilizes a simpler unsupervised defect detection network, significantly improving detection speed while ensuring detection accuracy, thus resolving the technical issue of low efficiency in prior art unsupervised defect detection assisted by abnormal data synthesis.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention provides a defect detection system, wherein the defect detection system adopts an unsupervised defect detection network, wherein the unsupervised defect detection network includes a feature extractor, a feature mapper, and a feature discriminator connected in sequence;

[0007] The feature extractor is used to input the image to be defect detected and output multi-layer fusion features; the feature mapper is used to input the multi-layer fusion features and output fusion features that eliminate deviations; the feature discriminator is used to input the fusion features that eliminate deviations and output a segmentation result as a defect detection result;

[0008] in,

[0009] During training, the overall training objectives of the unsupervised defect detection network include binary cross entropy loss between normal features and synthetic defect features, and Euclidean distance loss between mapped normal features and feature centers;

[0010] The synthetic defect features are obtained by adopting a feature space defect editing strategy based on support vector data description.

[0011] A further improvement of the defect detection system of the present invention is that:

[0012] The training steps of the unsupervised defect detection network specifically include:

[0013] Normal samples are used for training, and the multi-layer fused normal features are obtained through the feature extractor. The normal features with eliminated deviations are then obtained through the feature mapper. Finally, the normal sample discrimination loss is output through the feature discriminator. In addition, based on the normal features with eliminated deviations, the feature space defect editing strategy is adopted to obtain the defect features with introduced anomalies, and then the synthetic defect discrimination loss is output through the feature discriminator.

[0014] A further improvement of the defect detection system of the present invention is that:

[0015] Before the unsupervised defect detection network training begins, feature center initialization is performed; wherein,

[0016] The steps for initializing the feature center specifically include: iteratively updating the initial center vector by traversing all batches of normal samples, and finally determining and outputting the initialized center vector; wherein, for the first batch of normal samples, use the feature extractor and feature mapper to obtain unbiased normal features, and set the average value of the feature map as the initial value of the center vector; for subsequent batches of normal samples, first use the feature extractor and feature mapper to obtain unbiased normal features, then calculate the similarity between the obtained features and the current center vector, find the closest center feature point, and finally update the center vector by averaging each center feature point with the same index; after traversing all batches of normal samples, determine and output the initialized center vector.

[0017] A further improvement of the defect detection system of the present invention is that:

[0018] The step of using a feature space defect editing strategy to obtain defect features that introduce abnormalities based on normal features that eliminate deviations specifically includes:

[0019] Calculate and obtain the center vector that is most similar to the mapped normal feature;

[0020] Get the unit vector by passing the center vector to the direction vector of the normal feature;

[0021] Taking the normal feature as the starting point and the unit vector as the direction, the abnormal feature is controllably synthesized according to a fixed step size.

[0022] A further improvement of the defect detection system of the present invention is that:

[0023] The step size is proportional to the average distance between normal features and the center vector within a single batch.

[0024] A further improvement of the defect detection system of the present invention is that:

[0025] In the feature extractor, the steps of inputting an image to be inspected for defects and outputting multi-layer fusion features specifically include: using a pre-trained backbone network to extract features of different levels from the input image, performing average neighborhood aggregation on each layer of features to embed neighborhood information, merging the neighborhood embedded features in the channel dimension, and obtaining and outputting multi-layer fusion features.

[0026] A further improvement of the defect detection system of the present invention is that:

[0027] The step of outputting the segmentation result as the defect detection result specifically includes:

[0028] Outputting the post-processed segmentation result as a defect detection result of the image to be defect detected;

[0029] in,

[0030] Post-processing involves upsampling and Gaussian smoothing the output to match the original image size and reduce noise;

[0031] The image-level defect detection result is given by the maximum confidence value of the entire image.

[0032] A second aspect of the present invention provides a defect detection method, comprising:

[0033] Acquire an image to be inspected for defects;

[0034] Based on the image to be defect-detected, defect detection is performed using the defect detection system described in the first aspect of the present invention to obtain and output defect detection results.

[0035] According to a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the defect detection method according to the second aspect of the present invention is implemented.

[0036] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the defect detection method according to the second aspect of the present invention is implemented.

[0037] Compared with the prior art, the present invention has the following beneficial effects:

[0038] The present invention provides a defect detection system, specifically an industrial parts defect detection system based on abnormal feature editing. Its synthetic defect features are obtained using a feature space defect editing strategy based on support vector data description. The abnormal feature editing technology is used to generate artificial defect data to assist defect detection at the feature level, thereby eliminating the need to rely on real defect sample annotation, solving the technical defects of the prior art that construct a training set by pre-annotating defect images. In addition, the present invention adopts an unsupervised defect detection network including a feature extractor, a feature mapper, and a feature discriminator, and is trained based on the binary cross entropy loss of normal features and synthetic defect features, and the Euclidean distance loss between the mapped normal features and the feature center. The model structure is simpler, can effectively identify various significant defects, and improve the detection accuracy of minor defects. It overcomes the limitations of traditional manual detection methods and can significantly improve the detection speed while ensuring detection accuracy. It solves the technical problem of low efficiency of abnormal data synthesis-assisted unsupervised defect detection in the prior art. Further specifically, in the unsupervised defect detection network architecture disclosed in the present invention, the feature discriminator directly provides the defect location result. In the inference stage, there is no need to read the normal features used for comparison into memory, thereby accelerating the inference speed and reducing the deployment difficulty.

[0039] In the present invention, a feature space defect editing strategy based on support vector data description is disclosed, which synthesizes defects near normal features in a controllable manner, making the model easier to detect subtle defects on the surface of industrial parts. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below; obviously, the drawings described below are some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 4 is a flow chart of the unsupervised defect detection network inference phase in an embodiment of the present invention.

[0042] Figure 2 4 is a flow chart of the unsupervised defect detection network training phase in an embodiment of the present invention.

[0043] Figure 3 4 is a flow chart of initializing a normal feature center vector in an embodiment of the present invention.

[0044] Figure 44 is a flow chart of a feature space defect editing strategy in an embodiment of the present invention.

[0045] Figure 5 3 is a scatter plot comparing the detection speed and detection accuracy of different methods in an embodiment of the present invention.

[0046] Figure 6 It is a flowchart of a defect detection method in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0048] See also Figure 1 In an embodiment of the present invention, a defect detection system is provided, which may be specifically an industrial parts defect detection system based on abnormal feature editing. The defect detection system adopts an unsupervised defect detection network, which mainly includes a feature extractor, a feature mapper, and a feature discriminator connected in sequence;

[0049] The feature extractor is used to input the image to be defect-detected and output the corresponding multi-layer fusion features; the feature mapper is used to input the multi-layer fusion features and output the features that eliminate the deviation; the feature discriminator is used to input the features that eliminate the deviation and output the post-processed segmentation results as the defect detection results of the image to be defect-detected;

[0050] The overall training objectives of the unsupervised defect detection network during training include the binary cross entropy loss of normal features and synthetic defect features, and the Euclidean distance loss between the mapped normal features and the feature centers; the synthetic defect features are obtained using a feature space defect editing strategy based on support vector data description.

[0051] The defect detection system provided by the embodiment of the present invention uses abnormal feature editing technology to generate artificial defect data, assisting defect detection at the feature level, without relying on the labeling of real defect samples, solving the technical defects brought about by the existing technology of constructing a training set by pre-labeling defect images; it adopts an unsupervised defect detection network with a simpler structure, which can significantly improve the detection speed while ensuring detection accuracy, solving the technical problem of low efficiency of abnormal data synthesis-assisted unsupervised defect detection in the existing technology.

[0052] Example explanatory, the above-mentioned feature extractor is used to integrate multi-level features of the image. Multi-level features generally refer to information extracted from multiple different levels of abstraction of the image. These features can capture the local details and global structure of the image; the feature extractor can be implemented by a convolutional neural network (CNN) or other types of network structures, and the feature representation of the image is extracted through operations such as convolution and pooling.

[0053] In a specific exemplary embodiment, the feature extractor is a convolutional deep neural network pre-trained on a large image dataset; during the training phase, only normal samples are used for training. In a further preferred embodiment, the present invention uses a pre-trained feature extractor to initially extract important features from industrial part images: first, a pre-trained backbone network is used to extract features at different levels from the input image; second, average neighborhood aggregation is performed on each layer of features to embed neighborhood information; finally, these neighborhood embedded features are merged in the channel dimension to obtain multi-layer fused normal features. This method disclosed by the present invention effectively utilizes the multi-scale information of the image and enhances the expressive power of the features.

[0054] Example Explanation: The above-mentioned feature mapper will further process the extracted multi-level features to eliminate domain bias (explanation: domain bias usually refers to the difference between training data and test data due to different sources or conditions); the goal of the feature mapper is to map these features from the original domain to a new domain, so that the features of the test image are closer to the training data, thereby improving the performance of the model on the test data.

[0055] In a specific exemplary scheme, the present invention re-projects features through a feature mapper to eliminate domain bias that may be introduced by the pre-trained network; at the same time, in order to make the distribution of the extracted normal feature vectors as compact as possible, the Euclidean distance loss between the mapped normal features and the feature center is introduced. The trained feature mapper can project normal samples in the original space to the vicinity of the corresponding center point in the feature space, while the defective features will be far away from the center point.

[0056] See also Figure 2 , Figure 2Specifically, the process of the unsupervised defect detection network training phase is shown. Normal samples are used for training. A feature extractor obtains multi-layer fused normal features. A feature mapper then obtains debiased normal features. Finally, a feature discriminator outputs a normal sample discrimination loss. Furthermore, based on the debiased normal features, a feature space defect editing strategy is used to obtain anomaly-introduced defect features. The feature discriminator then outputs a composite defect discrimination loss.

[0057] Among them, the overall training objective includes three parts: binary cross entropy loss between normal features and synthetic defect features, and Euclidean distance loss between mapped normal features and feature centers, in order to optimize the network's defect detection ability.

[0058] See also Figure 3 , Figure 3 A process for initializing a normal feature center vector is specifically shown, including: before training begins, iteratively updating the initial center vector by traversing all batches of normal samples; first, for the first batch of normal samples, unbiased normal features are obtained using a feature extractor and a feature mapper, and the average value of these feature maps is set as the initial value of the center vector; second, for subsequent batches of normal samples, normal features are first obtained in the same way, and then the similarity between these features and the current center vector is calculated to find the closest center feature point; finally, the center vector is updated by averaging each center feature point with the same index; after traversing all batches, the initialized center vector is finally determined and output.

[0059] See also Figure 4 , Figure 4 The proposed feature space defect editing strategy involves calculating the most similar center vector for the mapped normal feature. Secondly, the unit vector is obtained by mapping the center vector to the normal feature. Finally, starting from the normal feature, the abnormal feature is synthesized along the direction of the unit vector with a fixed controllable step size. Specifically, the step size is proportional to the average distance between the normal feature and the center vector within a single batch.

[0060] In the technical solution of the embodiment of the present invention, the synthetic defect features are obtained by using a feature space defect editing strategy based on support vector data description. The feature space defect editing strategy based on support vector data description synthesizes defects near normal features in a strong and weak controllable manner, making it easier for the model to detect weak defects on the surface of industrial parts. The present invention proposes a feature space defect editing strategy based on support vector data description. By editing normal features to obtain effective abnormal features, the overfitting phenomenon of the feature mapper projecting all normal sample points to one point is avoided. Since the normal features are constrained within the hypersphere, the strategy of the present invention can controllably synthesize abnormal sample features. Finally, since the hypersphere classification surface given by the distance constraint is too loose, the present invention uses a feature discriminator to further optimize the classification boundary. The feature discriminator directly evaluates the abnormality confidence for each feature point, and these confidences and the defect labels are jointly involved in the calculation of the binary classification loss.

[0061] In the technical solution provided by the embodiment of the present invention, the feature mapper and the feature discriminator are multi-layer neural networks with simple structures. In the inference stage, the feature extractor is first used to integrate the multi-level features of the test image, and then these features are re-projected through the feature mapper to eliminate domain bias. Finally, these processed test features are input into the feature discriminator to directly obtain the segmentation result. Therefore, the inference stage of the present invention does not need to read the center vector, which speeds up the inference speed and reduces the deployment difficulty. In order to optimize the quality of defect positioning, the output results are upsampled and Gaussian smoothed to match the original image size and reduce noise; in addition, the image-level defect detection result is given by the maximum value of the confidence of the entire image.

[0062] The goal of unsupervised defect detection is to identify defective samples and accurately locate defective areas by using only normal samples. This method has been widely used in situations where the frequency of defects is low and data collection is extremely difficult. Current unsupervised defect detection methods can be roughly divided into three types: the first is an unsupervised defect detection method based on image reconstruction, which aims to use the reconstruction model to correctly reconstruct normal areas and fail to reconstruct abnormal areas, and detect defects by analyzing the differences before and after the reconstructed images; the second is an unsupervised defect detection method based on feature embedding, which uses a pre-trained network to extract features and compresses normal features into a compact space to detect defect features that are far away in the feature space; the third is an unsupervised defect detection method based on synthetic anomalies, which uses normal samples to perform data enhancement at the image level or feature level, and introduces anomaly discrimination information to further improve the accuracy of defect detection. Specifically, for example, Chinese invention application number 202211388657.0 discloses a multi-scale industrial part defect detection method based on a generative adversarial network. It proposes an industrial part defect detection method that utilizes a generative adversarial network and combines it with a multi-scale image information fusion module. This method can efficiently identify and locate surface defects on parts while improving the image translation quality and learning efficiency of the model. However, it only uses positive sample training and lacks abnormal discrimination information for artificial defects. Chinese invention application number 202310109015.0 discloses an industrial part defect detection method, system, and electronic device based on deep learning. This method integrates a convolutional neural network and a Transformer architecture for industrial part defect detection. Through a parallel branch design, it achieves high-precision defect detection and fast model training and inference. However, due to the complexity of its architecture, it significantly increases the model's inference time and the computing power required for deployment.

[0063] Existing methods for assisting unsupervised defect detection based on abnormal data synthesis can be divided into two types: image-level synthesis and feature-level synthesis. The first abnormal data synthesis method assists unsupervised defect detection by locally synthesizing defect samples at the image level. The basic assumption of this method is that defects usually appear in local areas on the surface of a part. By synthesizing defects with multiple different textures in these local areas, the distribution of real samples can be closer. At the same time, because detailed local structural information is introduced, the model's ability to identify obvious surface defects is enhanced. In contrast, the second abnormal data synthesis method synthesizes defect features in the feature space. Since the feature space is a high-dimensional representation of the image, the feature map size is smaller, and defect synthesis in this space is usually more efficient. This method of assisting unsupervised defect detection can also be regarded as defect construction at the global level. For methods that synthesize defects locally at the image level, due to the low dimensionality of the image space, the defects generated by this method often only cover a limited amount of texture, so this method lacks diversity and authenticity. For methods that synthesize defects globally at the feature level, due to the higher dimensionality of the feature space, the defect synthesis efficiency is higher, but this method still has difficulty in generating controllable and target-oriented defects, especially for those weak defects that are close to normal features.

[0064] In light of the shortcomings of existing technologies, the present invention discloses a novel feature-space defect editing strategy based on support vector data description, which can effectively detect and locate various types of industrial part defects, especially extremely subtle defects. Furthermore, the present invention utilizes a feature extraction, feature mapping, and feature discrimination architecture during the inference phase, with the feature discriminator directly providing defect localization results, ensuring accurate and efficient defect detection.

[0065] See also Figure 5 , Figure 5 The experimental results of different methods on the metal part defect detection (MPDD) dataset are shown. The method of the embodiment of the present invention has a detection speed (the number of image detections per second) that is more than twice that of other methods, and it also has a significant lead in the detection accuracy (the area under the receiver operating characteristic curve, i.e., AUROC), which proves the superiority of the technical solution of the embodiment of the present invention. The reasoning stage of the present invention only includes three modules and adopts a simpler and more efficient network structure, and the model detection speed is more impressive. At the same time, thanks to the selection of the initialization center and the effective training of feature anomalies, the model detection accuracy is significantly improved.

[0066] See also Figure 6 In an embodiment of the present invention, a defect detection method is specifically provided, which is characterized by comprising the following steps:

[0067] Step 1: Acquire an image to be inspected for defects; for example, it may be an image of the surface of an industrial part;

[0068] Step 2: Based on the image to be inspected obtained in step 1, a defect detection system is used to perform defect detection, and a defect detection result is obtained and outputted;

[0069] Among them, the defect detection system adopts an unsupervised defect detection network, which includes a feature extractor, a feature mapper and a feature discriminator connected in sequence; the feature extractor is used to input the image to be defect detected and output multi-layer fusion features; the feature mapper is used to input the multi-layer fusion features and output fusion features that eliminate bias; the feature discriminator is used to input the fusion features that eliminate bias, output the segmentation results and use them as defect detection results; in addition, during training, the overall training objectives of the unsupervised defect detection network include the binary cross entropy loss of normal features and synthetic defect features, and the Euclidean distance loss between the mapped normal features and the feature center; the synthetic defect features are obtained using a feature space defect editing strategy based on support vector data description.

[0070] In one embodiment of the present invention, a computer device is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, and is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used to perform the operation of the defect detection method.

[0071] In one embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory). The computer-readable storage medium is a memory device in a computer device for storing programs and data. It is understood that the computer-readable storage medium herein may include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides storage space, which stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for being loaded and executed by a processor. These instructions may be one or more computer programs (including program code). It should be noted that the computer-readable storage medium herein may be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage device. The processor may load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the defect detection method in the above-mentioned embodiment.

[0072] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0073] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0074] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1The function specified in one or more boxes.

[0075] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A defect detection system, characterized in that: The defect detection system adopts an unsupervised defect detection network, which includes a feature extractor, a feature mapper and a feature discriminator connected in sequence; The feature extractor is used to input the image to be defect detected and output multi-layer fusion features; the feature mapper is used to input the multi-layer fusion features and output fusion features that eliminate deviations; the feature discriminator is used to input the fusion features that eliminate deviations and output a segmentation result as a defect detection result; in, During training, the overall training objectives of the unsupervised defect detection network include binary cross entropy loss between normal features and synthetic defect features, and Euclidean distance loss between mapped normal features and feature centers; The synthetic defect features are obtained by using a feature space defect editing strategy based on support vector data description; in, The training steps of the unsupervised defect detection network specifically include: using normal samples for training, obtaining multi-layer fused normal features through a feature extractor, obtaining normal features with deviated features through a feature mapper, and finally outputting a normal sample discrimination loss through a feature discriminator; in addition, based on the deviated normal features, a feature space defect editing strategy is used to obtain defect features with anomalies, and then the feature discriminator outputs a composite defect discrimination loss; Before the unsupervised defect detection network training begins, feature center initialization is performed; wherein, the step of performing feature center initialization specifically includes: iteratively updating the initial center vector by traversing all batches of normal samples, and finally determining and outputting the initialized center vector; wherein, for the first batch of normal samples, using a feature extractor and a feature mapper to obtain unbiased normal features, and setting the average value of the feature map as the initial value of the center vector; for subsequent batches of normal samples, first using a feature extractor and a feature mapper to obtain unbiased normal features, then calculating the similarity between the obtained features and the current center vector, finding the closest center feature point, and finally updating the center vector by averaging each center feature point with the same index; after traversing all batches of normal samples, determining and outputting the initialized center vector; In the feature extractor, the steps of inputting an image to be inspected for defects and outputting multi-layer fusion features specifically include: using a pre-trained backbone network to extract features of different levels from the input image, performing average neighborhood aggregation on each layer of features to embed neighborhood information, merging the neighborhood embedded features in the channel dimension, and obtaining and outputting multi-layer fusion features.

2. A defect detection system according to claim 1, characterized in that: The step of using a feature space defect editing strategy to obtain defect features that introduce abnormalities based on normal features that eliminate deviations specifically includes: Calculate and obtain the center vector that is most similar to the mapped normal feature; Get the unit vector by passing the center vector to the direction vector of the normal feature; Taking the normal feature as the starting point and the unit vector as the direction, the abnormal feature is controllably synthesized according to a fixed step size.

3. A defect detection system according to claim 2, characterized in that: The step size is proportional to the average distance between normal features and the center vector within a single batch.

4. A defect detection system according to claim 1, characterized in that: The step of outputting the segmentation result as the defect detection result specifically includes: Outputting the post-processed segmentation result as a defect detection result of the image to be defect detected; in, Post-processing involves upsampling and Gaussian smoothing the output to match the original image size and reduce noise; The image-level defect detection result is given by the maximum confidence value of the entire image.

5. A defect detection method, characterized in that: include: Acquire an image to be inspected for defects; Based on the image to be defect-detected, defect detection is performed using the defect detection system described in claim 1 to obtain and output defect detection results.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the defect detection method according to claim 5 is implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the defect detection method according to claim 5 is implemented.

Citation Information

Patent Citations

  • Multi-scale industrial part defect detection method based on generative adversarial network

    CN115661543A

  • Industrial part defect detection method and system based on deep learning and electronic equipment

    CN116051532A

  • Defect detection method and device based on unsupervised learning

    CN114862838A

  • Product appearance defect detection method based on unsupervised anomaly detection

    CN116912173A