Method for accurately detecting surface defects of magnetic shoe
Through the use of an adaptive rotating attention network, the problem of large differences in defects and high randomness in surface defect detection of magnetic shingles is solved, and the precise detection and efficient detection of surface defects of magnetic shingles is realized.
Patent Information
- Application Number
- CN202510029456.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing magnetic tiles surface defect detection methods are difficult to achieve accurate detection when there are large defect differences and high randomness.
Adaptive rotation attention network, including an adaptive rotation convolution module and a rotation area attention module, is used to accurately detect defects on the magnetic tile surface through multi-view feature extraction and attention mechanism.
It improves the accuracy and efficiency of surface defect detection of magnetic tile, and can effectively capture random and small defects on magnetic tile surface, thereby improving the working efficiency of the magnetic tile production detection process.
Smart Images

Figure CN119832333A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the application field of artificial intelligence technology, and in particular to a method for accurately detecting defects on the surface of a magnetic tile. Background Art
[0002] In industrial production, magnetic tiles are widely used to produce rotors or stators of permanent magnet motors. However, in this process, mechanical friction and people's unconscious collisions will inevitably lead to surface defects of tiles, which will have adverse effects and affect the performance of permanent magnet motors. Therefore, it is crucial to detect defects on magnetic tiles during the production process.
[0003] Generally, defect detection on the surface of magnetic tiles mainly relies on experienced workers, but it is time-consuming and has low accuracy. Inspired by this, researchers have proposed many methods for this complex task, including traditional methods and machine learning-based methods. For traditional detection methods, Xie et al. proposed a shear wave-based method for defect detection on the surface of magnetic tiles; Yang et al. proposed the use of static wavelet transform for effective defect detection in magnetic tiles. These traditional methods tend to extract representative features from tiles to perform defect detection, but they are performed under specific conditions and show low results in this task.
[0004] Compared with traditional methods, machine learning-based methods have achieved better performance in the detection of magnetic tile surface defects. For example, researchers proposed an attention-enhanced flexible U-Net and fused feature convolutional neural network for r magnetic tile surface defect detection using attention mechanism; Liang et al. proposed a feature enhancement and ring fusion convolutional neural network for magnetic tile surface defects, which was achieved by enhancing shallow features and fusing ring features.
[0005] Although these machine learning-based methods have shown good results in detecting surface defects on magnetic tiles, their practical application is still difficult due to the existence of certain problems. First, most defects appear randomly on the surface of magnetic tiles (such as Figure 1 As shown in the figure, the network is difficult to locate and capture, which reduces the performance of the deep learning model; secondly, the defects on the surface of the magnetic tile vary greatly, such as long and thin cracks and tiny deformations, which are always submerged by the background, causing the convolutional neural network to fail in detection during learning. Summary of the invention
[0006] The present invention aims to solve the problem that the existing magnetic tile surface detection method is difficult to detect when the defects have large differences and high randomness.
[0007] In order to solve the above technical problems, the present invention provides a method for accurately detecting defects on the surface of a magnetic tile, the method comprising the following steps:
[0008] Acquire the surface image of the magnetic tile;
[0009] Inputting the magnetic tile surface image into an adaptive rotation attention network for accurate defect detection, wherein the adaptive rotation attention network includes an adaptive rotation convolution module and a rotation region attention module;
[0010] The adaptive rotational attention network outputs the precise defect detection result of the magnetic tile surface corresponding to the magnetic tile surface image.
[0011] Furthermore, the adaptive rotation convolution module is defined as ARC(X), which satisfies:
[0012] ARC(X)=Concat[BR(F)+α.AR(F)];
[0013] Among them, X represents the target image processed by the adaptive rotation convolution module, BR and AR represent basic rotation and adaptive rotation respectively, F represents the feature map of the target image obtained by basic rotation and adaptive rotation, α represents a preset learnable parameter, and Concat represents connection.
[0014] Furthermore, the adaptive rotation convolution module is specifically used for:
[0015] Generating a head feature map of the magnetic tile surface image by head convolution;
[0016] The head feature map is basically rotated to generate a basic multi-view feature map with four basic angles;
[0017] Adaptively rotating the basic multi-view feature maps at four basic angles according to a preset offset angle to generate four adaptive feature maps with different offsets;
[0018] The basic multi-view feature maps at four basic angles and the adaptive feature maps at four different offsets are added together to obtain a random defect recognition image of the target image.
[0019] Furthermore, the four basic angles are 0°, 90°, 180° and 270° respectively.
[0020] Furthermore, the preset offset angle is greater than 0° and less than 90°.
[0021] Furthermore, the adaptive rotation convolution module is defined as RRA(X), which satisfies:
[0022] RRA(X)=AT(X)⊙AR(X);
[0023] Wherein, X represents the target image processed by the rotation area attention module, AT represents the self-attention mechanism, AR represents the feature map of different offsets obtained from the adaptive rotation convolution module, and ⊙ represents the XOR operation.
[0024] Furthermore, the rotation area attention module is specifically used for:
[0025] Using the feature map of the target image as a query item, a keyword, and a value of an attention mechanism, respectively;
[0026] Flattening and transposing the query item in the spatial dimension, and then multiplying it with the keyword to generate an attention weight map;
[0027] Multiplying the attention weight map by the keyword to obtain an output feature map;
[0028] The output feature map is spatially flattened and multiplied with the feature maps with different offsets to obtain a minute defect recognition image of the target image.
[0029] Furthermore, the adaptive rotational attention network also includes a feedforward network module, which is used to classify defects in the magnetic tile surface image detected by the adaptive rotational convolution module and the rotational area attention module.
[0030] The beneficial effect achieved by the present invention is that a method for accurate defect detection on the surface of magnetic tiles based on an adaptive rotating attention network is proposed. The network detects random defects and small defects on the surface of magnetic tiles respectively through an adaptive rotating convolution module and a rotating area attention module, thereby improving the overall performance of the network in detecting defects on the surface of magnetic tiles and improving the work efficiency of the magnetic tile production inspection process. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a schematic diagram of surface defects of a magnetic tile provided by an embodiment of the present invention;
[0032] Figure 2 It is a schematic diagram of the steps of a method for accurate defect detection on the surface of a magnetic tile provided by an embodiment of the present invention;
[0033] Figure 3 is a schematic diagram of the structure of an adaptive rotation attention network (ARA-Net) provided in an embodiment of the present invention;
[0034] Figure 4 Schematic diagram of image processing of an adaptive rotational convolution module provided by an embodiment of the present invention;
[0035] Figure 5 It is a schematic diagram of comparative experimental results provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0037] Please refer to Figure 2 , Figure 2 1 is a schematic diagram of the steps of a method for accurately detecting defects on the surface of a magnetic tile provided by an embodiment of the present invention, the method comprising the following steps:
[0038] S1. Obtain the surface image of the magnetic tile.
[0039] S2. Input the magnetic tile surface image into an adaptive rotational attention network for accurate defect detection. The adaptive rotational attention network includes an adaptive rotational convolution module and a rotational area attention module.
[0040] For details, please refer to Figure 3 , Figure 3 It is a structural diagram of the adaptive rotation attention network (ARA-Net) provided in an embodiment of the present invention. In the production of permanent magnet motors, most defects appear randomly on the surface of the magnetic tile, resulting in network capture failure and reducing the performance of the deep learning model; accordingly, multi-view learning can provide rich feature map information for network training, thereby capturing the target position from a complex background.
[0041] The Adaptive Rotation Convolution Module is defined as ARC(X), which satisfies:
[0042] ARC(X)=Concat[BR(F)+α.AR(F)];
[0043] Among them, X represents the target image processed by the adaptive rotation convolution module, BR and AR represent basic rotation and adaptive rotation respectively, F represents the feature map of the target image obtained by basic rotation and adaptive rotation, α represents a preset learnable parameter, and Concat represents connection.
[0044] Furthermore, the adaptive rotation convolution module is specifically used for:
[0045] Generating a head feature map of the magnetic tile surface image by head convolution;
[0046] The head feature map is basically rotated to generate a basic multi-view feature map with four basic angles;
[0047] Adaptively rotating the basic multi-view feature maps at four basic angles according to a preset offset angle to generate four adaptive feature maps with different offsets;
[0048] The basic multi-view feature maps at four basic angles and the adaptive feature maps at four different offsets are added together to obtain a random defect recognition image of the target image.
[0049] Furthermore, the four basic angles are 0°, 90°, 180° and 270° respectively.
[0050] Furthermore, the preset offset angle is greater than 0° and less than 90°, and the preset offset angle can be obtained by adaptively calculating the linear layer.
[0051] like Figure 4 As shown, the head feature map is basically rotated to generate basic multi-view feature maps a, c, e, and g with four basic angles; after a, c, e, and g are adaptively rotated according to the preset offset angle, four adaptive feature maps b, d, f, and h are obtained accordingly. In this way, multi-view feature maps can be obtained based on the original image, so that it is easy to capture the location of defects in the complex background in the constructed network.
[0052] Another fact that makes it difficult to detect surface defects on magnetic tiles is that tiny pores and fine cracks always lead to detection failures.
[0053] Furthermore, the adaptive rotation convolution module is defined as RRA(X), which satisfies:
[0054] RRA(X)=AT(X)⊙AR(X);
[0055] Wherein, X represents the target image processed by the rotation area attention module, AT represents the self-attention mechanism, AR represents the feature map of different offsets obtained from the adaptive rotation convolution module, and ⊙ represents the XOR operation.
[0056] Furthermore, the rotation area attention module is specifically used for:
[0057] Using the feature map of the target image as a query item, a keyword, and a value of an attention mechanism, respectively;
[0058] Flattening and transposing the query item in the spatial dimension, and then multiplying it with the keyword to generate an attention weight map;
[0059] Multiplying the attention weight map by the keyword to obtain an output feature map;
[0060] The output feature map is spatially flattened and multiplied with the feature maps with different offsets to obtain a minute defect recognition image of the target image.
[0061] Through the described rotation region attention module, the constructed network can focus on small defects on the surface of magnetic tiles, thereby improving the overall performance of the network.
[0062] Furthermore, the adaptive rotational attention network also includes a feedforward network module, which is used to classify defects in the magnetic tile surface image detected by the adaptive rotational convolution module and the rotational area attention module.
[0063] S3. Output the precise defect detection result of the magnetic tile surface corresponding to the magnetic tile surface image through the adaptive rotation attention network.
[0064] In order to verify the performance of the adaptive rotation attention network (hereinafter referred to as ARA-Net) proposed in the embodiment of the present invention in the detection of magnetic tile surface defects, the embodiment of the present invention also provides the following comparative data:
[0065] The validation was performed based on the public MTSD3C6K dataset, which contains 6628 samples, including 2204 crack images, 2208 normal samples, and 2216 pit images. In the experiment, the dataset was divided into training set, validation set, and test set, numbered 3975, 1326, and 1327 respectively.
[0066] Accuracy and Kappa scores were used as evaluation indicators in the validation process of the above datasets, where:
[0067]
[0068] CAccuracy represents the class accuracy:
[0069]
[0070] a i is the actual number of samples in each category, b i is the number of predicted samples for each category.
[0071] ARA-Net was built with Pytorch 1.9.0 on a server equipped with an NVIDIA GeForce GTX 3090Ti GPU. The SGD optimizer was used to obtain a high-performance model, and the epoch, batch size, and initial learning rate were set to 100, 32, and 1e^3, respectively. StepLR was used as the learning scheduler, and CrossEntroy was used as the loss function.
[0072] For comparison, the embodiment of the present invention selects five classic deep learning-based networks, including DenseNet-121, MobileNetV3, EfficiencyNet-b0, GhostNet and VGG19, and two visual converters, including Visformer and HRNet, for testing on the MTSD3C6K dataset, where accuracy and kappa score are used as evaluation indicators.
[0073] These five classic deep learning networks are tested on the MTSD3C6K dataset. Then, the vision-based transformer network is tested and the results are shown in Figure 5 It can be noted that ARA-Net can achieve the best performance on defect detection, with an accuracy and kappa of 96.81% and 0.858 respectively, which indicates that it can be used as a valuable tool for magnetic tile defect detection.
[0074] Figure 5 Two indicators, Params and FPS, are also used to evaluate the model efficiency. It can be seen that ARC-Net can achieve excellent computing speed, with an FPS of 37.3 and a small account of 0.133M; in addition, compared with the second best VGG19, although the proposed ARA-Net is slower than VGG19, it can obtain significant improvements in Params, which shows that ARA-Net can be used as an effective tool for surface defect detection of magnetic tiles.
[0075] The beneficial effect achieved by the present invention is that a method for accurate defect detection on the surface of magnetic tiles based on an adaptive rotating attention network is proposed. The network detects random defects and small defects on the surface of magnetic tiles respectively through an adaptive rotating convolution module and a rotating area attention module, thereby improving the overall performance of the network in detecting defects on the surface of magnetic tiles and improving the work efficiency of the magnetic tile production inspection process.
[0076] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0077] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0079] The embodiments of the present invention are described above in conjunction with the accompanying drawings. What is disclosed is only the preferred embodiment of the present invention. However, the present invention is not limited to the above-mentioned specific implementation manner. The above-mentioned specific implementation manner is only illustrative rather than restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms and equivalent changes without departing from the scope of protection of the purpose of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A method for accurate defect detection on the surface of a magnetic tile, characterized in that: The method comprises the following steps: Acquire the surface image of the magnetic tile; Inputting the magnetic tile surface image into an adaptive rotation attention network for accurate defect detection, wherein the adaptive rotation attention network includes an adaptive rotation convolution module and a rotation region attention module; The adaptive rotational attention network outputs the precise defect detection result of the magnetic tile surface corresponding to the magnetic tile surface image.
2. The method for accurate defect detection on the surface of a magnetic tile according to claim 1, characterized in that: The adaptive rotation convolution module is defined as ARC(X), which satisfies: ARC(X)=Concat[BR(F)+α.AR(F)]; Among them, X represents the target image processed by the adaptive rotation convolution module, BR and AR represent basic rotation and adaptive rotation respectively, F represents the feature map of the target image obtained by basic rotation and adaptive rotation, α represents a preset learnable parameter, and Concat represents connection.
3. The method for accurate defect detection on the surface of a magnetic tile according to claim 2, characterized in that: The adaptive rotation convolution module is specifically used for: Generating a head feature map of the magnetic tile surface image by head convolution; The head feature map is basically rotated to generate a basic multi-view feature map with four basic angles; Adaptively rotating the basic multi-view feature maps at four basic angles according to a preset offset angle to generate four adaptive feature maps with different offsets; The basic multi-view feature maps at four basic angles and the adaptive feature maps at four different offsets are added together to obtain a random defect recognition image of the target image.
4. The method for accurate defect detection on the surface of a magnetic tile according to claim 3, characterized in that: The four basic angles are 0°, 90°, 180° and 270° respectively.
5. The method for accurate defect detection on the surface of a magnetic tile according to claim 3, characterized in that: The preset offset angle is greater than 0° and less than 90°.
6. The method for accurate defect detection on the surface of a magnetic tile according to claim 1, characterized in that: The adaptive rotation convolution module is defined as RRA(X), which satisfies: RRA(X)=AT(X)⊙AR(X); Wherein, X represents the target image processed by the rotation area attention module, AT represents the self-attention mechanism, AR represents the feature map of different offsets obtained from the adaptive rotation convolution module, and ⊙ represents the XOR operation.
7. The method for accurate defect detection on the surface of a magnetic tile according to claim 6, characterized in that: The rotation area attention module is specifically used for: Using the feature map of the target image as a query item, a keyword, and a value of an attention mechanism, respectively; Flattening and transposing the query item in the spatial dimension, and then multiplying it with the keyword to generate an attention weight map; Multiplying the attention weight map by the keyword to obtain an output feature map; The output feature map is spatially flattened and multiplied with the feature maps with different offsets to obtain a minute defect recognition image of the target image.
8. The method for accurate defect detection on the surface of a magnetic tile according to claim 1, characterized in that: The adaptive rotational attention network also includes a feedforward network module, which is used to classify defects in the magnetic tile surface image detected by the adaptive rotational convolution module and the rotational area attention module.
Citation Information
Patent Citations
Magnetic shoe surface defect detection method
CN115841447A