Flat wire motor stator surface defect detection method, device, equipment and storage medium

Through deep learning and image processing technology, combined with multi-scale similarity measurement, the problem of low efficiency and poor accuracy in flat wire motor stator surface defect detection is solved, achieving efficient and accurate defect identification and evaluation, providing intuitive display and continuous optimization.

CN118379283BActive Publication Date: 2024-10-18SANLINGLU (JIANGSU) POWER PARTS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410805742.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-10-18
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

The existing flat wire motor stator surface defect detection methods are inefficient, susceptible to noise and complex background, difficult to identify small defects, and cannot accurately assess the severity of defects, which limits the practicality of the detection system.

Method used

Deep learning and image processing technology are used to obtain image data of the flat wire motor stator surface, perform noise suppression, local contrast enhancement and feature fusion, and combine with multi-scale similarity measurement to achieve automatic identification, classification and severity assessment of defects.

Benefits of technology

It improves detection accuracy and efficiency, reduces missed detections and false detections, enhances the ability to identify defects of different sizes and shapes, provides intuitive visual display, and optimizes the model through user feedback and continuous learning to adapt to actual needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379283B_ABST
    Figure CN118379283B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of defect detection, and discloses a flat wire motor stator surface defect detection method, device, equipment and storage medium, which are used to improve the accuracy and efficiency of defect detection and provide strong support for the quality control and repair and maintenance of flat wire motors. The flat wire motor stator surface defect detection method includes: integrating deep learning and image processing technology to improve the accuracy of flat wire motor stator surface defect detection. Through image preprocessing, noise suppression and feature fusion, automatic defect recognition and classification are achieved. Multi-scale similarity measurement technology accurately locates defects and evaluates their severity. This solution improves detection accuracy and efficiency, captures various defects, and provides intuitive visual display. At the same time, with the help of user feedback and continuous learning, the model is continuously optimized to meet practical application needs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection, and in particular to a method, device, equipment and storage medium for detecting surface defects of a flat wire motor stator. Background Art

[0002] With the rapid development of industrial automation, motors, as core power components, are increasingly used in various fields. As a type of efficient and compact motor, the performance and service life of flat wire motors largely depend on the quality of the stator. However, during the manufacturing and operation of flat wire motors, various defects may appear on the stator surface, such as cracks, stains, deformation, etc. These defects seriously affect the performance and safety of the motor.

[0003] In order to ensure the quality and reliability of the motor, it is particularly important to detect defects on the surface of the flat wire motor stator. Traditional defect detection methods mainly rely on manual visual inspection, but this method is inefficient and easily affected by factors such as the experience and visual fatigue of the inspector, resulting in missed detection and false detection. Therefore, the development of an automated, efficient and accurate flat wire motor stator surface defect detection method has become an urgent need in the industry.

[0004] In recent years, with the continuous advancement of computer vision and deep learning technologies, image processing-based defect detection methods have been widely used in the field of industrial automation. These methods acquire image data of the stator surface and analyze the image using image processing algorithms or deep learning models to achieve automatic defect detection.

[0005] However, existing image processing-based defect detection methods still have some shortcomings. For example, some methods are not effective when dealing with complex backgrounds and noise interference, which can easily lead to false detection; other methods have limited ability to identify tiny defects and are difficult to meet the needs of high-precision detection. In addition, most existing methods can only provide defect category and location information, but cannot quantitatively evaluate the severity of the defects, which to some extent limits the practicality of defect detection systems.

[0006] In order to solve the above problems, this study proposed a new flat wire motor stator surface defect detection method. Summary of the invention

[0007] The present invention provides a flat wire motor stator surface defect detection method, device, equipment and storage medium, which are used to improve the accuracy and efficiency of defect detection and provide strong support for the quality control and repair and maintenance of the flat wire motor.

[0008] A first aspect of the present invention provides a flat wire motor stator surface defect detection method, the flat wire motor stator surface defect detection method comprising: acquiring flat wire motor stator surface image data, the flat wire motor stator surface image data comprising historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and marking the historical flat wire motor stator surface image data; performing noise identification and suppression based on the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image; performing noise-suppressed flat wire motor stator surface image based on the noise-suppressed flat wire motor stator surface image and the noise-suppressed flat wire motor stator surface normal image; The image is subjected to local contrast enhancement to obtain an enhanced flat wire motor stator surface image and an enhanced flat wire motor stator surface normal image; a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation are obtained based on the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image in combination with a preset ASNN model; the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation is calculated at multiple scales, and this is achieved by performing similarity measurement on feature maps of different scales; when the similarity at a certain scale is lower than a preset threshold, there is a defect at this scale, and the defect position information is further located, and the defect detection result of the flat wire motor stator surface is output based on the similarity measurement and the defect position information.

[0009] Optionally, in a first implementation method of the first aspect of the present invention, the flat wire motor stator surface image data is obtained, and the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and the historical flat wire motor stator surface image data is labeled, including: the flat wire motor stator surface image data includes normal stator surface image data samples and defective stator surface image data samples; the historical flat wire motor stator surface image data is sorted, including format conversion and resolution unification; the historical flat wire motor stator surface image data is labeled, and various defects on the stator surface are manually labeled, including cracks, stains, and deformations; and / or the historical flat wire motor stator surface image data is preliminarily labeled using a pre-trained machine learning model, and then manually reviewed and corrected; the labeled historical flat wire motor stator surface image data is pre-processed with enhancement and normalization.

[0010] Optionally, in a second implementation of the first aspect of the present invention, the noise identification and suppression based on the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model are obtained by noise suppression processing of the flat wire motor stator surface image and the noise suppression processing of the flat wire motor stator surface normal image, including: training a deep residual shrinkage network based on the historical flat wire motor stator surface image data, the deep residual shrinkage network includes multiple residual modules, each module internally integrates an adaptive soft threshold function, adopts a composite loss function and combines the mean square error to design the loss function, uses an Adam optimizer, and combines a learning rate decay strategy to improve training stability and convergence speed; first pre-training is performed on a large-scale natural image denoising dataset, and then fine-tuning is performed based on the historical flat wire motor stator surface image data; and / or adversarial samples are introduced, the adversarial samples are generated by adding small perturbations to improve the robustness of the model to noise and small changes; the DRSN model introduces a soft threshold function as a nonlinear layer, learns the characteristics of the noise and performs denoising, and sets y as the output of this layer, then:

[0011] y=\sigma(Wx+b)\odot\tau(Wx+b)+(1-\tau(Wx+b))\odotx

[0012] Among them, W represents the weight matrix of the network, b represents the bias term, which is a learnable parameter, \sigma is the activation function, \tau is the soft threshold function, \odot represents element-by-element multiplication, and x is the input data of this layer. After processing by DRSN, the denoised image is obtained.

[0013] Optionally, in a third implementation method of the first aspect of the present invention, the local contrast enhancement is performed based on the noise suppression processed flat wire motor stator surface image and the noise suppression processed normal flat wire motor stator surface image to obtain the enhanced processed flat wire motor stator surface image and the enhanced processed normal flat wire motor stator surface image, including: dividing the noise suppression processed flat wire motor stator surface image and the noise suppression processed normal flat wire motor stator surface image into a number of small blocks or areas; for each image block, calculating its contrast, which is obtained by calculating the standard deviation of pixel intensity; and / or designing a local contrast enhancement algorithm, using contrast-limited adaptive histogram equalization to enhance the local contrast, applying the enhancement algorithm to each image block, thereby improving the local contrast of the image and making the defective part more prominent; merging the enhanced image blocks back to the size of the original image, and in order to ensure a smooth transition between image blocks, using feathering or fusion technology during the merging; obtaining the enhanced processed flat wire motor stator surface image and the enhanced processed normal flat wire motor stator surface image.

[0014] Optionally, in a fourth implementation manner of the first aspect of the present invention, the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation are obtained based on the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image combined with a preset ASNN model, including: training a preset ASNN model based on the historical flat wire motor stator surface image data, the ASNN model includes two weight-sharing twin sub-networks and a third sub-network, the third sub-network is used to learn the normal features of the stator surface, and the third sub-network captures the unique features of the normal stator surface; using the historical flat wire motor stator surface image data to train the ASNN model, adopting a staged training strategy, first training the twin sub-network, then training the third sub-network, and finally performing overall fine-tuning; using contrast loss to train the two twin sub-networks so that they can distinguish different input images, setting the contrast loss function to L_{contrastive}(W), then:

[0015] L_{contrastive}(W)=(1-Y)\frac{1}{2}D_W^2+(Y)\frac{1}{2}\max(0,m-D_W)^2

[0016] Wherein, W represents the weight parameter of the twin network; D_W represents the Euclidean distance of the feature representation of the two input images in the twin network; Y is a binary label, when the two input images belong to the same category, Y=1; otherwise, Y=0; m is a preset threshold value used to define the minimum distance between images of different categories; the normal flat wire motor stator surface image data in the historical flat wire motor stator surface image data is used to train the third sub-network, and the cross entropy loss is used to optimize the network, and the cross entropy loss function is set to L_{cross-entropy}(W'), then:

[0017] L_{cross-entropy}(W')=-\sum_{i=1}^{C}y_i\log(p_i)

[0018] Where: W' represents the weight parameter of the third sub-network; C is the number of categories; y_i is the true category label, for the normal category, y_i=1; otherwise, y_i=0; p_i is the probability distribution predicted by the network;

[0019] The output features of the three sub-networks are fused and fine-tuned as a whole. A joint loss function is used to optimize the weights of all sub-networks at the same time. The joint loss function is set to L_{joint}(W,W'), then:

[0020] L_{joint}(W,W')=\alphaL_{contrastive}(W)+(1-\alpha)L_{cross-entropy}(W')

[0021] Among them, (\alpha) is a weight coefficient that balances the two losses; L2 regularization and Dropout technology are applied to prevent overfitting, and the optimizer is used to accelerate the training process; after the feature extraction layer, the output of the two twin sub-networks is fused with the output of the third sub-network, and the output features of the two twin sub-networks are set to f_1 and f_2, and the output features of the third sub-network are set to f_3 for fusion:

[0022] f_{fused}=[f_1;f_2;f_3]

[0023] The real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation are obtained.

[0024] Optionally, in a fifth implementation of the first aspect of the present invention, the similarity between the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation is calculated at multiple scales by performing similarity measurement on feature maps of different scales. When the similarity at a certain scale is lower than a preset threshold, a defect exists at the scale, and the defect location information is further located. Based on the similarity measurement and the defect location information, the defect detection result of the flat wire motor stator surface is output, including: ensuring that the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation are aligned in space and scale by interpolation, adjusting the size of the feature map or using an attention mechanism; at each scale, using the structural similarity index SSIM to calculate the similarity between the real-time feature and the normal feature; and / or designing a weighted similarity measurement, wherein the weight is dynamically adjusted according to the importance or information amount of the feature; setting a similarity threshold for each scale to determine whether there is a defect, and this threshold is based on training data or historical The method comprises the following steps: setting the similarity of the defect at a certain scale by using historical data, and / or dynamically adjusting the similarity through online learning, and / or feedback mechanism; and / or using a multi-scale feature fusion network to integrate feature information of different scales, so as to enhance the recognition ability of defects; once the similarity is detected to be lower than a threshold at a certain scale, it is considered that there is a defect, and the defect area is highlighted by using a heat map, a saliency map or a class activation mapping technique to analyze the feature map of the scale to locate the defect location information; integrating the similarity measurement and defect location information at each scale, including summarizing the similarity scores, defect locations and type data of different scales; parsing the integrated data to identify the defect locations corresponding to the similarity scores lower than the preset threshold, and the defect types at these locations; classifying the detected defects according to the defect type information parsed, and classifying the defects into multiple types such as surface cracks, coating peeling and impurities; and / or designing a defect rating system to rate each defect, including slight, moderate and severe, according to the results of the similarity measurement and the size and location factors of the defect.

[0025] Optionally, in the sixth implementation method of the first aspect of the present invention, it also includes: using 3D modeling technology to create a 3D model of a flat wire motor stator, on which the detected defect location, type and rating are intuitively displayed, and the user can observe the defects on the stator surface from different angles through rotation and scaling operations; and / or designing a dynamic heat map, in which different colors and intensities represent different defect types and severities. At the same time, combined with data visualization technology, the similarity measurement, defect location, type and rating information are displayed in the form of charts or graphs to facilitate users to quickly understand and analyze; and / or using VR and AR technology to provide users with an immersive defect detection experience. Users enter a virtual flat wire motor stator environment by wearing VR or AR devices to intuitively view and interact with defect information; based on user feedback and actual needs, continuously optimize the form and content of the output results to make it more in line with the user's usage habits and aesthetic needs; use newly collected defect data and user feedback for continuous learning and updating of the model.

[0026] The second aspect of the present invention provides a flat wire motor stator surface defect detection device, the flat wire motor stator surface defect detection device comprising: an acquisition module, used to acquire flat wire motor stator surface image data, the flat wire motor stator surface image data comprising historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and annotating the historical flat wire motor stator surface image data; a processing module, used to perform noise identification and suppression based on the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a normal image of the noise-suppressed flat wire motor stator surface; an enhancement module, used to perform noise-suppressed flat wire motor stator surface image based on the noise-suppressed flat wire motor stator surface image and the noise-suppressed flat wire motor stator surface image; The method comprises the following steps: performing local contrast enhancement on a normal surface image of a flat wire motor stator to obtain an enhanced surface image of the flat wire motor stator and an enhanced surface normal image of the flat wire motor stator; a setting module is used to obtain a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation according to the enhanced surface image of the flat wire motor stator and the enhanced surface normal image of the flat wire motor stator in combination with a preset ASNN model; an output module is used to calculate the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation at multiple scales, which is achieved by performing similarity measurement on feature maps of different scales. When the similarity of a certain scale is lower than a preset threshold, there is a defect at this scale, and the defect position information is further located. According to the similarity measurement and the defect position information, the defect detection result of the flat wire motor stator surface is output.

[0027] A third aspect of the present invention provides a flat wire motor stator surface defect detection device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the flat wire motor stator surface defect detection device executes the above-mentioned flat wire motor stator surface defect detection method.

[0028] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned method for detecting surface defects of a flat wire motor stator.

[0029] The technical solution provided by the present invention combines technologies such as deep learning, image processing and multi-scale feature fusion, aiming to improve the accuracy, robustness and practicality of defect detection. By acquiring image data of the stator surface of the flat wire motor and performing operations such as image preprocessing, noise suppression and local contrast enhancement, the method can more effectively extract the feature information of the stator surface. At the same time, the deep learning model is used to fuse and classify the features, thereby realizing automatic recognition and classification of defects. Finally, through multi-scale similarity measurement and defect location positioning technology, the defect location can be accurately located and its severity can be evaluated. Beneficial Effects

[0030] Improve detection accuracy and efficiency: Through deep learning models, image noise recognition and suppression, local contrast enhancement and feature fusion, it is possible to more accurately identify tiny defects on the stator surface and reduce missed detection and false detection. At the same time, the automated detection process also greatly improves detection efficiency.

[0031] Multi-scale feature analysis: Calculating feature similarity at different scales helps capture defects of different sizes and shapes, enhancing the flexibility and adaptability of detection.

[0032] Intuitive visual display: Through 3D modeling, dynamic heat map, VR / AR technology and other methods, defect information is presented to users in an intuitive and easy-to-understand way, which helps users quickly understand and analyze the defects on the stator surface.

[0033] User feedback and continuous learning: User feedback and continuous learning of the model are also taken into consideration. The model is optimized and updated by continuously collecting new defect data and user feedback to make it more adaptable to the needs of actual application scenarios.

[0034] In summary, the present invention realizes efficient and accurate detection of surface defects of flat wire motor stators through the combination of deep learning and image processing technology, providing strong technical support for motor manufacturing and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of an embodiment of a method for detecting surface defects of a flat wire motor stator according to an embodiment of the present invention;

[0036] Figure 2 It is a schematic diagram of another embodiment of a method for detecting surface defects of a flat wire motor stator according to an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of an embodiment of a flat wire motor stator surface defect detection device in an embodiment of the present invention;

[0038] Figure 4 It is a schematic diagram of another embodiment of a flat wire motor stator surface defect detection device according to an embodiment of the present invention;

[0039] Figure 5 It is a schematic diagram of an embodiment of a flat wire motor stator surface defect detection device in an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The embodiments of the present invention provide a method, device, equipment and storage medium for detecting surface defects of a flat wire motor stator, which are used to improve the accuracy and efficiency of defect detection and provide strong support for the quality control and repair and maintenance of the flat wire motor. The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0041] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of a flat wire motor stator surface defect detection method in an embodiment of the present invention includes:

[0042] Start 101, obtain flat wire motor stator surface image data, the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and mark the historical flat wire motor stator surface image data;

[0043] It is understandable that the execution subject of the present invention may be a flat wire motor stator surface defect detection device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0044] It should be noted that historical data: surface image data of flat wire motor stators produced in the past five years were collected from the company's database, totaling 10,000 images. These data include various common stator surface defects, such as cracks, stains, deformation, etc.; real-time data: high-definition cameras are installed on the production line to capture the surface images of flat wire motor stators in real time, and about 500 real-time image data can be collected every day;

[0045] Annotation tool: Choose a suitable image annotation tool, such as LabelImg or VIA (Visual Image Annotation Tool); Annotation team: Assemble a 5-person annotation team with rich experience in motor manufacturing and quality control; Annotation process: Train the annotation team to ensure that they are familiar with the characteristics and annotation methods of various stator surface defects; Use annotation tools to annotate historical image data. The defects in each image will be annotated and the specific defect type (such as cracks, stains, etc.) will be given;

[0046] After two weeks of labeling all 10,000 historical images, the team identified more than 5,000 defect instances. After the labeling was completed, we obtained a dataset containing 10,000 labeled flat wire motor stator surface images, of which crack defects accounted for 35%, stain defects accounted for 25%, deformation defects accounted for 20%, and other types of defects accounted for 20%.

[0047] Using the DRSN model 102, according to the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data combined with a preset DRSN model, noise identification and suppression are performed to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image;

[0048] It should be noted that real-time data: 100 representative images are selected from the flat wire motor stator surface images captured in real time on the production line, including various common stator surface defects and normal images without defects; historical data: 1,000 annotated flat wire motor stator surface images are selected from the historical database, which contain various noise types and stator surface defects; DRSN model preset and training; model selection: select the deep residual shrinkage network (DRSN) as the model for noise recognition and suppression; DRSN consists of a residual network, a self-attention network and soft thresholding, which can effectively handle strong noise data; training set construction: 800 images in the historical data are used as training sets, and the remaining 200 images are used as validation sets; model training: the DRSN model is trained using the training set, and the model parameters and hyperparameters are adjusted to optimize the model's noise recognition and suppression capabilities. During the training process, use appropriate loss functions (such as mean square error loss) and optimizers (such as Adam optimizer).

[0049] Real-time data processing: 100 real-time captured images of the flat wire motor stator surface are input into the trained DRSN model; Noise identification: The DRSN model first identifies the noise part in the image, such as Gaussian noise, salt and pepper noise, etc.; Noise suppression: The model effectively suppresses the identified noise through a combination of residual network, self-attention network and soft thresholding;

[0050] The peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM) are used to quantitatively evaluate the image quality before and after noise suppression. For example, PSNR is improved from 30dB before suppression to 38dB after suppression, and SSIM is improved from 0.85 to 0.95. Qualitative evaluation: Through visual inspection, it is confirmed that the stator surface defects are more clearly visible in the image after noise suppression, which is convenient for subsequent defect detection and analysis.

[0051] Images after noise suppression: output 100 flat wire motor stator surface images after noise suppression by the DRSN model; Normal images: output normal images judged by the model as noise-free or defect-free at the same time for comparison and reference.

[0052] Local contrast enhancement 103, performing local contrast enhancement according to the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image to obtain an enhanced processed flat wire motor stator surface image and an enhanced processed flat wire motor stator surface normal image;

[0053] It should be noted that data preparation: noise suppressed images: select 100 flat wire motor stator surface images that have been processed by DRSN model noise suppression, including images with defects and normal images; use adaptive histogram equalization (AHE) or contrast limited adaptive histogram equalization (CLAHE) and other methods to perform local contrast enhancement; image preprocessing: ensure that all images have been processed by noise suppression to reduce the additional noise that may be introduced during contrast enhancement; parameter setting: set appropriate parameters for the CLAHE algorithm, such as block size and contrast limit. For example, the block size is set to 8x8 and the contrast limit is set to 0.02; apply CLAHE: apply the CLAHE algorithm to each noise suppressed image to enhance the local contrast of the image; save results: save the enhanced images, which are divided into two groups: enhanced flat wire motor stator surface images (including defects) and enhanced flat wire motor stator surface normal images. Result evaluation and comparison: Quantitative evaluation: Compare the contrast, brightness and other indicators of the image before and after enhancement, for example, the contrast is increased from 50 before enhancement to 80 after enhancement; Qualitative evaluation: Through visual inspection, confirm that the defective part is more obvious and easy to identify in the enhanced image. Output the enhanced image set for subsequent defect identification and analysis.

[0054] Using the ASNN model 104, according to the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image combined with a preset ASNN model, a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation are obtained;

[0055] It should be noted that: Data preparation: Enhanced images: Select 100 flat wire motor stator surface images that have been locally contrast enhanced, including 50 images with defects and 50 normal images; Model construction: Design an adaptive selection neural network (ASNN) that can adaptively select the most representative features for extraction. The network structure can include multiple convolutional layers, pooling layers, fully connected layers, etc.; Training set and validation set: 80 images (40 defective images, 40 normal images) are used as training sets, and the remaining 20 images (10 defective images, 10 normal images) are used as validation sets; Model training: Use the training set to train the ASNN model, and adjust the model parameters through the back propagation algorithm and optimizer (such as gradient descent) to minimize the prediction error; Input image: Input the enhanced flat wire motor stator surface image and normal image into the trained ASNN model; Feature extraction: Extract the fusion feature representation in the image through the convolutional layer, pooling layer, etc. of the model. These features can capture the detailed information of the stator surface, including the features of defects and normal parts. Feature visualization: Visualize the extracted features to confirm whether the model has successfully captured the key features of the stator surface; Quantitative evaluation: Use the validation set to evaluate the performance of the model, such as accuracy, recall and other indicators. For example, the accuracy can reach more than 90%. Feature representation: Output the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation. These features can be used for subsequent defect classification, positioning and identification tasks.

[0056] Multi-scale similarity calculation 105, calculating the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation at multiple scales, and realizing it by performing similarity measurement on feature maps of different scales. When the similarity of a certain scale is lower than a preset threshold, there is a defect at this scale, and further locates the defect position information. Based on the similarity measurement and the defect position information, the defect detection result of the flat wire motor stator surface is output;

[0057] It should be noted that data preparation: Feature representation: Use the real-time flat wire motor stator fusion feature representation and flat wire motor stator normal image feature representation extracted in the previous step; Scale setting: Set three different scales (such as small scale, medium scale, and large scale) and perform similarity measurement at each scale. Use cosine similarity, Euclidean distance, or other suitable similarity calculation methods to measure the similarity between real-time features and normal features. Feature map adjustment: Adjust the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation to the preset three scales to form feature maps of different scales. Similarity calculation: Small scale: Calculate the similarity of corresponding positions on the small scale feature map. For example, the cosine similarity is 0.95. Medium scale: Perform similarity calculation on the medium scale feature map. For example, the cosine similarity is 0.90. Large scale: Perform similarity calculation on the large scale feature map. For example, the cosine similarity is 0.85. Threshold setting: Set a similarity threshold for each scale, such as setting the small scale threshold to 0.90, the medium scale threshold to 0.85, and the large scale threshold to 0.80.

[0058] Defect judgment: When the similarity of a certain scale is lower than the corresponding preset threshold, it is judged that there is a defect at this scale. For scales judged to have defects, the defect position is located by the low-similarity area in the similarity graph. For example, an area with a similarity lower than 0.90 found on a small scale is the defect location. Output the similarity measurement results and defect location information at each scale. Combine the information of multiple scales to give the final defect detection result. For example, in this case, defects were found on both the small and medium scales, and no defects were found on the large scale. Therefore, it can be judged that there are small to medium-sized defects on the stator surface. Quantitative evaluation: Statistical indicators such as the accuracy rate and recall rate of correctly detecting defects at different scales to evaluate the performance of the detection method. Visualization: Mark the detected defect locations on the original image to generate a visualized defect detection result map.

[0059] In the embodiment of the present invention, the real-time surface image of the flat wire motor stator is captured by a high-definition camera, combined with historical image data, and the deep residual shrinkage network (DRSN) is used to identify and suppress noise, thereby improving the image quality. Subsequently, the adaptive histogram equalization technology is used to enhance the local contrast of the image, making the defects on the stator surface more obvious. Next, the adaptive selection neural network (ASNN) is used to extract the features of the enhanced image. Finally, by calculating the similarity between the real-time features and the normal features at multiple scales, the defects on the stator surface are accurately located and detected. Image preprocessing techniques such as noise suppression and local contrast enhancement are used to effectively improve image quality, making subsequent defect detection more accurate; similarity measurement at different scales can more accurately locate and identify defects of different sizes, improving the comprehensiveness and accuracy of detection; the ASNN model is used to adaptively extract the most representative features, enhancing the flexibility and effectiveness of feature extraction; the entire detection process has a high degree of automation and can quickly process large amounts of real-time image data to meet real-time monitoring needs on the production line; it provides visual defect detection results, allowing operators to intuitively understand the defects on the stator surface and take corresponding measures in a timely manner; it is not only suitable for defect detection on the surface of flat wire motor stators, but can also be promoted to surface quality inspection of other similar products. In summary, this technology achieves efficient and accurate detection of surface defects on flat wire motor stators through the comprehensive use of image processing, deep learning, multi-scale analysis and other technical means, providing strong support for quality control in the motor manufacturing industry.

[0060] See also Figure 2 Another embodiment of the flat wire motor stator surface defect detection method in the embodiment of the present invention includes:

[0061] Start 101, obtain flat wire motor stator surface image data, the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and mark the historical flat wire motor stator surface image data;

[0062] Specifically, the flat wire motor stator surface image data includes normal stator surface image data samples and defective stator surface image data samples; the historical flat wire motor stator surface image data is sorted, including format conversion and resolution unification; the historical flat wire motor stator surface image data is annotated, and various defects on the stator surface are manually annotated, including cracks, stains, and deformations; and / or the historical flat wire motor stator surface image data is preliminarily annotated using a pre-trained machine learning model, and then manually reviewed and corrected; the annotated historical flat wire motor stator surface image data is pre-processed by enhancement and normalization;

[0063] It should be noted that data acquisition: Historical data: From the company's database, we collected surface image data of flat wire motor stators produced in the past 5 years. A total of 10,000 images were obtained, including 5,000 samples of normal stator surface image data and 5,000 samples of stator surface image data with various defects. Real-time data: A high-definition camera was installed on the production line to capture the surface image of the flat wire motor stator in real time at a speed of 5 frames per second. During a continuous week of production, we collected about 25,200 (5 frames / second x 60 seconds / minute x 60 minutes / hour x 24 hours / day x 7 days / week = 25,200) real-time image data. Historical data collation: Format conversion: The original image data may be stored in a variety of formats, such as JPEG, PNG, BMP, etc. Use image processing tools (such as ImageMagick or Pillow library) to uniformly convert all images to PNG format to ensure consistency in subsequent processing. Unified resolution: The resolution of the images varies, some may be high-definition 4K images, and some may be just ordinary 1080p. The image processing algorithm is used to unify the resolution of all images to 1920x1080 pixels to facilitate subsequent feature extraction and model training. Data annotation: Manual annotation: A team of 5 professional annotators with rich experience in motor manufacturing and quality control was formed. Using professional image annotation tools such as LabelImg, the team manually annotated the defects in 10,000 historical image data. The annotations included various stator surface defects such as cracks, stains, and deformation. Automatic annotation and review: To improve efficiency, we also used a pre-trained machine learning model such as Faster R-CNN to perform preliminary annotations on historical images. The annotation team then manually reviewed and corrected the results of the automatic annotations to ensure the accuracy of the annotations. Data enhancement: In order to increase the generalization ability of the model, we performed data enhancement operations on the annotated historical image data. Enhancement operations include random rotation, scaling, cropping, flipping, etc. to simulate various situations that may occur on the production line. Normalization: Before feeding the data into the machine learning model, we normalized the images. Normalization adjusts the pixel value range of the image to [0, 1] to eliminate the differences between different images due to factors such as lighting conditions.

[0064] Using the DRSN model 102, according to the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data combined with a preset DRSN model, noise identification and suppression are performed to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image;

[0065] Specifically, a deep residual shrinkage network is trained based on the historical flat wire motor stator surface image data, the deep residual shrinkage network includes multiple residual modules, each module integrates an adaptive soft threshold function, adopts a composite loss function and combines the mean square error to design the loss function, uses an Adam optimizer, and combines the learning rate decay strategy to improve the training stability and convergence speed; first, pre-training is performed on a large-scale natural image denoising dataset, and then fine-tuning is performed based on the historical flat wire motor stator surface image data; and / or adversarial samples are introduced, and the adversarial samples are generated by adding small perturbations to improve the robustness of the model to noise and small changes; the DRSN model learns the characteristics of the noise and denoises it by introducing a soft threshold function as a nonlinear layer, and y is set as the output of this layer, then:

[0066] y=\sigma(Wx+b)\odot\tau(Wx+b)+(1-\tau(Wx+b))\odotx

[0067] Among them, W represents the weight matrix of the network, b represents the bias term, which is a learnable parameter, \sigma is the activation function, \tau is the soft threshold function, \odot represents element-by-element multiplication, and x is the input data of this layer. After being processed by DRSN, the denoised image is obtained;

[0068] It should be noted that the real-time data and historical data are as follows: Real-time flat wire motor stator surface image data: 5,000 images are randomly selected from the 25,200 images captured in real time on the production line as the real-time data set. Historical flat wire motor stator surface image data: 10,000 historical image data that have been sorted and annotated before are used. Network structure: A deep residual contraction network is built, which contains 6 residual modules, and each module integrates an adaptive soft threshold function. Each residual module contains a convolution layer, a batch normalization layer, an adaptive soft threshold function, and a ReLU activation function. Loss function design: A composite loss function is used to design the loss function in combination with the mean square error (MSE) and the structural similarity index (SSIM) to more comprehensively evaluate the image quality. Loss function formula: Loss = α * MSE_Loss + (1 - α) * (1 - SSIM), where α is set to 0.7. The Adam optimizer is used, the initial learning rate is set to 0.001, and combined with the learning rate decay strategy, the learning rate is reduced to 0.1 times the original every 10 cycles. First, pre-training is performed on a large-scale natural image denoising dataset containing 10,000 images, and a total of 50 cycles are trained. Then, 10,000 historical flat wire motor stator surface image data are used for fine-tuning and another 20 cycles are trained. Introducing adversarial samples: Adding small perturbations to some images in the historical dataset to generate adversarial samples to enhance the robustness of the model. Adversarial samples account for 10% of the training set, that is, 1000 images. Noise identification and suppression: The real-time dataset (5000 images) is input into the trained DRSN model for noise identification and suppression. The signal-to-noise ratio (SNR) and structural similarity index (SSIM) of each image before and after processing are recorded to evaluate the denoising effect.

[0069] Results statistics: Average SNR improvement: After DRSN processing, the average SNR of the real-time data set increased from the original 20dB to 28dB. Average SSIM improvement: The SSIM of the processed image and the original clear image increased from 0.7 to 0.9.

[0070] Local contrast enhancement 103, performing local contrast enhancement according to the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image to obtain an enhanced processed flat wire motor stator surface image and an enhanced processed flat wire motor stator surface normal image;

[0071] Specifically, the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image are divided into several small blocks or areas; for each image block, its contrast is calculated by calculating the standard deviation of pixel intensity; and / or a local contrast enhancement algorithm is designed, and the local contrast is enhanced by using contrast-limited adaptive histogram equalization, and the enhancement algorithm is applied to each image block, thereby improving the local contrast of the image and making the defective part more prominent; the enhanced image blocks are merged back to the size of the original image, and in order to ensure a smooth transition between the image blocks, feathering or fusion technology is used during the merging; the enhanced processed flat wire motor stator surface image and the enhanced processed flat wire motor stator surface normal image are obtained;

[0072] It should be noted that data preparation: Noise suppression processed images: 5000 noise suppression flat wire motor stator surface images previously processed by the DRSN model (real-time data set) are used. At the same time, 5000 normal images of the flat wire motor stator surface with corresponding noise suppression are prepared for comparison. Image block division: Each noise suppression processed image is divided into small blocks of 64x64 pixels. For the edge part, if it is not enough to form a complete small block, it is filled (for example, using mirror filling or zero filling). Calculate contrast: For each 64x64 image block, calculate the standard deviation of its pixel intensity to represent the contrast. Record the contrast value of each image block. Design local contrast enhancement algorithm: The contrast-limited adaptive histogram equalization (CLAHE) algorithm is used to enhance the local contrast. In the CLAHE algorithm, set appropriate parameters, such as clipLimit (contrast limit) to 4 and tileGridSize (area size used to calculate the histogram) to 8x8. Apply enhancement algorithm: Apply the CLAHE algorithm to each 64x64 image block to enhance the local contrast. Image block merging: Merge the enhanced image blocks back to the size of the original image. When merging, use feathering techniques (for example, Gaussian blurring the edges of the image blocks) to ensure a smooth transition between image blocks and reduce blocking effects. Result statistics: Compare the images before and after the enhancement process, and record the average contrast improvement ratio. In this case, the average contrast (measured by standard deviation) increased by about 30%. Visual inspection confirmed that the defective parts (such as cracks, stains, etc.) are more prominent and obvious in the enhanced image. After local contrast enhancement, we obtained 5,000 enhanced flat wire motor stator surface images and 5,000 enhanced flat wire motor stator surface normal images. The effectiveness of the enhancement process was confirmed by quantitative evaluation (such as contrast improvement ratio) and qualitative evaluation (such as visual inspection of the prominence of defects).

[0073] Using the ASNN model 104, according to the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image combined with a preset ASNN model, a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation are obtained;

[0074] Specifically, a preset ASNN model is trained according to the historical flat wire motor stator surface image data, the ASNN model includes two weight-sharing twin sub-networks and a third sub-network, the third sub-network is used to learn the normal features of the stator surface, and the third sub-network captures the unique features of the normal stator surface; the ASNN model is trained using the historical flat wire motor stator surface image data, a phased training strategy is adopted, first the twin sub-network is trained, then the third sub-network is trained, and finally the overall fine-tuning is performed; the contrast loss is used to train the two twin sub-networks so that they can distinguish different input images, and the contrast loss function is set to L_{contrastive}(W), then:

[0075] L_{contrastive}(W)=(1-Y)\frac{1}{2}D_W^2+(Y)\frac{1}{2}\max(0,m-D_W)^2

[0076] Wherein, W represents the weight parameter of the twin network; D_W represents the Euclidean distance of the feature representation of the two input images in the twin network; Y is a binary label, when the two input images belong to the same category, Y=1; otherwise, Y=0; m is a preset threshold value used to define the minimum distance between images of different categories; the normal flat wire motor stator surface image data in the historical flat wire motor stator surface image data is used to train the third sub-network, and the cross entropy loss is used to optimize the network, and the cross entropy loss function is set to L_{cross-entropy}(W'), then:

[0077] L_{cross-entropy}(W')=-\sum_{i=1}^{C}y_i\log(p_i)

[0078] Where: W' represents the weight parameter of the third sub-network; C is the number of categories; y_i is the true category label, for the normal category, y_i=1; otherwise, y_i=0; p_i is the probability distribution predicted by the network; the output features of the three sub-networks are fused and fine-tuned as a whole, and a joint loss function is used to optimize the weights of all sub-networks at the same time. The joint loss function is set to L_{joint}(W,W'), then:

[0079] L_{joint}(W,W')=\alphaL_{contrastive}(W)+(1-\alpha)L_{cross-entropy}(W')

[0080] Among them, (\alpha) is a weight coefficient that balances the two losses; L2 regularization and Dropout technology are applied to prevent overfitting, and the optimizer is used to accelerate the training process; after the feature extraction layer, the output of the two twin sub-networks is fused with the output of the third sub-network, and the output features of the two twin sub-networks are set to f_1 and f_2, and the output features of the third sub-network are set to f_3 for fusion:

[0081] f_{fused}=[f_1;f_2;f_3]

[0082] Obtain real-time flat wire motor stator fusion feature representation and flat wire motor stator normal image feature representation;

[0083] It should be noted that the data preparation is as follows: Historical data set: 10,000 historical flat wire motor stator surface image data that have been sorted and annotated before are used, including 5,000 normal stator surface images and 5,000 stator surface images with various defects. Real-time data set: 5,000 real-time flat wire motor stator surface images that have been processed with noise suppression and local contrast enhancement.

[0084] Network structure: An ASNN model consisting of two shared weighted twin networks and a third network is constructed. The twin network is used to learn the features that distinguish different input images, and the third network specifically learns the features of the normal stator surface.

[0085] Training strategy: Phase 1: First train the twin network. Use normal and defective image pairs in the historical dataset as input, and train through the contrast loss function so that the network can distinguish different input images. Dataset size: 10,000 pairs of images (5,000 pairs of the same category, 5,000 pairs of different categories); Twin network structure: Use pre-trained models such as VGG16 or ResNet50 as the basic network structure, and remove the fully connected layer to adapt to the feature extraction task. Threshold m: 1.0; Number of training rounds: set to 50 rounds (epochs); Batch size: set to 32 or 64; Learning rate: The initial learning rate can be set to 0.001 and gradually decrease as training progresses;

[0086] Phase 2: Next, train the third sub-network. Only use the normal stator surface images in the historical dataset for training. The training set size is 5,000 normal flat wire motor stator surface images. The third sub-network structure: Use ResNet18 as the basic architecture and make necessary adjustments to suit this task. Number of training rounds (epochs): Set to 20 rounds. Batch size: Set to 32. Learning rate: The initial learning rate can be set to 0.001 and adjusted using the learning rate scheduler as training progresses.

[0087] Stage 3: Finally, fine-tune the whole network. The output features of the three sub-networks are fused, and the weights of all sub-networks are optimized simultaneously using the joint loss function. Training set size: 10,000 flat wire motor stator surface images (including normal and defective images); Sub-network structure: The two twin sub-networks use the same CNN architecture (such as ResNet50), and the third sub-network also uses a similar architecture but may have different layers and parameters. Feature fusion method: feature concatenation. Joint loss function weight coefficient (\alpha): 0.6; Number of training rounds (epochs): 20 rounds; Batch size (batch size): 64; Learning rate: The initial learning rate is set to 0.001, and the learning rate decay strategy is adopted.

[0088] Prevent overfitting and optimization: L2 regularization is applied during training, with a regularization coefficient of 0.001. Dropout technology is used, and the dropout ratio is set to 0.5 after the fully connected layer. Adam optimizer is used, and the initial learning rate is set to 0.0001, and gradually reduced as training progresses.

[0089] Feature fusion: After the feature extraction layer, the output features f1 and f2 of the two twin sub-networks are fused with the output feature f3 of the third sub-network to obtain the fused feature f_{fused}.

[0090] Feature extraction and fusion: For each image in the real-time data set, extract the features of the twin network and the third sub-network through the trained ASNN model and fuse them. Record the dimension and value range of the fused features for subsequent processing and analysis. Compare the feature representation before and after fusion to observe whether the fused features can more effectively represent the state of the stator surface. Use the fused features for subsequent defect detection tasks and record the improvement in detection accuracy.

[0091] Multi-scale similarity calculation 105, calculating the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation at multiple scales, and realizing it by performing similarity measurement on feature maps of different scales. When the similarity of a certain scale is lower than a preset threshold, there is a defect at this scale, and further locates the defect position information. Based on the similarity measurement and the defect position information, the defect detection result of the flat wire motor stator surface is output;

[0092] Specifically, the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation are aligned in space and scale by interpolation, feature map resizing or attention mechanism; at each scale, the structural similarity index SSIM is used to calculate the similarity between the real-time feature and the normal feature; and / or a weighted similarity metric is designed, in which the weight is dynamically adjusted according to the importance or information amount of the feature; a similarity threshold is set for each scale to determine whether there is a defect, and this threshold is set based on training data or historical data, and / or is dynamically adjusted through online learning and / or a feedback mechanism; and / or a multi-scale feature fusion network is used to integrate feature information of different scales, thereby enhancing the ability to recognize defects; once at a certain scale, When the similarity is detected to be lower than the threshold, it is considered that there is a defect. The defect area is highlighted by using heat map, saliency map or class activation mapping technology to analyze the feature map of the scale to locate the defect location information; the similarity measurement and defect location information at each scale are integrated, including summarizing the similarity scores, defect location and type data at different scales; the integrated data is analyzed to identify the defect locations corresponding to the similarity scores below the preset threshold, as well as the defect types at these locations; the detected defects are classified according to the analyzed defect type information, and the defects are divided into multiple types such as surface cracks, coating peeling, and impurities; and / or a defect rating system is designed to rate each defect, including minor, moderate, and severe, based on the results of the similarity measurement and the size and location factors of the defect;

[0093] It should be noted that interpolation (such as bilinear interpolation) and feature map resizing are used to ensure that the real-time flat wire motor stator fusion feature representation is aligned with the flat wire motor stator normal image feature representation in space and scale; Data: For example, if the size of the real-time feature map is 128x128 and the size of the normal image feature map is 256x256, the normal image feature map can be scaled to 128x128 by downsampling, or the real-time feature map can be enlarged to 256x256 by upsampling to achieve feature alignment. At each scale, the structural similarity index (SSIM) is used to calculate the similarity between the real-time feature and the normal feature. Data: It is assumed that at a certain scale, the SSIM value of the real-time feature and the normal feature is 0.95, which indicates that the two have a high similarity at this scale. Design a weighted similarity measure in which the weight is dynamically adjusted according to the importance or information content of the feature. For example, a higher weight can be given to a more critical feature area. Data: It is assumed that the weight of a certain key feature area is set to 0.6, while the weight of other areas is 0.4. Then, when calculating the total similarity, the contribution of this key feature area will be greater. Set a similarity threshold for each scale to determine whether there is a defect. This threshold can be set based on training data or historical data, and can be dynamically adjusted through online learning or feedback mechanisms. Data: For example, the SSIM threshold can be set to 0.9. When the SSIM value of the real-time feature and the normal feature is lower than 0.9, it is considered to be a defect.

[0094] A multi-scale feature fusion network is used to integrate feature information at different scales. This can be achieved through pyramid structures, skip connections, etc. to enhance the ability to identify defects. Data: It is set to extract features at three different scales and fuse them. By fusing these multi-scale features, the model is able to more accurately identify tiny defects on the stator surface. At a certain scale, once the similarity is detected to be lower than the set threshold (for example, the SSIM threshold is 0.9), it is considered that there is a defect. The defect area is highlighted by using heatmap, saliency map or class activation mapping (CAM) technology. These techniques can help us analyze the feature map of the scale to accurately locate the defect location. Data: For example, at scale 3, we detected an SSIM value of 0.85, which is lower than the threshold of 0.9. By applying the heatmap technique, we successfully located a specific area on the stator surface that showed obvious temperature anomalies, indicating the possibility of surface cracks. Integrate the similarity measures and defect location information at each scale. This includes summarizing the similarity scores, defect location and type data at different scales. Data: We collected data on three scales: the SSIM value of scale 1 was 0.92 (no defect), the SSIM value of scale 2 was 0.95 (no defect), and the SSIM value of scale 3 was 0.85 (defective). At the same time, we recorded the specific location of the defect on scale 3 (for example, the coordinate point on the stator surface). The integrated data was parsed to identify the defect locations corresponding to the similarity scores below the preset threshold, and the defect type was determined based on the characteristics of these locations. Data: By analyzing the defect location information on scale 3, we found that the characteristics of this area meet the characteristics of surface cracks (such as sharp edges, long length, etc.). Therefore, we classified this defect as "surface crack". Design a defect rating system to rate each defect based on the results of the similarity measurement and factors such as the size and location of the defect. The rating can be divided into three levels: slight, moderate, and severe. Data: According to our rating system, the surface crack detected on scale 3 was rated as "severe" because its size exceeded the preset threshold and was located in a critical area of ​​the stator.

[0095] Modeling and data visualization 106. Use 3D modeling technology to create a 3D model of a flat wire motor stator. On this model, the detected defect location, type and rating are intuitively displayed. Users can observe the defects on the stator surface from different angles by rotating and zooming. And / or design a dynamic heat map in which different colors and intensities represent different defect types and severity. At the same time, combined with data visualization technology, similarity metrics, defect locations, types and rating information are displayed in the form of charts or graphs to facilitate users to quickly understand and analyze; and / or use VR and AR technology to provide users with an immersive defect detection experience. Users can wear VR or AR devices to enter a virtual flat wire motor stator environment and intuitively view and interact with defect information; based on user feedback and actual needs, continuously optimize the form and content of output results to make them more in line with user usage habits and aesthetic needs; use newly collected defect data and user feedback for continuous learning and updating of the model;

[0096] It should be noted that the method of using 3D modeling technology to display defects is as follows: First, the precise geometric data of the flat wire motor stator is obtained through 3D scanning technology. Then, this data is used to create a highly realistic 3D model in professional 3D modeling software (such as Blender, 3ds Max, etc.). On this model, we can intuitively display the location, type and rating of the defect in different colors or marks at the corresponding positions according to the detected defect data. Data: For example, we mark a red dot at a specific location on the 3D model (such as X=100mm, Y=150mm), indicating that there is a surface crack at this location, which is rated as "severe". Users can clearly observe the shape, size and location of this crack from different angles through rotation and zooming operations.

[0097] Design a dynamic heat map to display defects Method: Design a dynamic heat map system in which different colors and intensities represent different defect types and severity. For example, red can represent severe defects, yellow represents moderate defects, and green represents minor defects. At the same time, combined with data visualization technology (such as using tools such as Tableau and Power BI), the similarity measure, defect location, type, and rating information are displayed in real time in the form of charts or graphs. Data: On the dynamic heat map, we can observe that a certain area on the stator surface (for example, the center position) is displayed in red, indicating that there is a severe defect in the area. At the same time, the chart next to it shows that the SSIM value of the area is 0.75, which is significantly lower than the threshold of 0.9, further verifying the existence of the defect.

[0098] Through VR and AR technology, a virtual flat wire motor stator environment is built for users. After wearing VR or AR equipment, users can enter this virtual environment and intuitively view and interact with defect information. For example, when a user approaches a defect, the system can automatically pop up detailed information about the defect (such as location, type, rating, etc.). Data: In the VR environment, users can clearly see a crack defect on the surface of the stator, and obtain detailed information about the defect through interactive operations: location (X=120mm, Y=180mm), type (surface crack), rating (severe). This provides users with an immersive defect detection experience.

[0099] Through user surveys and feedback collection, we understand users' expectations and needs for output results. Based on user feedback, we adjust the layout, color matching, and font size of the output report to make it clearer and easier to read. We add interactive functions, such as users can click on the defect location to view detailed information, or filter and sort the defect list as needed. We collected 50 user feedbacks, of which 40 mentioned that they hope the defect images in the report can be enlarged, 35 suggested adding detailed descriptions of the defects, and 25 hoped that the report can be more beautiful. Based on these feedbacks, we adjusted the report template, added the function of clicking to enlarge the image, added a detailed defect description field, and optimized the visual design of the report.

[0100] Collect new defect data, including various defect images and corresponding labels on the stator surface (such as cracks, coating peeling, etc.). Add the new data to the training set and retrain the model to improve its ability to recognize new types of defects. Use user feedback to fine-tune the model, such as adjusting model parameters or adding new feature extraction methods to optimize the performance of the model. Suppose we have collected 1,000 new labeled defect images, of which 500 are new defect types. Add these new data to the original 5,000 training sets to form a new training set of 6,000 images. After retraining the model with the new training set, the model's recognition accuracy for new types of defects increased from the original 60% to 85%. Based on user feedback, we also adjusted a parameter of the model (such as the learning rate) to make the model converge faster during training and reduce overfitting.

[0101] In the embodiment of the present invention, the historical image data and real-time image data of the flat wire motor stator surface are obtained and processed, and the noise is identified and suppressed by the deep residual shrinkage network (DRSN), and then the defective part is highlighted by the local contrast enhancement technology. Subsequently, the system uses a preset adaptive twin neural network (ASNN) to extract and fuse features to obtain the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation. Through multi-scale similarity measurement, the system can accurately detect and locate defects on the stator surface, and classify and rate them. Finally, the technology also uses advanced technologies such as 3D modeling, dynamic heat map, VR / AR, etc. to provide users with intuitive defect display and immersive detection experience. The entire system is also designed with a user feedback mechanism to continuously optimize the output results and use new data and user feedback to continuously learn and update the model. Through deep learning and multi-scale similarity measurement, this technology can more accurately detect and locate defects on the surface of flat wire motor stators, reducing the possibility of false detection and missed detection; the automated detection process greatly improves detection efficiency and saves manpower and time costs; using 3D modeling, dynamic heat map and VR / AR technology, users can intuitively view and interact with defect information, which helps to better understand the defect situation and make decisions; the system continuously optimizes the output results based on user feedback, making it more in line with the user's usage habits and aesthetic needs, and improving the user experience; it can use the newly collected defect data and user feedback for continuous learning and updating, thereby continuously improving the detection performance; it is not only suitable for flat wire motor stator surface defect detection, but can also be extended to the surface defect detection of other similar products. In summary, this technology provides a comprehensive, efficient and user-friendly solution for flat wire motor stator surface defect detection by combining multiple advanced technologies such as deep learning, multi-scale similarity measurement, 3D modeling, data visualization and VR / AR technology.

[0102] The above describes the flat wire motor stator surface defect detection method in the embodiment of the present invention. The following describes the flat wire motor stator surface defect detection device in the embodiment of the present invention. Figure 3 In one embodiment of the present invention, a device for detecting surface defects of a flat wire motor stator comprises:

[0103] An acquisition module 301 is used to acquire flat wire motor stator surface image data, wherein the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and annotate the historical flat wire motor stator surface image data;

[0104] The processing module 302 is used to identify and suppress noise according to the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image;

[0105] An enhancement module 303 is used to perform local contrast enhancement according to the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image to obtain an enhanced processed flat wire motor stator surface image and an enhanced processed flat wire motor stator surface normal image;

[0106] A setting module 304 is used to obtain a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation according to the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image in combination with a preset ASNN model;

[0107] The output module 305 is used to calculate the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation at multiple scales, which is achieved by performing similarity measurement on feature maps of different scales. When the similarity at a certain scale is lower than a preset threshold, there is a defect at this scale, and the defect position information is further located. Based on the similarity measurement and the defect position information, the defect detection result of the flat wire motor stator surface is output.

[0108] In the embodiment of the present invention, five main modules are included: an acquisition module, a processing module, an enhancement module, a setting module and an output module. These modules work together, starting from acquiring the image data of the flat wire motor stator surface, through noise identification and suppression, local contrast enhancement, feature extraction and fusion, to the final multi-scale similarity measurement, to achieve a complete and automated surface defect detection process. Through a series of automated modules, the whole process automation from data acquisition to defect detection is realized, which greatly improves the detection efficiency and accuracy; through the preset DRSN model for noise identification and suppression, the noise interference in the image is effectively reduced, and the accuracy of subsequent defect detection is improved; through enhanced processing and multi-scale similarity measurement, the technology can more accurately identify and locate tiny defects on the stator surface, reducing the risk of missed detection and false detection; the modular design makes the whole system more flexible and scalable. In the future, modules can be added or replaced as needed to adapt to different detection needs; it can process and analyze image data in real time, and output defect detection results in time, which provides strong support for real-time monitoring and quality control of production lines. In summary, this technology provides an efficient and accurate solution for flat wire motor stator surface defect detection through automated and modular design, as well as powerful noise suppression and defect identification capabilities.

[0109] See also Figure 4 Another embodiment of the flat wire motor stator surface defect detection device in the embodiment of the present invention includes:

[0110] An acquisition module 301 is used to acquire flat wire motor stator surface image data, wherein the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and annotate the historical flat wire motor stator surface image data;

[0111] The processing module 302 is used to identify and suppress noise according to the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image;

[0112] An enhancement module 303 is used to perform local contrast enhancement according to the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image to obtain an enhanced processed flat wire motor stator surface image and an enhanced processed flat wire motor stator surface normal image;

[0113] A setting module 304 is used to obtain a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation according to the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image in combination with a preset ASNN model;

[0114] The output module 305 is used to calculate the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation at multiple scales, which is achieved by performing similarity measurement on feature maps of different scales. When the similarity of a certain scale is lower than a preset threshold, there is a defect at this scale, and the defect position information is further located. According to the similarity measurement and the defect position information, the defect detection result of the flat wire motor stator surface is output;

[0115] The updating module 306 is used to continuously optimize the form and content of the output results according to user feedback and actual needs, so that it is more in line with the user's usage habits and aesthetic needs; and use the newly collected defect data and user feedback for continuous learning and updating of the model.

[0116] In the embodiment of the present invention, multiple modules such as image acquisition, processing, enhancement, feature extraction, defect identification and model update are integrated. The overall process starts with acquiring historical and real-time image data of the flat wire motor stator surface, and model training is performed by annotating historical data. The preset DRSN model is used to identify and suppress noise in the image, and then the image quality is improved by local contrast enhancement technology. Subsequently, the ASNN model is combined to extract features, and the similarity between the real-time image and the normal image features is calculated at multiple scales to locate and identify defects on the stator surface. Finally, the technology also includes an update module for continuously optimizing the model based on user feedback and newly collected defect data to improve the accuracy and efficiency of defect detection. By combining the DRSN model for noise identification and suppression, and using the ASNN model for feature extraction, the technology can more accurately identify and locate defects on the stator surface of the flat wire motor, reducing false detection and missed detection. The application of local contrast enhancement technology makes the image of the stator surface clearer, which helps to improve the accuracy of subsequent defect detection. By performing similarity measurement on feature maps of different scales, the technology can more comprehensively evaluate the state of the stator surface and has a high detection sensitivity for tiny defects. The update module allows users to continuously optimize the output of the model based on actual needs and feedback, and use newly collected defect data and user feedback to continuously learn and update the model to maintain the advancement and practicality of the technology. Accurate stator surface defect detection can promptly detect and deal with problems in production, avoid defective products from entering the market, and thus improve overall product quality and production efficiency. By promptly detecting and dealing with defects on the stator surface, the failure rate of the equipment can be reduced, the service life of the equipment can be extended, and the maintenance cost can be reduced.

[0117] above Figure 3 and Figure 4 The flat wire motor stator surface defect detection device in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The flat wire motor stator surface defect detection device in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0118] Figure 54 is a schematic diagram of the structure of a flat wire motor stator surface defect detection device provided by an embodiment of the present invention. The flat wire motor stator surface defect detection device 400 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 410 (for example, one or more processors) and a memory 420, and one or more storage media 430 (for example, one or more mass storage devices) storing application programs 433 or data 432. Among them, the memory 420 and the storage medium 430 can be short-term storage or permanent storage. The program stored in the storage medium 430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the flat wire motor stator surface defect detection device 400. Furthermore, the processor 410 can be configured to communicate with the storage medium 430 to execute a series of instruction operations in the storage medium 430 on the flat wire motor stator surface defect detection device 400.

[0119] The flat wire motor stator surface defect detection device 400 may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input and output interfaces 460, and / or one or more operating systems 431, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Figure 4 The structure of the flat wire motor stator surface defect detection device shown does not constitute a limitation of the flat wire motor stator surface defect detection device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0120] The present invention also provides a flat wire motor stator surface defect detection device, which includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the flat wire motor stator surface defect detection method in the above-mentioned embodiments.

[0121] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the flat wire motor stator surface defect detection method.

[0122] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0123] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0124] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting surface defects of a flat wire motor stator. It is characterized in that The flat wire motor stator surface defect detection method comprises: Acquire flat wire motor stator surface image data, wherein the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and annotate the historical flat wire motor stator surface image data; According to the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data, noise identification and suppression are performed in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image; Performing local contrast enhancement according to the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image to obtain an enhanced processed flat wire motor stator surface image and an enhanced processed flat wire motor stator surface normal image; According to the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image combined with a preset ASNN model, a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation are obtained; The similarity between the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation is calculated at multiple scales, and is achieved by measuring the similarity on feature maps of different scales. When the similarity of a certain scale is lower than the preset threshold, there is a defect at that scale, and the defect location information is further located. Based on the similarity measurement and defect location information, the defect detection results of the flat wire motor stator surface are output, including: Use a multi-scale feature fusion network to integrate feature information of different scales to enhance the ability to identify defects; Once the similarity is detected to be lower than the threshold at a certain scale, it is considered that there is a defect. The defect area is highlighted by analyzing the feature map of the scale using heat map, saliency map or class activation mapping technology to locate the defect location information; Integrate similarity metrics and defect location information at each scale, including summarizing similarity scores, defect locations, and types at different scales; Analyze the integrated data to identify the defect locations corresponding to the similarity scores below the preset threshold and the defect types at these locations; According to the analyzed defect type information, the detected defects are classified into various types such as surface cracks, coating peeling, and impurities.

2. The flat wire motor stator surface defect detection method according to claim 1, It is characterized in that The obtaining of the flat wire motor stator surface image data, wherein the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and marking the historical flat wire motor stator surface image data, comprises: The flat wire motor stator surface image data includes normal stator surface image data samples and defective stator surface image data samples; Arranging the historical flat wire motor stator surface image data, including format conversion and resolution unification; Annotating the stator surface image data of the historical flat wire motor, and manually annotating various defects on the stator surface, including cracks, stains, and deformations; and / or using a pre-trained machine learning model to initially annotate historical flat wire motor stator surface image data, followed by manual review and correction; The annotated historical flat wire motor stator surface image data is preprocessed by enhancement and normalization.

3. The flat wire motor stator surface defect detection method according to claim 1, It is characterized in that The method of performing noise identification and suppression based on the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image includes: A deep residual shrinkage network is trained based on the historical flat wire motor stator surface image data, wherein the deep residual shrinkage network includes multiple residual modules, each module has an internal adaptive soft threshold function, a composite loss function and a mean square error are used to design the loss function, an Adam optimizer is used, and a learning rate decay strategy is combined to improve training stability and convergence speed; First, pre-training is performed on a large-scale natural image denoising dataset, and then fine-tuning is performed based on the historical flat wire motor stator surface image data; And / or introduce adversarial samples, which are generated by adding small perturbations to improve the robustness of the model to noise and small changes; The DRSN model introduces a soft threshold function as a nonlinear layer to learn the characteristics of noise and perform denoising. Set y as the output of this layer, then: y=\sigma(Wx+b)\odot\tau(Wx+b)+(1-\tau(Wx+b))\odotx Among them, W represents the weight matrix of the network, b represents the bias term, which is a learnable parameter, \sigma is the activation function, \tau is the soft threshold function, \odot represents element-by-element multiplication, and x is the input data of this layer. After processing by DRSN, the denoised image is obtained.

4. The flat wire motor stator surface defect detection method according to claim 1, It is characterized in that The method of performing local contrast enhancement on the flat wire motor stator surface image processed by noise suppression and the flat wire motor stator surface normal image processed by noise suppression to obtain the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image includes: Dividing the flat wire motor stator surface image processed by noise suppression and the flat wire motor stator surface normal image processed by noise suppression into a plurality of small blocks or regions; For each image patch, calculate its contrast by calculating the standard deviation of pixel intensities; and / or designing a local contrast enhancement algorithm, using contrast-limited adaptive histogram equalization to enhance the local contrast, applying the enhancement algorithm to each image block, thereby improving the local contrast of the image and making the defective part more prominent; Merge the enhanced image blocks back to the size of the original image. To ensure a smooth transition between image blocks, feathering or fusion techniques are used during merging. The enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image are obtained.

5. The flat wire motor stator surface defect detection method according to claim 1, It is characterized in that The method of obtaining a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation based on the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image in combination with a preset ASNN model includes: A preset ASNN model is trained according to the historical flat wire motor stator surface image data, wherein the ASNN model includes two weight-sharing twin sub-networks and a third sub-network, wherein the third sub-network is used to learn normal features of the stator surface, and the third sub-network captures unique features of the normal stator surface; The ASNN model is trained using the historical flat wire motor stator surface image data, and a phased training strategy is adopted to first train the twin sub-network, then train the third sub-network, and finally perform overall fine-tuning; Use contrast loss to train the two twin networks so that they can distinguish different input images. Set the contrast loss function to L_{contrastive}(W), then: L_{contrastive}(W)=(1-Y)\frac{1}{2}D_W^2+(Y)\frac{1}{2}\max(0,m-D_W)^2 Where W represents the weight parameter of the twin network; D_W represents the Euclidean distance between the feature representations of the two input images in the twin network; Y is a binary label, when the two input images belong to the same category, Y=1; otherwise, Y=0; m is a preset threshold used to define the minimum distance between images of different categories; The normal flat wire motor stator surface image data in the historical flat wire motor stator surface image data is used to train the third sub-network, and the cross entropy loss is used to optimize the network. The cross entropy loss function is set to L_{cross-entropy}(W'), then: L_{cross-entropy}(W')=-\sum_{i=1}^{C}y_i\log(p_i) Where: W' represents the weight parameter of the third sub-network; C is the number of categories; y_i is the true category label, for the normal category, y_i=1; otherwise, y_i=0; p_i is the probability distribution predicted by the network; The output features of the three sub-networks are fused and fine-tuned as a whole. A joint loss function is used to optimize the weights of all sub-networks at the same time. The joint loss function is set to L_{joint}(W,W'), then: L_{joint}(W,W')=\alpha*L_{contrastive}(W)+(1-\alpha)*L_{cross-entropy}(W') Among them, \alpha is a weight coefficient that balances the two losses; Apply L2 regularization and Dropout techniques to prevent overfitting, and use optimizers to speed up the training process; After the feature extraction layer, the outputs of the two twin sub-networks are fused with the output of the third sub-network. The output features of the two twin sub-networks are set to f_1 and f_2, and the output features of the third sub-network are set to f_3 for fusion: f_{fused}=[f_1;f_2;f_3] The real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation are obtained.

6. The flat wire motor stator surface defect detection method according to claim 1, It is characterized in that The similarity between the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation is calculated at multiple scales by performing similarity measurement on feature maps at different scales. When the similarity at a certain scale is lower than a preset threshold, a defect exists at the scale, and the defect position information is further located. Based on the similarity measurement and the defect position information, the defect detection result of the flat wire motor stator surface is output, including: Ensure that the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation are aligned in space and scale by interpolation, resizing the feature map or using an attention mechanism; At each scale, the structural similarity index SSIM is used to calculate the similarity between real-time features and normal features; and / or design a weighted similarity measure where the weights are dynamically adjusted based on the importance or informativeness of the features; A similarity threshold is set for each scale to determine whether there is a defect. The threshold is set based on training data or historical data, and / or is dynamically adjusted through online learning and / or a feedback mechanism; And / or design a defect rating system to rate each defect as minor, moderate, or severe based on the results of the similarity metric and the size and location of the defect.

7. The method for detecting surface defects of a flat wire motor stator according to any one of claims 1 to 6, It is characterized in that Also includes: Using 3D modeling technology, a 3D model of a flat wire motor stator is created. On this model, the detected defect location, type and rating are intuitively displayed. Users can observe the defects on the stator surface from different angles by rotating and zooming. and / or design a dynamic heat map where different colors and intensities represent different defect types and severity levels, and at the same time, combine data visualization technology to display similarity metrics, defect locations, types, and rating information in the form of charts or graphs for users to quickly understand and analyze; And / or using VR and AR technologies to provide users with an immersive defect detection experience. Users wear VR or AR devices to enter a virtual flat wire motor stator environment and intuitively view and interact with defect information; Based on user feedback and actual needs, we continuously optimize the form and content of output results to make them more in line with user habits and aesthetic needs; Use newly collected defect data and user feedback for continuous learning and updating of the model.

8. A flat wire motor stator surface defect detection device, It is characterized in that The flat wire motor stator surface defect detection device comprises: An acquisition module, used for acquiring flat wire motor stator surface image data, wherein the flat wire motor stator surface image data includes historical flat wire motor stator surface image data and real-time flat wire motor stator surface image data, and marking the historical flat wire motor stator surface image data; A processing module, used for performing noise identification and suppression according to the real-time flat wire motor stator surface image data and the historical flat wire motor stator surface image data in combination with a preset DRSN model to obtain a noise-suppressed flat wire motor stator surface image and a noise-suppressed flat wire motor stator surface normal image; An enhancement module, used for performing local contrast enhancement according to the noise suppression processed flat wire motor stator surface image and the noise suppression processed flat wire motor stator surface normal image to obtain an enhanced processed flat wire motor stator surface image and an enhanced processed flat wire motor stator surface normal image; A setting module is used to obtain a real-time flat wire motor stator fusion feature representation and a flat wire motor stator normal image feature representation according to the enhanced flat wire motor stator surface image and the enhanced flat wire motor stator surface normal image in combination with a preset ASNN model; The output module is used to calculate the similarity of the real-time flat wire motor stator fusion feature representation and the flat wire motor stator normal image feature representation at multiple scales, which is achieved by measuring the similarity on feature maps of different scales. When the similarity of a certain scale is lower than a preset threshold, there is a defect at this scale, and the defect location information is further located. According to the similarity measurement and defect location information, the defect detection result of the flat wire motor stator surface is output. The output module includes: using a multi-scale feature fusion network to integrate feature information of different scales, thereby enhancing the defect recognition ability; once a low similarity is detected at a certain scale, If the threshold is exceeded, it is considered that there is a defect. The defect area is highlighted by using heat map, saliency map or class activation mapping technology to analyze the feature map of the scale to locate the defect location information; the similarity measurement and defect location information at each scale are integrated, including summarizing the similarity scores, defect locations and type data at different scales; the integrated data is analyzed to identify the defect locations corresponding to the similarity scores below the preset threshold, as well as the defect types at these locations; according to the analyzed defect type information, the detected defects are classified into multiple types such as surface cracks, coating peeling, and impurities.

9. A flat wire motor stator surface defect detection device, It is characterized in that The flat wire motor stator surface defect detection device comprises: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the flat wire motor stator surface defect detection device to execute the flat wire motor stator surface defect detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium having instructions stored thereon, It is characterized in that When the instructions are executed by the processor, the flat wire motor stator surface defect detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Mobile phone screen defect detection method, device and system, computer equipment and medium

    CN111612763A

  • Welding defect detection method and device, electronic equipment and storage medium

    CN111862067A