Motor shell surface defect detection method based on deep learning

Through the deep learning-based motor housing surface defect detection method, using deep learning models and high-resolution industrial cameras for automated detection, the problem of insufficient accuracy and generalization capabilities of traditional methods in complex backgrounds and diversified defect detection is solved. Achieve efficient and real-time detection results.

CN119107314APending Publication Date: 2024-12-10ZHEJIANG XINYIJIA METAL PROD CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411220903.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

When traditional metal material defect detection methods face complex backgrounds and diversified defects, the detection accuracy and generalization capabilities are insufficient, and rely on manual design characteristics, making it difficult to achieve real-time and efficient automated detection.

Method used

Using deep learning-based motor housing surface defect detection method, the deep learning model can automatically learn and extract high-dimensional features, simplify the detection process, adapt to defects of different types and sizes, and combine high-resolution industrial cameras and ring LED light sources for data Acquisition, high-precision detection is achieved using CSPDarknet53 architecture and multi-scale converged network.

Benefits of technology

It realizes high-precision and real-time defect detection, simplifies the detection process, improves the robustness and generalization capabilities of the model, is suitable for online detection, and reduces computing complexity and hardware requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119107314A_ABST
    Figure CN119107314A_ABST
Patent Text Reader

Abstract

The invention discloses a motor shell surface defect detection method based on deep learning. The motor shell surface defect detection method comprises the following steps that S1, a data acquisition device acquires a defect image of a motor shell; s2, marking the defect image by a computer; s3, using a deep learning model to train data; and S4, outputting a detection result of the surface defects of the motor shell. The motor shell surface defect detection method based on deep learning disclosed by the invention has the beneficial effects that the deep learning model can process defect images at a high frame rate, real-time detection is realized, and the motor shell surface defect detection method is suitable for online detection application; through end-to-end model training, the deep learning method can automatically learn features from data, complex preprocessing and feature extraction steps are not needed, and the detection process is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of metal material defect detection, and specifically relates to a motor casing surface defect detection method based on deep learning. Background Art

[0002] Motor housings are usually made of metal materials. Metal materials are key components in various industrial applications, and their quality directly affects the performance and reliability of products. Therefore, the detection of surface defects in metal materials is particularly important in the manufacturing industry. Traditional metal material defect detection methods mainly rely on manual inspection, but with the increasing complexity of industrial products, this method is increasingly difficult to meet the needs of high precision and high efficiency. Therefore, various automated metal material defect detection methods have been proposed, among which the detection method based on deep learning has attracted much attention due to its high efficiency and accuracy.

[0003] On the one hand, in the existing technology, early metal material defect detection usually relies on visual inspection and physical methods. Visual inspection includes optical inspection and microscopic inspection. Although these methods can detect obvious defects, it is often difficult to accurately identify small or complex defects. Although physical methods such as ultrasonic inspection and X-ray inspection have advantages in some aspects, their equipment costs are high and they are insufficient in detection speed and flexibility.

[0004] In addition, with the development of computer technology, metal material defect detection methods based on machine vision have gradually emerged. For example, methods based on template matching and defect image segmentation can achieve a certain degree of automated detection, but these methods still have limitations when facing complex backgrounds and diverse defects. Traditional machine learning methods (such as support vector machines (SVM) and random forests) have been applied to metal material defect detection, but their detection accuracy and generalization ability have not yet met the requirements of industrial applications.

[0005] On the other hand, deep learning technology has made significant progress in the field of defect image processing, and many researchers have begun to apply it to metal material defect detection. The deep learning model (DNN) provides an end-to-end detection model that can automatically extract features and adapt to complex and changing defect types. The following are several metal material defect detection methods based on deep learning in the existing technology.

[0006] Prior art 1: A metal material defect detection method based on a convolutional neural network, which achieves efficient detection and classification of defects through multi-layer convolution and pooling operations. This method shows high accuracy and robustness on data sets of various defect types.

[0007] Prior art 2: Using deep residual networks for metal material defect detection, the gradient vanishing problem of deep networks is solved by introducing residual modules. This method improves the training speed and stability of the model while maintaining high detection accuracy.

[0008] Prior art 3: Generate simulated defect images using a generative adversarial network to enhance the training dataset, improving the generalization ability and detection performance of the model.

[0009] Prior art 4: A real-time detection method for metal material defects based on YOLOv4. This method completes target detection through a single forward propagation, has efficient real-time processing capabilities, and is suitable for online detection. By improving the YOLOv5 model, the network structure and loss function are optimized, and the detection accuracy and speed are improved.

[0010] It can be seen that traditional metal material surface defect detection algorithms usually rely on defect image processing and machine learning methods, such as edge detection, texture analysis, and feature-based classification. These methods have many disadvantages: they rely on manual design and selection of features, it is difficult to cover all defect types, and the feature extraction process is complicated; the complex preprocessing and feature extraction steps increase the calculation time, making it difficult to achieve real-time detection; they are sensitive to noise and environmental changes, and the detection effect is easily disturbed; the generalization ability is weak, it is difficult to adapt to defects of different types and shapes, and it is difficult to maintain, and further improvement is needed. Summary of the invention

[0011] In view of the status of the prior art, the present invention overcomes the above-mentioned defects and provides a motor casing surface defect detection method based on deep learning.

[0012] The main purpose of the motor housing surface defect detection method based on deep learning disclosed in the present invention is that high efficiency and end-to-end model training simplify the detection process without the need for complex feature extraction and preprocessing steps.

[0013] Another purpose of the motor housing surface defect detection method based on deep learning disclosed in the present invention is that the high-precision deep learning model can automatically learn and extract high-dimensional features, thereby improving the accuracy of defect detection.

[0014] Another purpose of the motor housing surface defect detection method based on deep learning disclosed in the present invention is that the deep learning model demonstrates good generalization ability through data enhancement and optimized model structure, and can effectively identify defects of various types and sizes.

[0015] Another purpose of the motor housing surface defect detection method based on deep learning disclosed in the present invention is that the flexibility of the deep learning model allows the structure to be adjusted according to specific needs, adapting to different hardware platforms and application scenarios, and meeting the needs of efficient, accurate and automated detection.

[0016] The present invention adopts the following technical solution, a motor housing surface defect detection method based on deep learning, comprising the following steps:

[0017] Step S1: a data acquisition device acquires defect images of a motor housing;

[0018] Step S2: The computer labels the defect image;

[0019] Step S3: training data using a deep learning model;

[0020] Step S4: output the detection result of the motor housing surface defects.

[0021] As a preferred technical solution of the above technical solution, in step S1, the data acquisition device includes a high-resolution industrial camera and a ring-shaped LED light source, wherein:

[0022] Place the annular LED light source above the running motor housing and install it coaxially with the high-resolution industrial camera. The light of the annular LED light source is consistent with the visual axis of the high-resolution industrial camera.

[0023] When the motor housing passes through the detection area of ​​the high-resolution industrial camera and the ring-shaped LED light source, the high-resolution industrial camera continuously captures defect images, and the data of the defect images is transmitted to the computer through the high-speed interface GigE, and the computer stores and processes the data of the defect images.

[0024] As a preferred technical solution of the above technical solution, the computer stores and processes the data of the defect image, which is specifically implemented as follows:

[0025] Classify and store by defect category;

[0026] Use annotation tools to manually annotate defect images and mark the location and type of each defect;

[0027] Generate corresponding annotation text for deep learning model training.

[0028] As a preferred technical solution of the above technical solutions, in step S3, the deep learning model includes a feature extraction network, a multi-scale fusion network and model detection.

[0029] As a preferred technical solution of the above technical solutions, the feature extraction network adopts the CSPDarknet53 architecture, and the feature extraction network includes Conv layer, Conv layer, C2f layer, Conv layer, C2f layer, Conv layer, C2f layer, Conv layer, C2f layer and AIFI layer.

[0030] As a preferred technical solution of the above technical solutions, the feature extraction network defines the feature maps output by its second and third C2f layers and AIFI layers as large feature maps FL, medium feature maps FM and small feature maps FS of different scales respectively.

[0031] As a preferred technical solution of the above technical solutions, in the multi-scale fusion network, the feature maps finally output to the model detection head are the large fusion feature map MFL, the medium fusion feature map MFM and the small fusion feature map MFS.

[0032] As a preferred technical solution of the above technical solutions, the model detection head includes a classification head and a regression head.

[0033] As a preferred technical solution of the above technical solutions, in the classification head, the Conv layer performs convolution operations, batch normalization operations, and SiLU activation operations, so that the number of channels of the feature map finally output is the number of object categories in the feature map.

[0034] As a preferred technical solution of the above technical solutions, in the regression head, the Conv layer performs convolution operations, batch normalization operations, and SiLU activation operations, so that the number of channels of the feature map finally output is the number of channels required for calculating the distribution focal loss.

[0035] The motor housing surface defect detection method based on deep learning disclosed in the present invention has the following beneficial effects:

[0036] 1. Replace the SPPF module at the tail of the backbone network of the model with the attention-based intra-dimensional feature interaction AIFI module.

[0037] 2. Replace the C2f module of the model’s neck network with the PIC2f module.

[0038] 3. The deep learning model can process defect images at a high frame rate and realize real-time detection, which is suitable for online detection applications.

[0039] 4. Through end-to-end model training, deep learning methods can automatically learn features from data without the need for complex preprocessing and feature extraction steps, simplifying the detection process.

[0040] 5. Deep learning models such as convolutional neural networks (CNN) and the improved version of YOLOv8 have greatly improved detection accuracy and robustness by automatically extracting high-level features and optimizing model structures, demonstrating good generalization and adaptability, and can cope with defects of different types and sizes. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a schematic diagram of the deep learning model of the present invention.

[0042] Figure 2 It is a schematic diagram of the AIFI module of the present invention.

[0043] Figure 3 is a schematic diagram of a PIC2f module of the present invention.

[0044] Figure 4 Schematic diagram of the PConv module of the present invention.

[0045] Figure 5 is a schematic diagram of an iRMB module of the present invention. DETAILED DESCRIPTION

[0046] The present invention discloses a method for detecting surface defects of a motor housing based on deep learning. Figures 1 to 5 , the specific implementation modes of the present invention are further described.

[0047] See attached figure Figures 1 to 5 , showing the deep learning model, AIFI module, PIC2f module, PConv module, and iRMB module respectively.

[0048] Example 1.

[0049] Preferably, see the accompanying drawings Figures 1 to 5 , a motor housing surface defect detection method based on deep learning includes the following steps:

[0050] Step S1: a data acquisition device acquires defect images of a motor housing;

[0051] Step S2: The computer labels the defect image;

[0052] Step S3: training data using a deep learning model;

[0053] Step S4: output the detection result of the motor housing surface defects.

[0054] Wherein, in step S1, the data acquisition device includes a high-resolution industrial camera and a ring-shaped LED light source, wherein:

[0055] High-resolution industrial cameras can continuously capture images of motor housing surface defects at high speed and high resolution, making them ideal for real-time inspection on production lines. High-resolution industrial cameras ensure defect image quality with their high sensitivity and low noise characteristics;

[0056] The ring-shaped LED light source provides uniform and stable lighting, effectively eliminating reflections and shadows, ensuring the clarity and contrast of defects in defect images;

[0057] Place the ring LED light source above the running motor housing and install it coaxially with the high-resolution industrial camera to ensure that the light of the ring LED light source is consistent with the visual axis of the high-resolution industrial camera to provide the best lighting effect;

[0058] When the motor housing passes through the inspection area of ​​the high-resolution industrial camera and the ring-shaped LED light source, the high-resolution industrial camera will continuously capture defect images at a high frame rate. The data of the defect images are transmitted to the computer through the high-speed interface GigE, and the computer will store and process the data of the defect images.

[0059] The computer stores and processes the data of the defect image, which is specifically implemented in the following steps:

[0060] Classify and store by defect category;

[0061] Use annotation tools (such as Labelimg) to manually annotate defect images, and mark the location and type of each defect;

[0062] Generate the corresponding annotation file (TXT format) for deep learning model training.

[0063] Among them, in step S3, the deep learning model includes a feature extraction network, a multi-scale fusion network and a model detection head.

[0064] Among them, the feature extraction network adopts the CSPDarknet53 architecture, and the feature extraction network includes Conv layer (first layer), Conv layer (second layer), C2f layer (third layer), Conv layer (fourth layer), C2f layer (fifth layer), Conv layer (sixth layer), C2f layer (seventh layer), Conv layer (eighth layer), C2f layer (ninth layer) and AIFI layer (tenth layer, which is the last layer).

[0065] Among them, the feature extraction network defines the feature maps output by its second and third C2f layers and AIFI layers as large feature maps FL, medium feature maps FM and small feature maps FS of different scales (that is, the feature extraction network defines the feature maps output by its second and third C2f layers and AIFI layers as three feature maps of different scales, namely large feature maps FL, medium feature maps FM and small feature maps FS).

[0066] Among them, in the multi-scale fusion network, the feature maps finally output to the model detection head are the large fusion feature map MFL, the medium fusion feature map MFM and the small fusion feature map MFS (that is, in the multi-scale fusion network, three feature maps are finally output to the model detection head).

[0067] Among them, the model detection head includes a classification head and a regression head.

[0068] Among them, in the classification head, the Conv layer performs convolution operations, batch normalization operations, and SiLU activation operations, so that the number of channels of the final output feature map is the number of object categories in the feature map.

[0069] Among them, in the regression head, the Conv layer performs convolution operations, batch normalization operations, and SiLU activation operations, so that the number of channels of the final output feature map is the number of channels required to calculate the distribution focal loss.

[0070] The following describes the overall concept of the motor housing surface defect detection method based on deep learning disclosed in this embodiment.

[0071] Specifically, a data acquisition device is used to collect defect images, the defect images are annotated, a deep learning model is used to train data, and defect detection results are output.

[0072] The following describes the implementation process of the motor housing surface defect detection method based on deep learning disclosed in this embodiment.

[0073] 1. Data Collection and Preprocessing

[0074] 1.1 Data acquisition device design

[0075] High-resolution industrial camera: High-resolution industrial camera can continuously capture the surface defect images of motor housing at high speed and high resolution, which is very suitable for real-time detection on the production line. High-resolution industrial camera ensures the quality of defect images with its high sensitivity and low noise characteristics. Ring LED light source: Ring LED light source provides uniform and stable lighting, effectively eliminates reflections and shadows, and ensures the clarity and contrast of defects in defect images. Place the ring LED light source above the running motor housing and install it coaxially with the high-resolution industrial camera to ensure that the light of the ring LED light source is consistent with the high-resolution industrial camera's visual axis to provide the best lighting effect. When the motor housing passes through the inspection area of ​​the high-resolution industrial camera and the ring LED light source, the high-resolution industrial camera will continuously capture defect images at a high frame rate. The defect image data is transmitted to the computer via the high-speed interface GigE for storage and processing.

[0076] 1.2 Data Annotation

[0077] The data collected by the data acquisition device is classified and stored by defect category. The defect images are manually annotated using annotation tools (such as Labelimg). The location and type of each defect need to be marked, and the corresponding annotation file (TXT format) is generated for deep learning model training.

[0078] 2. Deep Learning Model

[0079] The overall structure of the deep learning model is based on the improved network structure of YOLOv8 (You Only Look Once version 8), such as Figure 1 (In the module, k is the convolution kernel size, s is the convolution step size, n is the number of repetitions of the bottleneck structure of the C2f or PIC2f module, and True indicates the residual connection in the bottleneck structure)

[0080] 2.1 Feature Extraction Network

[0081] The feature extraction network of the deep learning model adopts the CSPDarknet53 architecture. The network has a total of 10 layers, and the structure is: Conv layer→Conv layer→C2f layer→Conv layer→C2f layer→Conv layer→C2f layer→Conv layer→C2f layer→AIFI layer.

[0082] The output channels of the first Conv layer are 16, and the number of output channels of each subsequent Conv layer is twice that of the previous layer. There are five Conv layers in total, and the output channels of the last Conv layer are 256. The Conv layer contains four operations, namely convolution operation, batch normalization operation, SiLU activation processing, and downsampling operation. The first three are regular operations, and the last operation is only performed when the step size in the Conv layer is 2.

[0083] The BottleNeck structure in the C2f layer consists of two consecutive Conv layers with a convolution kernel of 1×1 and a stride of 1, and when the residual parameter is True, the input features are residually connected with the output features of the two Conv layers. The structure of the C2f layer is as follows: First, it passes through a Conv layer with a convolution kernel of 1x1 and a stride of 1, and then the output of the Conv layer is divided into two parts through Split. After one part of the features is processed by n BottleNeck structures, it is concatenated with the other part of the features through Concat. The concatenated features are then passed through a Conv layer with a convolution kernel of 1×1 and a stride of 1, and finally the results of the C2f layer are output. The feature map output by the C2f layer is consistent with the input features in terms of resolution and number of channels, that is, it is the same as the output of the Conv layer before the C2f layer.

[0084] The last layer of the feature extraction network, the AIFI layer, is an attention-based intra-dimensional feature interaction layer, which consists of a two-dimensional sine-cosine position embedding method, a multi-head attention mechanism, a fully connected layer, a residual connection, a normalization layer, and a nonlinear activation function, such as Figure 2 .

[0085] The 2D sine-cosine position embedding method is a technique for encoding the position information of a defect image into a feature vector. First, the width w and height h of the defect image are determined, as well as the embedding dimension D and a temperature parameter temperature. These parameters are used to generate the 2D grid coordinates of the defect image, where the coordinates in the width direction range from 0 to w-1 and the coordinates in the height direction range from 0 to h-1. Next, a frequency term is defined for each coordinate. This frequency term is calculated based on the temperature parameter and the embedding dimension and is used to control the periodicity of the sine and cosine functions. Specifically, the frequency term is calculated by dividing 1 by the temperature parameter multiplied by the exponential function, where the power is a fraction of the embedding dimension. Then, for each grid coordinate (x, y), these frequency terms are used to calculate its sine and cosine values. For each dimension of the embedding, these sine and cosine values ​​correspond to different frequencies of the width and height of the defect image, respectively. By applying the sine and cosine functions to the frequency terms of each coordinate, a series of sine and cosine values ​​are generated, which are combined together to form a complete position embedding representation of that coordinate. Finally, all the sine and cosine values ​​of each coordinate are combined to obtain a two-dimensional sine-cosine position embedding representation of the entire defect image. This method can effectively encode the position information into the feature vector, so that the model can preserve the spatial relationship when processing defect images, thereby improving the performance in position-sensitive tasks.

[0086] The basic principle of the multi-head attention mechanism is to first map the input features into query, key, and value vectors through linear transformation. Assume that the input dimension is d model , the multi-head attention mechanism has h heads, each with a dimension of d model / h. For each head i, calculate its attention output head i , where the query, key, and value vectors of each header are Q i , K i and V i The method of calculating the attention output is to scale the dot product of the query and the key, then apply the softmax function, and then multiply the weights with the value vector. The attention outputs of all heads are concatenated together to form a new vector, and finally the final multi-head attention output is obtained through linear transformation and normalization.

[0087] 2.2 Multi-scale Fusion Network

[0088] The feature extraction network defines the feature maps output by its second and third C2f layers and AIFI layers as feature maps of three different scales, namely, large feature map FL, medium feature map FM and small feature map FS. The feature map corresponding to large-scale features has a higher resolution but fewer channels, while the resolution of small-scale features is smaller and the number of channels is larger. Large-scale features contain rich spatial information suitable for positioning, while small-scale features contain rich semantic information suitable for classification. The multi-scale fusion network fuses features of different scales into one scale, and uses the rich information of various scales to enhance the model's feature extraction capability for defect images, thereby improving the model's detection accuracy.

[0089] In the multi-scale fusion network, the feature maps that are finally output to the model detection head are divided into three types, namely, the large fusion feature map MFL, the medium fusion feature map MFM, and the small fusion feature map MFS. The first feature map is to combine the FL with the upsampling achieved by the two nearest neighbor interpolation methods and the FS after the PIC2f layer, and then pass through the PIC2f layer to obtain the final feature map MFL. The second feature map is to combine the feature map after the first PIC2f layer and the downsampled feature map MFL achieved by the Conv layer, and finally pass through the PIC2f layer to obtain the final feature map MFM. The last feature map is to combine the FS with the downsampled MFM achieved by the Conv layer, and finally pass through the PIC2f layer to obtain the final feature map MFS.

[0090] The PIC2f layer consists of two Conv modules and multiple PIBottleNeck modules, such as Figure 3 It first passes through a Conv layer with a convolution kernel of 1×1 and a stride of 1, and then the output of the Conv layer is divided into two parts through Split. After one part of the features is processed by n PIBottleNeck structures, it is concatenated with the other part of the features through Concat. The concatenated features are then passed through a Conv layer with a convolution kernel of 1×1 and a stride of 1, and finally the results of the PIC2f layer are output.

[0091] The PIBottleNeck module is mainly composed of the PConv partial convolution module and the iRMB inverted residual block module. And when the residual parameter is True, the input features are residually connected with the output features of the two Conv layers.

[0092] The PConv module first passes the feature map and the corresponding mask (indicating which parts of the defect image are occluded) into the module. Then, for each convolution window, PConv only uses the valid pixels that are not occluded for a 3×3 convolution operation. Occluded pixels (mask value 0) are not involved in the calculation, and only non-occluded pixels (mask value 1) are used. Finally, a 1×1 convolution operation is performed on all pixels of the entire feature map (including occluded and unoccluded pixels), as shown in Figure 4 .

[0093] iRMB combines the dynamic processing capabilities of a lightweight CNN architecture and a Transformer attention-based model to create an efficient mobile network, such as Figure 5 . It combines the depthwise separable convolution (DWConv) and the self-attention mechanism. 1×1 convolution is used for channel compression and expansion to optimize computational efficiency. DWConv is used to capture spatial features, while the attention mechanism is used to capture global dependencies between features. In addition, iRMB improves the handling of information flow through its inverted residual block design, allowing long-distance dependencies to be captured and exploited while keeping the model lightweight. The IRMB module first performs a 1×1 convolution on the input feature map to transform and compress the channel dimension, and then calculates the query (Q) and key (K) through the self-attention mechanism to generate an attention matrix. The attention matrix is ​​used to weight the input feature map to generate a weighted sum value (V). Next, a 3×3 depthwise separable convolution is performed on the weighted sum feature map to further extract local features. Subsequently, the input feature map is added to the feature map after these processing through a residual connection to ensure effective information transmission and smooth gradient propagation. Finally, another 3×3 convolution is performed to further transform and compress the channel dimension to obtain the final output feature map, thereby enhancing the feature expression ability and overall performance of the model.

[0094] 2.3 Model Detection Head

[0095] The three-scale feature maps output by the multi-scale fusion network are placed in the classification head and regression head for classification and regression tasks respectively. In the classification head, the Conv layer contains three operations, namely convolution operation, batch normalization operation and SiLU activation processing. The three-scale feature maps pass through two consecutive Conv layers with a convolution kernel of 3×3 and a step size of 1, and a 1×1 convolution operation. The number of channels of the final output feature map is the number of object categories in the feature map. In the regression head, the operations performed are the same as those of the classification head, except that the number of channels of the final output feature map is the number of channels required to calculate the distribution focal loss (64).

[0096] 3. Loss Function

[0097] The loss function mainly consists of two parts: category classification loss and bounding box regression loss. Category classification calculates the difference loss between the category of the target contained in each predicted box and the true category, using the binary cross entropy loss of N targets. Bounding box loss is used to calculate the difference loss between the predicted box and the true box, mainly composed of IOU loss and DFL loss.

[0098]

[0099] λ coord and λ cls is the weight coefficient, which is used to balance the impact of different losses.

[0100] 4. Post-processing operations

[0101] The deep model generates a large number of prediction boxes during the inference process, each of which contains the category probability, confidence, and bounding box coordinates. In order to extract meaningful detection results, a series of post-processing steps are required, including threshold filtering, non-maximum suppression (NMS), bounding box adjustment, and multi-classification processing.

[0102] 4.1 Threshold Filtering

[0103] Threshold filtering is used to filter the bounding boxes predicted by the model. By setting a confidence threshold, only the prediction results with confidence scores higher than the threshold are retained, thereby reducing irrelevant or wrong detections. The purpose of this step is to improve the accuracy and reliability of the detection results, ensuring that only those bounding boxes that are more likely to represent the real target are retained.

[0104] 4.2 Non-Maximum Suppression (NMS)

[0105] After threshold filtering, the remaining prediction boxes may still contain a large number of redundant boxes, especially when the target object is large, multiple prediction boxes may overlap. Non-maximum suppression (NMS) is a post-processing technique used to remove redundant overlapping bounding boxes. NMS compares the confidence scores of overlapping bounding boxes, retains the box with the highest confidence, and suppresses other boxes that overlap with it by more than a certain threshold. This can reduce duplicate detection and improve the accuracy and clarity of the detection results.

[0106] 4.3 Bounding Box Refinement

[0107] After the non-maximum suppression (NMS) process, the retained prediction boxes need to be further adjusted to improve the localization accuracy. Bounding box adjustment is a step to further refine the bounding box predicted by the model. By correcting and adjusting the initially predicted bounding box, the accuracy of object localization can be improved. This includes converting relative coordinates to absolute coordinates in the defect image so that the bounding box can accurately locate the object in the defect image.

[0108] 4.4 Multi-classification processing

[0109] Multi-classification processing refers to processing prediction results of multiple categories simultaneously in a detection task. The model needs to be able to distinguish and correctly classify targets of multiple categories. By setting the category probability threshold, the prediction results with the highest confidence in each category can be screened out to ensure that the final output category prediction is accurate and reliable.

[0110] The following describes the technical features of the motor housing surface defect detection method based on deep learning disclosed in this embodiment.

[0111] 1. Improve detection accuracy: The improved YOLOv8 network can more carefully capture the complex defect features on the surface of the motor housing, such as small cracks and complex spots, greatly improving the detection accuracy.

[0112] 2. Improve feature extraction capabilities: The improved YOLOv8 network enhances the efficiency and effect of feature extraction, and can more effectively extract spatial features and global dependencies, ensuring the excellent performance of the model under different defect types.

[0113] 3. Reduce computational complexity: The improved YOLOv8 network has significantly reduced computational complexity and resource consumption compared to the original network, which improves the detection speed.

[0114] 4. Enhanced real-time processing capabilities: The improved YOLOv8 network structure is more lightweight and optimizes computing efficiency, making it more suitable for real-time detection application scenarios.

[0115] 5. Improve the robustness and generalization ability of the model: The improved YOLOv8 network can better capture the complex relationship between feature maps, improving the robustness and generalization ability of the model to different defect types and environmental changes.

[0116] 6. Simplified model deployment: The improved YOLOv8 network not only meets the detection requirements, but also reduces the hardware requirements and deployment costs, adapting to the actual deployment needs of enterprises.

[0117] It is worth mentioning that the technical features such as the specific selection of high-resolution industrial cameras involved in the patent application of this invention should be regarded as the prior art. The specific structure, working principle and possible control method and spatial layout method of these technical features can be selected according to the conventional selection in the field, and should not be regarded as the inventive point of the patent of this invention. The patent of this invention will not be further elaborated.

[0118] For those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A motor housing surface defect detection method based on deep learning, characterized in that: The following steps are involved: Step S1: a data acquisition device acquires defect images of a motor housing; Step S2: The computer labels the defect image; Step S3: training data using a deep learning model; Step S4: output the detection result of the motor housing surface defects.

2. The motor housing surface defect detection method based on deep learning according to claim 1 is characterized in that: In step S1, the data acquisition device includes a high-resolution industrial camera and a ring-shaped LED light source, wherein: Place the annular LED light source above the running motor housing and install it coaxially with the high-resolution industrial camera. The light of the annular LED light source is consistent with the visual axis of the high-resolution industrial camera. When the motor housing passes through the detection area of ​​the high-resolution industrial camera and the ring-shaped LED light source, the high-resolution industrial camera continuously captures defect images, and the data of the defect images is transmitted to the computer through the high-speed interface GigE, and the computer stores and processes the data of the defect images.

3. The motor housing surface defect detection method based on deep learning according to claim 2 is characterized in that: The computer stores and processes the data of the defect image, which is specifically implemented in the following steps: Classify and store by defect category; Use annotation tools to manually annotate defect images and mark the location and type of each defect; Generate corresponding annotation text for deep learning model training.

4. The motor housing surface defect detection method based on deep learning according to claim 1 is characterized in that: In step S3, the deep learning model includes a feature extraction network, a multi-scale fusion network and a model detection.

5. The motor housing surface defect detection method based on deep learning according to claim 4 is characterized in that: The feature extraction network adopts the CSPDarknet53 architecture, and the feature extraction network includes Conv layer, Conv layer, C2f layer, Conv layer, C2f layer, Conv layer, C2f layer, Conv layer, C2f layer and AIFI layer.

6. The motor housing surface defect detection method based on deep learning according to claim 5 is characterized in that: The feature extraction network defines the feature maps output by its second and third C2f layers and AIFI layers as large feature maps FL, medium feature maps FM and small feature maps FS of different scales, respectively.

7. The motor housing surface defect detection method based on deep learning according to claim 6 is characterized in that: In the multi-scale fusion network, the feature maps finally output to the model detection head are the large fusion feature map MFL, the medium fusion feature map MFM and the small fusion feature map MFS.

8. The motor housing surface defect detection method based on deep learning according to claim 7 is characterized in that: The model detection head includes a classification head and a regression head.

9. The motor housing surface defect detection method based on deep learning according to claim 8, characterized in that: In the classification head, the Conv layer performs convolution, batch normalization, and SiLU activation operations, so that the number of channels of the final output feature map is the number of object categories in the feature map.

10. The motor housing surface defect detection method based on deep learning according to claim 8, characterized in that: In the regression head, the Conv layer performs convolution, batch normalization, and SiLU activation operations, so that the number of channels of the final output feature map is the number of channels required to calculate the distribution focal loss.

Citation Information

Cited By

  • Lightweight wafer defect detection method

    CN119359702A

  • Surface defect detection method with anti-interference capability

    CN121577624A