Gear end face defect detection method based on multi-scale target detection

By introducing a small object detection layer, a bidirectional feature pyramid network, a packet channel convolution module and an efficient channel attention mechanism on the YOLOv8 model, combined with the Wise-IoU loss function, the problems of detection accuracy and model lightweight in the existing technology are solved, and efficient and real-time gear end face defect detection is achieved.

CN119904444AActive Publication Date: 2025-04-29ZHEJIANG UNIV

Patent Information

Application Number
CN202510036399.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-04-29
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

The existing gear end face defect detection technology has shortcomings in detection accuracy, model lightweighting and complex background adaptability, especially when applied on edge devices with limited resources, it is difficult to meet real-time detection requirements.

Method used

Using a multi-scale object detection method, a small object detection layer is added to the YOLOv8 model, a replacement splicing operation is used as a bidirectional feature pyramid network, a replacement convolution layer is used as a packet channel convolution module, and an efficient channel attention mechanism is added before the SPPF module. Combined with the Wise-IoU loss function, the feature extraction and bounding box regression of the model are optimized.

Benefits of technology

It significantly improves detection accuracy and efficiency, enhances the model's adaptability to complex backgrounds and small goals, reduces computing resource consumption, and is suitable for achieving efficient and real-time gear end face defect detection in industrial scenarios with limited resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904444A_ABST
    Figure CN119904444A_ABST
Patent Text Reader

Abstract

The invention discloses a gear end face defect detection method based on multi-scale target detection, and the method specifically comprises the steps: setting data collection parameters of gear end face defect detection, generating original images containing different gear end face defect types based on the data collection parameters, marking the original images, and generating a label file, forming a processed image data set by the label file and the preprocessed image; optimizing a YOLOv8 model structure, designing a gear end face defect detection model, training the gear end face defect detection model on a processed image data set, and updating parameters based on a Wise-IoU loss function; and inputting an image to be subjected to gear end face defect detection into the trained gear end face defect detection model to obtain a gear end face defect detection result of the image. The invention aims to enhance the detection capability of the model on small target defects under a complex background and reduce the calculation complexity of the model so as to realize efficient and accurate surface defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of gear end face defect image processing and machine vision, and in particular relates to a gear end face defect detection method based on multi-scale target detection. Background Art

[0002] At present, gear face defect detection technology is an important quality control link in the field of industrial manufacturing. Traditional gear face defect detection methods mainly rely on manual detection or machine vision-based detection systems, but these methods have problems such as low efficiency and insufficient robustness. In recent years, target detection technology based on deep learning has been widely used in defect detection, especially the YOLO series (You Only Look Once) model has become a popular choice for industrial defect detection due to its efficient real-time detection capabilities. However, in practical applications, existing deep learning models still face bottlenecks in the face of problems such as small target detection, complex background interference, and high consumption of model computing resources. Especially when applied on edge devices with limited resources, the balance between model lightweight and detection accuracy needs to be solved urgently.

[0003] The main purpose of existing gear end face defect detection technology is to improve the degree of automation and detection accuracy, especially for the detection of minor defects, and to achieve efficient and real-time detection capabilities. Technical measures include the use of deep learning technology for automatic identification and classification of defects. Common technical means include feature extraction using convolutional neural networks (CNN), real-time detection using the YOLO series of networks, and the introduction of attention mechanisms to enhance the model's capture of key features. Some studies have introduced an efficient channel attention mechanism (ECA) into the backbone network of the YOLOv5 network when extracting defect features, which improves the feature extraction capability by enhancing the network's attention to bearing surface defect information. The ECA mechanism allows the network to better focus on the defect information on the bearing surface and ignore useless background information by training weights in the channel dimension.

[0004] However, the existing gear end face defect detection technology has the following defects and shortcomings in practical applications:

[0005] (1) Insufficient detection accuracy and adaptability to complex backgrounds: Although existing technologies have made some improvements in small target detection, the detection model is still easily affected by background interference in complex industrial scenarios. The gear end faces are often affected by background interference such as oil pollution and lighting changes. It is difficult to effectively suppress background noise, resulting in missed detections and false detections.

[0006] (2) High consumption of computing resources: Although existing models (such as YOLOv5, YOLOv8, etc.) have high detection efficiency, they have large computational complexity and too many model parameters, especially when deployed on devices with limited resources (such as edge computing devices), which makes it difficult to meet the requirements of real-time detection.

[0007] (3) Insufficient lightweightness: Although some existing technologies have introduced lightweight convolution modules or attention mechanisms, these improvements are mostly focused on the optimization of individual modules. The number of parameters and computational complexity of the overall model are still large, which cannot meet the deployment requirements of edge devices with limited resources.

[0008] (4) Small target detection still has limitations: Most detection models are not capable of extracting small target features, and these features are easily masked by background information. In addition, since gear end face defects are usually small, existing models find it difficult to accurately detect these tiny targets, resulting in frequent missed detections and false detections. Although the existing small target detection layer improves the detection of tiny defects, it has limited performance for more complex gear end face defects (such as scratches and wear), especially in densely distributed defects, where detection omissions are still likely to occur.

[0009] (5) Limited generalization ability of the model: Existing gear detection models are usually trained on specific data sets, with weak generalization ability and difficulty in adapting to complex industrial scenarios.

[0010] Therefore, there is still room for improvement in existing technologies in terms of detection accuracy, model lightweight, and adaptability to complex backgrounds. Especially when applied in actual industrial scenarios, how to effectively solve these problems is an urgent goal to be solved. Summary of the invention

[0011] The purpose of the present invention is to solve the above-mentioned problems existing in the prior art and to provide a gear end face defect detection method based on multi-scale target detection. The method can effectively solve the problems of low small target detection accuracy, large background interference, high computing resource consumption, etc., and is suitable for real-time detection needs in industrial production.

[0012] In order to achieve the above-mentioned invention object, the present invention specifically adopts the following technical solutions:

[0013] In a first aspect, the present invention provides a gear end face defect detection method based on multi-scale target detection, which comprises the following steps:

[0014] S1. Setting data acquisition parameters for gear end face defect detection, and generating original images containing different gear end face defect types based on the data acquisition parameters;

[0015] S2, annotate the original image, generate a label file corresponding to the original image, and preprocess the original image, so that the label file and the preprocessed image constitute a processed image data set;

[0016] S3. Add a small target detection layer to the YOLOv8 model, replace all splicing operations in the YOLOv8 model with a bidirectional feature pyramid network, replace one convolution layer of the YOLOv8 model backbone network with a grouped channel convolution module, and add an efficient channel attention mechanism before the SPPF module of the YOLOv8 model backbone network to obtain a gear end face defect detection model.

[0017] S4. Train the gear end face defect detection model on the processed image dataset, and update the gear end face defect detection model parameters based on the Wise-IoU loss function;

[0018] S5. Input the image to be detected into the trained gear end face defect detection model to obtain the gear end face defect detection result of the image to be detected.

[0019] Preferably, in step S1, the data acquisition parameters include the resolution of image acquisition, the range of image acquisition and the frequency of image acquisition; the gear end surface defect types include scratches, broken teeth and dents.

[0020] Preferably, in step S2, an image annotation tool is used to annotate the position of the gear end face defect on the original image, a label file is generated, and a data augmentation operation is performed on the original image to obtain a preprocessed image.

[0021] Preferably, in step S4, during the process of training the gear end face defect detection model, the preprocessed image is input into the backbone network of the gear end face defect detection model, the preprocessed image passes through the first convolution layer, the second convolution layer and the first C2f module in sequence to obtain a first feature map, the first feature map passes through the third convolution layer and the second C2f module in sequence to obtain a second feature map, the second feature map passes through the grouped channel convolution module and the third C2f module in sequence to obtain a third feature map, the third feature map passes through the fourth convolution layer, the fourth C2f module, the efficient channel attention mechanism and the SPPF module in sequence to obtain a fourth feature map, the fourth feature map is upsampled, and the upsampled fourth feature map and the third feature map are combined. Figure 1 The fifth feature map is input into the first bidirectional feature pyramid network to obtain the fifth feature map, the fifth feature map is input into the fifth C2f module to obtain the sixth feature map, the sixth feature map is upsampled, and the upsampled sixth feature map and the second feature map are connected. Figure 1The first and eighth feature maps are input into the second bidirectional feature pyramid network to obtain the seventh feature map, the seventh feature map is input into the sixth C2f module to obtain the eighth feature map, the first and eighth feature maps are input into the small target detection layer, the eighth feature map is first upsampled in the small target detection layer, and the upsampled eighth feature map and the first feature map are connected. Figure 1 The ninth feature map is input into the third bidirectional feature pyramid network to obtain the ninth feature map, the ninth feature map is input into the seventh C2f module to obtain the tenth feature map, the tenth feature map is input into the fifth convolutional layer to obtain the eleventh feature map and use it as the output of the small target detection layer, the tenth feature map is input into the first detection layer to obtain the candidate detection box output by the small target detection layer, the eleventh feature map and the eighth feature map are combined. Figure 1 The twelfth feature map is input into the fourth bidirectional feature pyramid network and the eighth C2f module to obtain the twelfth feature map, the twelfth feature map is input into the second detection layer to obtain the candidate detection box output by the second detection layer, the twelfth feature map is input into the sixth convolutional layer to obtain the thirteenth feature map, the thirteenth feature map and the sixth feature map are combined. Figure 1 The fourteenth feature map is input into the fifth bidirectional feature pyramid network and the ninth C2f module to obtain the fourteenth feature map, the fourteenth feature map is input into the third detection layer to obtain the candidate detection box output by the third detection layer, the fourteenth feature map is input into the seventh convolutional layer to obtain the fifteenth feature map, the fifteenth feature map and the fourth feature map are combined. Figure 1 The sixteenth feature map is input into the sixth bidirectional feature pyramid network and the tenth C2f module to obtain the sixteenth feature map, the sixteenth feature map is input into the fourth detection layer to obtain the candidate detection frame output by the fourth detection layer, the Wise-IoU loss function between the candidate detection frames output by each detection layer and the labeled true detection frame is calculated, and among all the candidate detection frames, the candidate detection frame with the smallest Wise-IoU loss function is taken as the final matching detection frame, and the Wise-IoU loss function between the final matching detection frame and the labeled true detection frame is calculated as the final Wise-IoU loss function. The gear end face defect detection model parameters are updated based on minimizing the final Wise-IoU loss function until the loss converges to obtain a trained gear end face defect detection model.

[0022] Preferably, the Wise-IoU loss function L Wise-IoU The function form is as follows:

[0023]

[0024] Where: B gt represents the real detection box; B p Represents a candidate detection box; ∩ represents the intersection; ∪ represents the union; α represents the weight hyperparameter.

[0025] Preferably, the weight hyperparameter value range is [0.2, 1.0].

[0026] Preferably, the convolution kernel sizes of the first convolution layer and the fourth convolution layer are both 3×3, the padding is 1, and the stride is 2.

[0027] Preferably, the convolution kernel sizes of the second convolution layer, the third convolution layer, the fifth convolution layer, the sixth convolution layer and the seventh convolution layer are all 3×3, the padding is 1 and the stride is 1.

[0028] Preferably, in step S5, the gear end face defect detection result of the image to be detected includes the predicted gear end face defect type and the bounding box coordinates of the gear end face defect.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] The advantage of the present invention is that the traditional YOLOv8 model is innovatively integrated with the efficient channel attention mechanism (ECA), the small target detection layer, the GSConv module and the Wise-IoU loss function, and a gear end face defect detection model is designed. By optimizing feature extraction, lightweight design and loss function strategy, the model detection accuracy and efficiency are significantly improved. The efficient channel attention mechanism enhances the focus of the gear end face defect detection model on key features, the GSConv module achieves lightweight by reducing the amount of calculation and feature redundancy, the small target detection layer improves the detection effect of tiny defects, and the Wise-IoU loss function further optimizes the bounding box regression, reduces false detection and missed detection, and improves the convergence speed of the model. The gear end face defect detection model has fast detection speed, small storage space, and excellent detection effect, providing an efficient detection method with high practicality and innovation in industrial mass detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 Schematic diagram of the steps of the method of the present invention;

[0032] Figure 2 A schematic diagram of updating parameters of the gear end face defect detection model of the present invention;

[0033] Figure 3 It is a structural schematic diagram of the gear end face defect detection model of the present invention. DETAILED DESCRIPTION

[0034] In order to make the above-mentioned purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation mode of the present invention is described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. The technical features in each embodiment of the present invention can be combined accordingly without conflicting with each other.

[0035] In the description of the present invention, it should be understood that the terms "first" and "second" are only used for the purpose of distinguishing descriptions, and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features.

[0036] In order to solve the technical problems of missed detection of small targets, large model computing resource requirements, many complex background interferences and high real-time requirements in gear end face defect detection, the present invention provides a gear end face defect detection method based on multi-scale target detection, aiming to improve the detection accuracy and speed of surface defects of industrial equipment, especially in complex background and small target detection. The method of the present invention uses a grouped channel convolution module (GSConv) to replace a standard convolution layer in the backbone network part of the YOLOv8 network, thereby reducing the computational complexity of the gear end face defect detection model; in the feature extraction part, an efficient channel attention mechanism is incorporated to enhance the attention of the gear end face defect detection model to important features, especially by weighting the important channels in the feature map to improve the detection accuracy; in the feature classification process, a bidirectional feature pyramid network (BiFPN) is used to improve the adaptability of the gear end face defect detection model to defects of different scales; the Wise-IoU loss function and the small target detection layer are used to improve the accuracy of the bounding box regression, thereby enhancing the detection effect of small targets. The method of the present invention is superior to the existing technology in terms of detection accuracy, computational complexity and real-time performance. It is suitable for real-time defect detection on embedded devices, realizing efficient and real-time gear end face defect detection, and is suitable for industrial scenarios with limited resources.

[0037] like Figure 1 As shown, in a preferred implementation of the present invention, the gear end face defect detection method based on multi-scale target detection includes the following steps S1 to S5. The specific implementation process is described below.

[0038] S1. Setting data acquisition parameters for gear end face defect detection, and generating original images containing different gear end face defect types based on the data acquisition parameters.

[0039] It should be noted that in step S1 of the present invention, the data acquisition parameters for gear end face defect detection are set, including the resolution, acquisition range and frequency of image acquisition, to ensure that different types of gear end face defects, including scratches, broken teeth and dents, are covered. Then, the data acquisition parameters are adjusted to collect original images containing different types of gear end face defects such as scratches and dents, to ensure the diversity and comprehensiveness of the data, and obtain the original image data set.

[0040] S2. Annotate the original image, generate a label file corresponding to the original image, and preprocess the original image. The label file and the preprocessed image constitute a processed image data set.

[0041] It should be noted that in step S2 of the present invention, the original image data set is labeled and preprocessed, specifically: the open source image annotation tool LabelImg is used to mark the gear end face defect position on the original image, a label file is generated, and data augmentation operations are performed on the original image to improve the generalization ability of the gear end face defect detection model.

[0042] S3. Add a small target detection layer to the YOLOv8 model, replace all splicing operations in the YOLOv8 model with a bidirectional feature pyramid network, replace one convolution layer of the YOLOv8 model backbone network with a grouped channel convolution module, and add an efficient channel attention mechanism before the SPPF module of the YOLOv8 model backbone network to obtain the gear end face defect detection model.

[0043] It should be noted that the present invention improves the YOLOv8 model to obtain a gear end face defect detection model. The specific improvements are: integrating the GSConv module in the backbone network to enhance the feature extraction capability, and adding the ECA attention mechanism to highlight key feature information. Feature fusion is achieved through BiFPN, and the upsampling operation is used to ensure the alignment of features of different scales, providing rich feature information for the detection layer. A multi-detection layer structure is constructed, and the feature map extracted by BiFPN is converted into the output of the small target detection layer through the detection layer, thereby improving the gear end face defect detection model's ability to detect tiny defects on the gear surface.

[0044] The embodiment of the present invention makes a series of improvements in the backbone network, neck and detection head of YOLOv8, including introducing a grouped channel convolution module, an efficient channel attention mechanism and a bidirectional feature pyramid network to improve the defect detection performance of the model, and finally forms a gear end face defect detection model, which specifically includes the following parts:

[0045] 1) Backbone network: The backbone network based on YOLOv8 is responsible for the preliminary extraction of multi-scale features of the gear end face. The backbone network replaces one of the standard convolutions with a grouped channel convolution module (GSConv). By using smaller convolution kernels and optimized convolution structures as well as spatial grouping and pseudo-feature generation mechanisms, the amount of computation and redundant feature information in the spatial and channel dimensions are significantly reduced, making defect detection in complex backgrounds more efficient. At the same time, an efficient channel attention mechanism (ECA) is added before the SPPF module to enhance the feature interaction between channels without adding additional parameters, focus on key defect areas, and efficiently enhance channel features through lightweight 1D convolution, effectively improving the attention of the gear end face defect detection model to the gear end face defects, while maintaining computational efficiency and capturing global information.

[0046] Specifically, the grouped channel convolution module GSConv adopts a combination of group convolution and point-by-point convolution to reduce the amount of computation while maintaining feature extraction capabilities, thereby achieving lightweight design and accelerating the inference speed of the model. This improvement is particularly suitable for embedded devices with limited resources, ensuring the real-time and effectiveness of the model. The introduction of GSConv not only reduces the computational complexity, but also plays a good balancing role in maintaining feature expression capabilities. The ECA attention mechanism enhances the model's attention to key features by weighting the features of each channel in the feature map, thereby effectively improving the detection accuracy of small target defects. In the ECA attention mechanism, the channel weights are dynamically adjusted based on global information. This adaptive weighting method enables the model to focus on the most important features more accurately, especially in complex backgrounds. In addition, the implementation methods of GSConv and ECA attention mechanisms are both existing technologies and will not be repeated here.

[0047] 2) Small target detection layer: It is located at the neck of YOLOv8 and is a newly added structure. It is used to more accurately identify small-size defects on the gear end face through upsampling and fusion of low-level features of the backbone network. This layer processes feature maps with a resolution of 160×160, which improves the ability to accurately detect tiny defects on the gear end face and effectively reduces missed detections, making the model more reliable when dealing with tiny defects in industrial equipment.

[0048] 3) Bidirectional Feature Pyramid Network (BiFPN): By effectively fusing feature maps from different scales, the adaptability of the gear end face defect detection model to defects of various sizes is enhanced, thereby improving the detection accuracy.

[0049] Specifically, in the neck structure, the present invention uses a bidirectional feature pyramid network BiFPN to replace the original feature fusion method. BiFPN achieves adaptive control of features of different scales by repeatedly fusing weighted multi-scale feature maps, effectively improving the performance of the model in detecting multi-scale targets. BiFPN allows the model to dynamically adjust the contribution of features of different scales during the feature fusion process, which is particularly important for scenes containing both large and small targets, thereby ensuring the accuracy and robustness of detection.

[0050] The implementation method of the bidirectional feature pyramid network BiFPN belongs to the prior art. To facilitate the understanding of those skilled in the art, a brief introduction to its implementation method is now given. The bidirectional feature pyramid network BiFPN contains a top-down and bottom-up bidirectional path. The top-down path is responsible for transmitting the semantic information of high-level features, while the bottom-up path transmits the position information of low-level features. In addition, a new connection path is added in the same layer between the input node and the output node. In BiFPN, the first feature fusion is first achieved through lateral connections and downsampling layers, and the feature maps of different scales extracted by the main CSPDarkNet layer are downsampled and fused through lateral connections. Subsequently, the second feature fusion with the downsampling layer and upsampling layer of the same scale is achieved through jump connections. Jump connections enable BiFPN to transfer information between feature maps of different scales, thereby better fusing multi-scale information. Finally, the multi-scale feature maps obtained after multiple feature fusions are input into the detector to complete the target detection task. Through multiple feature fusions, BiFPN can more accurately capture the features of the target, thereby improving the accuracy of target detection.

[0051] 4) Wise-IoU loss function: By introducing a dynamic non-monotonic focusing mechanism, the bounding box regression process is optimized, the anchor box regression error is reduced, the accumulation of anchor box errors is avoided, the convergence of the gear end face defect detection model is accelerated, and the impact of low-quality images on model training is reduced, making the gear end face defect detection model more accurate in small target detection.

[0052] The above structural designs ensure that the detection accuracy, computational complexity and real-time performance are better than the existing technologies, which is suitable for efficient and real-time gear end face defect detection in industrial scenarios with limited resources.

[0053] S4. Train the gear end face defect detection model on the processed image dataset, and update the gear end face defect detection model parameters based on the Wise-IoU loss function.

[0054] It should be noted that in the process of training the gear end face defect detection model in step S4 of the present invention, Figure 3As shown, the preprocessed image is input into the backbone network of the gear end face defect detection model, the preprocessed image passes through the first convolution layer, the second convolution layer and the first C2f module in sequence to obtain a first feature map, the first feature map passes through the third convolution layer and the second C2f module in sequence to obtain a second feature map, the second feature map passes through the grouped channel convolution module and the third C2f module in sequence to obtain a third feature map, the third feature map passes through the fourth convolution layer, the fourth C2f module, the efficient channel attention mechanism and the SPPF module in sequence to obtain a fourth feature map, the fourth feature map is upsampled, and the upsampled fourth feature map and the third feature map are combined. Figure 1 The fifth feature map is input into the first bidirectional feature pyramid network to obtain the fifth feature map, the fifth feature map is input into the fifth C2f module to obtain the sixth feature map, the sixth feature map is upsampled, and the upsampled sixth feature map and the second feature map are connected. Figure 1 The first and eighth feature maps are input into the second bidirectional feature pyramid network to obtain the seventh feature map, the seventh feature map is input into the sixth C2f module to obtain the eighth feature map, the first and eighth feature maps are input into the small target detection layer, the eighth feature map is first upsampled in the small target detection layer, and the upsampled eighth feature map and the first feature map are connected. Figure 1 The ninth feature map is input into the third bidirectional feature pyramid network to obtain the ninth feature map, the ninth feature map is input into the seventh C2f module to obtain the tenth feature map, the tenth feature map is input into the fifth convolutional layer to obtain the eleventh feature map and use it as the output of the small target detection layer, the tenth feature map is input into the first detection layer to obtain the candidate detection box output by the small target detection layer, the eleventh feature map and the eighth feature map are combined. Figure 1 The twelfth feature map is input into the fourth bidirectional feature pyramid network and the eighth C2f module to obtain the twelfth feature map, the twelfth feature map is input into the second detection layer to obtain the candidate detection box output by the second detection layer, the twelfth feature map is input into the sixth convolutional layer to obtain the thirteenth feature map, the thirteenth feature map and the sixth feature map are combined. Figure 1 The fourteenth feature map is input into the fifth bidirectional feature pyramid network and the ninth C2f module to obtain the fourteenth feature map, the fourteenth feature map is input into the third detection layer to obtain the candidate detection box output by the third detection layer, the fourteenth feature map is input into the seventh convolutional layer to obtain the fifteenth feature map, the fifteenth feature map and the fourth feature map are combined. Figure 1The sixteenth feature map is input into the sixth bidirectional feature pyramid network and the tenth C2f module to obtain the sixteenth feature map, the sixteenth feature map is input into the fourth detection layer to obtain the candidate detection frame output by the fourth detection layer, the Wise-IoU loss function between the candidate detection frames output by each detection layer and the labeled true detection frame is calculated, and among all the candidate detection frames, the candidate detection frame with the smallest Wise-IoU loss function is taken as the final matching detection frame, and the Wise-IoU loss function between the final matching detection frame and the labeled true detection frame is calculated as the final Wise-IoU loss function. The gear end face defect detection model parameters are updated based on minimizing the final Wise-IoU loss function until the loss converges to obtain a trained gear end face defect detection model.

[0055] It should be noted that, in this embodiment, the convolution kernel sizes of the first convolution layer and the fourth convolution layer are both 3×3, the padding is 1, and the step size is 2; the convolution kernel sizes of the second convolution layer, the third convolution layer, the fifth convolution layer, the sixth convolution layer, and the seventh convolution layer are all 3×3, the padding is 1, and the step size is 1.

[0056] In this embodiment, if Figure 2 As shown in the figure, the parameters of the gear end face defect detection model only need to be updated in the places that are different from the YOLOv8 model, such as the bidirectional feature pyramid network, the grouped channel convolution module, the small target detection layer, and the efficient channel attention mechanism. The other structures that are the same as the YOLOv8 model do not need to be updated. Before model training, first formulate a training strategy, including setting hyperparameters such as the learning rate adjustment scheme, the loss function weight ratio, and the training batch size, focusing on optimizing the recognition effect of the small target detection layer on small targets and improving the detection ability of small-sized defects (such as tiny scratches, wear, etc.). After training, evaluate the model performance, analyze the performance indicators of the small target detection layer in small target detection, such as precision, recall rate, and mAP, and verify the detection effect of the model. In the process of evaluating the model detection effect, record and analyze the detected defect types and locations, pay special attention to false detection and missed detection, especially the detection effect under complex backgrounds. According to the results of false detection and missed detection analysis, the parameter configuration of the GSConv module, the weight of the ECA attention mechanism and the parameters of the small target detection layer are adjusted, the configuration of BiFPN is optimized, the small target detection performance is improved, the detection strategy of the model is optimized, and the detection accuracy and recall rate are further improved. Finally, a lightweight gear end face defect detection model is generated and deployed in an industrial production environment for actual detection, and the detection effect and operation performance of the model in real scenes are recorded.

[0057] It should be noted that in step S4 of the present invention, in order to further improve the accuracy of the bounding box, the present invention uses Wise-IoU as the loss function of the bounding box regression. Compared with the traditional IoU loss function, Wise-IoU can better handle the overlap between bounding boxes, accelerate the convergence process of the model, and improve the accuracy of bounding box positioning. Through the improved loss function design, the model can achieve better positioning effect in a shorter training time, thereby reducing the occurrence of false detection and missed detection.

[0058] In this embodiment, the Wise-IoU loss function L Wise-IoU The function form is as follows:

[0059]

[0060] Where: B gt represents the real detection box; B p Represents a candidate detection box; ∩ represents the intersection; ∪ represents the union; α represents the weight hyperparameter, and its value range is [0.2, 1.0].

[0061] It should be noted that in step S4 of the present invention, for the gear end face defect detection model, in addition to using the efficient channel attention mechanism (ECA), other attention mechanisms or feature fusion methods, such as SE layer (Squeeze-and-Excitation) or CBAM (Convolutional Block Attention Module), may also be used, but these methods may not be as efficient as ECA in terms of lightweight effect. The SE layer enhances the representation of important features in the channel dimension, and CBAM enhances the feature extraction of both spatial and channel dimensions, but their computational complexity is slightly higher than that of ECA, so it may increase the demand for computing resources. In addition, the traditional FPN (Feature Pyramid Network) can also replace the GSConv module as a multi-scale feature fusion method. However, although the traditional FPN has good feature fusion capabilities, it may not be as efficient as the GSConv module in terms of lightweight and real-time performance. GSConv reduces the amount of calculation by generating pseudo-features, while FPN is relatively more complex.

[0062] S5. Input the image to be detected into the trained gear end face defect detection model to obtain the gear end face defect detection result of the image to be detected.

[0063] It should be noted that, in step S5, the gear end face defect detection result of the image to be detected includes the predicted gear end face defect type and the bounding box coordinates of the gear end face defect.

[0064] Based on the YOLOv8 network model, the present invention additionally introduces an efficient channel attention mechanism (ECA), a grouped channel convolution module (GSConv) and a small target detection layer, designs an optimization strategy for the Wise-IoU loss function, and then improves the gear end face defect detection. These technical innovations constitute the core of the present invention, ensuring the efficiency, accuracy and real-time performance of the gear end face defect detection process, and are particularly suitable for large-scale applications in industrial environments. Specifically, the efficient channel attention mechanism enhances the focus of the gear end face defect detection model on key defect features, and the grouped channel convolution module reduces the computational complexity and parameter amount of the gear end face defect detection model by reducing redundancy in spatial and channel dimensions, thereby achieving a lightweight design. At the same time, the small target detection layer significantly improves the detection accuracy and recall rate of tiny gear defects. Through these improvements, the present invention exhibits significant advantages in the following aspects:

[0065] (1) Improved feature extraction efficiency: By introducing a lightweight grouped channel convolution module, the computational complexity of the gear end face defect detection model is reduced while maintaining high-quality feature extraction, making the gear end face defect detection model more suitable for environments with limited resources.

[0066] (2) Improved small target detection performance: The combination of an efficient channel attention mechanism and a small target detection layer significantly improves the detection accuracy of small targets in gear end face defect detection models under complex backgrounds and multi-scale scenarios, reducing missed detections and false detections.

[0067] (3) Enhancement of multi-scale feature fusion: The bidirectional feature pyramid network (BiFPN) is used to achieve efficient fusion of feature maps, which improves the adaptability of the gear end face defect detection model to defects of different scales, allowing the gear end face defect detection model to work stably in various complex industrial scenarios.

[0068] (4) More accurate bounding box positioning: The Wise-IoU loss function is used to enable the gear end face defect detection model to better perform bounding box regression, reduce the error in the overlapping area, and ensure the accurate positioning of the defect area.

[0069] In summary, the present invention realizes efficient and accurate detection of surface defects of industrial equipment through multi-faceted improvements to the YOLOv8 network model structure, especially in the detection of complex backgrounds and small targets, meeting the requirements of high precision, real-time and lightweight for gear end face defect detection under complex backgrounds.

[0070] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.

Claims

1. A gear end surface defect detection method based on multi-scale target detection, characterized in that: The following steps are involved: S1. Setting data acquisition parameters for gear end face defect detection, and generating original images containing different gear end face defect types based on the data acquisition parameters; S2, annotate the original image, generate a label file corresponding to the original image, and preprocess the original image, so that the label file and the preprocessed image constitute a processed image data set; S3. Add a small target detection layer to the YOLOv8 model, replace all splicing operations in the YOLOv8 model with a bidirectional feature pyramid network, replace one convolution layer of the YOLOv8 model backbone network with a grouped channel convolution module, and add an efficient channel attention mechanism before the SPPF module of the YOLOv8 model backbone network to obtain a gear end face defect detection model. S4. Train the gear end face defect detection model on the processed image dataset, and update the gear end face defect detection model parameters based on the Wise-IoU loss function; S5. Input the image to be detected into the trained gear end face defect detection model to obtain the gear end face defect detection result of the image to be detected.

2. A gear end surface defect detection method based on multi-scale target detection as claimed in claim 1, characterized in that: In step S1, the data acquisition parameters include the resolution of image acquisition, the range of image acquisition and the frequency of image acquisition.

3. The gear end face defect detection method based on multi-scale target detection according to claim 1, characterized in that: In step S1, the gear end surface defect types include scratches, broken teeth and dents.

4. The gear end surface defect detection method based on multi-scale target detection according to claim 1, characterized in that: In step S2, an image annotation tool is used to annotate the position of the gear end face defect on the original image, a label file is generated, and a data augmentation operation is performed on the original image to obtain a preprocessed image.

5. The gear end face defect detection method based on multi-scale target detection according to claim 1, characterized in that: In step S4, during the training of the gear end face defect detection model, the preprocessed image is input into the backbone network of the gear end face defect detection model, the preprocessed image is sequentially passed through the first convolution layer, the second convolution layer and the first C2f module to obtain a first feature map, the first feature map is sequentially passed through the third convolution layer and the second C2f module to obtain a second feature map, the second feature map is sequentially passed through the grouped channel convolution module and the third C2f module to obtain a third feature map, the third feature map is sequentially passed through the fourth convolution layer, the fourth C2f module, the efficient channel attention mechanism and the SPPF module to obtain a fourth feature map, the fourth feature map is upsampled, and the upsampled fourth feature map is combined with the third feature map Input the first bidirectional feature pyramid network to obtain a fifth feature map, input the fifth feature map to the fifth C2f module to obtain a sixth feature map, upsample the sixth feature map, input the upsampled sixth feature map and the second feature map together to the second bidirectional feature pyramid network to obtain a seventh feature map, input the seventh feature map to the sixth C2f module to obtain an eighth feature map, input the first feature map and the eighth feature map to the small target detection layer, upsample the eighth feature map in the small target detection layer, input the upsampled eighth feature map and the first feature map together to the third bidirectional feature pyramid network to obtain a ninth feature map, input the ninth feature map to the seventh C2f module to obtain a tenth feature map, and input the tenth feature map to the seventh C2f module. The first feature map is input into the fifth convolutional layer to obtain the eleventh feature map and use it as the output of the small target detection layer. The tenth feature map is input into the first detection layer to obtain the candidate detection box output by the small target detection layer. The eleventh feature map and the eighth feature map are input into the fourth bidirectional feature pyramid network and the eighth C2f module together to obtain the twelfth feature map. The twelfth feature map is input into the second detection layer to obtain the candidate detection box output by the second detection layer. The twelfth feature map is input into the sixth convolutional layer to obtain the thirteenth feature map. The thirteenth feature map and the sixth feature map are input into the fifth bidirectional feature pyramid network and the ninth C2f module together to obtain the fourteenth feature map. The fourteenth feature map is input into the third detection layer to obtain the output of the third detection layer. candidate detection frame, input the fourteenth feature map into the seventh convolutional layer to obtain the fifteenth feature map, input the fifteenth feature map and the fourth feature map together into the sixth bidirectional feature pyramid network and the tenth C2f module to obtain the sixteenth feature map, input the sixteenth feature map into the fourth detection layer, obtain the candidate detection frame output by the fourth detection layer, calculate the Wise-IoU loss function between the candidate detection frames output by each detection layer and the annotated true detection frame, take the candidate detection frame with the smallest Wise-IoU loss function among all the candidate detection frames as the final matching detection frame, and calculate the Wise-IoU loss function between the final matching detection frame and the annotated true detection frame as the final Wise-IoU loss function,Based on minimizing the final Wise-IoU loss function, the gear end face defect detection model parameters are updated until the loss converges, and a trained gear end face defect detection model is obtained.

6. A gear end surface defect detection method based on multi-scale target detection as claimed in claim 5, characterized in that: The Wise-IoU loss function L Wise-IoU The function form is as follows: Where: B gt represents the real detection box; B p Represents a candidate detection box; ∩ represents the intersection; ∪ represents the union; α represents the weight hyperparameter.

7. A gear end face defect detection method based on multi-scale target detection as claimed in claim 6, characterized in that: The weight hyperparameter value range is [0.2, 1.0].

8. The gear end face defect detection method based on multi-scale target detection according to claim 5, characterized in that: The convolution kernel sizes of the first convolution layer and the fourth convolution layer are both 3×3, the padding is 1, and the stride is 2.

9. The gear end surface defect detection method based on multi-scale target detection according to claim 5, characterized in that: The convolution kernel sizes of the second convolution layer, the third convolution layer, the fifth convolution layer, the sixth convolution layer and the seventh convolution layer are all 3×3, the padding is 1 and the stride is 1.

10. The gear end surface defect detection method based on multi-scale target detection according to claim 1, characterized in that: In step S5, the gear end face defect detection result of the image to be detected includes the predicted gear end face defect type and the bounding box coordinates of the gear end face defect.

Citation Information

Patent Citations

  • Wind turbine surface defect detection method

    CN115719337A

  • Method for detecting surface defects of defective prefabricated French fries

    CN118537318A

  • Method and system for surface defect detection based on few-shot learning

    US20240362762A1

  • Deep-learning-based target detection method for defects of image of inner side of commutator

    WO2024208102A1

Cited By

  • Gear defect detection method, device, equipment and medium

    CN120747100A

  • Gear defect detection method, apparatus, device, and medium

    CN120747100B