A gear defect detection method based on deep learning
By constructing a tooth surface unfolding coordinate system and an improved Grounding DINO model in gear inspection, the problems of reflection and texture interference in gear defect detection are solved, achieving cross-device consistency with high detection rate and quantification accuracy, and supporting online quality control in gear manufacturing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU MAI RUOLIN TECHNOLOGY CO LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-09
Smart Images

Figure CN122175905A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine vision and industrial intelligent inspection technology, and in particular to a gear defect detection method based on deep learning. Background Technology
[0002] With the increasing demands for transmission reliability in gearboxes, reducers, and high-end CNC equipment, online gear defect detection technology for production and service processes has received widespread attention. Existing gear defect detection methods largely rely on manual visual inspection of single tooth surface images, traditional threshold segmentation and edge operators, or the direct output of defect boxes and categories from the original image using general object detection networks. However, these methods commonly suffer from the following problems in practical applications: Strong reflections and periodic interference from machining textures on tooth surfaces can easily lead to the confusion of highlight stripes with real cracks and pitting in single-view or single-scale images, resulting in both false positives and false negatives. Misalignment of clamping at different workstations, asynchronous rotation, and lens distortion make it difficult to align defect locations in a unified coordinate system, leading to poor consistency between cross-tooth comparisons and cross-batch re-inspections. Microcracks and early pitting are small in scale and elongated in shape, causing general detection networks to be insufficient in recalling small targets during whole-image inference, resulting in unstable candidate regions and accumulated errors in subsequent segmentation and quantization. Existing methods often lack prior constraints related to critical areas such as the tooth root transition zone, making it difficult to effectively distinguish the spatial risks of defects. Furthermore, the lack of reliable calibration mapping and cross-device consistency correction in pixel quantization results in incomparability of millimeter-level measurements under different cameras or workstations, affecting the stability of severity assessment and treatment decisions.
[0003] Therefore, how to provide a deep learning-based gear defect detection method is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] One objective of this invention is to propose a gear defect detection method based on deep learning. This invention utilizes gear geometric parameters and station calibration parameters to correct distortion, normalize posture, and expand mapping of tooth surface images. It constructs a normal texture base based on the tooth pitch periodic structure to achieve residual enhancement, builds a tooth surface feature generation network, and combines an improved GroundingDINO to locate defect regions for further fine segmentation. It outputs quantization and severity suggestions and maps them to millimeters or square millimeters with cross-device correction, which has the advantages of high detection rate and strong measurement consistency.
[0005] A gear defect detection method based on deep learning according to an embodiment of the present invention includes the following steps: Step 1: Obtain the gear geometric parameters and station calibration parameters, perform distortion correction and attitude normalization on the acquired gear tooth surface image, and map the tooth surface to the tooth surface unfolding coordinate system to obtain the tooth surface unfolding diagram; Step 2: Construct a normal texture base using the periodic structure of the gear repeating according to the tooth pitch, and perform residualization and local contrast normalization on the tooth surface unfolded image to obtain an enhanced tooth surface representation; Step 3: Construct a tooth surface feature generation network, which includes a lightweight backbone network, a feature pyramid fusion module, a region prediction head and a direction prediction head, and outputs a multi-scale feature pyramid, a tooth surface region map and a tooth surface direction field. Step 4: Call the improved Grounding DINO model, which includes a defect prompt word constructor, an adaptive block cutting and candidate fusion module, and a cross-modal decoding gating module based on the tooth surface orientation field. It outputs candidate defect regions based on a multi-scale feature pyramid, a tooth surface region map, and a tooth surface orientation field. Step 5: Perform fine segmentation of the candidate defect area to obtain a defect mask. For crack-type defects, perform centerline refinement based on the defect mask to obtain a crack centerline map. Perform connectivity repair based on the crack centerline map. For pitting and peeling defects, perform connected domain merging and boundary smoothing based on the defect mask. Step 6: Generate defect quantification results based on the defect mask and crack centerline map, and output the severity level and treatment recommendations; Step 7: Map the defect quantification results from pixel units to millimeter and square millimeter measurement results through station calibration parameters, and perform cross-device consistency correction.
[0006] Optionally, step one specifically includes: Obtain the gear geometry parameters, including module, number of teeth, pressure angle, helix angle, and tooth width; Obtain the station calibration parameters, which include a ratio parameter for converting pixels to actual size, a camera distortion parameter for distortion correction, and a station reference pose parameter for coordinate alignment. Gear tooth surface images are acquired under the detection conditions of gear rotation or equal angle indexing, and distortion correction is performed on the acquired gear tooth surface images. The distortion correction includes radial distortion and tangential distortion compensation of the image based on the camera distortion parameters. The image after distortion correction is normalized in posture. The posture normalization includes positioning the gear center to a unified reference position based on the workstation reference posture parameters, aligning the gear rotation angle to a unified reference direction, and compensating for the translational deviation caused by gear eccentricity. After attitude normalization, the root boundary, tip boundary, and width boundary of the effective area of the tooth surface are determined based on the gear geometry parameters. The effective area of the tooth surface is then mapped to the tooth surface development coordinate system to generate a tooth surface development diagram. For each tooth surface development diagram, the tooth number index is associated with the corresponding tooth profile position index and tooth width position index.
[0007] Optionally, step two specifically includes: The tooth surface unfolding diagrams of a lap acquisition sequence are grouped according to the number of gear teeth, and the tooth surface unfolding diagrams corresponding to the same tooth number are aligned to the same tooth profile position index and tooth width position index according to the tooth number index. For each tooth number, the tooth surface unfolded image is statistically analyzed at the same index position, and a normal texture base is generated by median aggregation. For each tooth surface unfolded image, perform a pixel-by-pixel difference operation between it and the normal texture base at the corresponding index position to obtain the residual image; The residual image is subjected to local contrast normalization processing, which includes selecting a neighborhood window for each pixel in the tooth surface unfolding coordinate system, calculating the mean gray level and gray level dispersion within the neighborhood window, and standardizing the residual value of the pixel according to the mean gray level and gray level dispersion. The residual map after local contrast normalization is output as the enhanced tooth surface representation, and the corresponding tooth number index, tooth profile position index and tooth width position index are retained for the enhanced tooth surface representation.
[0008] Optionally, step three specifically includes: The enhanced tooth surface representation is input into the tooth surface feature generation network. The lightweight backbone network of the tooth surface feature generation network consists of a series of interconnected multi-level convolutional downsampling units. Each level of convolutional downsampling unit performs convolution operation, normalization operation and modified linear unit function activation operation in sequence. Multi-layer features with different spatial resolutions are obtained by downsampling between two adjacent convolutional layers, and the multi-layer features are input into the feature pyramid fusion module. The feature pyramid fusion module adopts a top-down stepwise bilinear interpolation upsampling and lateral connection fusion method to perform channel splicing and convolution fusion of high-level semantic features and low-level detail features at corresponding resolutions, and outputs a multi-scale feature pyramid. The multi-scale feature pyramid includes a high-resolution feature layer, a medium-resolution feature layer, and a low-resolution feature layer. The high-resolution feature layer is input into the region prediction head, which includes a convolutional layer and an upsampling layer. The output is a tooth surface region map of the same size as the enhanced tooth surface representation. The tooth surface region map includes three types of region identifiers: the tooth root transition area, the main working surface, and the tooth tip area. A high-resolution feature layer is input into a direction prediction head, which includes convolutional layers and outputs a tooth surface direction field of the same size as the enhanced tooth surface representation.
[0009] Optionally, the defect prompt word constructor reads the tooth surface region map, generates a defect prompt word sequence and a negative prompt word sequence containing region identifiers, and inputs them into the text encoding branch to obtain defect text features and negative text features; The adaptive slicing and candidate fusion module generates slicing blocks from the tooth surface unfolded map based on the tooth surface region map. High-resolution slicing blocks are generated in the tooth root transition area and the main working surface, and low-resolution slicing blocks are generated in the tooth tip area. The regions of each slicing block in the tooth surface unfolded coordinate system are mapped to a multi-scale feature pyramid to obtain slicing block features. The slicing block features and defect text features are input into the detection branch to obtain slicing block candidate defect regions. The detection branch includes a feature enhancement layer and a decoding layer, and outputs bounding box parameters, category query vectors and category scores. The coordinates of the slicing block candidate defect regions are restored to the tooth surface unfolded coordinate system, and candidate fusion is performed using the intersection-union ratio (IUU) deduplication method. For candidate defect regions with an IUU greater than a preset threshold, only candidate defect regions with a category score higher than a preset retention threshold are retained to obtain fused candidate defect regions. The cross-modal decoding gating module operates on the cross-modal decoding structure in the decoding layer. It uses the defect text features as the query input and the segmentation features as the key input to calculate the cross-attention response. It samples each fused candidate defect region on the tooth surface orientation field to obtain a sequence of orientation vectors, calculates the candidate principal orientation vector, and calculates the cosine value of the angle between the candidate principal orientation vector and the corresponding principal orientation vector of the cross-attention response. The cosine value of the angle is mapped to the gating weight through the Sigmoid function, and the cross-attention response is weighted by element-wise multiplication using the gating weight. Based on the weighted cross-attention response, defect text features, and negative text features, the defect category is determined for the fused candidate defect region and the defect category is output.
[0010] Optionally, step five specifically includes: Using the candidate defect region as the detection region, a detection sub-image is obtained by cropping in the tooth surface unfolding coordinate system. The detection sub-image is then input into the defect fine segmentation network to obtain the defect mask. The defect fine segmentation network is an encoder-decoder structure. The encoder is composed of a convolutional layer, a batch normalization layer and a modified linear unit function connected in sequence and uses downsampling with a stride of two. The decoder uses bilinear interpolation upsampling and performs skip connections and fusion with the corresponding encoded features. When the defect category is crack, the Zhang-Suen thinning algorithm is used to generate a crack centerline map based on the defect mask, and the fracture endpoints with an endpoint spacing less than a preset distance threshold are connected by the eight-neighbor shortest path in the crack centerline map to complete the connectivity repair. When the defect type is pitting or peeling, the eight-neighbor connected component labeling is performed based on the defect mask, and connected components with a minimum boundary distance less than a preset distance threshold are merged. The morphological closing operation of the circular structuring element is used to smooth the boundary of the merged defect mask.
[0011] Optionally, step six specifically includes: Defect quantification results are generated based on defect mask and crack centerline map. When the defect type is crack, the number of foreground pixels in the crack centerline map is counted in the tooth surface unfolding coordinate system and converted into crack length. The crack direction is determined based on the coordinate increment of adjacent centerline pixels in the crack centerline map. When the defect type is pitting, the ratio of the foreground pixels of the defect mask to the total number of pixels in the detection area is calculated in the tooth surface unfolding coordinate system to obtain the pitting coverage rate. The connected region area of the defect mask is calculated and the equivalent diameter of the connected region is converted based on the connected region area. When the defect category is spalling, the number of foreground pixels of the defect mask is counted in the tooth surface unfolding coordinate system and converted into spalling area. The boundary perimeter and boundary curvature change are calculated based on the boundary pixel set of the defect mask as boundary features. The location of the tooth root transition zone boundary is determined based on the tooth surface region map, the distance from the defect to the tooth root transition zone is calculated, and the expansion ratio along the tooth profile direction is calculated in the tooth surface unfolding coordinate system. Input the defect quantification results into the preset severity judgment rule set to output the severity level and handling suggestions.
[0012] Optionally, step seven specifically includes: Obtain the pixel-to-actual-size conversion ratio parameter in the workstation calibration parameters. The conversion ratio parameter includes the pixel length conversion coefficient along the tooth profile direction and the pixel length conversion coefficient along the tooth width direction. The pixel values of crack length, distance from defect to tooth root transition zone, and boundary perimeter in the defect quantification results are multiplied by the pixel length conversion factor along the tooth profile direction or the pixel length conversion factor along the tooth width direction to obtain the corresponding millimeter measurement results. The pixel value of pitting equivalent diameter in the defect quantification results is averaged according to the pixel length conversion factor along the tooth profile direction and the pixel length conversion factor along the tooth width direction and converted into millimeter measurement results. The pixel value of the peeling area in the defect quantification result is multiplied by the product of the pixel length conversion factor along the tooth profile direction and the pixel length conversion factor along the tooth width direction to obtain the square millimeter measurement result. Cross-device consistency correction is performed on the millimeter and square millimeter measurement results obtained from different inspection stations or different cameras. The cross-device consistency correction includes acquiring calibration images of the same standard gauge block or standard gear at each inspection station and calculating the corresponding conversion ratio parameters. After mapping the conversion ratio parameters of different inspection stations to the conversion ratio parameters under a unified reference station, the millimeter and square millimeter measurement results are recalculated to obtain cross-device consistent measurement results.
[0013] The beneficial effects of this invention are: This invention constructs a tooth surface unfolding coordinate system under station calibration constraints, achieving unified alignment of images with different rotation angles and tooth positions. Combined with normal texture base construction based on tooth pitch periodic structure and residual processing, as well as local contrast normalization, it effectively reduces the interference of machining textures and stable highlight stripes on defect saliency, improving detection reliability under complex lighting conditions. Furthermore, it constructs a tooth surface feature generation network including a lightweight backbone network, a feature pyramid fusion module, a region prediction head, and a direction prediction head, outputting a multi-scale feature pyramid, tooth surface region map, and tooth surface orientation field. This ensures that small-scale defects such as microcracks and early pitting remain distinguishable in multi-scale features and provides region and orientation priors for subsequent detection. In the candidate generation stage, an improved Grounding module is introduced, including a defect cue word constructor, adaptive slicing and candidate fusion module, and a cross-modal decoding gating module. The DINO model improves small defect recall through region-guided prompts and a segmentation strategy, and suppresses reflection artifacts and stabilizes candidate localization through directional field gating. During the fine segmentation stage, it outputs a defect mask and generates crack centerline maps and connectivity repair for crack-type defects, making quantitative indicators such as crack length and orientation more stable. Finally, the defect quantification results are mapped to millimeters and square millimeters using station calibration parameters and cross-equipment consistency correction is performed to ensure comparability of measurements across multiple stations and cameras, thereby supporting the stable output of severity levels and treatment recommendations. This invention significantly improves the anti-reflection and anti-texture interference capabilities, cross-station consistency, small defect detection rate, and quantification accuracy of gear defect detection, and has important engineering significance for achieving online closed-loop control of gear manufacturing quality and ensuring equipment reliability. Attached Figure Description
[0014] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a gear defect detection method based on deep learning proposed in this invention; Figure 2 This is a schematic diagram of a gear defect detection method based on deep learning proposed in this invention; Figure 3 This is a framework diagram of the improved GroundingDINO model in the deep learning-based gear defect detection method proposed in this invention. Detailed Implementation
[0015] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0016] refer to Figures 1-3A deep learning-based method for gear defect detection includes the following steps: Step 1: Obtain the gear geometric parameters and station calibration parameters, perform distortion correction and attitude normalization on the acquired gear tooth surface image, and map the tooth surface to the tooth surface unfolding coordinate system to obtain the tooth surface unfolding diagram; Step 2: Construct a normal texture base using the periodic structure of the gear repeating according to the tooth pitch, and perform residualization and local contrast normalization on the tooth surface unfolded image to obtain an enhanced tooth surface representation; Step 3: Construct a tooth surface feature generation network, which includes a lightweight backbone network, a feature pyramid fusion module, a region prediction head and a direction prediction head, and outputs a multi-scale feature pyramid, a tooth surface region map and a tooth surface direction field. Step 4: Call the improved Grounding DINO model. The improved Grounding DINO model includes a defect prompt word constructor, an adaptive block cutting and candidate fusion module, and a cross-modal decoding gating module based on the tooth surface orientation field. It outputs candidate defect regions based on multi-scale feature pyramids, tooth surface region maps, and tooth surface orientation fields. Step 5: Perform fine segmentation of the candidate defect area to obtain a defect mask. For crack-type defects, perform centerline refinement based on the defect mask to obtain a crack centerline map. Perform connectivity repair based on the crack centerline map. For pitting and peeling defects, perform connected domain merging and boundary smoothing based on the defect mask. Step 6: Generate defect quantification results based on the defect mask and crack centerline map, and output the severity level and treatment recommendations; Step 7: Map the defect quantification results from pixel units to millimeter and square millimeter measurement results through station calibration parameters, and perform cross-device consistency correction.
[0017] In this embodiment, step one specifically includes: Obtain the gear geometry parameters, including module, number of teeth, pressure angle, helix angle, and tooth width; Obtain the station calibration parameters, which include the ratio parameters for converting pixels to actual size, the camera distortion parameters for distortion correction, and the station reference pose parameters for coordinate alignment. Gear tooth surface images are acquired under the detection conditions of gear rotation or equal angle indexing, and distortion correction is performed on the acquired gear tooth surface images. Distortion correction includes radial distortion and tangential distortion compensation of the image based on camera distortion parameters. The image after distortion correction is normalized in posture. The posture normalization includes positioning the gear center to a unified reference position based on the workstation reference pose parameters, aligning the gear rotation angle to a unified reference direction, and compensating for the translation deviation caused by gear eccentricity. After attitude normalization, the root boundary, tip boundary, and width boundary of the effective area of the tooth surface are determined based on the gear geometry parameters. The effective area of the tooth surface is then mapped to the tooth surface development coordinate system. The tooth surface development coordinate system uses the tooth profile direction as the first coordinate axis and the tooth width direction as the second coordinate axis to generate a tooth surface development diagram and associate each tooth surface development diagram with the tooth number index and the corresponding tooth profile position index and tooth width position index.
[0018] In this embodiment, step two specifically includes: The tooth surface unfolding diagrams of a lap acquisition sequence are grouped according to the number of gear teeth, and the tooth surface unfolding diagrams corresponding to the same tooth number are aligned to the same tooth profile position index and tooth width position index according to the tooth number index. For each tooth number, the tooth surface unfolded image is statistically analyzed at the same index position, and a normal texture base is generated by median aggregation. The normal texture base is a base image that is consistent with the tooth surface unfolded coordinate system. For each tooth surface unfolded image, perform a pixel-by-pixel difference operation between it and the normal texture base at the corresponding index position to obtain the residual image; Local contrast normalization is performed on the residual image. The local contrast normalization process includes selecting a neighborhood window for each pixel in the tooth surface unfolding coordinate system, calculating the mean gray value and gray dispersion within the neighborhood window, and standardizing the residual value of the pixel according to the mean gray value and gray dispersion. The residual map after local contrast normalization is output as the enhanced tooth surface representation, and the corresponding tooth number index, tooth profile position index and tooth width position index are retained for the enhanced tooth surface representation.
[0019] In this embodiment, step three specifically includes: The enhanced tooth surface representation is input into the tooth surface feature generation network. The lightweight backbone network of the tooth surface feature generation network consists of multiple levels of convolutional downsampling units connected in sequence. Each level of convolutional downsampling unit performs convolution operation, normalization operation and modified linear unit function activation operation in sequence. A downsampling method with a stride of two is used between adjacent convolutional downsampling units to obtain multi-layer features with different spatial resolutions. The multi-layer features are then input into the feature pyramid fusion module. The feature pyramid fusion module uses a top-down, stepwise bilinear interpolation upsampling and lateral connection fusion method to concatenate high-level semantic features and low-level detail features at the corresponding resolutions and then perform convolutional fusion to output a multi-scale feature pyramid. The multi-scale feature pyramid includes a high-resolution feature layer, a medium-resolution feature layer, and a low-resolution feature layer. The spatial resolution of the high-resolution feature layer is half that of the enhanced tooth surface representation, the spatial resolution of the medium-resolution feature layer is one-quarter that of the enhanced tooth surface representation, and the spatial resolution of the low-resolution feature layer is one-eighth that of the enhanced tooth surface representation. The high-resolution feature layer is input into the region prediction head, which includes a convolutional layer and an upsampling layer. The output is a tooth surface region map of the same size as the enhanced tooth surface representation. The tooth surface region map includes three types of region labels: tooth root transition area, main working surface, and tooth tip area. The tooth root transition area is obtained by extending the tooth root boundary determined in step one along the tooth profile position index towards the tooth tip. The tooth tip area is obtained by extending the tooth tip boundary determined in step one along the tooth profile position index towards the tooth root. The main working surface is the remaining area outside the tooth root transition area and tooth tip area. The high-resolution feature layer is input into the orientation prediction head, which includes a convolutional layer and outputs a tooth surface orientation field of the same size as the enhanced tooth surface representation. The tooth surface orientation field provides orientation components along the tooth profile direction and along the tooth width direction in pixels, and the orientation components are normalized to obtain a unit orientation vector.
[0020] In this embodiment, the defect prompt word constructor reads the tooth surface region map, generates a defect prompt word sequence and a negative prompt word sequence containing region identifiers, and inputs them into the text encoding branch to obtain defect text features and negative text features. The text encoding branch includes a word vector embedding layer and a Transformer encoding layer. The word vector embedding layer maps the prompt words into a fixed-length vector sequence. The Transformer encoding layer is formed by stacking a multi-head self-attention layer and a feedforward network layer and outputs defect text features and negative text features. The adaptive slicing and candidate fusion module generates slicing blocks from the tooth surface unfolded map based on the tooth surface region map. High-resolution slicing blocks are generated in the tooth root transition area and the main working surface, while low-resolution slicing blocks are generated in the tooth tip region. The regions of each slicing block in the tooth surface unfolded coordinate system are mapped to a multi-scale feature pyramid to obtain slicing block features. The slicing block features and defect text features are input into the detection branch to obtain slicing block candidate defect regions. The detection branch includes a feature enhancement layer and a decoding layer. The feature enhancement layer performs convolution and normalization operations on the slicing block features. The decoding layer is a detection layer based on the Transformer decoding structure and outputs bounding box parameters, category query vectors, and category scores. The category query vector is a fixed-length vector representing the semantics of a single candidate defect region. The coordinates of the slicing block candidate defect regions are restored to the tooth surface unfolded coordinate system, and candidate fusion is performed using the intersection-union ratio (IUGR) deduplication method. The IUGR is the ratio of the intersection area to the union area of the bounding boxes of two candidate defect regions. For candidate defect regions with an IUGR greater than a preset threshold, only candidate defect regions with a category score higher than a preset retention threshold are retained to obtain fused candidate defect regions. The cross-modal decoding gating module operates on the cross-modal decoding structure in the decoding layer. The cross-modal decoding structure calculates the cross-attention response in Transformer decoding by using defect text features as query input and segmentation features as key input. It samples each fused candidate defect region on the tooth surface orientation field to obtain a sequence of orientation vectors, calculates the candidate principal orientation vector, and calculates the cosine value of the angle between the candidate principal orientation vector and the corresponding principal orientation vector of the cross-attention response. The cosine value of the angle is mapped to the gating weight through the Sigmoid function, and the cross-attention response is weighted by element-wise multiplication using the gating weight. Based on the weighted cross-attention response, defect text features, and negative text features, defect category determination is performed on the fused candidate defect region and the defect category is output. The defect category determination includes calculating the similarity score between the category query vector and the defect text features, as well as the similarity score between the category query vector and the negative text features. The difference between the two is used to obtain the final category score, and the defect category with the largest final category score is selected as the defect category corresponding to the fused candidate defect region. The improved Grounding DINO model is similar to the original Grounding DINO model in that it adopts a joint detection framework of text encoding branch and image feature branch, realizes cross-modal interaction through Transformer encoding and decoding structure, and outputs the bounding box parameters and defect category scores of candidate defect regions by the detection branch. The difference lies in that this invention introduces three structured improvements for gear scenarios without changing its basic framework: first, a defect prompt word constructor, which uses the tooth surface region map to generate a sequence of defect prompt words containing region identifiers and a sequence of negative prompt words; second, an adaptive slicing and candidate fusion module, which divides the tooth surface unfolded map into high- and low-resolution slices based on the tooth surface region map and fuses them for deduplication within the tooth surface unfolded coordinate system; and third, a cross-modal decoding gating module, which uses the tooth surface orientation field to perform gating weighting on the cross-attention response. Improvements were made to make the Grounding DINO model more stable in generating candidate regions against strong reflective and periodic texture backgrounds: regionalization and negative cues reduced the probability of triggering artifacts such as highlight stripes and oil films; partitioning and slicing improved the detection rate of small defects such as microcracks and early pitting in high-risk areas and reduced missed detections; orientation field gating suppressed spurious responses that were inconsistent with the tooth profile or texture orientation, thus improving the consistency of candidate box localization and the reliability of category determination.
[0021] In this embodiment, step five specifically includes: Using the candidate defect region as the detection region, a detection sub-image is obtained by cropping in the tooth surface unfolding coordinate system. The detection sub-image is then input into the defect fine segmentation network to obtain the defect mask. The defect fine segmentation network is an encoder-decoder structure. The encoder is composed of a convolutional layer, a batch normalization layer and a modified linear unit function connected in sequence, and uses downsampling with a stride of two. The decoder uses bilinear interpolation upsampling and performs skip connections to fuse with the corresponding encoded features. The defect mask is output by a mask output head composed of a 1x1 convolutional layer and a sigmoid function. When the defect type is crack, the Zhang-Suen thinning algorithm is used to generate a crack centerline map based on the defect mask. In the crack centerline map, the fracture endpoints with an endpoint spacing less than a preset distance threshold are connected by the eight-neighbor shortest path to complete the connectivity repair. When the defect type is pitting or peeling, the eight-neighbor connected component labeling is performed based on the defect mask, and connected components with a minimum boundary distance less than a preset distance threshold are merged. The morphological closing operation of the circular structuring element is used to smooth the boundary of the merged defect mask.
[0022] In this embodiment, step six specifically includes: Defect quantification results are generated based on defect mask and crack centerline map. When the defect type is crack, the number of foreground pixels in the crack centerline map is counted in the tooth surface unfolding coordinate system and converted into crack length. The crack direction is determined based on the coordinate increment of adjacent centerline pixels in the crack centerline map. When the defect type is pitting, the ratio of the foreground pixels of the defect mask to the total number of pixels in the detection area is calculated in the tooth surface unfolding coordinate system to obtain the pitting coverage rate. The connected region area of the defect mask is calculated and the equivalent diameter of the connected region is converted based on the connected region area. When the defect category is spalling, the number of foreground pixels of the defect mask is counted in the tooth surface unfolding coordinate system and converted into spalling area. The boundary perimeter and boundary curvature change are calculated based on the boundary pixel set of the defect mask as boundary features. The location of the tooth root transition zone boundary is determined based on the tooth surface region map, and the minimum Euclidean distance from the defect pixel closest to the tooth root transition zone boundary in the defect mask to the tooth root transition zone boundary is calculated as the distance from the defect to the tooth root transition zone. In the tooth surface unfolding coordinate system, the ratio of the projection length of the defect mask along the tooth profile direction to the length of the detection sub-image along the tooth profile direction is calculated as the expansion ratio along the tooth profile direction. The defect quantification result is input into a preset severity determination rule set, which outputs the severity level and handling recommendations. The severity determination rule set is a pre-stored rule table. The rule table takes at least one parameter from the defect category and the defect quantification result as input conditions, and outputs the severity level and handling recommendations.
[0023] In this embodiment, step seven specifically includes: Obtain the pixel-to-actual-size conversion ratio parameter in the workstation calibration parameters. The conversion ratio parameter includes the pixel length conversion coefficient along the tooth profile direction and the pixel length conversion coefficient along the tooth width direction. The pixel values of crack length, distance from defect to tooth root transition zone, and boundary perimeter in the defect quantification results are multiplied by the pixel length conversion factor along the tooth profile direction or the pixel length conversion factor along the tooth width direction to obtain the corresponding millimeter measurement results. The pixel value of pitting equivalent diameter in the defect quantification results is averaged according to the pixel length conversion factor along the tooth profile direction and the pixel length conversion factor along the tooth width direction and converted into millimeter measurement results. The pixel value of the peeling area in the defect quantification result is multiplied by the product of the pixel length conversion factor along the tooth profile direction and the pixel length conversion factor along the tooth width direction to obtain the square millimeter measurement result. Cross-device consistency correction is performed on the millimeter and square millimeter measurement results obtained from different inspection stations or different cameras. Cross-device consistency correction includes acquiring calibration images of the same standard gauge block or standard gear at each inspection station and calculating the corresponding conversion ratio parameters. After mapping the conversion ratio parameters of different inspection stations to the conversion ratio parameters under a unified reference station, the millimeter and square millimeter measurement results are recalculated to obtain consistent measurement results across devices.
[0024] Example 1: To verify the feasibility of this invention in practice, it was applied to the online final inspection station after gear grinding in an automotive transmission. This station is located before cleaning and rust prevention; the grinding texture on the tooth surface is obvious, and residual oil easily forms streaks of high gloss. The production line cycle time requires a single-piece inspection time of no more than 0.35 seconds, and millimeter-level measurements such as crack length and peeling area are required for rework and scrap determination. Two 24-megapixel industrial cameras and a ring-shaped coaxial composite light source were used on-site. The camera working distance was approximately 320mm, the light source power was 70%, the exposure was 1.2ms, and the gain was 6dB. The indexing plate collected data at 24rpm with equal angles, covering a circle of the tooth surface. Station calibration used a combination of standard gears and gauge blocks to obtain conversion coefficients of 0.018mm / pixel along the tooth profile direction and 0.020mm / pixel along the tooth width direction. The station's reference pose was recorded for attitude normalization. To verify cross-equipment consistency, the same model of camera and light source were simultaneously configured in adjacent stations, and the same standard gear was used to complete the conversion coefficient mapping.
[0025] In this workstation, the system performs distortion correction and pose normalization on the acquired images and maps them to the tooth surface unfolding coordinate system to form a tooth surface unfolded map. A ring of unfolded maps is aligned according to tooth number and aggregated using the median to generate a normal texture base. The residual map is obtained by differencing each unfolded map, and then local contrast normalization is performed using a 21×21 neighborhood to obtain an enhanced tooth surface representation. The tooth surface feature generation network outputs a multi-scale feature pyramid, a tooth surface region map, and a tooth surface orientation field. The root transition area and the main working surface are marked as high-interest regions for subsequent slicing strategies. The orientation field is used to suppress strip pseudo-responses inconsistent with the tooth profile orientation. Candidate defect regions are generated by an improved Grounding DINO model, with an intersection-over-union deduplication threshold of 0.55 and a class score retention threshold of 0.30. The root transition area and the main working surface are sliced into 512×512 blocks with a stride of 384, while the tooth tip region is sliced into 384×384 blocks with a stride of 288. Negative cue words are used to reduce false triggering of oil film and highlights. The defect fine segmentation network outputs a defect mask; the crack centerline map is obtained using the Zhang-Suen refinement algorithm, and the fracture is repaired by connecting the eight-neighbor shortest paths; pitting and spalling are merged into connected domains and the boundaries are smoothed using circular structuring element closing operations. The quantization stage outputs crack length and orientation, pitting coverage and equivalent diameter, spalling area and boundary perimeter, distance from the defect to the tooth root transition zone and the propagation ratio along the tooth profile, and maps them to millimeters and square millimeters according to calibration coefficients; cross-equipment consistency correction is performed by comparing measurements taken at two stations using standard gears, and the conversion coefficients are mapped to a unified reference station before recalculating the measured values.
[0026] To compare and verify the results, a test set of 640 pieces was selected from production line data over three consecutive days, including 192 defective pieces (78 cracks, 69 pitting, and 45 spalling) and 448 normal pieces. The comparison schemes included Scheme 1 (traditional threshold segmentation + edge rules), Scheme 2 (general YOLO detection + segmentation network), and Scheme 3 (original Grounding DINO + segmentation network). This invention and the three comparison schemes were tested on the same hardware platform. Overall recall, overall precision, segmentation crossover ratio, quantization error of crack length and spalling area, false positive rate, single-piece processing time, and cross-device deviation were statistically analyzed and summarized in Table 1 below: Table 1. Comparison of the overall performance of different gear defect detection methods on the production line test set.
[0027] From the perspective of overall recall, traditional methods show significant missed detections under the interference of texture and specular highlights, especially early pitting and fine cracks, which are easily suppressed by thresholds and edge responses. The general YOLO method improves recall, but candidate boxes are prone to shifting in highly reflective strip areas, resulting in incomplete coverage of small defect edges and defect truncation during segmentation. The original GroundingDINO method has stronger semantic detection capabilities due to text guidance, further improving recall, but there are still some false positives in grinding texture intersections and oil film reflective areas. False positives are mostly concentrated near the tooth root transition area, which easily triggers unnecessary re-examinations. The method of this invention improves the overall recall to 93.8% while reducing the false positive rate to 2.6%. This is because the tooth surface region map-guided segmentation strategy allows high-risk areas to enter the detection branch at a higher resolution, resulting in more complete small defect candidates; the tooth surface orientation field gating suppresses the cross-attention response triggered by strip specular highlights and regular textures, making the candidate defect region location more stable and reducing the propagation of false positives to segmentation and quantization.
[0028] From the perspective of segmentation and quantification, the segmentation crossover ratio of this invention reaches 82.7%, and the average absolute errors of crack length and spalling area are reduced to 0.15mm and 0.72mm², respectively, further lower than the original Grounding DINO baseline. Refinement and connectivity repair of the crack centerline diagram reduce the underestimation of length caused by end fractures, making severity determination more stable; merging of connected domains and smoothing of the closing operation reduce area fluctuations caused by the jagged spalling contour, making measurements of the same defect more consistent under different batches of illumination. Cross-device measurement deviation is reduced to 1.1%, significantly lower than the 3.0% or more of the comparative scheme, allowing the same severity determination rule table to be directly applied to outputs from different workstations, reducing disputes arising from manual review. The single-piece processing time of 268ms meets the 0.35-second cycle time requirement, and no significant fluctuations due to illumination drift occurred during three days of continuous operation. It can stably output severity levels and handling suggestions, supporting online quality closed-loop and rework decisions, reducing the risk of early failure caused by missed detections and reducing additional rework costs caused by false detections.
[0029] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A gear defect detection method based on deep learning, characterized in that, Includes the following steps: Step 1: Obtain the gear geometric parameters and station calibration parameters, perform distortion correction and attitude normalization on the acquired gear tooth surface image, and map the tooth surface to the tooth surface unfolding coordinate system to obtain the tooth surface unfolding diagram; Step 2: Construct a normal texture base using the periodic structure of the gear repeating according to the tooth pitch, and perform residualization and local contrast normalization on the tooth surface unfolded image to obtain an enhanced tooth surface representation; Step 3: Construct a tooth surface feature generation network, which includes a lightweight backbone network, a feature pyramid fusion module, a region prediction head and a direction prediction head, and outputs a multi-scale feature pyramid, a tooth surface region map and a tooth surface direction field. Step 4: Call the improved Grounding DINO model, which includes a defect prompt word constructor, an adaptive block cutting and candidate fusion module, and a cross-modal decoding gating module based on the tooth surface orientation field. It outputs candidate defect regions based on a multi-scale feature pyramid, a tooth surface region map, and a tooth surface orientation field. Step 5: Perform fine segmentation of the candidate defect area to obtain a defect mask. For crack-type defects, perform centerline refinement based on the defect mask to obtain a crack centerline map. Perform connectivity repair based on the crack centerline map. For pitting and peeling defects, perform connected domain merging and boundary smoothing based on the defect mask. Step 6: Generate defect quantification results based on the defect mask and crack centerline map, and output the severity level and treatment recommendations; Step 7: Map the defect quantification results from pixel units to millimeter and square millimeter measurement results through station calibration parameters, and perform cross-device consistency correction.
2. The gear defect detection method based on deep learning according to claim 1, characterized in that, Step one specifically includes: Obtain the gear geometry parameters, including module, number of teeth, pressure angle, helix angle, and tooth width; Obtain the station calibration parameters, which include a ratio parameter for converting pixels to actual size, a camera distortion parameter for distortion correction, and a station reference pose parameter for coordinate alignment. Gear tooth surface images are acquired under the detection conditions of gear rotation or equal angle indexing, and distortion correction is performed on the acquired gear tooth surface images. The distortion correction includes radial distortion and tangential distortion compensation of the image based on the camera distortion parameters. The image after distortion correction is normalized in posture. The posture normalization includes positioning the gear center to a unified reference position based on the workstation reference posture parameters, aligning the gear rotation angle to a unified reference direction, and compensating for the translational deviation caused by gear eccentricity. After attitude normalization, the root boundary, tip boundary, and width boundary of the effective area of the tooth surface are determined based on the gear geometry parameters. The effective area of the tooth surface is then mapped to the tooth surface development coordinate system to generate a tooth surface development diagram. For each tooth surface development diagram, the tooth number index is associated with the corresponding tooth profile position index and tooth width position index.
3. The gear defect detection method based on deep learning according to claim 1, characterized in that, Step two specifically includes: The tooth surface unfolding diagrams of a lap acquisition sequence are grouped according to the number of gear teeth, and the tooth surface unfolding diagrams corresponding to the same tooth number are aligned to the same tooth profile position index and tooth width position index according to the tooth number index. For each tooth number, the tooth surface unfolded image is statistically analyzed at the same index position, and a normal texture base is generated by median aggregation. For each tooth surface unfolded image, perform a pixel-by-pixel difference operation between it and the normal texture base at the corresponding index position to obtain the residual image; The residual image is subjected to local contrast normalization processing, which includes selecting a neighborhood window for each pixel in the tooth surface unfolding coordinate system, calculating the mean gray level and gray level dispersion within the neighborhood window, and standardizing the residual value of the pixel according to the mean gray level and gray level dispersion. The residual map after local contrast normalization is output as the enhanced tooth surface representation, and the corresponding tooth number index, tooth profile position index and tooth width position index are retained for the enhanced tooth surface representation.
4. The gear defect detection method based on deep learning according to claim 1, characterized in that, Step three specifically includes: The enhanced tooth surface representation is input into the tooth surface feature generation network. The lightweight backbone network of the tooth surface feature generation network consists of a series of interconnected multi-level convolutional downsampling units. Each level of convolutional downsampling unit performs convolution operation, normalization operation and modified linear unit function activation operation in sequence. Multi-layer features with different spatial resolutions are obtained by downsampling between two adjacent convolutional layers, and the multi-layer features are input into the feature pyramid fusion module. The feature pyramid fusion module adopts a top-down stepwise bilinear interpolation upsampling and lateral connection fusion method to perform channel splicing and convolution fusion of high-level semantic features and low-level detail features at corresponding resolutions, and outputs a multi-scale feature pyramid. The multi-scale feature pyramid includes a high-resolution feature layer, a medium-resolution feature layer, and a low-resolution feature layer. The high-resolution feature layer is input into the region prediction head, which includes a convolutional layer and an upsampling layer. The output is a tooth surface region map of the same size as the enhanced tooth surface representation. The tooth surface region map includes three types of region identifiers: the tooth root transition area, the main working surface, and the tooth tip area. A high-resolution feature layer is input into a direction prediction head, which includes convolutional layers and outputs a tooth surface direction field of the same size as the enhanced tooth surface representation.
5. The gear defect detection method based on deep learning according to claim 1, characterized in that, The defect prompt word constructor reads the tooth surface region map, generates a defect prompt word sequence and a negative prompt word sequence containing region identifiers, and inputs them into the text encoding branch to obtain defect text features and negative text features; The adaptive slicing and candidate fusion module generates slicing blocks from the tooth surface unfolded map based on the tooth surface region map. High-resolution slicing blocks are generated in the tooth root transition area and the main working surface, and low-resolution slicing blocks are generated in the tooth tip area. The regions of each slicing block in the tooth surface unfolded coordinate system are mapped to a multi-scale feature pyramid to obtain slicing block features. The slicing block features and defect text features are input into the detection branch to obtain slicing block candidate defect regions. The detection branch includes a feature enhancement layer and a decoding layer, and outputs bounding box parameters, category query vectors and category scores. The coordinates of the slicing block candidate defect regions are restored to the tooth surface unfolded coordinate system, and candidate fusion is performed using the intersection-union ratio (IUU) deduplication method. For candidate defect regions with an IUU greater than a preset threshold, only candidate defect regions with a category score higher than a preset retention threshold are retained to obtain fused candidate defect regions. The cross-modal decoding gating module operates on the cross-modal decoding structure in the decoding layer. It uses the defect text features as the query input and the segmentation features as the key input to calculate the cross-attention response. It samples each fused candidate defect region on the tooth surface orientation field to obtain a sequence of orientation vectors, calculates the candidate principal orientation vector, and calculates the cosine value of the angle between the candidate principal orientation vector and the corresponding principal orientation vector of the cross-attention response. The cosine value of the angle is mapped to the gating weight through the Sigmoid function, and the cross-attention response is weighted by element-wise multiplication using the gating weight. Based on the weighted cross-attention response, defect text features, and negative text features, the defect category is determined for the fused candidate defect region and the defect category is output.
6. The gear defect detection method based on deep learning according to claim 1, characterized in that, Step five specifically includes: Using the candidate defect region as the detection region, a detection sub-image is obtained by cropping in the tooth surface unfolding coordinate system. The detection sub-image is then input into the defect fine segmentation network to obtain the defect mask. The defect fine segmentation network is an encoder-decoder structure. The encoder is composed of a convolutional layer, a batch normalization layer and a modified linear unit function connected in sequence and uses downsampling with a stride of two. The decoder uses bilinear interpolation upsampling and performs skip connections and fusion with the corresponding encoded features. When the defect category is crack, the Zhang-Suen thinning algorithm is used to generate a crack centerline map based on the defect mask, and the fracture endpoints with an endpoint spacing less than a preset distance threshold are connected by the eight-neighbor shortest path in the crack centerline map to complete the connectivity repair. When the defect type is pitting or peeling, the eight-neighbor connected component labeling is performed based on the defect mask, and connected components with a minimum boundary distance less than a preset distance threshold are merged. The morphological closing operation of the circular structuring element is used to smooth the boundary of the merged defect mask.
7. The gear defect detection method based on deep learning according to claim 1, characterized in that, Step six specifically includes: Defect quantification results are generated based on defect mask and crack centerline map. When the defect type is crack, the number of foreground pixels in the crack centerline map is counted in the tooth surface unfolding coordinate system and converted into crack length. The crack direction is determined based on the coordinate increment of adjacent centerline pixels in the crack centerline map. When the defect type is pitting, the ratio of the foreground pixels of the defect mask to the total number of pixels in the detection area is calculated in the tooth surface unfolding coordinate system to obtain the pitting coverage rate. The connected region area of the defect mask is calculated and the equivalent diameter of the connected region is converted based on the connected region area. When the defect category is spalling, the number of foreground pixels of the defect mask is counted in the tooth surface unfolding coordinate system and converted into spalling area. The boundary perimeter and boundary curvature change are calculated based on the boundary pixel set of the defect mask as boundary features. The location of the tooth root transition zone boundary is determined based on the tooth surface region map, the distance from the defect to the tooth root transition zone is calculated, and the expansion ratio along the tooth profile direction is calculated in the tooth surface unfolding coordinate system. Input the defect quantification results into the preset severity judgment rule set to output the severity level and handling suggestions.
8. The gear defect detection method based on deep learning according to claim 1, characterized in that, Step seven specifically includes: Obtain the pixel-to-actual-size conversion ratio parameter in the workstation calibration parameters. The conversion ratio parameter includes the pixel length conversion coefficient along the tooth profile direction and the pixel length conversion coefficient along the tooth width direction. The pixel values of crack length, distance from defect to tooth root transition zone, and boundary perimeter in the defect quantification results are multiplied by the pixel length conversion factor along the tooth profile direction or the pixel length conversion factor along the tooth width direction to obtain the corresponding millimeter measurement results. The pixel value of pitting equivalent diameter in the defect quantification results is averaged according to the pixel length conversion factor along the tooth profile direction and the pixel length conversion factor along the tooth width direction and converted into millimeter measurement results. The pixel value of the peeling area in the defect quantification result is multiplied by the product of the pixel length conversion factor along the tooth profile direction and the pixel length conversion factor along the tooth width direction to obtain the square millimeter measurement result. Cross-device consistency correction is performed on the millimeter and square millimeter measurement results obtained from different inspection stations or different cameras. The cross-device consistency correction includes acquiring calibration images of the same standard gauge block or standard gear at each inspection station and calculating the corresponding conversion ratio parameters. After mapping the conversion ratio parameters of different inspection stations to the conversion ratio parameters under a unified reference station, the millimeter and square millimeter measurement results are recalculated to obtain cross-device consistent measurement results.