A method for detecting surface defects of motor magnetic tiles based on machine vision

By constructing the EfficientNet-GC model, combining Gaussian random lighting generator, equal-pixel brightness interval division algorithm and correction network, the problem of low robustness of deep convolutional neural networks for illumination imbalance images is solved, and higher accuracy of motor magnetic tile defect classification and model stability are achieved.

CN114565012BActive Publication Date: 2025-05-27GUILIN UNIV OF ELECTRONIC TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210058175.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-19
Publication Date
2025-05-27
Estimated Expiration
2042-01-19

AI Technical Summary

Technical Problem

The existing deep convolutional neural network has low robustness and weak generalization for illumination imbalance images, making it difficult to accurately extract the surface characteristics of the motor magnetic tile, resulting in a degradation of classification performance and weakening of robustness.

Method used

The EfficientNet-GC model is constructed, combined with the Gaussian random lighting generator, the equal-pixel brightness interval division algorithm, the correction network and the EfficientNetV2, and the Gaussian random lighting generator generates the illumination imbalance image. The equal-pixel brightness interval division algorithm divides the image into multiple brightness intervals, the correction network performs lighting correction, and finally completes the defect classification through EfficientNetV2.

Benefits of technology

The overall performance of the motor magnetic tile defect classification model is improved, the robustness and generalization ability to illuminate imbalance images are enhanced, and the classification accuracy and model stability are significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114565012B_ABST
    Figure CN114565012B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of motor fault detection, and particularly to a method for detecting surface defects of motor magnetic tiles based on machine vision. By cooperating with a Gaussian random illumination generator to perform random illumination superposition on the input tensor, an illumination-unbalanced image is generated to participate in model training, so as to achieve the purpose of improving the overall performance of the motor magnetic tile defect classification model. At the same time, an equal-pixel brightness interval division algorithm is adopted. By dynamically calculating the pixels in each brightness interval of the image, equal segmentation is performed, and then the free points are clustered through the K-nearest neighbor algorithm to complete the layer division. Finally, the brightness of each layer is corrected through a BP neural network. Finally, the surface grayscale image of the motor magnetic tile to be detected is detected and classified by the trained classification model, solving the technical problems that the existing deep convolutional neural network has low robustness and weak generalization ability for illumination-unbalanced images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of motor fault detection, and particularly to a method for detecting surface defects of motor magnetic tiles based on machine vision. Background Technique

[0002] The magnetic tile as the stator of the motor is the core component of the motor. In the modern production process of motor magnetic tiles, it is necessary to detect and classify the defects of the motor magnetic tiles to ensure the product quality. For the surface defects of the motor magnetic tiles, the magnetic tile itself has a complex background, and this complex background will cause the image gradient to mutate, making it difficult for traditional image processing algorithms to complete feature extraction.

[0003] In industrial inspection, due to reasons such as mechanical vibration, the component will have a certain offset from the light source point, and the existence of the phenomenon of uneven illumination makes the image gradient feature unclear, making the model unable to accurately extract the surface features of the magnetic tile image. Moreover, the same measured object will form different offset amounts with the light source point at different positions, so that the same image will have different texture features under different illuminations. Eventually, it leads to a decline in the classification performance of the model and a weakening of the robustness. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for detecting surface defects of motor magnetic tiles based on machine vision, aiming to solve the technical problems that the existing deep convolutional neural network has low robustness and weak generalization ability for images with uneven illumination.

[0005] To achieve the above purpose, the present invention provides a method for detecting surface defects of motor magnetic tiles based on machine vision, including the following steps:

[0006] Construct an EfficientNet-GC model;

[0007] Obtain a classification training sample set of motor magnetic tiles;

[0008] Use the classification training sample set to train the EfficientNet-GC model to obtain a trained classification model;

[0009] Input the grayscale image of the surface of the motor magnetic tile to be detected into the trained classification model to obtain the class label of the motor magnetic tile to be detected.

[0010] Among them, the EfficientNet-GC model is composed of a Gaussian random illumination generator, an equal-pixel brightness interval division algorithm, a correction network, and EfficientNetV2. The Gaussian random illumination generator is responsible for superimposing random illumination to generate illumination-unbalanced images. The equal-pixel brightness interval division algorithm divides the illumination-unbalanced images into 8 layers with equal pixel amounts. The correction network is responsible for illumination correction, and EfficientNetV2 completes defect classification.

[0011] Among them, the Gaussian random illumination generator includes an input channel and a calculated illumination map channel, and the outputs of the input channel and the calculated illumination map channel satisfy the Retinex theory.

[0012] Among them, the equal-pixel brightness interval division algorithm includes data preprocessing, layer segmentation, and free point clustering. By dynamically calculating the pixels of each brightness interval of the image, then performing equal segmentation, and then clustering the free points through the K-nearest neighbor algorithm, the layer division is finally completed.

[0013] Among them, the process of the correction network performing illumination correction is specifically to correct and superimpose the input tensor with a size of 128×128×8 obtained by the equal-pixel brightness interval division algorithm and then restore it to a size of 128×128×1.

[0014] Among them, EfficientNetV2 is a convolutional neural network model with progressive learning ability with adaptive regularization.

[0015] Among them, each training sample in the classification training sample set includes a grayscale image of the surface of the motor magnetic tile and the corresponding class label.

[0016] The present invention provides a method for detecting defects on the surface of a motor magnetic tile based on machine vision. By cooperating with a Gaussian random illumination generator to perform random illumination superposition on the input tensor to generate illumination-unbalanced images for model training, the purpose of improving the overall performance of the motor magnetic tile defect classification model is achieved. At the same time, an equal-pixel brightness interval division algorithm is adopted. By dynamically calculating the pixels of each brightness interval of the image, equal segmentation is performed, and then the free points are clustered through the K-nearest neighbor algorithm to complete the layer division. Finally, the brightness of each layer is corrected through a BP neural network, and finally the grayscale image of the surface of the motor magnetic tile to be detected is detected and classified by the trained classification model, solving the technical problems of low robustness and weak generalization of existing deep convolutional neural networks to illumination-unbalanced images. Description of the Drawings

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0018] Figure 1 It is a schematic flowchart of a method for detecting surface defects of motor magnetic tiles based on machine vision according to the present invention.

[0019] Figure 2 It is a schematic structural diagram of the EfficientNet-GC model of the present invention.

[0020] Figure 3 It is a schematic structural diagram of the Gaussian random illumination generator of the present invention.

[0021] Figure 4 It is a schematic structural diagram of the calibration network of the present invention. Specific embodiments

[0022] The following will describe in detail the embodiments of the present invention. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below with reference to the drawings are exemplary and are intended to explain the present invention, but should not be construed as a limitation to the present invention.

[0023] Please refer to Figure 1 , the present invention proposes a method for detecting surface defects of motor magnetic tiles based on machine vision, including the following steps:

[0024] S1: Construct an EfficientNet-GC model;

[0025] S2: Obtain a classification training sample set of motor magnetic tiles;

[0026] S3: Use the classification training sample set to train the EfficientNet-GC model to obtain a trained classification model;

[0027] S4: Input the grayscale image of the surface of the motor magnetic tile to be detected into the trained classification model to obtain the category label of the motor magnetic tile to be detected.

[0028] The EfficientNet-GC model consists of a Gaussian random illumination generator, an equal-pixel brightness interval division algorithm, a correction network, and EfficientNetV2. The Gaussian random illumination generator is responsible for superimposing random illumination to generate an illumination-unbalanced image. The equal-pixel brightness interval division algorithm divides the illumination-unbalanced image into 8 layers with equal pixel amounts. The correction network is responsible for illumination correction, and EfficientNetV2 completes defect classification.

[0029] The Gaussian random illumination generator includes an input channel and a calculated illumination map channel, and the outputs of the input channel and the calculated illumination map channel satisfy the Retinex theory.

[0030] The equal-pixel brightness interval division algorithm includes data preprocessing, layer segmentation, and free point clustering. By dynamically calculating the pixels in each brightness interval of the image, then performing equal division, and then clustering the free points through the K-nearest neighbor algorithm, the layer division is finally completed.

[0031] The process of the correction network performing illumination correction is specifically to correct and superimpose the input tensor with a size of 128×128×8 obtained by the equal-pixel brightness interval division algorithm and then restore it to a size of 128×128×1.

[0032] EfficientNetV2 is a convolutional neural network model with progressive learning ability with adaptive regularization.

[0033] Each training sample in the classification training sample set includes a grayscale image of the surface of the motor magnetic tile and the corresponding class label.

[0034] The following will be described in detail for the specific steps:

[0035] Please refer to Figure 2 , the EfficientNet-GC model consists of a Gaussian random illumination generator, an equal-pixel brightness interval division algorithm, a correction network, and EfficientNetV2. The original image tensor T is used as the model input. Random illumination is superimposed through the Gaussian random illumination generator to generate an illumination-unbalanced image, and then it is divided into 8 layers with equal pixel amounts through the equal-pixel brightness interval division algorithm. Immediately afterwards, illumination correction is performed through the correction network. Finally, defect classification is completed by sending it into the EfficientNetV2 model.

[0036] As Figure 3 shown, the Gaussian random illumination generator consists of two channels, namely the input R(x,y) channel and the calculated illumination map L(x,y) channel. The outputs of these two channels satisfy the Retinex theory, that is, formula (1), where x and y are the horizontal and vertical coordinates of the image pixel points respectively, and S(x,y) is the generated illumination-unbalanced image.

[0037] S(x, y) = R(x, y) · L(x, y) (1)

[0038] Input the R(x, y) channel to directly obtain the input T of EfficientNet-GC, where N is the batch size and the image size is 128×128.

[0039] To calculate the illumination map channel, first generate a Gaussian mask image through the Gaussian function. The size of the Gaussian mask image is N×601×601, where N is the batch processing size. The Gaussian function satisfies formula (2), where μ is the mean and σ is the variance, taking 0.5 and 0.5 respectively. Substitute μ, σ, the horizontal and vertical coordinates of the image into formula (2) respectively to obtain the value at the position and generate a random Gaussian mask image.

[0040]

[0041] The center point of the generated Gaussian mask image is the light source point, and the illumination gradually weakens along the direction of the image edge. Randomly crop the Gaussian mask image according to the size of the input image to obtain an illumination image with a randomly offset light source point. At this time, it is the same as the size. Immediately perform a random dropout operation on the illumination image with a dropout ratio of = 0.5. The dropped illumination image will be set to a matrix of all 1s, that is, the illumination remains unchanged. Finally, operate on the original image and the illumination image according to formula (1) to obtain illumination-unbalanced data.

[0042] The equal-pixel brightness interval division algorithm can be divided into 3 parts: data preprocessing, layer segmentation, and free point clustering. Specifically, it includes the following steps:

[0043] Algorithm input: original tensor F, number of segments K = 8

[0044] Algorithm output: multi-channel tensor F'

[0045] Step(1): Flatten the tensor F

[0046] Step(2): Record the current position index Seq of each element

[0047] Step(3): Sort F in ascending order

[0048] Step(4): Calculate the number of pixels num in each interval: len(F) / K

[0049] Step(5): i = 0

[0050] Step(6): F i = [0]×i×num + F[i×num:(i + 1)×num] + [0]×(K - i - 1)×num

[0051] Step(7): Arrange F with Seq index i And make F i Reshaped to the same shape as F

[0052] Step(8): i = i + 1, if i != K: Jump back to Step(6)

[0053] Step(9): F' connects F according to channels 0 To F K-1 As F'

[0054] Step(10): Perform a convolution operation with a convolution kernel of 1 on F', and activate through a threshold

[0055] Step(11): Free point = F - (sum F' along channels)

[0056] Step(12): Perform KNN (K-Nearest Neighbor Algorithm) clustering with a radius of 20 on each Free point in each channel of F' to obtain N K-dimensional vectors

[0057] Step(13): Take the maximum number of the i-th vector obtained in Step(12) as the channel of the i-th Freepoint in F'

[0058] Specifically, Step(1) reduces the dimension of the tensor F with the format of 128×128×1 in the row direction to obtain a sequence signal F with the format of 1×16384. Immediately afterwards, Step(2) records the position index of each element of this sequence to obtain the index Seq. Then, Step(3) changes the F sequence to ascending order. Finally, Step(4) measures the sequence length of F and divides it into K = 8 parts to obtain the pixel amount num of each layer, thus completing the data preprocessing.

[0059] Steps(5) to (8) are to calculate the pixels F of each layer i , taking the i-th layer as an example, the subsequence of F obtained is from the i×num-th bit to the (i + 1)×num - 1-th bit. Then, i×num 0 values are added to the front of this sequence, and (K - i + 1)×num 0 values are added to the back of it. At this time, the data is filled to a sequence of the same length as F. (For example, assume i is 2, K is 8, and num is 2048, then the calculated F 2 Is the 4096th to 6143rd bits of F. Then perform the zero-padding operation on F 2 To obtain a sequence with a length of 1×16384. Then for F iArrange them in the order of Seq and rearrange them into a 128×128×1 format. Finally, Step (9) is to convert F 0 To F K-1 By superimposing them according to the channels, we get a tensor F' of size 128×128×K. This completes the image segmentation.

[0060] In Step (10), a convolution operation with a fixed convolution kernel of 1 is performed on each layer of F', and the convolution operation is activated by a threshold. This operation determines whether a point is a free point by whether there are many non-zero pixels near a certain point, so as to remove free points caused by drastic changes in background gradients. In Step (11), F' is summed according to the channels, and the points with a value of 0 are free points. Step (12) traverses the free points, substitutes the position of each free point into each layer in F' for KNN (K nearest neighbor algorithm) clustering with a radius of 20 pixels, and obtains the corresponding K-dimensional vector of each free point. Step (13) takes the maximum value index i in its K-dimensional vector, and the value of the corresponding position of the i-th layer in F' is set from 0 to the grayscale value of the free point. At this point, the clustering of the free points is completed and the tensor F is output.

[0061] The correction diagram of the correction network is as follows Figure 4 As shown in the figure, the size of the input tensor F is 128×128×8. A tensor of size 1×8 is obtained through global average pooling, and then a 1×4 fully connected layer is connected. Then, a 1×8 fully connected layer is connected to output a tensor of size 1×8, which is activated by normalization and Sigmoid function to limit its output value to the range of 0 to 1. This tensor is multiplied with the input tensor F to correct each layer. Finally, the size is restored to 128×128×1 through channel superposition.

[0062] Finally, the output G of the correction network is sent to EfficientNetV2 for classification, thus completing the construction of the model.

[0063] Furthermore, the present invention also provides a specific embodiment to verify the effectiveness of classifying the defective images of motor magnetic shoes with unbalanced illumination:

[0064] The three-fold cross-validation test was carried out using the motor magnetic tile defect set publicly disclosed by the Institute of Automation, Chinese Academy of Sciences. Each fold was divided into a training set and a test set. The model was trained separately and its sparse classification accuracy was verified on the test set. The results of the three-fold cross-validation were averaged, and the results are shown in Table 1 below. It can be seen from Table 1 that the proposed EfficientNet-GC method in the present invention has a sparse classification accuracy of 96.70% under standard conditions and 97.19% under the condition of unbalanced illumination. It is superior to the original EfficientNetV2 model in terms of classification accuracy, and it can be obtained by comparing EfficientNet-GC with other models that this method has stronger classification ability.

[0065] Table 1 Accuracy of each model under different conditions

[0066]

[0067] Considering the sample balance phenomenon of the samples, Recall, Precision, and AUC were proposed for in-depth verification. The results are shown in Table 2. It can be seen from Table 2 that the Recall and Precision obtained by the proposed model in the present invention under standard conditions are 0.961 and 0.785 respectively, showing excellent performance. Under the condition of unbalanced illumination, these two values are further improved to 0.967 and 0.786, far superior to other models. The AUC value under standard conditions is 0.991, and under the condition of unbalanced illumination data, the AUC is 0.996, far superior to other models. It shows that the method proposed in the present invention has excellent performance under the condition of unbalanced illumination, and the EfficientNet-GC model can effectively reduce the light sensitivity and is suitable for deployment in actual application scenarios.

[0068] Table 2 Comparison of Recall, Precision, and AUC of each model

[0069]

[0070] The above-disclosed is only a preferred embodiment of the present invention. Of course, the scope of the rights of the present invention cannot be limited thereby. Those of ordinary skill in the art can understand all or part of the processes of implementing the above embodiments, and the equivalent changes made according to the claims of the present invention still fall within the scope covered by the invention.

Claims

1. A method for detecting surface defects of motor magnetic tiles based on machine vision, characterized in that, it includes the following steps: Construct an EfficientNet-GC model; The EfficientNet-GC model is composed of a Gaussian random illumination generator, an equal-pixel brightness interval division algorithm, a correction network, and EfficientNetV2. The Gaussian random illumination generator is responsible for superimposing random illumination to generate an illumination-unbalanced image. The equal-pixel brightness interval division algorithm divides the illumination-unbalanced image into 8 layers with equal pixel amounts. The correction network is responsible for illumination correction, and EfficientNetV2 completes defect classification; The Gaussian random illumination generator includes an input channel and a calculated illumination map channel, and the outputs of the input channel and the calculated illumination map channel satisfy the Retinex theory; The equal-pixel brightness interval division algorithm includes data preprocessing, layer segmentation, and free point clustering. By dynamically calculating the pixels in each brightness interval of the image, then performing equal division, and then clustering the free points through the K-nearest neighbor algorithm, the layer division is finally completed; Obtain a classification training sample set of motor magnetic tiles; Use the classification training sample set to train the EfficientNet-GC model to obtain a trained classification model; Input the surface grayscale image of the motor magnetic tile to be detected into the trained classification model to obtain the class label of the motor magnetic tile to be detected.

2. The method for detecting surface defects of motor magnetic tiles based on machine vision according to claim 1, characterized in that, The process of the correction network for illumination correction is specifically to correct and superimpose the input tensor with a size of 128×128×8 obtained by the equal-pixel brightness interval division algorithm and then restore it to a size of 128×128×1.

3. The method for detecting surface defects of motor magnetic tiles based on machine vision according to claim 1, characterized in that, EfficientNetV2 is a convolutional neural network model with progressive learning ability with adaptive regularization.

4. The method for detecting surface defects of motor magnetic tiles based on machine vision according to claim 1, characterized in that, Each training sample of the classification training sample set includes the surface grayscale image of the motor magnetic tile and the corresponding class label.

Citation Information

Patent Citations

  • Motor magnetic shoe defect classification method based on region-of-interest enhancement

    CN113687227A