Bearing outer side surface defect detection method based on unsupervised learning algorithm
Through the improved generation of unsupervised learning, combined with transfer learning and SE-Block module, the overfitting problem of defect detection on the outer side of the bearing in the prior art is solved, and a more accurate defect detection effect is achieved.
Patent Information
- Application Number
- CN202411172296.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-03
AI Technical Summary
In the prior art, defect detection on the outer side of bearing based on supervised learning models is prone to overfitting, and complex defects cannot be accurately detected, and there are few defect samples, resulting in poor detection results.
The improved generative adversarial network anomaly detection model based on unsupervised learning is adopted, and the model is constructed through transfer learning and adaptive encoder, and the abnormal score is calculated by using the generative adversarial network for detection. Combined with SE-Block module and transfer learning is used to improve the generalization ability of the model.
It realizes more accurate detection of defects on the outer side of the bearing, can handle complex situations, and improves the accuracy of the detection results and the generalization ability of the model.
Smart Images

Figure CN119067948A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a bearing surface defect detection method, in particular to a bearing outer surface defect detection method based on an unsupervised learning algorithm, and belongs to the technical field of machine vision detection. Background Art
[0002] When performing defect detection on the outer side of the bearing, since the image of the outer side of the bearing is collected using a linear array camera, its morphology is different from the other three surfaces. In addition, the types of defects on the outer side of the bearing are complex and diverse, there are no clear category labels, and there are few outer side defect samples collected on site. Therefore, the detection method based on supervised learning models in the existing technology is likely to cause overfitting and fail to perform accurate defect detection. Summary of the invention
[0003] Based on the above background, the purpose of the present invention is to provide a method for detecting defects on the outer side of a bearing based on an unsupervised learning algorithm to solve the problems described in the background technology.
[0004] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:
[0005] A method for detecting defects on the outer side of a bearing based on an unsupervised learning algorithm, the method comprising the following steps:
[0006] Acquire an outer side surface image of the bearing to be tested, and traverse the outer side surface image with a window of a fixed size;
[0007] The traversed window images are sequentially input into the improved generative adversarial network anomaly detection model for detection;
[0008] Among them, the improved generative adversarial network anomaly detection model includes a discriminator for distinguishing whether an input image is a real image or a generated image, a generator for mapping a random noise vector in a latent space to a generated image through upsampling and transformation, and an encoder for quickly mapping the input image to the latent space; the encoder includes two downsampling modules, an SE-Block module, two downsampling modules, an SE-Block module, a linear layer and a Tanh activation function layer connected in sequence; the SE-Block module includes a CBL module and an SE attention module connected in a residual structure, and the SE attention module includes a global average pooling layer, a linear layer, a ReLU activation function layer, a linear layer and a Sigmoid activation function layer connected in sequence; the improved generative adversarial network anomaly detection model is trained in a transfer learning manner, first using the parameters of the generative adversarial network anomaly detection model trained on other data sets to set the pre-weights of the discriminator, generator and encoder, and then using the collected bearing outer side image data set to train the improved generative adversarial network anomaly detection model, thereby fine-tuning the parameters of the discriminator, generator and encoder.
[0009] Preferably, the traversed window images are sequentially input into the improved generative adversarial network anomaly detection model for detection, specifically including:
[0010] Calculate the abnormality score of the input window image, the mathematical expression of the abnormality score is:
[0011] A(x)=A R (x)+kA D (x);
[0012]
[0013] Where A(x) is the anomaly score, A R (x) is the image reconstruction error, that is, the difference between the input image x and the generated image G(E(x)), A D (x) is the discriminator feature residual error, that is, the difference between the input image x and the generated image G(E(x)) at the intermediate layer output of the discriminator, n is the number of pixels in the input image, n d is the dimension of the middle layer of the discriminator, k is the weight parameter, f is the output function of the middle layer of the discriminator, and G is the generator function;
[0014] The anomaly score is compared with a predetermined discrimination threshold. If the anomaly score is greater than the discrimination threshold, the input window image is an abnormal image with defects, otherwise it is a normal image.
[0015] Preferably, the method for determining the discrimination threshold comprises:
[0016] By initially setting a discrimination threshold to calculate the false positive rate FPR and the true positive rate TPR, and constantly changing the threshold, different false positive rates FPR and true positive rates TPR are obtained;
[0017] Draw the ROC curve in the xy coordinate system with FPR as the horizontal coordinate and TPR as the vertical coordinate;
[0018] The intersection point of the ROC curve and the straight line y=-x+1 is calculated as the balance point when the FPR and TPR reach a relative optimum. Based on the balance point, the discrimination threshold is determined.
[0019] Preferably, the discriminator comprises a downsampling module without batch normalization, three downsampling modules and a linear layer connected in sequence.
[0020] Preferably, the generator comprises a linear layer, a batch normalization layer, an upsampling module, a CBL module, an upsampling module, a CBL module, a convolutional layer and a Tanh activation function layer connected in sequence.
[0021] Preferably, the CBL module includes a convolution layer, a batch normalization layer and a LeakyReLu activation function layer.
[0022] Preferably, the mathematical expression of the loss function of the discriminator is:
[0023]
[0024] The mathematical expression of the loss function of the generator is:
[0025]
[0026] In the formula, x is the real data, p r (x) is the distribution of real data, z is random noise, p(z) is the distribution of random noise, D is the discriminator function, G is the generator function, For expectations;
[0027] The mathematical expression of the loss function of the encoder is:
[0028]
[0029] Where n is the number of pixels in the input image, n d is the dimension of the intermediate layer of the discriminator, k is the weight parameter, f is the output function of the intermediate layer of the discriminator, G is the generator function, and E is the encoder function.
[0030] Compared with the prior art, the present invention has the following advantages:
[0031] The present invention discloses a bearing outer surface defect detection method based on an unsupervised learning algorithm. By introducing an adaptive encoder to construct an improved generative adversarial network anomaly detection model and training it in a transfer learning manner, the method can better handle various complex situations of the bearing outer surface image and has a more accurate detection result for the defect detection of the bearing outer surface. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0033] Figure 1 It is a schematic diagram of a bearing outer surface defect detection method based on an unsupervised learning algorithm of the present invention;
[0034] Figure 2 It is a flow chart of a bearing outer surface defect detection method based on an unsupervised learning algorithm of the present invention;
[0035] Figure 3 It is a schematic diagram of the detection principle of the improved generative adversarial network anomaly detection model in the present invention;
[0036] Figure 4 Schematic diagram of the network structure of the discriminator in the present invention;
[0037] Figure 5 It is a schematic diagram of the network structure of the generator in the present invention;
[0038] Figure 6 Schematic diagram of the network structure of the encoder in the present invention;
[0039] Figure 7 It is a structural diagram of the SE-Block module in the present invention;
[0040] Figure 8 It is a diagram showing the generation effect of different rounds of training of the improved generative adversarial network anomaly detection model in the present invention;
[0041] Fig. 9 is a statistical histogram of abnormal scores of different models under the evaluation experiment of the present invention;
[0042] Fig.10 It is the ROC curve diagram of different models under the evaluation experiment in the present invention;
[0043] Fig.11 It is a confusion matrix diagram of different models under the comparative experiment in the present invention. DETAILED DESCRIPTION
[0044] The technical solution of the present invention is further described in detail below through specific embodiments and in conjunction with the accompanying drawings. It should be understood that the implementation of the present invention is not limited to the following embodiments, and any form of modification and / or change made to the present invention will fall within the protection scope of the present invention.
[0045] In the present invention, unless otherwise specified, all parts and percentages are weight units, and the equipment and raw materials used can be purchased from the market or are commonly used in the art. The methods in the following embodiments, unless otherwise specified, are conventional methods in the art. The components or equipment in the following embodiments, unless otherwise specified, are universal standard parts or components known to those skilled in the art, and their structures and principles are known to those skilled in the art through technical manuals or conventional experimental methods.
[0046] The embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present invention. However, one or more embodiments may also be implemented by those skilled in the art without these specific details.
[0047] The embodiment of the present invention discloses a bearing outer surface defect detection method based on an unsupervised learning algorithm, such as Figure 1 As shown, the method comprises the following steps:
[0048] S1, collecting the outer side image of the bearing to be tested, and traversing the outer side image with a window of a fixed size;
[0049] S2. Input the traversed window images into the improved generative adversarial network anomaly detection model for detection.
[0050] Among them, the improved generative adversarial network anomaly detection model includes a discriminator for distinguishing whether an input image is a real image or a generated image, a generator for mapping a random noise vector in a latent space to a generated image after upsampling and transformation, and an encoder for quickly mapping an input image to a latent space.
[0051] The encoder includes two downsampling modules, an SE-Block module, two downsampling modules, an SE-Block module, a linear layer, and a Tanh activation function layer connected in sequence. The SE-Block module includes a CBL module and an SE attention module connected in a residual structure. The SE attention module includes a global average pooling layer, a linear layer, a ReLU activation function layer, a linear layer, and a Sigmoid activation function layer connected in sequence.
[0052] The improved generative adversarial network anomaly detection model is trained using transfer learning. The parameters of the generative adversarial network anomaly detection model trained on other datasets are first used to set the pre-weights of the discriminator, generator, and encoder. Then, the collected bearing outer side image dataset is used to train the improved generative adversarial network anomaly detection model, thereby fine-tuning the parameters of the discriminator, generator, and encoder.
[0053] The following is a detailed description of the various steps of the bearing outer surface defect detection method based on the unsupervised learning algorithm and the improved generative adversarial network anomaly detection model used.
[0054] The process of this method is as follows Figure 2 As shown. The generative adversarial network anomaly detection model (AnoGAN, Anomaly detection with Generative Adversarial Networks) is an unsupervised learning model based on GAN, which is used to determine whether an image is abnormal. The detection principle of AnoGAN is to perform anomaly detection by calculating the difference between the input image and the generated image. However, this method relies heavily on the quality of the generated image, and poor quality of the generated image will easily lead to errors in the detection results. Therefore, the method of this embodiment is further improved on the basis of f-AnoGAN (Fast unsupervised anomaly detection with generative adversarial networks), and an adaptive encoder is introduced to construct an improved generative adversarial network anomaly detection model. Compared with directly using AnoGAN to detect defects on the outer side of the bearing, this method can better handle various complex situations, thereby obtaining more accurate detection results.
[0055] In the method of this embodiment, Figure 3 As shown in Figure 1, the detection process in the improved generative adversarial network anomaly detection model is similar to that of f-AnoGAN, that is, the trained generator, discriminator, and encoder are used to calculate the anomaly score of the input window image. The mathematical expression of the anomaly score is:
[0056] A(x)=A R (x)+kA D (x);
[0057]
[0058] Where A(x) is the anomaly score, A R (x) is the image reconstruction error, that is, the difference between the input image x and the generated image G(E(x)), A D(x) is the discriminator feature residual error, that is, the difference between the input image x and the generated image G(E(x)) at the intermediate layer output of the discriminator, n is the number of pixels in the input image, n d is the dimension of the intermediate layer of the discriminator, k is the weight parameter, f is the output function of the intermediate layer of the discriminator, and G is the generator function.
[0059] The higher the anomaly score, the more likely the input window image is abnormal.
[0060] After obtaining the anomaly score, the anomaly score is compared with a predetermined discrimination threshold. If the anomaly score is greater than the discrimination threshold, the input window image is an abnormal image with defects, otherwise it is a normal image.
[0061] The method for determining the discrimination threshold includes:
[0062] By initially setting a discrimination threshold to calculate the false positive rate FPR and the true positive rate TPR, and constantly changing the threshold, different false positive rates FPR and true positive rates TPR are obtained;
[0063] Draw the ROC curve in the xy coordinate system with FPR as the horizontal coordinate and TPR as the vertical coordinate;
[0064] The intersection point of the ROC curve and the straight line y=-x+1 is calculated as the balance point when the FPR and TPR reach a relative optimum. The discrimination threshold is determined based on the balance point.
[0065] In the method of this embodiment, the discriminator of the improved generative adversarial network anomaly detection model is a deep neural network, which is used to distinguish the input image as a real image or a generated image. The discriminator includes a downsampling module without batch normalization, three downsampling modules and a linear layer connected in sequence. The specific network structure of the discriminator is as follows Figure 4 The specific parameters of each module and layer are shown in Table 1.
[0066] Table 1 Discriminator network parameters
[0067] Type Size Stride Padding Output Block* 3×3 2 1 64×64×16 Block 3×3 2 1 32×32×32 Block 3×3 2 1 16×16×64 Block 3×3 2 1 8×8×128 Linear - - - 1
[0068] The discriminator consists of four downsampling modules Block and a linear layer Linear. Among them, Block includes a convolution layer Conv, a LeakyReLU activation function, and optional batch normalization layers BatchNorm and Dropout. The convolution layer is used for downsampling, thereby reducing the spatial size of the feature map. In the discriminator network, the convolution kernel size of all convolution layers is 3, the step size is 2, and the padding is 1, so each downsampling module will cause the size of the feature map to be halved. LeakyReLU is an activation function that allows values less than zero to pass through and applies a small negative slope, which helps prevent the gradient disappearance problem. BatchNorm helps to improve the stability of training and accelerate convergence. Dropout is used to randomly discard part of the input neurons during training to prevent overfitting. In the method of this embodiment, since the input data is a mixture of generated graphs and real graphs, using BatchNorm in the first downsampling module will make the effect worse, so BatchNorm is not enabled in the first downsampling module. The last layer of the discriminator is Linear, which is also a fully connected layer. It is responsible for mapping the features extracted by the convolutional layer into a single scalar value. This scalar value represents the fraction of the input image that is judged as real data. This value is used to indicate the authenticity of the input image, that is, the discriminator's judgment result on the input image.
[0069] In the method of this embodiment, the function of the generator of the improved generative adversarial network anomaly detection model is to map the random noise vector in the latent space to the generated image. The input of the generator is a random noise vector sampled from the latent space. The random noise vector is gradually mapped to an image through the forward propagation of the generator, after a series of upsampling and transformation. The generator includes a linear layer, a batch normalization layer, an upsampling module, a CBL module, an upsampling module, a CBL module, a convolutional layer and a Tanh activation function layer connected in sequence. The specific network structure of the generator is as follows Figure 5 The specific parameters of each module and layer are shown in Table 2.
[0070] Table 2 Generator network parameters
[0071]
[0072]
[0073] The generation part of the generator consists of Linear, BatchNorm, Upsample and CBL. The role of Linear is to map the input random noise vector to a high-dimensional representation, providing initial features for the subsequent transposed convolution layer. The input of Linear is a random noise vector in the latent space, which is usually randomly sampled from a prior distribution. This distribution can be a uniform distribution, a normal distribution, or other suitable distributions. According to the characteristics of the bearing image to be generated, this method chooses a uniform distribution. The role of BatchNorm is the same as that in the discriminator, which is still batch normalization of features, which helps to improve the stability of training. Upsample is an upsampling operation, which expands the size of the feature map by enlarging the height and width of the feature map. The CBL module consists of a convolution layer Conv, a batch normalization layer BatchNorm, and a LeakyReLu activation function layer. Since the step size of the convolution is 1 and the padding is 1, the CBL module will not change the size of the feature map. The main role of the CBL module is to introduce more feature representations so that the generator can better learn how to generate realistic images.
[0074] In the last part of the generator, a convolution layer Conv is used to reduce the number of channels of the feature map to the number of channels of the output image. Since grayscale images are used for training and detection in this embodiment, the number of output channels is 1. After that, the pixel values of the feature map are mapped to the range of [-1, 1] through the Tanh activation function to generate the final synthetic image.
[0075] In the method of this embodiment, the encoder of the improved generative adversarial network anomaly detection model is used to achieve fast image to latent space mapping, thereby avoiding the need for iterative optimization in AnoGAN. The training goal of the encoder is to learn an inverse mapping function that maps the image from pixel space to latent space, so that the output of the encoder is as close as possible to the input of the generator. The specific network structure of the encoder is as follows: Figure 6 The specific parameters of each module and layer are shown in Table 3.
[0076] Table 3 Encoder network parameters
[0077]
[0078]
[0079] The downsampling module Block is also a downsampling module without batch normalization, including a convolution layer Conv, a LeakyReLU activation function and Dropout. Their functions are the same as those described in the discriminator Block. The convolution layer is used to extract features from the input image. The LeakyReLU activation function is used to introduce nonlinearity, allowing the network to learn more complex features. The Dropout operation is used to help prevent overfitting by randomly discarding a portion of neurons. The Linear layer is used to flatten the final feature map and map it to a low-dimensional representation in the latent space. latent_dim (latent dimension) refers to the dimension of the latent space, which is a low-dimensional representation in which each point corresponds to an abstract feature learned by the model. In the method of this embodiment, after many experiments, latent_dim is set to 12.
[0080] In the prior art, the encoder of f-AnoGAN includes four downsampling modules Block and a Linear layer. The final output is mapped to the range of [-1, 1] through a Tanh activation function. However, the gradient may become very small after passing through multiple layers of propagation, and the weight is hardly updated during the training process, making the network difficult to train. Therefore, in the method of this embodiment, the encoder introduces two SE-Block modules. The specific structure of the module is as follows: Figure 7 shown.
[0081] The structure of the SE-Block module consists of two parts. The upper part is a standard CBL module, which is used to extract feature information. The lower part is the SE attention module, which is a channel attention mechanism for convolutional neural networks, which aims to improve the representation ability of the network by adaptively recalibrating channel features. The process of the SE attention module is to first compress the spatial information of each channel into a single value through a global average pooling to form a channel descriptor. Next, two fully connected layers and nonlinear activation functions are used to learn the weight of each channel. Finally, the learned channel weights are applied to each channel of the original feature map to emphasize important features.
[0082] By applying the channel weights learned by the SE attention mechanism to the feature maps extracted by CBL, this structure can not only help the network focus on channel information, but also this residual-like structure allows the gradient to flow directly to earlier layers, thereby alleviating the gradient vanishing problem, so that multi-layer network training will not harm the performance of the model.
[0083] The discriminator and the generator form a WGAN structure. The loss function of WGAN is a metric based on the Wasserstein distance, which is used to measure the difference between the generated data distribution and the real data distribution. The loss function of WGAN can be derived from two perspectives, one from the perspective of the discriminator and the other from the perspective of the generator. The goal of the discriminator is to distinguish between real data and generated data, and the goal of the generator is to deceive the discriminator and make the generated data as close to the real data as possible. These two goals are antagonistic, so the loss function of WGAN is a minimum maximum problem.
[0084] From the perspective of the discriminator, the loss function of WGAN is:
[0085]
[0086] From the generator's perspective, the loss function of WGAN is:
[0087]
[0088] In the formula, x is the real data, p r (x) is the distribution of real data, z is random noise, p(z) is the distribution of random noise, D is the discriminator function, G is the generator function, For expectation.
[0089] The discriminator should maximize its output for real data and minimize its output for generated data, that is, make the output of real data as large as possible and the output of generated data as small as possible. In this way, the two types of data can be distinguished. The generator should minimize the output of the discriminator for generated data, that is, make the output of generated data as large as possible, so as to deceive the discriminator and make the generated data closer to the real data. In summary, the loss function of WGAN is:
[0090]
[0091] As shown in the above formula, the generator and the discriminator must reach a Nash equilibrium in a confrontation, that is, when the discriminator reaches the optimal state, the generator can no longer improve its performance.
[0092] The encoder usually has three training structures, corresponding to three forms of loss functions, namely ziz, izi and izif. Among them, ziz means that the latent variable z generates an image through the generator G, and then is encoded into the latent variable z through the encoder E. Its loss function is the mean square error between z and E(G(z)); izi means that the real image x is mapped to the latent space through the encoder E, and then the image is generated through the generator G. Its loss function is the mean square error between x and G(E(x)); izif adds a discriminator D on the basis of izi, and its loss function is the mean square error of x and G(E(x)) plus the mean square error of the intermediate layer output f(x) and f(G(E(x))) of the discriminator. In the method of this embodiment, izif is selected as the loss function of the encoder because it can utilize the feature extraction capability of the discriminator to improve the performance of the encoder. Therefore, the mathematical expression of the loss function of the encoder is:
[0093]
[0094] Where n is the number of pixels in the input image, n d is the dimension of the intermediate layer of the discriminator, k is the weight parameter, f is the output function of the intermediate layer of the discriminator, G is the generator function, and E is the encoder function.
[0095] Because in the method of this embodiment, the samples of the collected data set of defects on the outer side of the bearing are relatively small, and the morphology, texture, color, etc. of the defects are quite different. If the conventionally trained f-AnoGAN is directly used for detection, it is difficult to achieve a good fitting effect. Therefore, the method of this embodiment adopts the method of transfer learning to improve the performance and generalization ability of model anomaly detection. The working principle of transfer learning is to use the weights learned by a model on one task as the initial weights of another task. This can avoid learning from scratch, saving time and computing resources. In the method of this embodiment, the parameters of a generative adversarial network anomaly detection model trained on the MNIST handwritten character data set are first used to set the pre-weights of the discriminator, generator, and encoder, and then the collected data set of images of the outer side of the bearing is used to train the improved generative adversarial network anomaly detection model, thereby fine-tuning the parameters of the discriminator, generator, and encoder. This can reduce training time and computing resources, while using the knowledge of the handwritten character data set to enhance the expressive power of the improved generative adversarial network anomaly detection model.
[0096] In the method of this embodiment, the bearing outer surface defect dataset is collected from the industrial site and imaged using a 4K resolution linear array camera, and the obtained image resolution is 4096×10000. Due to the large resolution of the image, this paper also uses a sliding window to crop the original image into a 128×128 resolution image for training and detection. The dataset consists of a training set and a test set. Among them, the training set includes 20,000 defect-free sample images for network learning of defect-free sample features. The test set contains 2,000 defect-free samples and 2,000 defective samples.
[0097] In order to verify the effectiveness of the improved generative adversarial network anomaly detection model, this embodiment uses the anomaly score statistical histogram and AUC (Area Under Curve) as measurement indicators. AUC is an indicator for evaluating the performance of a classification model, usually referring to the area under the ROC curve. The ROC curve is a curve with the true positive rate (TPR) as the vertical axis and the false positive rate (FPR) as the horizontal axis, reflecting the sensitivity and specificity of the model under different thresholds. The value range of AUC is 0 to 1. The larger the AUC, the better the effect of the classification model. When AUC is equal to 0.5, it means that the effect of the classification model is equivalent to random guessing; when AUC is equal to 1, it means that the effect of the classification model is perfect and can completely distinguish between positive and negative examples. AUC is not affected by sample imbalance and does not depend on the specific threshold, and can reflect the overall performance of the model.
[0098] In order to verify the effect of the improved generative adversarial network anomaly detection model in generating images, this embodiment conducted an experiment based on the bearing outer surface defect dataset collected on site. The generated effect pictures at different epochs in the training of the improved generative adversarial network anomaly detection model are shown in the figure below. Figure 8 As shown in the figure. The first 10,000 epochs only train WGAN (i.e., generator and discriminator), and the next 10,000 epochs lock the weights of the generator and discriminator and train the encoder. It can be seen that with the increase in the number of iterations, the quality of image generation begins to gradually improve. When the training reaches 20,000, the pictures generated by the network are almost the same as those in the real bearing dataset, indicating that the model can be used for detection at this time.
[0099] This example tests the performance of the model on the bearing outer surface data set. Fig. 9As shown in the figure, the difference in the distribution of anomaly scores between positive and negative samples is shown in the form of anomaly score statistical histogram. The horizontal axis of the histogram represents the anomaly score of the sample, and the vertical axis represents the frequency of the sample under the anomaly score. In the figure, abnormal samples are represented by orange, and normal samples are represented by blue. For the convenience of comparison, abnormal samples with the same anomaly score are superimposed on normal samples. It can be seen that in the detection model trained by the AnoGAN network, the distribution of defective samples (NG) and non-defective samples (OK) almost overlap, and the model cannot distinguish between the two types. In the detection model trained by the f-AnoGAN network, the distribution distance between defective samples and non-defective samples is significantly expanded, and the anomaly score is also significantly reduced, which proves that the model has stronger recognition ability. By introducing the SE-Block module, the distribution distance between defective samples and non-defective samples is further expanded, and the distribution of the two appears to be more independent, indicating that the accuracy and recall rate are higher at this time. Then, by introducing transfer learning (transfer learning + SE-Block + f-AnoGAN, that is, the improved generative adversarial network anomaly detection model), the distribution distance between the two samples is further expanded on the basis of the original model. At this point, the gap in anomaly scores between positive and negative samples is clear, with only a few parts overlapping, indicating that the model can accurately distinguish whether an image has defects.
[0100] This example also uses AUC to evaluate the performance of AnoGAN, f-AnoGAN, f-AnoGAN with SE-Block, and f-AnoGAN with transfer learning and SE-Block. Through experiments, the ROC curves of each model are obtained as follows: Fig.10 As shown in the figure, it can be seen that the area under the ROC curve of f-AnoGAN (improved generative adversarial network anomaly detection model) with transfer learning and SE-Block is the largest, and the AUC score reaches 99.96%. Compared with f-AnoGAN with SE-Block, f-AnoGAN and AnoGAN have increased by 1.44%, 7.07% and 11.75% respectively, proving that the model has very excellent performance.
[0101] In order to further verify the effectiveness of the improved generative adversarial network anomaly detection model, this embodiment uses Precision (accuracy), Sensitivity (positive sample recall rate), Specificity (negative sample recall rate), AUC and AP (average precision) as performance indicators for comparative experiments. The models compared with it are Auto-Encoders (AE), Variational Auto-Encoders (VAE), Attribute Restoration Network (ARNet), AnoGAN and f-AnoGAN. The defect detection evaluation results on the bearing outer surface defect dataset are shown in Table 4. It can be seen that the five performance indicators of the improved generative adversarial network anomaly detection model all achieve the best results, and can accurately identify normal and abnormal samples.
[0102] Table 4 Comparative experimental performance evaluation results
[0103]
[0104] The classification effects of the above different models on the bearing outer surface defect dataset are shown in the form of confusion matrix. Fig.11 As shown in the figure, the horizontal axis is the predicted value, the vertical axis is the true value, "1" represents a positive sample, and "0" represents a negative sample. It can be seen that the improved generative adversarial network anomaly detection model has shown excellent performance in both accuracy and recall, while other models are insufficient in identifying positive samples.
[0105] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A bearing outer surface defect detection method based on unsupervised learning algorithm, Features: The method comprises the following steps: Acquire an outer side surface image of the bearing to be tested, and traverse the outer side surface image with a window of a fixed size; The traversed window images are sequentially input into the improved generative adversarial network anomaly detection model for detection; Among them, the improved generative adversarial network anomaly detection model includes a discriminator for distinguishing whether an input image is a real image or a generated image, a generator for mapping a random noise vector in a latent space to a generated image through upsampling and transformation, and an encoder for quickly mapping the input image to the latent space; the encoder includes two downsampling modules, an SE-Block module, two downsampling modules, an SE-Block module, a linear layer and a Tanh activation function layer connected in sequence; the SE-Block module includes a CBL module and an SE attention module connected in a residual structure, and the SE attention module includes a global average pooling layer, a linear layer, a ReLU activation function layer, a linear layer and a Sigmoid activation function layer connected in sequence; the improved generative adversarial network anomaly detection model is trained in a transfer learning manner, first using the parameters of the generative adversarial network anomaly detection model trained on other data sets to set the pre-weights of the discriminator, generator and encoder, and then using the collected bearing outer side image data set to train the improved generative adversarial network anomaly detection model, thereby fine-tuning the parameters of the discriminator, generator and encoder.
2. A bearing outer surface defect detection method based on an unsupervised learning algorithm according to claim 1, Features: The traversed window images are sequentially input into the improved generative adversarial network anomaly detection model for detection, including: Calculate the abnormality score of the input window image, the mathematical expression of the abnormality score is: A(x)=A R (x)+kA D (x); Where A(x) is the anomaly score, A R (x) is the image reconstruction error, that is, the difference between the input image x and the generated image G(E(x)), A D (x) is the discriminator feature residual error, that is, the difference between the input image x and the generated image G(E(x)) at the intermediate layer output of the discriminator, n is the number of pixels in the input image, n d is the dimension of the intermediate layer of the discriminator, k is the weight parameter, f is the output function of the intermediate layer of the discriminator, and x is the generator function; The anomaly score is compared with a predetermined discrimination threshold. If the anomaly score is greater than the discrimination threshold, the input window image is an abnormal image with defects, otherwise it is a normal image.
3. A bearing outer surface defect detection method based on an unsupervised learning algorithm according to claim 2, Features: The method for determining the discrimination threshold comprises: By initially setting a discrimination threshold to calculate the false positive rate FPR and the true positive rate TPR, and constantly changing the threshold, different false positive rates FPR and true positive rates TPR are obtained; Draw the ROC curve in the xy coordinate system with FPR as the horizontal coordinate and TPR as the vertical coordinate; The intersection point of the ROC curve and the straight line y=-x+1 is calculated as the balance point when the FPR and TPR reach a relative optimum. The discrimination threshold is determined based on the balance point.
4. A bearing outer surface defect detection method based on an unsupervised learning algorithm according to claim 1, Features: The discriminator includes a downsampling module without batch normalization, three downsampling modules and a linear layer connected in sequence.
5. The method for detecting bearing outer surface defects based on an unsupervised learning algorithm according to claim 1, Features: The generator includes a linear layer, a batch normalization layer, an upsampling module, a CBL module, an upsampling module, a CBL module, a convolution layer and a Tanh activation function layer connected in sequence.
6. A method for detecting bearing outer surface defects based on an unsupervised learning algorithm according to claim 1, Features: The CBL module includes a convolution layer, a batch normalization layer and a LeakyReLu activation function layer.
7. A bearing outer surface defect detection method based on an unsupervised learning algorithm according to claim 1, Features: The mathematical expression of the loss function of the discriminator is: The mathematical expression of the loss function of the generator is: In the formula, x is the real data, p r (x) is the distribution of real data, z is random noise, p(z) is the distribution of random noise, D is the discriminator function, G is the generator function, For expectations; The mathematical expression of the loss function of the encoder is: Where n is the number of pixels in the input image, n d is the dimension of the intermediate layer of the discriminator, k is the weight parameter, f is the output function of the intermediate layer of the discriminator, G is the generator function, and E is the encoder function.
Citation Information
Patent Citations
Photovoltaic module unsupervised defect detection method based on GAN improved algorithm
CN111340791A
Novel bearing surface defect intelligent detection system
CN113686892A
Anomaly detection device and anomaly detection method based on generative adversarial network architecture
US20220156580A1
