A hierarchical multi-scale feature analysis and dynamic attention enhancement method and system for gear surface defect detection

By employing hierarchical multi-scale feature analysis and dynamic attention enhancement methods, the problem of detecting minute defects in complex backgrounds in gear surface defect detection was solved, achieving efficient and accurate defect identification and localization, and improving the level of automated quality control in industrial gears.

CN121073945BActive Publication Date: 2026-02-27GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511189640.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2026-02-27
Estimated Expiration
2045-08-25

AI Technical Summary

Technical Problem

Existing methods for detecting surface defects in gears struggle to effectively distinguish minute defects in complex environments. They lack efficient cross-scale and structural-level fusion mechanisms during feature extraction, and their attention mechanisms are insufficient to adapt to diverse defect types and dynamic backgrounds, resulting in high false negative rates and limited detection accuracy.

Method used

We employ a hierarchical multi-scale feature analysis and dynamic attention enhancement method to achieve efficient fusion of fine-grained textures and macroscopic structures through a multi-branch heterogeneous convolutional structure. Furthermore, we introduce a Monte Carlo dynamic attention mechanism to enhance the model's adaptability to diverse defect types and dynamic backgrounds.

Benefits of technology

It significantly improves the detection capability of minute defects in complex backgrounds, enhances the robustness and accuracy of detection, strengthens the adaptability to diverse defect types and dynamic backgrounds, and improves the positioning accuracy of minute targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121073945B_ABST
    Figure CN121073945B_ABST
Patent Text Reader

Abstract

The application discloses a layered multi-scale feature analysis and dynamic attention enhancement method and system for gear surface defect detection, and comprises the following steps: collecting a gear surface image through a high-definition imaging device; inputting the gear surface image into a deep learning network based on a YOLOv11 architecture; the deep learning network integrates a layered multi-scale feature extraction module and a dynamic Monte Carlo attention mechanism; using the layered multi-scale feature extraction module to extract cross-scale defect features; using the dynamic Monte Carlo attention mechanism to generate adaptive attention weights; and outputting the position, category and confidence of the gear surface defect. The application fuses multi-branch heterogeneous convolution and Monte Carlo dynamic attention mechanism, significantly improves the recognition ability of multiple types of defects in a complex background, and effectively improves the detection precision and reasoning speed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of gear surface defect detection, and particularly relates to a hierarchical multi-scale feature analysis and dynamic attention enhancement method and system for gear surface defect detection. BACKGROUND

[0002] As a core component in mechanical transmission systems, the surface quality of gears directly affects the operation reliability and service life of equipment. If gear surface defects (such as pitting, cracking, wear, etc.) are not detected and repaired in a timely manner, it can easily lead to a decrease in transmission accuracy, an increase in noise, early failure of components, and even major equipment failures. Therefore, gear surface defect detection technology has important engineering application value in many fields such as automobiles, rail transportation, aerospace, heavy machinery, etc.

[0003] Existing gear surface defect detection methods are mainly based on deep learning networks, which use multi-scale feature fusion and attention mechanisms to improve detection performance. However, traditional gear surface defect detection methods are limited by the difficulty of effectively distinguishing small defects in complex backgrounds, the lack of efficient cross-scale and structural level fusion mechanisms in the feature extraction process, and the insufficient adaptability of existing attention mechanisms to diverse defect types and dynamic backgrounds, resulting in high false negative rates, limited detection accuracy, and difficulties in balancing inference speed and accuracy in practical applications. Therefore, developing a new detection method and system that can efficiently fuse multi-scale features, dynamically enhance defect saliency, and improve small target detection capability is of great significance for promoting the application and development of gear surface defect detection technology. SUMMARY

[0004] To solve the above technical problems, the application provides a hierarchical multi-scale feature analysis and dynamic attention enhancement method and system for gear surface defect detection, which has a compact system structure, integrates multi-branch heterogeneous convolution and Monte Carlo dynamic attention mechanism, significantly improves the recognition ability of multiple types of defects in complex backgrounds, and effectively improves the detection accuracy and inference speed.

[0005] In one aspect, to achieve the above object, the application provides a hierarchical multi-scale feature analysis and dynamic attention enhancement method for gear surface defect detection, comprising:

[0006] Collecting a gear surface image through a high-definition imaging device;

[0007] Inputting the gear surface image into a deep learning network based on a YOLOv11 architecture, the deep learning network integrating a hierarchical multi-scale feature extraction module and a dynamic Monte Carlo attention mechanism;

[0008] Extracting cross-scale defect features using the hierarchical multi-scale feature extraction module;

[0009] generating adaptive attention weights using the dynamic Monte Carlo attention mechanism;

[0010] outputting the position, category and confidence of the gear surface defect.

[0011] Optionally, the process of the hierarchical multi-scale feature extraction module includes an enhanced attention sub-module, and the process of the enhanced attention sub-module includes:

[0012] extracting local spatial features through 3x3 convolution;

[0013] modeling global channel dependency features through global average pooling and 1x1 convolution;

[0014] concatenating the local features and the global features in the channel dimension and then reducing the dimension;

[0015] applying a channel attention mechanism and a 7x7 spatial convolution to the fused features;

[0016] after the Dropout processing, connecting in residual connection with the input features.

[0017] Optionally, the process of the hierarchical multi-scale feature extraction module includes a multi-scale sub-module, and the implementation process of the multi-scale sub-module includes:

[0018] parallelly executing four groups of heterogeneous convolution operations:

[0019] the first group uses 3x3 standard convolution to extract small-scale features;

[0020] the second group uses 5x5 standard convolution to extract medium-scale features;

[0021] the third group uses 7x7 standard convolution to extract large-scale features;

[0022] the fourth group uses 3x3 dilated convolution to extract sparse background features;

[0023] concatenating the four groups of features in the channel dimension and then reducing the dimension, and connecting in residual connection with the input features.

[0024] Optionally, the process of the hierarchical multi-scale feature extraction module includes a detail sub-module, and the implementation process of the detail sub-module includes:

[0025] the first branch extracts local contrast features through depthwise separable convolution;

[0026] the second branch extracts high-frequency features through the combination of 1x1 convolution and 3x3 convolution;

[0027] generating adaptive channel attention weights for the high-frequency features;

[0028] adding the weighted high-frequency features and the local contrast features and connecting in residual connection.

[0029] Optionally, the process of the hierarchical multi-scale feature extraction module includes a linear submodule, and the implementation process includes:

[0030] Multi-directional linear features are extracted through 1x5 horizontal convolution, 5x1 vertical convolution and two groups of 3x3 expansion convolution.

[0031] The multi-directional features are spliced in the channel dimension and then integrated through 1x1 convolution.

[0032] The 3x3 convolution of the edge enhancement branch is used to simulate gradient features.

[0033] The directional features, edge features and input features are triple residual connected.

[0034] Optionally, the process of the hierarchical multi-scale feature extraction module includes a feature fusion submodule, and the implementation process includes:

[0035] The output features of the enhanced attention submodule, the multi-scale submodule, the detail submodule and the linear submodule are spliced in the channel dimension.

[0036] A channel statistical vector is generated through global average pooling.

[0037] After dimension reduction through two layers of 1x1 convolution, a Softmax function is applied to generate four groups of weights.

[0038] The features of each submodule are weighted and fused according to the weights, and the integrated features are output through 3x3 convolution.

[0039] Optionally, the implementation process of the dynamic Monte Carlo attention mechanism includes:

[0040] In the training stage, the pooling resolution is randomly selected, and the average pooling features and the maximum pooling features are fused;

[0041] In the test stage, multi-resolution weighted fusion is fixedly used;

[0042] The channel attention weight is dynamically generated based on the defect type.

[0043] The basic attention weight and the defect type attention weight are weighted and multiplied by the channel mixed features.

[0044] In another aspect, to achieve the above object, the application provides a hierarchical multi-scale feature analysis and dynamic attention enhancement system for gear surface defect detection, comprising:

[0045] A computer is used to run the deep learning network.

[0046] A high-definition imaging device is connected to the computer and is used to collect 2048x2448 resolution images.

[0047] Gear detection platform for carrying the gear to be detected and communicating with the computer, outputting the position, category and confidence of the gear surface defect.

[0048] The present application has the technical effect that: the application discloses a layered multi-scale feature analysis and dynamic attention enhancement method and system for gear surface defect detection, which effectively realizes efficient fusion of fine-grained texture and macrostructure by introducing a multi-branch heterogeneous convolution structure, thereby significantly improving the detection capability of micro defects in a complex background. The Monte Carlo dynamic attention mechanism is adopted to enhance the adaptability of the model to diversified defect types and dynamic backgrounds, thereby improving the robustness and accuracy of detection. In addition, the high-resolution multi-path detection architecture is combined to effectively improve the positioning accuracy of micro targets. The application is very helpful for efficient detection and intelligent identification of gear surface defects, and provides strong technical support for improving the automatic quality control and maintenance level of industrial gears. BRIEF DESCRIPTION OF DRAWINGS

[0049] The accompanying drawings, which form a part of this application, are included to provide a further understanding of the application and are incorporated in and constitute a part of this application. The embodiments of this application, and their

[0050] Figure 1 The figure is a structural schematic diagram of an industrial gear defect detection system according to an embodiment of the application, wherein 101 is a computer, 102 is a high-definition imaging device, 103 is a gear detection platform, and 104 is a gear to be detected.

[0051] Figure 2 The figure is a schematic diagram of a deep learning network model based on a YOLOv11 architecture according to an embodiment of the application.

[0052] Figure 3 The figure is a schematic diagram of a layered multi-scale feature extraction module according to an embodiment of the application.

[0053] Figure 4 The figure is a schematic diagram of an enhanced attention module according to an embodiment of the application.

[0054] Figure 5 The figure is a schematic diagram of a multi-scale module according to an embodiment of the application.

[0055] Figure 6 The figure is a schematic diagram of a linear module according to an embodiment of the application.

[0056] Figure 7 The figure is a schematic diagram of a detail module according to an embodiment of the application.

[0057] Figure 8 The figure is a schematic diagram of a feature fusion module according to an embodiment of the application.

[0058] Figure 9 The figure is a schematic diagram of a dynamic Monte Carlo attention mechanism according to an embodiment of the application.

[0059] Figure 10 Fig. 1 is a flowchart of a hierarchical multi-scale feature analysis and dynamic attention enhancement method for gear surface defect detection according to an embodiment of the present application. DETAILED DESCRIPTION

[0060] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0061] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in a different order.

[0062] As shown in Figure 10 The present embodiment also provides a hierarchical multi-scale feature analysis and dynamic attention enhancement method for gear surface defect detection, which comprises:

[0063] Collecting a gear surface image by a high-definition imaging device;

[0064] Inputting the gear surface image into a deep learning network based on a YOLOv11 architecture, the deep learning network integrating a hierarchical multi-scale feature extraction module and a dynamic Monte Carlo attention mechanism;

[0065] Extracting cross-scale defect features using the hierarchical multi-scale feature extraction module;

[0066] Generating adaptive attention weights using the dynamic Monte Carlo attention mechanism;

[0067] Outputting the position, category and confidence of the gear surface defect.

[0068] Further, the process of the hierarchical multi-scale feature extraction module includes an enhanced attention sub-module, which comprises:

[0069] Extracting local spatial features by 3x3 convolution;

[0070] Modeling global channel dependency features by global average pooling and 1x1 convolution;

[0071] Dimensionally reducing the local features and the global features after concatenating them in the channel dimension;

[0072] Applying a channel attention mechanism and a 7x7 spatial convolution weighting to the fused features;

[0073] After Dropout processing, connecting with input feature residual.

[0074] Further, the process of the hierarchical multi-scale feature extraction module includes a multi-scale sub-module, and the implementation process includes:

[0075] Four groups of heterogeneous convolution operations are performed in parallel:

[0076] The first group uses 3x3 standard convolution to extract small-scale features;

[0077] The second group uses 5x5 standard convolution to extract medium-scale features;

[0078] The third group uses 7x7 standard convolution to extract large-scale features;

[0079] The fourth group uses 3x3 dilated convolution to extract sparse background features;

[0080] After concatenating the four groups of features in the channel dimension, dimension reduction is performed, and residual connection is performed with the input features.

[0081] Further, the process of the hierarchical multi-scale feature extraction module includes a detail sub-module, and the implementation process includes:

[0082] The first branch extracts local contrast features through depth separable convolution;

[0083] The second branch extracts high-frequency features through 1x1 convolution combined with 3x3 convolution;

[0084] An adaptive channel attention weight is applied to the high-frequency features to generate;

[0085] The weighted high-frequency features are added to the local contrast features for residual connection.

[0086] Further, the process of the hierarchical multi-scale feature extraction module includes a linear sub-module, and the implementation process includes:

[0087] Multi-directional linear features are extracted through 1x5 horizontal convolution, 5x1 vertical convolution, and two groups of 3x3 dilated convolution;

[0088] The multi-directional features are concatenated in the channel dimension and integrated through 1x1 convolution;

[0089] Gradient features are simulated through 3x3 convolution of the edge enhancement branch;

[0090] The directional features, edge features, and input features are triple residual connected.

[0091] Further, the process of the hierarchical multi-scale feature extraction module includes a feature fusion sub-module, and the implementation process includes:

[0092] The output features of the enhanced attention sub-module, the multi-scale sub-module, the detail sub-module, and the linear sub-module are concatenated in the channel dimension;

[0093] A channel statistics vector is generated by global average pooling;

[0094] Four groups of weights are generated by applying a Softmax function after dimension reduction by two layers of 1x1 convolution;

[0095] The features of each sub-module are fused by weight, and the integrated features are output by 3x3 convolution.

[0096] Further, the implementation process of the dynamic Monte Carlo attention mechanism includes:

[0097] In the training phase, the pooling resolution is randomly selected, and the average pooling features and the maximum pooling features are fused;

[0098] In the test phase, multi-resolution weighted fusion is fixedly used;

[0099] The channel attention weights are dynamically generated based on the defect type;

[0100] The basic attention weights and the defect type attention weights are weighted and multiplied by the channel mixed features.

[0101] Specifically, the implementation process of the embodiment includes the following steps:

[0102] Step 1: The surface image of the inspected gear is collected by a high-definition imaging device, and an original gear image dataset [Gear1, Gear2, … Gearn] is constructed, wherein the image resolution is HxW, H is the image height, W is the image width, and n is the total number of images. The dataset is used as the input image basis in the model training and inference stage, covering multiple typical gear surface defect types, including scratches, black skin, wear, etc.

[0103] Step 2: A deep learning network model based on YOLOv11 architecture is constructed as shown in Figure 2 The convolution module, upsampling module, hierarchical multi-scale feature extraction module, and dynamic Monte Carlo attention mechanism are integrated to enhance the detection ability of gear defects in small targets and complex backgrounds.

[0104] Step 2.1: A hierarchical multi-scale feature extraction module is constructed as shown in Figure 3 , which replaces the structure of the C3k2 module in the YOLOv11 backbone network to enhance the cross-scale representation ability of the network. The module is composed of an enhanced attention module (EAM), a multi-scale module (MSM), a detail module (FDM), a linear module (LM), and a feature fusion module (FFM).

[0105] A gear surface image I gear with a size of HxWxC is taken as input. The input image first passes through the 1x1 convolution module and enters the enhanced attention module. The enhanced attention module is as shown in Figure 4is shown. Assume a given input X ∈ R H×W×C The processing is done by two parallel branches. The first one is the local representation branch, which captures local spatial relationships and micro-texture details with a 3x3 convolution followed by batch normalization (BN) and SiLU activation. The second branch is the global representation branch, which first compresses the spatial dimension by global average pooling, then models the inter-channel dependency with two 1x1 convolution layers (with SiLU activation in between), and finally expands back to the original spatial dimension. The mathematical expression is:

[0106] F loc = f SiLU (f BN (f c (X) 3×3 ));

[0107] F exp = e(f c (f SiLU (f c (f GAP (X)) 1×1 )) 1×1 );

[0108] In the above equation, f c (·) k×k represents a convolution layer with kernel size kxk, f BN (·) is the batch normalization operation, f SiLU (·) is the SiLU activation function, f GAP (·) represents the global average pooling, and e(·) represents the spatial dimension expansion operation (expanding the global features to the input spatial size). The local features F loc and the global features F exp are concatenated in the channel dimension, and then reduced to C channels by a 1x1 convolution to achieve adaptive fusion of local and global information. The fusion expression is:

[0109] F fus = f c (con(F loc ,F exp )) 1×1 ;

[0110] In the above equation, con(·) represents the channel concatenation function. The fused features F fus are applied to the channel attention mechanism: first, the channel statistics are obtained by global average pooling, then the channel weights are generated by an MLP (containing 1x1 convolution layers for reducing to C / 16 and increasing back to C, with SiLU activation in between), and finally the feature maps are normalized by Sigmoid and weighted. The fusion expression is:

[0111] F channel = Ffus σ(f c (f SiLU (f c (f GAP (F fus )) 1×1 )) 1×1 );

[0112] σ(·) represents the Sigmoid activation function, and is the element-wise multiplication. The channel-enhanced feature F channel A spatial weight map is generated using a 7x7 convolution, activated by Sigmoid, and weighted on the feature map to highlight the defect area. Then, Dropout (dropout rate 0.1) is applied to prevent overfitting, and then added to the input feature X through a residual connection to obtain the final output feature map:

[0113]

[0114] D(·) is the Dropout operation and uses a dropout rate of 0.1, represents a residual connection.

[0115] Step 2.2: Multi-scale module as shown in Figure 5 First, given the input feature Y EA ∈R H×W×C is processed through four independent convolution branches at the same time, and each branch is designed for a specific scale of defects. This process is represented as:

[0116] F sma = f c (Y EA ) 3×3 ;

[0117] F med = f c (Y EA ) 5×5 ;

[0118] F lar = f c (Y EA ) 7×7 ;

[0119] F dil = f c (Y EA ) 3×3,d=3 ;

[0120] In the above formula, d represents the dilation rate of the dilated convolution. The output feature maps of the four branches are concatenated in the channel dimension to form a high-dimensional feature, which is then reduced to the original channel number through a 1x1 convolution, and finally added to the input feature through a residual connection. This process is represented as:

[0121]

[0122] Step 2.3: Detail module as shown in Figure 6 First, given the input feature Y MS ∈R H×W×C is processed by two parallel branches. The process is represented as:

[0123] I loc = f c (f SiLU (f BN (f dw (Y MS ) 3×3 ))) 1×1 ;

[0124] I hig = f SiLU (f BN (f c (f SiLU (f BN (f c (Y MS ) 1×1 ))) 3×3 ));

[0125] In the above formula, f dw (·) 3×3 represents a depth separable convolution with a 3x3 convolution kernel. The original input Y MS is compressed by adaptive average pooling to compress spatial information, and the channel dependency relationship is modeled by an MLP structure (first 1x1 convolution dimension reduction to C / 16, then dimension increase back to C), and then the channel weight is generated by Sigmoid activation. The process is represented as:

[0126] A = σ(f c (f SiLU (f c (f APP (I hig )) 1×1 )) 1×1 );

[0127] In the above formula, f APP (·) represents adaptive average pooling. Finally, the local contrast feature I hig is multiplied by the channel attention weight A channel by channel, and then added to the input feature through a residual connection to preserve the original information flow. The process is represented as:

[0128]

[0129] Step 2.4: Linear module as shown in Figure 7 First, given the input feature Y MS ∈RH×W×C Each branch is designed for a specific linear defect by processing through four directional convolution branches:

[0130] F h = f c (Y MS ) 1×5 ;

[0131] F v = f c (Y MS ) 5×1 ;

[0132] F d1 = f c (Y MS ) 3×3,d=2 ;

[0133] F d2 = f c (Y MS ) 3×3,d=2 ;

[0134] The four directional feature maps are concatenated in the channel dimension, then the directional information is integrated through 1x1 convolution, and then batch normalization and SiLU activation function are used to further enhance the nonlinear expression ability. This process is represented as:

[0135] F dir = f SiLU (f BN (f c (con(F h ,F v ,F d1 ,F d2 )) 1×1 ));

[0136] Finally, the original input features are processed by the edge enhancement branch. This branch uses 3x3 convolution to simulate the effect of gradient operators such as Sobel operator, and enhances the nonlinear expression through batch normalization and SiLU activation. Finally, the three key features are connected by residual connection, and the final feature map is output. This process is represented as:

[0137]

[0138] Step 2.5: The feature fusion module as shown in Figure 8 concatenates the four input feature maps Y EA , Y MS , Y FD , Y L in the channel dimension, and then compresses the spatial information through global average pooling to generate a channel statistics vector:

[0139] F con4= f GAP EA MS FD L

[0140] Subsequently, a 1x1 convolution is used to reduce the dimension to C / 2, followed by a SiLU activation, and another 1x1 convolution is used to further reduce the dimension to 4 (corresponding to four input features), and a Softmax function is applied along the channel dimension to generate four normalized weights. This process is represented as:

[0141] W = f Softmax c SiLU c con4 1×1 1×1 );

[0142] In the above formula, f Softmax (·) represents a Softmax activation function. The weight vector W is split into four scalar weights and multiplied element-wise with the original feature map through the broadcast mechanism and then added, followed by a 3x3 convolution to adjust the channel number, and finally a batch normalization and a SiLU activation function are used to obtain the final output. This process is represented as:

[0143] Y = f SiLU BN c EA MS FD L 3×3 );

[0144] In the above formula, f

[0145] Step 3: Build a dynamic Monte Carlo attention mechanism as shown in Figure 9 , which is used to enhance the discrimination ability between the target and the background. It includes: a multi-scale mixed pooling strategy that combines the average pooling and maximum pooling results with a 0.6:0.4 weighting ratio to effectively perceive defects of different scales; a random resolution sampling mechanism that uses random resolution pooling in the training stage to improve the scale invariance and generalization ability of the model; a defect type guided channel attention that strengthens the discrimination representation of different defects through specific defect type channel weighting mechanism; a channel mixing module that uses 1x1 convolution and SiLU activation to enhance the nonlinear ability of feature expression, and finally element-level multiplication is used to fuse the attention weight and the input feature.

[0146] ​​​​​​​​​​​​​​​​​​The feature map Y processed by the layered multi-scale feature extraction module with size HxWxC is used as input, and during training, the pooling resolution Pool is randomly selected from 1, 2, 3, 5, and the feature map can be randomly shuffled into Y' if necessary, and the average pooling and maximum pooling results are fused (ratio 0.6:0.4). During testing, the resolution s i ∈1,2,3,5 is fixedly used i ∈0.3,0.3,0.4 is fused. The process is represented as:

[0147]

[0148] In the above formula, f G (·) represents adaptive average pooling, f M (·) represents maximum pooling. The pooled features are reduced to C / 4 by 1x1 convolution, and after SiLU activation, Dropout (0.1) is used to prevent overfitting, and then 3x3 convolution is used to capture spatial information, and after SiLU activation, 1x1 convolution is used to restore the channel dimension, and finally Sigmoid activation is used to generate the basic attention weight. The process is represented as:

[0149] A base =σ(f c (f SiLU (f c (D(f SiLU (f c (F attn ) 1×1 ))) 3×3 )) 1×1 );

[0150] According to the defect type, the attention is dynamically adjusted, and during training, the defect type is randomly selected, and during testing, the attention outputs of all defect types are fused. The process is represented as:

[0151]

[0152] In the above formula, n represents the number of defect types, and r(·) represents the random selection operation. Finally, the basic attention and defect attention are weighted and fused, and the original input Y is mixed with the fused attention after channel mixing. The process is represented as:

[0153] Out=f SiLU (f BN (f c (Y) 1×1 ))⊙(0.7⊙A base +0.3⊙A defect )。

[0154] Step 4: using the trained network to make predictions, input the collected gear surface image, and output the defect detection result (including defect location, category and confidence). First, the gear surface image I input ∈R H×W×C to be detected is input into the network, the image size is HxW, and after network inference, the detection result image I detect (containing the bounding box and defect category) is obtained. The network effectively extracts the micro-texture and macro-structure features of the gear surface through the hierarchical multi-scale feature extraction module and the dynamic Monte Carlo attention mechanism, improving the accuracy and industrial scene robustness of defect detection. At the same time, by adjusting the multi-scale fusion parameters and attention sampling strategy of the network, it can support the detection of small defects (pitting, cracks, etc.) of gears of different sizes (such as automobile gearboxes, aviation gearboxes).

[0155] The embodiment provides a hierarchical multi-scale feature analysis and dynamic attention enhancement system for gear surface defect detection, comprising:

[0156] A computer 101, a high-definition imaging device 102, a gear detection platform 103, and a gear to be detected 104;

[0157] The computer 101 is connected with the high-definition imaging device 102, and is also connected with the gear detection platform 103 to obtain an industrial gear dataset. The dataset image obtains detailed feature information of the gear surface defect through a network fused with the hierarchical multi-scale feature analysis and dynamic attention enhancement method.

[0158] The application discloses a hierarchical multi-scale feature analysis and dynamic attention enhancement method and system for gear surface defect detection. By introducing a multi-branch heterogeneous convolution structure, efficient fusion of fine-grained texture and macro-structure is effectively realized, thereby significantly improving the detection capability of small defects in complex backgrounds. The Monte Carlo dynamic attention mechanism is adopted to enhance the adaptability of the model to diversified defect types and dynamic backgrounds, thereby improving the robustness and accuracy of detection. In addition, the high-resolution multi-path detection architecture is combined to effectively improve the positioning accuracy of small targets. The application is very helpful for efficient detection and intelligent identification of gear surface defects, and provides strong technical support for improving the automatic quality control and maintenance level of industrial gears.

[0159] The above is only a preferred specific embodiment of the application, but the protection scope of the application is not limited thereto. Any changes or replacements within the technical range disclosed in the application can be easily thought of by those skilled in the art, and should be covered within the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.

Claims

1. A hierarchical multi-scale feature analysis and dynamic attention enhancement method for gear surface defect detection, characterized in that, include: Images of the gear surface are acquired using high-definition imaging equipment; The gear surface image is input into a deep learning network based on the YOLOv11 architecture, which integrates a hierarchical multi-scale feature extraction module and a dynamic Monte Carlo attention mechanism. The hierarchical multi-scale feature extraction module is used to extract cross-scale defect features; The dynamic Monte Carlo attention mechanism is used to generate adaptive attention weights; Location, type, and confidence level of surface defects in the output gear; The hierarchical multi-scale feature extraction module consists of an enhanced attention module, a multi-scale module, a detail module, a linear module, and a feature fusion module. Based on size Gear surface image As input, the input image first passes through... The convolutional module enters the enhanced attention module; assuming a given input... The process is handled through two parallel branches; the first is the local representation branch, which employs... Convolution captures local spatial relationships and micro-texture details, followed by batch normalization (BN) and SiLU activation; the second branch is a global representation branch, which first compresses the spatial dimension through global average pooling, and then through two... Convolutional layers model the dependencies between channels and finally expand back to the original spatial dimension; its mathematical expression is: ; ; In the above formula Indicates the kernel size as convolutional layers, It is a batch normalization operation. The SiLU activation function is used. Indicates global average pooling. This represents a spatial dimension expansion operation; it extends local features. and global features Concatenate along the channel dimension, then... Convolution dimensionality reduction to The channel enables adaptive fusion of local and global information; the fusion expression for this process is: ; In the above formula This represents the channel-dimensional concatenation function; for fused features The application uses a channel attention mechanism: first, channel statistics are obtained through global average pooling; then, channel weights are generated using an MLP; finally, the feature maps are normalized using Sigmoid and weighted. The fusion expression for this process is: ; In the above formula This represents the Sigmoid activation function. Element-wise multiplication; channel enhancement features use Convolution generates a spatial weight map, which is activated by Sigmoid and weighted to highlight defective regions; Then Dropout is applied to prevent overfitting, and residual connections are used to connect the input features. Add them together to get the final output feature map: ; In the above formula For Dropout operations with a drop rate of 0.1, Indicates residual connection; In the multi-scale module, firstly, given the input features... Simultaneously, the process is handled through four independent convolutional branches, each designed for defects at a specific scale; this process is represented as follows: ; ; ; ; In the above formula, This represents the dilation rate of the dilated convolution; the output feature maps of the four branches are concatenated along the channel dimension to form a high-dimensional feature, which is then processed... The convolution reduces the dimensionality to the original number of channels, and finally, it is added to the input features through residual connections; this process can be represented as: ; In the details module, firstly, given the input features... The process is handled through two parallel branches; this process can be represented as: ; ; In the above formula, Indicates that the convolution kernel is Depth-separable convolution; will process the original input The process involves compressing spatial information using adaptive average pooling, modeling channel dependencies using an MLP structure, and then generating channel weights using sigmoid activation. This process can be represented as follows: ; In the above formula, This represents adaptive average pooling; finally, local contrastive features are... With channel attention weights Channel-by-channel multiplication, followed by addition to the input features via residual concatenation, preserves the original information flow; this process can be represented as: ; In the linear module, firstly, given the input features... The process employs four directional convolutional branches, each designed for a specific linear defect: ; ; ; ; The four directional feature maps are concatenated along the channel dimension, and then... Convolution integrates directional information, and then batch normalization and SiLU activation function are used to further enhance nonlinear expressive power; this process is represented as: ; Finally, the original input features are processed by the edge enhancement branch; this branch uses... Convolution is used to simulate the effect of the gradient operator, and batch normalization and SiLU activation are used to enhance the nonlinear expression. Finally, the three key features are residually concatenated to output the final feature map. This process is represented as follows: ; In the feature fusion module, the four input feature maps are... The data is concatenated along the channel dimension, and then spatial information is compressed using global average pooling to generate a channel statistical vector. ; Then use Convolution is reduced to C / 2 dimensionality, then activated by SiLU, and then another... The convolution is further reduced to 4 dimensions, and the Softmax function is applied along the channel dimension to generate four normalized weights; this process is represented as: ; In the above formula This represents the Softmax activation function; the weight vector... The feature map is split into four scalar weights, which are then multiplied element-wise by the original feature map using a broadcast mechanism and summed. Then... The number of channels is adjusted through convolution, and finally batch normalization and the SiLU activation function are used to obtain the final output; this process is represented as follows: ; In the above formula ; The dynamic Monte Carlo attention mechanism is used to enhance the ability to distinguish between the target and the background; The dynamic Monte Carlo attention mechanism includes: a multi-scale hybrid pooling strategy, which combines the results of average pooling and max pooling with a weighted fusion ratio of 0.6:0.4 to effectively perceive defects at different scales; a random resolution sampling mechanism, which uses random resolution pooling during the training phase to improve the model's scale invariance and generalization ability; defect type-guided channel attention, which strengthens the distinguishable representation of different defects through a channel weighting mechanism for specific defect types; and a channel fusion module, which employs... Convolution and SiLU activation enhance the non-linearity of feature representation, and finally, attention weights and input features are fused through element-wise multiplication; The size is Feature map after being processed by the hierarchical multi-scale feature extraction module As input, the pooling resolution is randomly selected during training. The feature map is randomly shuffled. It combines the results of average pooling and max pooling; a fixed resolution is used during testing. And by weight Fusion; this process is represented as: ; In the above formula Indicates adaptive average pooling. This represents max pooling; the feature paths after pooling... The convolutional dimension is reduced to C / 4, SiLU activation is applied, and Dropout (0.1) is used to prevent overfitting. Then... Convolution captures spatial information; after SiLU activation, it is used... Convolution restores the channel dimension, and finally, Sigmoid activation is used to generate the basic attention weights; this process can be represented as: ; The attention is dynamically adjusted based on the defect type. During training, defect types are randomly selected, and during testing, the attention outputs from all defect types are fused. This process can be represented as follows: ; in ; In the above formula Indicates the number of defect types. This represents a random selection operation; finally, the basic attention and the defective attention are weighted and fused, and the original input Y is mixed through channels and then weighted with the fused attention; this process is represented as: 。 2. A hierarchical multi-scale feature analysis and dynamic attention enhancement system for gear surface defect detection, characterized in that, The system for implementing the hierarchical multi-scale feature analysis and dynamic attention enhancement method for gear surface defect detection as described in claim 1, the system comprising: Computer (101) for running the deep learning network; High-definition imaging device (102) for connecting to a computer and acquiring 2048×2448 resolution images; The gear inspection platform (103) is used to carry the gear under inspection (104) and communicate with the computer to output the location, type and confidence level of the surface defects of the gear.

Citation Information

Patent Citations

  • Aircraft skin defect multi-scale detection system and method based on improved YOLOv11

    CN120279030A

  • Small sample steel defect detection method based on attention feature pyramid mechanism

    WO2025010883A1