A tool edge defect detection method based on image fusion

By using a lightweight FEF-DETR model based on image fusion, combined with multi-path feature extraction and image post-processing techniques, the problem of balancing accuracy and efficiency in tool edge detection is solved, achieving efficient and robust tool edge defect detection in complex environments.

CN122289211APending Publication Date: 2026-06-26SHENYANG UNIVERSITY OF TECHNOLOGY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENYANG UNIVERSITY OF TECHNOLOGY
Filing Date
2026-03-31
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies struggle to balance accuracy and efficiency in tool edge detection, and lack robustness in complex industrial environments. In particular, deep learning methods are difficult to deploy in real time on resource-constrained embedded platforms.

Method used

A lightweight FEF-DETR model based on image fusion is adopted, which combines multi-path hybrid feature extraction, adaptive feature fusion and hierarchical focusing modules. Pixel-level analysis and area method detection are performed through image post-processing technology to achieve high-precision detection of tool edge defects.

Benefits of technology

It achieves high-precision, low-computational-complexity tool edge defect detection in complex environments, improving detection efficiency and robustness while reducing the number of model parameters and computational load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289211A_ABST
    Figure CN122289211A_ABST
Patent Text Reader

Abstract

This invention discloses a tool edge defect detection method based on image fusion. First, by designing a multi-path feature extraction backbone (FEH) and an adaptive feature fusion module, the model's ability to represent tool features is enhanced. Then, a hierarchical focusing module (HF) and a feature stitching interaction module (FCI) are introduced to optimize multi-scale feature fusion and detail perception performance, constructing a lightweight FEF-DETR detection model based on RT-DETR to achieve high-precision tool region localization. On this basis, non-local mean filtering (NL-Means) is used to denoise the extracted region, and adaptive dual-threshold Otsu segmentation and the Canny operator are combined to complete the fine detection of edge defects. This invention improves both detection accuracy and model efficiency in tool detection, enhances robustness in complex industrial environments, and makes tool edge features clearer, thereby improving segmentation accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of tool edge detection technology, and in particular to a tool edge defect detection method based on image fusion. Background Technology

[0002] As a core actuator of machine tools, the edge integrity of the cutting edge in a cutting tool is a key factor in ensuring high-precision and high-efficiency machining. During continuous operation, cutting tools are prone to edge defects such as chipping and wear, which can lead to deterioration of workpiece machining quality, increased scrap rates, and even equipment failure. Therefore, rapid, accurate, and reliable online detection of the edge condition of machine tool cutting tools is of great significance for achieving intelligent manufacturing and improving product quality control.

[0003] Traditional tool edge condition detection includes two categories: direct methods and indirect methods. Direct methods utilize probes or other tools moving along the tool edge for detection. While offering high accuracy, they suffer from low efficiency and are prone to causing secondary damage to the tool surface, making them unsuitable for online inspection. In recent years, with the rapid development of machine vision technology, vision-based indirect detection methods have become the mainstream research direction in this field due to their advantages such as high efficiency, non-destructive testing, and rich information. Visual detection methods for tool edge conditions can be mainly divided into two categories: those based on classical image processing and those based on deep learning. Methods based on classical image processing directly utilize low-order visual features (such as texture and shape) for detection, with the core being a manually designed feature extractor. These methods are intuitive in principle and have low computational complexity, but their performance heavily relies on preset conditions such as the manually designed feature extractor. They also exhibit poor robustness to factors such as lighting changes and noise interference in complex industrial environments, and their generalization ability is limited. Deep learning-based methods, on the other hand, possess powerful autonomous feature learning capabilities. Deep learning models can implicitly learn highly abstract feature representations from massive amounts of data and are robust to complex environments and noise. However, this performance typically comes at the cost of enormous computational overhead and a large number of parameters, leading to a significant increase in model complexity and making real-time deployment on resource-constrained embedded platforms difficult. The performance of such models is highly dependent on the support of large-scale, high-quality labeled samples. In real-world industrial scenarios, tool defect samples are not only scarce but also extremely costly to label. This inherent limitation severely hinders the large-scale application and promotion of deep learning methods in tool defect detection.

[0004] Therefore, there is an urgent need for an effective new method to solve the problems of difficulty in balancing accuracy and efficiency and insufficient robustness in complex industrial environments in tool defect detection. Summary of the Invention

[0005] In view of the shortcomings of the prior art, the purpose of this invention is to provide a tool edge defect detection method based on image fusion, which aims to solve the problems of boundary blurring and low segmentation accuracy in tool edge detection in the prior art.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: A tool edge defect detection method based on image fusion, comprising: Step 1: Acquire tool images each time the tool returns to its original position, preprocess the tool images to form standard images, and establish a lightweight FEF-DETR model. Use the standard image as input to acquire clean tool region images from the standard image and extract the tool cutting edge region from the overall captured image to reduce detection complexity. Step 2: Perform pixel-level analysis on the clean tool area image based on image post-processing technology, and perform noise reduction, segmentation, and edge extraction to obtain the sub-pixel level tool cutting edge. Step 3: Tool edge defect detection based on area method. Using the tool edge obtained in step 2, mathematical reconstruction is performed. Defect detection is achieved by calculating the area of ​​the tool edge curve within a fixed distance from the leftmost edge to the right of the tool edge.

[0007] Furthermore, in step 1, the lightweight FEF-DETR model uses a multi-path hybrid feature extraction module as the backbone network, constructs a feature splicing interaction module as the encoder layer, introduces a decoder layer of a hierarchical focusing module, interacts with the encoder layer to output, and finally outputs the image through nonlinear transformation and feature integration of a feedforward network.

[0008] Furthermore, in the lightweight FEF-DETR model, a standard image is used as input. The backbone network of the multi-path hybrid feature extraction module integrates a high-resolution network and a lightweight network in parallel. In the high-resolution network, different numbers of high-resolution networks are used at different stages to gradually extract the features of the cutting edge region of the tool from the standard image. The computational complexity is reduced by depthwise separable convolution to obtain feature maps of various sizes. At the same time, in the lightweight network, different numbers of convolution operations are used to extract multi-scale feature information. Subsequently, an adaptive feature fusion module is used to fuse multi-source information to obtain multi-scale feature maps.

[0009] Furthermore, an adaptive feature fusion module is employed to fuse the outputs from the two feature extraction networks. Through alignment, weighted fusion, and channel attention mechanisms, multi-source information is fused to obtain multi-scale feature maps, represented as follows: First, a 1×1 convolution is used to align feature channels A and B, i.e.: ; Where A and B are input feature maps, and the number of channels is... and, and For convolution bias, channel concatenation is then performed, i.e.: ; in and The number of channels in the convolutional feature map is given. Finally, a 3×3 convolution is used to fuse the details. ; in It is a convolution kernel with the same number of output channels; This is the convolution bias.

[0010] Furthermore, in the lightweight FEF-DETR model, the feature concatenation interaction module first unifies the multi-scale inputs to the target size, then uses spatial partitioning convolution to extract deep features to enhance spatial information perception, and finally promotes feature reuse through residual connections to strengthen the fusion effect of cross-scale features. First, the target size is obtained from the first input feature map, and then the sizes of other input feature maps are compared: when the size of the input feature map is larger than the target size, adaptive average pooling is used to reduce the size G; when the size of the input feature map is smaller than the target size, bilinear interpolation is applied to increase the size H. Bilinear interpolation obtains the pixel value of a point by calculating the weighted average of the attributes of four surrounding texture pixels, first calculating linear interpolation in the x-direction: ; in Given points, and Known data points The coordinates; Then linear interpolation is performed in the y-direction: ; in and For data points The coordinates; Subsequently, the uniformly sized feature maps are used for depth feature extraction through spatial partitioning convolution. This convolutional layer performs the convolution operation by using operations on the input symmetric positive definite matrix: ; in These are the values ​​of the output feature map and the input feature map, respectively; is the value of the positive definite matrix; M and N define the convolution kernel size.

[0011] Furthermore, in the lightweight FEF-DETR model, the hierarchical focusing module decomposes multi-head self-attention into parallel high-frequency and low-frequency paths through the HiLoI component. The high-frequency path focuses on local details, while the low-frequency path captures the global context. The processed features are residually connected to the original input via Dropout and then integrated through a feedforward network to achieve sensitive perception of small targets. Each self-attention head is derived from a linear transformation of the input X to calculate the query Q, keyword K, and value matrix V, as shown below: ; in These are learnable parameters; Multi-head self-attention is expressed as: ; pass Implement internal calculations for each head: ; in The dimension of the hidden attention head.

[0012] Furthermore, in step 2, pixel-level analysis is performed on the clean tool region image based on image post-processing techniques, followed by denoising, segmentation, and edge extraction to obtain sub-pixel level tool edge images; denoising is performed using the NL-Means algorithm; and a weighted average is calculated by weighting the similarity between image blocks using global image redundancy information, expressed as: ; in For the original image, The image after denoising. It is a pixel. and Similarity weight between: ; in It is a normalization constant. and It is a neighboring block; To address the multi-peaked histogram characteristics of the clean tool region image, a dual-threshold Otsu method is employed for image segmentation. By optimizing the inter-class variance, an optimal pair of thresholds (t1, t2) is adaptively determined, dynamically dividing image pixels into three categories: foreground, middle, and background. The segmentation process is as follows: ; Where the image has gray levels L, the probability of a pixel at gray level i appearing is pi, and the overall mean of the image is... The variance between classes is: ; The optimal threshold is obtained by maximizing the inter-class variance, i.e.: ; The Canny operator is used to extract the tool region edges. The Canny edge detection mainly includes three steps: gradient calculation, non-maximum suppression, and double threshold connection. The high threshold Otsu is determined by the high threshold of the obtained double threshold, and the low threshold is half of it to achieve adaptive threshold selection K. Then, the extracted edges are filtered by contour length threshold, and skeleton extraction is performed to eliminate redundancy, finally obtaining a clear and continuous tool edge contour.

[0013] Furthermore, in step 3, based on the area-based tool edge defect detection, the sub-pixel level tool cutting edge point set obtained in step 2 is processed. To perform mathematical reconstruction, firstly, the edge points are sorted by their x-coordinates from smallest to largest, the leftmost edge point is determined, and a local coordinate system is established using this point as the origin, transforming all edge points into local coordinates. Then, cubic B-spline interpolation is used to fit the discrete edge points into a continuous edge curve. And calculate the fixed distance to the right from the origin. Area enclosed by the inner edge curve and the horizontal axis: ; Where X is the local x-coordinate with the leftmost edge point as the origin. The fitted continuous edge curve function, To maintain a fixed detection distance, it is generally 80% to 90% of the effective length of the cutting edge; Simultaneously, the same steps 1 and 2, along with the reconstruction process described above, are performed on a brand-new standard tool to calculate the standard reference area. Defects are determined by calculating the deviation rate between the area of ​​the tool to be inspected and the standard area. ; Where A is the edge area of ​​the tool to be inspected. This is the reference area for standard cutting tools. For area deviation rate, when If the threshold is exceeded, the tool is determined to be defective.

[0014] The technical solution adopted in this invention has the following beneficial effects: In this invention, the FEF-DETR model can accurately output the region of interest (ROI) of the tool from complex machining environments. However, this region still suffers from noise, uneven lighting, and interference from complex surface textures. To achieve accurate edge defect localization, this invention proposes a "denoising → enhancement → segmentation → extraction" image post-processing pipeline to refine the ROI, highlighting tool edge features and improving segmentation accuracy.

[0015] This invention enhances the model's ability to represent tool features by designing a multi-path feature extraction backbone (FEH) and an adaptive feature fusion module. Furthermore, it introduces a hierarchical focusing module (HF) and a feature stitching interaction module (FCI) to optimize multi-scale feature fusion and detail perception performance, constructing a lightweight FEF-DETR detection model based on RT-DETR to achieve high-precision tool region localization. On this basis, non-local mean filtering (NL-Means) is used to denoise the extracted region, and adaptive dual-threshold Otsu segmentation and the Canny operator are combined to achieve fine detection of edge defects.

[0016] The area method of this invention does not require spatial alignment between the standard tool and the tool to be tested. Each tool independently calculates its area using its leftmost edge point as the reference origin. Defect determination can be completed simply by comparing the scalar area values, thus avoiding the difficulty of precise alignment in traditional edge fitting methods. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the FEF-DETR lightweight detection model framework; Figure 2 This is a schematic diagram of the structure of the FEH of the present invention; Figure 3 This is a schematic diagram of the structure of the AFM of the present invention; Figure 4 This is a schematic diagram of the FCI structure of the present invention; Figure 5 This is a schematic diagram of the structure of the HF of the present invention; Figure 6 The figure shows the ablation experiment results of this invention; Figure 7 Visualization of the different receptive fields and heat maps of the present invention; Figure 8 A comparison of FCI and HF detection methods in this invention; Figure 9 A comparison of the effects of different denoising algorithms in this invention; Figure 10 The results of the tool extraction according to the present invention; Figure 11The noise reduction effect diagram of this invention; Figure 12 This is a diagram showing the image threshold determination locations for different Otsu methods of the present invention; Figure 13 This is an edge detection and screening diagram of the present invention; Figure 14 This is an edge defect detection diagram of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0019] Step 1: Acquire tool images each time the tool returns to its original position, preprocess the tool images to form standard images, and establish a lightweight FEF-DETR model. Use the standard images as input to obtain clean tool region images from the standard images. A multi-path hybrid feature extraction backbone network (FEH) is designed to replace the original ResNet backbone to reduce computational burden; a feature concatenation and interaction module (FCI) is constructed to enhance cross-scale feature fusion capabilities; a hierarchical focusing module (HF) is introduced to optimize intra-scale feature interaction, more comprehensively extracting high-frequency details and low-frequency global information, improving the model's detail capture capabilities, and enhancing tool perception accuracy. Its structure is as follows: Figure 1 As shown.

[0020] To overcome the limitations of high computational cost and difficult deployment of a single ResNet backbone on embedded platforms, this paper integrates a high-resolution network (HGNetV2) and a lightweight network (C2F) in parallel on the FEH backbone. It utilizes an Adaptive Feature Merging Module (AFM) to fuse multi-source information, significantly compressing the number of parameters while obtaining richer multi-scale feature representations. Its structure is as follows: Figure 2 As shown.

[0021] A depthwise separable convolution (DWConv) is introduced after HGBlock to effectively preserve spatial hierarchical information while significantly reducing computational complexity. By using different numbers of HGBlocks at different stages, features are extracted progressively to adapt to diverse feature map sizes. Similarly, C2F employs different numbers of convolution operations to extract multi-scale feature information. To fuse features extracted from different backbone networks, an adaptive feature fusion module (AFM) is introduced to fuse the outputs from the two feature extraction networks. Through alignment, weighted fusion, and channel attention mechanisms, a more comprehensive multi-scale feature map is output, structured as follows: Figure 3 As shown.

[0022] AFM first uses a 1×1 convolution to align the A and B channels of the feature, that is: ; Where A and B are input feature maps, and the number of channels is... and , and For convolution bias, channel concatenation is then performed, i.e.: ; in and The number of channels in the convolutional feature map is given. Finally, a 3×3 convolution is used to fuse the details. ; in It is a convolution kernel with the same number of output channels; This is the convolution bias.

[0023] To overcome the limitations of the original Cross-Scale Feature Fusion (CCFM) module, which suffers from insufficient information interaction due to simple concatenation, a Feature Concatenation Interaction (FCI) module is proposed to achieve adaptive integration of multi-scale features. This module first unifies the multi-scale inputs to the target size, then uses Spatial Partition Convolution (SPDConv) for deep feature extraction to enhance spatial information perception, and finally promotes feature reuse through residual connections, thereby effectively strengthening the fusion effect of cross-scale features. Its structure is as follows: Figure 4 As shown. In FCI, the target size is first obtained from the first input feature map. Then, the sizes of the other input feature maps are compared: if it is larger than the target size, adaptive average pooling is used to reduce the size G; if it is smaller than the target size, bilinear interpolation is applied to increase the size H. Bilinear interpolation obtains the pixel value of a point by calculating the weighted average of the attributes of four surrounding texture pixels. Its calculation process involves calculating linear interpolation in the x-direction, i.e.: ; in Given points, and Known data points The coordinates; Then linear interpolation is performed in the y-direction: ; in and For data points The coordinates.

[0024] Subsequently, the uniformly sized feature maps are used for depth feature extraction through spatial partitioning convolution. This convolutional layer performs the convolution operation by using operations on the input symmetric positive definite matrix: ; in These are the values ​​of the output feature map and the input feature map, respectively; is the value of the positive definite matrix; M and N define the convolution kernel size.

[0025] The Intra-Scale Feature Interaction (AIFI) module in the original RT-DETR suffers from excessive computational complexity when processing high-resolution features, easily leading to the loss of detailed information. This paper designs a Hierarchical Focus Module (HF). HF decomposes multi-head self-attention into parallel high-frequency (focusing on local details) and low-frequency (capturing global context) paths using the HiLoI component. The processed features are residually connected to the original input via Dropout and then integrated through a feedforward network, thereby reducing computational cost while achieving sensitive perception of small targets. Each self-attention head is derived from a linear transformation of the input X to compute the query Q, keyword K, and value matrix V. The computation process is defined as follows: ; in These are learnable parameters; Multi-head self-attention is expressed as: ; pass Implement internal calculations for each head: ; in The dimension of the hidden attention head.

[0026] By rearranging and combining high- and low-frequency features, the HiLo module can flexibly determine the high- and low-frequency information of the input features and select the appropriate processing path. This structure significantly reduces the processing cost of high-resolution images. Subsequently, the rearranged features are processed by Dropout and residually connected to the original features. This design not only alleviates the gradient vanishing problem but also improves the model's stability. The stitched features undergo nonlinear transformation and feature integration through a feedforward network, enhancing the model's sensitivity and discriminative power regarding cutting tools. Its structure is as follows: Figure 5 As shown. In summary, through the collaborative work of FEH, HF, and FCI, the FEF-DETR model achieves accurate tool extraction, providing effective data input for subsequent edge detection using image post-processing algorithms. Step 2: Perform pixel-level analysis on the clean tool area image based on image post-processing technology, and perform noise reduction, segmentation, and edge extraction to obtain sub-pixel level tool edges; Edge detection using image post-processing methods includes: Due to the intense friction during processing, direct edge detection of the Region of Interest (ROI) is easily affected by image noise, resulting in false edges. To suppress noise while preserving edges to the maximum extent, the NL-Means algorithm is used for denoising. This algorithm utilizes global redundancy information of the image and performs a weighted average by calculating the similarity weights between image blocks. The calculation process is as follows: ; in For the original image, The image after denoising. It is a pixel. and Similarity weight between: ; in It is a normalization constant. and It is a neighboring block; To address the multi-peaked histogram characteristics of the clean tool region image, a dual-threshold Otsu method is employed for image segmentation. By optimizing the inter-class variance, an optimal pair of thresholds (t1, t2) is adaptively determined, dynamically dividing image pixels into three categories: foreground, middle, and background. The segmentation process is as follows: ; Where the image has gray levels L, the probability of a pixel at gray level i appearing is pi, and the overall mean of the image is... The variance between classes is: ; The optimal threshold is obtained by maximizing the inter-class variance, i.e.: ; The Canny operator is used for edge extraction in the tool region. Canny edge detection mainly includes three steps: gradient calculation, non-maximum suppression, and dual-threshold concatenation. The higher threshold obtained from the Otsu threshold is determined, and half of the lower threshold is used, thus achieving adaptive threshold selection K. Subsequently, the extracted edges are filtered by contour length threshold, and skeleton extraction is performed to eliminate redundancy, ultimately obtaining a clear and continuous tool edge contour, providing a basis for defect judgment. Step 3: Tool Edge Defect Detection Based on Area Method. Using the tool edge obtained in Step 2, mathematical reconstruction is performed. Defect detection is achieved by calculating the area of ​​the tool edge curve within a fixed distance to the right of the leftmost edge. The core advantage of the area method is that the standard tool and the tool to be inspected do not need to be spatially aligned. Each tool independently calculates its area using its own leftmost edge point as the reference origin. Defect determination is completed simply by comparing scalar area values, thus avoiding the difficulty of precise alignment in traditional edge fitting methods.

[0027] Based on the area-based tool edge defect detection, the sub-pixel level tool cutting edge point set obtained in step 2 is processed. To perform mathematical reconstruction, firstly, the edge points are sorted by their x-coordinates from smallest to largest, the leftmost edge point is determined, and a local coordinate system is established using this point as the origin, transforming all edge points into local coordinates. Then, cubic B-spline interpolation is used to fit the discrete edge points into a continuous edge curve. And calculate the fixed distance to the right from the origin. Area enclosed by the inner edge curve and the horizontal axis: ; Where X is the local x-coordinate with the leftmost edge point as the origin. The fitted continuous edge curve function, To maintain a fixed detection distance, it is generally 80% to 90% of the effective length of the cutting edge; Simultaneously, the same steps 1 and 2, along with the reconstruction process described above, are performed on a brand-new standard tool to calculate the standard reference area. Defects are determined by calculating the deviation rate between the area of ​​the tool to be inspected and the standard area. ; Where A is the edge area of ​​the tool to be inspected. This is the reference area for standard cutting tools. For area deviation rate, when If the threshold is exceeded, the tool is determined to be defective.

[0028] To verify the effectiveness of each improved module, ablation experiments were conducted on a self-built dataset. The experimental results are as follows: Figure 6As shown in Table 1, the improved models (No.1 and No.5) maintain similar overall detection accuracy to the original networks, but with a significant reduction in parameters and computational cost. As shown in Table 1 (No.1 and No.2), compared to the baseline model, the introduction of the FEH backbone network reduces the number of parameters by 29.6% and the computational cost by 40.2% while maintaining similar accuracy; this is the main improvement of the model. Simultaneously, the AFM module effectively integrates the features extracted from the two path networks, resulting in richer feature maps at each layer of the output, thus improving the model's ability to handle complex background images while maintaining a lightweight design.

[0029] Table 1 Ablation Experiment To further verify the effectiveness of the backbone network design, under the same dataset and experimental environment, the backbone of the benchmark model was replaced with Efficientvit and Mobilenetv4 respectively, and compared with the improved FEH. The experimental results are shown in Tables 2 and 3: Table 2 Backbone Network Comparison Experiment Table 3. Receptive Fields of Different Trunks As can be seen, the detection accuracy of the FEH network is improved compared to MobileNetV4 and EfficientViT networks. The overall accuracy only decreased by 1% compared to the original networks, indicating that FEH's parallel extraction network can extract features well while maintaining a lightweight design. To more intuitively demonstrate the advantages of FEH compared to other networks, its detection results are visualized, as shown in Table 3. Figure 7 As shown in (a), FEH's receptive field coverage is greater than EfficientViT in the early stages of training, indicating that it can capture local small object information more quickly. In the later stages of training, FEH's receptive field coverage is less than MobileNetV4, indicating that it avoids noise interference introduced by an excessively large field of view. Figure 7 (b) is the actual detection heatmap, where both the tool and the workpiece were labeled during dataset creation. In the heatmap, darker colors indicate greater attention to that area, showing that other lightweight backbones are less effective at tool localization than the FEH network. It can be seen that the parallel path network of FEH has stronger feature extraction capabilities compared to the single-path backbone network.

[0030] In the FCI module, an interactive mechanism is introduced during feature stitching to adaptively fuse feature maps of different scales, avoiding information loss caused by simple stitching and thus improving the model's tool capture capability. Table 1 (No. 3, No. 3) shows that the model's detection accuracy improved after adding this module, proving its effectiveness. The feature map comparison more intuitively reflects the module's effect, such as... Figure 8 As shown, the feature map after FCI processing becomes clearer and more explicit, proving that the structure has a stronger feature representation capability.

[0031] The HF module aims to improve the model's ability to capture detailed tool features by efficiently combining high- and low-frequency information. As shown in Table 1 (No. 2, No. 4), the detection accuracy of the model is improved after adding HF to the FEH backbone. Figure 8 The heatmap shows the effect of HF. The original AIFI module failed to detect the workpiece effectively, but after the HF improvement, the workpiece can be detected effectively and the tool area is more focused.

[0032] To verify the performance of the improved FEF-DETR network model presented in this paper, it was compared with the YOLOv5s and YOLOv8s0 object detection algorithms. The experiments did not use pre-trained weights, and the results are shown in Table 4: Table 4 Comparison Experiments of Different Algorithms Compared to the original detection network, FEF-DETR reduces the number of model parameters and computational cost while maintaining similar detection accuracy. Compared to YOLOv5 and YOLOv8, FEF-DETR achieves higher detection accuracy. To verify the model's generalization ability, it was validated on the Peking University public PCB defect dataset. The experiment did not use pre-trained weights, and the experimental results are shown in Table 5. Table 5 Generalization experiments on different datasets As can be seen, the FEF-DETR Map50 score is 0.978, which is close to that of existing networks, indicating that the model has strong generalization ability.

[0033] Post-processing of the extracted region is equally important. Image denoising is a key step in ensuring the accuracy of edge detection. A comparison of the effects of median filtering and Gaussian filtering on the tool extraction region yields the following results: Figure 9 As shown, after NL-Means denoising in the tool area, noise is effectively suppressed while preserving the edge details of the tool to the maximum extent.

[0034] Tool extraction results: After FEF-DETR extraction, the tool in the acquired image can be effectively extracted, and the detection results are as follows: Figure 10 As shown, after denoising using the NL-Means method, the impact of image surface variations is significantly reduced. Figure 11 It can be seen that the pixel intensity of the filtered image is more concentrated, making the contrast between the target area edge and the background more obvious, and the interference is reduced after detection using the Canny operator. Due to the cumulative effect of long-term friction at the cutting edge, the gray-level difference between the cutting surface and the blade body in the denoised image is still significant, resulting in a three-peak gray-level distribution. To address this issue, the Otsu method with dual thresholds is used to accurately determine the threshold when the gray-level distribution is three-peaked, thus achieving better image segmentation. Figure 12 As shown in the figure. Since this method is sensitive to noise, the NL-Means denoising method described above can effectively overcome this problem and improve the segmentation effect.

[0035] After denoising and thresholding, edge detection was performed using the Canny operator. However, due to variations in the geometry of the cutting tool surface, some interference still exists in the edge detection results. Therefore, all contours were first searched, and the true tool edges were filtered out by selecting a reasonable length threshold. Subsequently, skeleton extraction was performed on the edge image to retain edge information while reducing redundant information. The final extraction result is shown below. Figure 13 As shown. In tool edge defect detection, previous fitting methods require determining the tool cutting edge position and the positional relationship between the detected edge and the ideal edge, making the process relatively complex. Therefore, an area method is used to simplify this process. First, the aforementioned edge detection method is used to extract pixel-level edges from the target area. Then, the edges are reconstructed based on the extracted pixels. Finally, due to issues such as the tool machining position and acquisition angle, the tool's position in the image may differ after extraction and cutting. Therefore, defect detection is performed by calculating the area of ​​the tool edge curve within a fixed distance from the leftmost edge to the right of the tool edge, as shown. Figure 14 As shown, by comparing it with the ideal tool area, it can be determined whether wear has occurred.

[0036] To verify the effectiveness of the proposed method, 10 cutting tools with different defect levels were selected as samples. The fusion method was used to test all samples in three rounds, with each round involving a different number of repeated tests. For example, each sample was tested twice in one round, resulting in a total of 20 test data points. The results are shown in Table 6. Table 6 Defect Identification Rate Statistics The dataset used in the experiment is a self-built machine tool image dataset, which contains 2,850 labeled images covering different lighting conditions, wear levels and background interference scenes. It is randomly divided into training set, validation set and test set in a ratio of 8:1:1.

[0037] The performance evaluation of the model uses the following metrics: detection accuracy, model efficiency, and robustness.

[0038] Detection accuracy (mean accuracy mAP): mAP50 and mAP50-95 are used as the main evaluation metrics to comprehensively measure detection accuracy and recall performance. mAP50 represents the multi-class average accuracy when the threshold is 0.5.

[0039] Model efficiency (parameters, FLOPs): Used to evaluate model complexity and computational efficiency, suitable for comparing lightweight models. Params and FLOPs represent the complexity of the model; the higher the value, the more demanding the computing equipment requirements.

[0040] Generalization (Precision): Reflects the accuracy of positive samples in the detection results. In the above metrics, ↑ indicates a higher value and better performance, while ↓ indicates a lower value and better performance.

[0041] The research results show that the fusion framework proposed in this invention is superior to the comparative methods in both accuracy and efficiency, and has good generalization and practical value, providing a reliable technology and method for online intelligent monitoring of tool status.

Claims

1. A method for detecting tool edge defects based on image fusion, characterized in that, include: Step 1: Acquire tool images each time the tool returns to its original position, preprocess the tool images to form standard images, and establish a lightweight FEF-DETR model. Use the standard image as input to acquire clean tool region images from the standard image and extract the tool cutting edge region from the overall captured image to reduce detection complexity. Step 2: Perform pixel-level analysis on the clean tool area image based on image post-processing technology, and perform noise reduction, segmentation, and edge extraction to obtain the sub-pixel level tool cutting edge. Step 3: Tool edge defect detection based on area method. Using the tool edge obtained in step 2, mathematical reconstruction is performed. Defect detection is achieved by calculating the area of ​​the tool edge curve within a fixed distance from the leftmost edge to the right of the tool edge.

2. The tool edge defect detection method based on image fusion according to claim 1, characterized in that, In step 1, the lightweight FEF-DETR model uses a multi-path hybrid feature extraction module as the backbone network, constructs a feature splicing interaction module as the encoder layer, introduces a decoder layer of a hierarchical focusing module, interacts with the encoder layer to output, and finally outputs the image through nonlinear transformation and feature integration of a feedforward network.

3. The tool edge defect detection method based on image fusion according to claim 2, characterized in that, In the lightweight FEF-DETR model, a standard image is used as input. The backbone network of the multi-path hybrid feature extraction module integrates a high-resolution network and a lightweight network in parallel. In the high-resolution network, different numbers of high-resolution networks are used at different stages to gradually extract the features of the cutting edge region of the tool from the standard image. The computational complexity is reduced by depthwise separable convolution to obtain feature maps of various sizes. At the same time, in the lightweight network, different numbers of convolution operations are used to extract multi-scale feature information. Subsequently, an adaptive feature fusion module is used to fuse multi-source information to obtain multi-scale feature maps.

4. The tool edge defect detection method based on image fusion according to claim 2, characterized in that, An adaptive feature fusion module is employed to fuse the outputs from two feature extraction networks. Through alignment, weighted fusion, and channel attention mechanisms, multi-source information is fused to obtain multi-scale feature maps, represented as follows: First, a 1×1 convolution is used to align feature channels A and B, i.e.: ; Where A and B are input feature maps, and the number of channels is... and , and For convolution bias, channel concatenation is then performed, i.e.: ; in and The number of channels in the convolutional feature map is given. Finally, a 3×3 convolution is used to fuse the details. ; in It is a convolution kernel with the same number of output channels; This is the convolution bias.

5. The tool edge defect detection method based on image fusion according to claim 2, characterized in that, In the lightweight FEF-DETR model, the feature concatenation interaction module first unifies the multi-scale inputs to the target size, then uses spatial partitioning convolution to extract deep features to enhance spatial information perception, and finally promotes feature reuse through residual connections to strengthen the fusion effect of cross-scale features. The target size is first obtained from the first input feature map, and then the sizes of other input feature maps are compared: when the size of the input feature map is larger than the target size, adaptive average pooling is used to reduce the size G; when the size of the input feature map is smaller than the target size, bilinear interpolation is applied to increase the size H. Bilinear interpolation obtains the pixel value of a point by calculating the weighted average of the attributes of four surrounding texture pixels, and first calculates linear interpolation in the x-direction: ; in Given points, and Known data points The coordinates; Then linear interpolation is performed in the y-direction: ; in and For data points The coordinates; Subsequently, the uniformly sized feature maps are used for depth feature extraction through spatial partitioning convolution. This convolutional layer performs the convolution operation by using operations on the input symmetric positive definite matrix: ; in These are the values ​​of the output feature map and the input feature map, respectively; is the value of the positive definite matrix; M and N define the convolution kernel size.

6. The tool edge defect detection method based on image fusion according to claim 2, characterized in that, In the lightweight FEF-DETR model, the hierarchical focusing module decomposes multi-head self-attention into parallel high-frequency and low-frequency paths through the HiLoI component. The high-frequency path focuses on local details, while the low-frequency path captures the global context. The processed features are residually connected to the original input via Dropout and then integrated through a feedforward network to achieve sensitive perception of small targets. Each self-attention head is derived from a linear transformation of the input X to compute the query Q, keyword K, and value matrix V, as shown below: ; in These are learnable parameters; Multi-head self-attention is expressed as: ; pass Implement internal calculations for each head: ; in The dimension of the hidden attention head.

7. The tool edge defect detection method based on image fusion according to claim 1, characterized in that, In step 2, pixel-level analysis is performed on the clean tool region image based on image post-processing techniques, followed by denoising, segmentation, and edge extraction to obtain sub-pixel level tool edge images; denoising is performed using the NL-Means algorithm; and a weighted average is calculated by weighting the similarity between image blocks using global image redundancy information, expressed as: ; in For the original image, The image after denoising. It is a pixel. and Similarity weight between: ; in It is a normalization constant. and It is a neighboring block; To address the multi-peaked histogram characteristics of the clean tool region image, a dual-threshold Otsu method is employed for image segmentation. By optimizing the inter-class variance, an optimal pair of thresholds (t1, t2) is adaptively determined, dynamically dividing image pixels into three categories: foreground, middle, and background. The segmentation process is as follows: ; Where the image has gray levels L, the probability of a pixel at gray level i appearing is pi, and the overall mean of the image is... The variance between classes is: ; The optimal threshold is obtained by maximizing the inter-class variance, i.e.: ; The Canny operator is used to extract the tool region edges. The Canny edge detection mainly includes three steps: gradient calculation, non-maximum suppression, and double threshold connection. The high threshold Otsu is determined by the high threshold of the obtained double threshold, and the low threshold is half of it to achieve adaptive threshold selection K. Then, the extracted edges are filtered by contour length threshold, and skeleton extraction is performed to eliminate redundancy, finally obtaining a clear and continuous tool edge contour.

8. The tool edge defect detection method based on image fusion according to claim 1, characterized in that, In step 3, tool edge defect detection based on the area method is performed on the sub-pixel level tool cutting edge point set obtained in step 2. To perform mathematical reconstruction, firstly, the edge points are sorted by their x-coordinates from smallest to largest, the leftmost edge point is determined, and a local coordinate system is established using this point as the origin, transforming all edge points into local coordinates. Then, cubic B-spline interpolation is used to fit the discrete edge points into a continuous edge curve. And calculate the fixed distance to the right from the origin. Area enclosed by the inner edge curve and the horizontal axis: ; Where X is the local x-coordinate with the leftmost edge point as the origin. The fitted continuous edge curve function, To maintain a fixed detection distance, it is generally 80% to 90% of the effective length of the cutting edge; Simultaneously, the same steps 1 and 2, along with the reconstruction process described above, are performed on a brand-new standard tool to calculate the standard reference area. Defects are determined by calculating the deviation rate between the area of ​​the tool to be inspected and the standard area. ; Where A is the edge area of ​​the tool to be inspected. This is the reference area for standard cutting tools. For area deviation rate, when If the threshold is exceeded, the tool is determined to be defective.