A computer vision-based milling cutter defect detection device and method
Patent Information
- Application Number
- CN202610885048.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-09-08
AI Technical Summary
然而,铣刀表面通常具有高反光、纹理复杂、刃口曲率变化大、缺陷尺度差异明显等特点
[0016]Compared with existing technologies, this invention has the following advantages and technical effects: This invention provides a computer vision-based milling cutter defect detection device that integrates a worktable, lens module, frame, and camera into the same detection structure. This allows the milling cutter to be inspected to be stably positioned within the imaging area of the lens module, thereby significantly improving the stability and repeatability of the image acquisition process and avoiding image quality degradation caused by device loosening or displacement. Employing a non-contact visible light imaging method, by setting the camera towards the worktable and arranging the camera's imaging optical axis at an angle to the central axis of the lens module, a dual-view collaborative acquisition structure is formed. This eliminates the need for close-range manual observation or contact measurement, efficiently acquiring visible light images of the milling cutter surface and reducing efficiency losses and safety risks associated with manual inspection. The device also integrates an image processing unit, which embeds a defect recognition model based on an improved TS-Unet. After preprocessing, the acquired visible light images are input into the improved TS-Unet-based defect recognition model. A CNN encoding module extracts local texture and edge features from the milling cutter image, while a Transformer encoding module performs global context modeling on the features output by the CNN module. This combines the sensitivity of CNN to local details with the Transformer's ability to model global semantic relationships, effectively addressing the challenges of recognizing complex areas of metal reflection, fine cracks, edge wear, and chipping on the milling cutter surface, significantly improving the accuracy and robustness of defect recognition. The defect recognition model also uses a decoding module to upsample and recover the features output by the Transformer encoding module, ultimately outputting pixel-level defect segmentation results. This not only determines whether defects exist on the milling cutter surface but also accurately locates the specific position of the defect area, calculates the defect area, and assesses the severity of the defect, providing a quantitative basis for subsequent quality assessment and maintenance decisions.
Smart Images

Figure CN122709445A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cutting tool quality inspection technology, and in particular to a milling cutter defect detection device and method based on computer vision. Background Technology
[0002] Milling cutters are critical consumable components in machining, precision manufacturing, and composite material processing. Working under conditions of high-speed cutting, intermittent impact, and frictional wear for extended periods, milling cutters are prone to defects such as wear, cracks, chipping, notches, edge dulling, and uneven wear. These defects reduce machining accuracy and surface quality, and in severe cases, can lead to tool failure, workpiece scrap, increased equipment vibration, or even unplanned downtime.
[0003] Current methods for inspecting the condition of milling cutters largely rely on manual visual inspection, microscopic observation, or contact measurement. These methods are inefficient, the results are significantly affected by the operator's experience, and they lack stability in detecting early-stage minor defects, complex reflective surfaces, or multiple cutter models. In some industrial settings, inspections also require machine shutdown, tool disassembly, or tool relocation, disrupting production continuity.
[0004] With the development of computer vision and deep learning technologies, using cameras to acquire tool images and algorithms to identify defects has become a feasible solution. However, milling cutter surfaces typically have characteristics such as high reflectivity, complex textures, large variations in cutting edge curvature, and significant differences in defect scale. Traditional threshold segmentation, edge detection, or simple classification algorithms struggle to maintain robustness under complex lighting conditions and with multiple tool types, and also find it difficult to simultaneously achieve defect localization and defect severity assessment.
[0005] Therefore, it is necessary to design a milling cutter defect detection device and method based on computer vision to solve the above-mentioned technical problems. Summary of the Invention
[0006] The purpose of this invention is to provide a milling cutter defect detection device and method based on computer vision. It has a compact structure and stable imaging, and can be combined with a deep learning segmentation model for the automatic identification of defects such as wear, cracks, chipping, and notches on the milling cutter cutting edge, tip, side edge, or other surface areas, so as to solve the problems existing in the prior art.
[0007] To achieve the above objectives, the present invention provides the following solution: The present invention provides a milling cutter defect detection device based on computer vision, comprising: A frame, wherein a lens module is provided inside the frame, and a worktable for placing the milling cutter to be tested is provided within the imaging area of the lens module; The base body has a worktable fixed on it. A camera is installed inside the base body and faces the worktable. The lens module and the camera form a first imaging channel and a second imaging channel, respectively. The imaging optical axis of the camera is arranged at an angle to the central axis of the lens module, thus forming a dual-view collaborative acquisition structure. The device also includes an image processing unit, which is communicatively connected to the lens module and the camera, for receiving dual-view acquired images and embedding a defect recognition model based on an improved TS-Unet. The defect recognition model includes a CNN encoding module, a ConvTransBlock hybrid module, a linear projection module, a Transformer encoding module, a decoding module, a skip connection module, and a segmentation output module. The CNN encoding module extracts local texture features, edge features, and cutting edge morphology features from the milling cutter image. The ConvTransBlock hybrid module fuses local texture features with global semantic features. The linear projection module maps the deep features output by the CNN encoding module into a feature embedding sequence. The skip connection module fuses the upsampled features output by the decoding module with the shallow detail features output by the CNN encoding module. The Transformer encoding module performs global context modeling on the features output by the CNN encoding module. The decoding module upsamples and restores the features output by the Transformer encoding module. The segmentation output module outputs pixel-level defect segmentation results.
[0008] Preferably, the imaging optical axis of the camera is arranged at an angle of 60° to 120° with the central axis of the lens module.
[0009] Preferably, the lens module is fixed inside the frame by a connecting block, and a spacer is provided at the bottom of the lens module or at the connection point between the lens module and the connecting block to reduce the impact of vibration transmission on the image acquisition clarity.
[0010] Preferably, the base body has a base cover at its top and a mounting cavity for mounting components is formed inside the base body; a display window is embedded in the side wall of the base body and is electrically connected to the components in the mounting cavity.
[0011] Preferably, the bottom of the base body is provided with anti-slip pads, which are used to improve the stability of the device and reduce the impact of external vibration on the image acquisition process.
[0012] Preferably, the top of the rack is provided with a top cover to reduce the interference of stray light from the outside on image acquisition.
[0013] This invention also discloses a detection method for a computer vision-based milling cutter defect detection device, comprising the following steps: Place the milling cutter to be tested on the worktable, and ensure that the area of the milling cutter to be tested is within the effective field of view of the camera and lens module; Visible light images of the milling cutter surface to be detected are acquired through a dual-view collaborative acquisition structure formed by the camera and the lens module, wherein the first imaging channel formed by the lens module completes imaging through the lens module itself or an image sensor set in conjunction with it. The obtained visible light image is preprocessed to obtain a preprocessed image of the milling cutter to be detected; wherein the preprocessing includes at least one of image cropping, size normalization, brightness correction, noise reduction, reflection suppression and edge enhancement; The preprocessed milling cutter image is input into a defect recognition model based on the improved TS-Unet to obtain the recognition results of the surface defects of the milling cutter to be detected. Based on the identification results, determine the defect type, location, or severity on the milling cutter surface, and output the detection results; The system achieves automated detection of defects on the milling cutter surface through the collaborative acquisition of data by the camera and the lens module, as well as the recognition and processing by the defect recognition model.
[0014] Preferably, the working process of the defect recognition model includes: the deep features output by the CNN encoding module are mapped into a feature embedding sequence by the linear projection module and then input into the Transformer encoding module; the deep semantic features output by the Transformer encoding module are upsampled step by step by the decoding module and fused with the shallow detail features output by the CNN encoding module through skip connections; finally, the segmentation output module outputs pixel-level segmentation results; wherein, a ConvTransBlock hybrid module is set between the CNN encoding module and the Transformer encoding module, the ConvTransBlock hybrid module is located before the linear projection module or is set in conjunction with the linear projection module, and is used to fuse local texture features and global semantic features. Preferably, the training of the defect identification model includes the following steps: Obtain a dataset of milling cutter defect images; The milling cutter area and defect area in the milling cutter defect image are annotated at the pixel level based on the Labelme annotation platform. The annotation categories include at least one of slight wear, moderate wear, heavy wear, chipping, crack, notch and normal tool area. The labeled milling cutter defect images were divided into training, validation and test sets in a ratio of 7:2:1. The defect identification model is trained using the training set, and its segmentation accuracy, recall, Dice coefficient, or intersection-union ratio is tested and validated using the validation set and test set.
[0015] Preferably, the step of outputting the detection result includes: Based on the results of the milling cutter surface defect identification, calculate at least one of the following defect evaluation parameters: defect area, defect length, defect width, defect percentage, or defect location. The obtained defect evaluation parameters are compared with a preset defect threshold, which is preset according to the milling cutter model, material or machining conditions. When the defect evaluation parameters exceed the preset defect threshold, it is determined that the milling cutter under test has an abnormal defect, and alarm information is output through the display window, the audible and visual alarm module or the communication unit. When the defect evaluation parameters do not exceed the preset defect threshold, the milling cutter under test is determined to be in a normal state or a usable state, and a qualified prompt or a prompt to continue testing is output through the display window.
[0016] Compared with existing technologies, this invention has the following advantages and technical effects: This invention provides a computer vision-based milling cutter defect detection device that integrates a worktable, lens module, frame, and camera into the same detection structure. This allows the milling cutter to be inspected to be stably positioned within the imaging area of the lens module, thereby significantly improving the stability and repeatability of the image acquisition process and avoiding image quality degradation caused by device loosening or displacement. Employing a non-contact visible light imaging method, by setting the camera towards the worktable and arranging the camera's imaging optical axis at an angle to the central axis of the lens module, a dual-view collaborative acquisition structure is formed. This eliminates the need for close-range manual observation or contact measurement, efficiently acquiring visible light images of the milling cutter surface and reducing efficiency losses and safety risks associated with manual inspection. The device also integrates an image processing unit, which embeds a defect recognition model based on an improved TS-Unet. After preprocessing, the acquired visible light images are input into the improved TS-Unet-based defect recognition model. A CNN encoding module extracts local texture and edge features from the milling cutter image, while a Transformer encoding module performs global context modeling on the features output by the CNN module. This combines the sensitivity of CNN to local details with the Transformer's ability to model global semantic relationships, effectively addressing the challenges of recognizing complex areas of metal reflection, fine cracks, edge wear, and chipping on the milling cutter surface, significantly improving the accuracy and robustness of defect recognition. The defect recognition model also uses a decoding module to upsample and recover the features output by the Transformer encoding module, ultimately outputting pixel-level defect segmentation results. This not only determines whether defects exist on the milling cutter surface but also accurately locates the specific position of the defect area, calculates the defect area, and assesses the severity of the defect, providing a quantitative basis for subsequent quality assessment and maintenance decisions. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 This is a schematic diagram of the overall structure of the computer vision-based milling cutter defect detection device of the present invention; Figure 2 This is a 3D exploded view of the computer vision-based milling cutter defect detection device of the present invention; Figure 3 This is a schematic diagram of the detection method based on the TS-Unet network architecture of the present invention; Figure 4This is a flowchart of the computer vision-based milling cutter defect detection method of the present invention; Figure 5 This is a schematic diagram of the original acquired image of the computer vision-based milling cutter defect detection method of the present invention; Figure 6 This is a defect segmentation result diagram of the computer vision-based milling cutter defect detection method of the present invention; In the diagram: 1. Top cover; 2. Frame; 3. Lens module; 4. Connecting block; 5. Workbench; 6. Display window; 7. Base body; 8. Camera; 9. Fastening screws; 10. Spacer; 11. Base cover; 12. Anti-slip pads. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0020] Reference Figures 1 to 6 As shown, this embodiment provides a computer vision-based milling cutter defect detection device, including: The frame 2 has a lens module 3 inside, and a worktable 5 for placing the milling cutter to be tested is set in the imaging area of the lens module 3. The base body 7 and the worktable 5 are fixed on the base body 7. A camera 8 is installed inside the base body 7. The camera 8 faces the worktable 5. The lens module 3 and the camera 8 form the first imaging channel and the second imaging channel respectively. The imaging optical axis of the camera 8 is arranged at an angle to the central axis of the lens module 3, forming a dual-view collaborative acquisition structure. The device also includes an image processing unit, which is communicatively connected to the lens module 3 and the camera 8 to receive dual-view acquired images and has an embedded defect recognition model based on the improved TS-Unet. The defect recognition model includes a CNN encoding module, a ConvTransBlock hybrid module, a linear projection module, a Transformer encoding module, a decoding module, a skip connection module, and a segmentation output module. The CNN encoding module is used to extract local texture features, edge features, and cutting edge morphology features from the milling cutter image. The ConvTransBlock hybrid module is used to fuse local texture features with global semantic features. The linear projection module is used to map the deep features output by the CNN encoding module into a feature embedding sequence. The skip connection module is used to fuse the upsampled features output by the decoding module with the shallow detail features output by the CNN encoding module. The Transformer encoding module is used to perform global context modeling on the features output by the CNN encoding module. The decoding module is used to upsample and restore the features output by the Transformer encoding module. The segmentation output module is used to output pixel-level defect segmentation results.
[0021] This invention provides a computer vision-based milling cutter defect detection device. It integrates a worktable 5, a lens module 3, a frame 2, and a camera 8 into a single detection structure, enabling the milling cutter to be inspected to be stably positioned within the imaging area of the lens module 3. This significantly improves the stability and repeatability of the image acquisition process, avoiding image quality degradation caused by device loosening or displacement. Employing a non-contact visible light imaging method, the camera 8 is positioned facing the worktable 5, with its imaging optical axis at an angle to the central axis of the lens module 3, forming a dual-view collaborative acquisition structure. This eliminates the need for close-range manual observation or contact measurement, efficiently acquiring visible light images of the milling cutter surface and reducing efficiency losses and safety risks associated with manual inspection. The device also integrates an image processing unit, which embeds a defect recognition model based on an improved TS-Unet. After preprocessing, the acquired visible light images are input into the improved TS-Unet-based defect recognition model. A CNN encoding module extracts local texture and edge features from the milling cutter image, while a Transformer encoding module performs global context modeling on the features output by the CNN module. This combines the sensitivity of CNN to local details with the Transformer's ability to model global semantic relationships, effectively addressing the challenges of recognizing complex areas of metal reflection, fine cracks, edge wear, and chipping on the milling cutter surface, significantly improving the accuracy and robustness of defect recognition. The defect recognition model also uses a decoding module to upsample and recover the features output by the Transformer encoding module, ultimately outputting pixel-level defect segmentation results. This not only determines whether defects exist on the milling cutter surface but also accurately locates the specific position of the defect area, calculates the defect area, and assesses the severity of the defect, providing a quantitative basis for subsequent quality assessment and maintenance decisions.
[0022] In one embodiment of the present invention, the worktable 5 is provided with a positioning groove, a clamping member or a limiting member, which is used to keep the detection area of the milling cutter under test stable within the effective field of view and improve the detection efficiency.
[0023] To further optimize the design, the imaging optical axis of camera 8 is arranged at an angle of 60° to 120° with the central axis of lens module 3. This allows camera 8 and lens module 3 to form a collaborative acquisition structure with different imaging directions, enabling dual-view image acquisition of the cutting edge, tip, or side cutting edge area of the milling cutter under inspection, thereby improving the completeness and accuracy of milling cutter surface defect identification.
[0024] In one embodiment of the present invention, the imaging optical axis of the camera 8 is preferably 90° with the central axis of the lens module 3.
[0025] To further optimize the design, the lens module 3 is fixed inside the frame 2 via a connecting block 4. Spacer pads 10 are provided at the bottom of the lens module 3 or at the connection point between the lens module 3 and the connecting block 4 to reduce the impact of vibration transmission on image acquisition clarity. The lens module 3 is fixed inside the frame 2 via the connecting block 4 using fastening screws 9, forming a stable connection structure and improving the imaging quality during the inspection process. Equipment vibration is unavoidable in industrial environments; therefore, to improve vibration damping, spacer pads 10 are provided at the bottom of the lens module 3 or at its connection point with the connecting block 4. These spacer pads act as flexible buffer layers, effectively attenuating the vibration energy transmitted to the lens module 3, preventing image blurring or edge distortion, and ensuring clear and stable milling cutter surface images can be acquired even under vibration conditions.
[0026] The design is further optimized by installing a base cover 11 at the top of the base body 7, forming a mounting cavity within the base body 7 for installing components. A display window 6 is embedded in the side wall of the base body 7, and the display window 6 is electrically connected to the components within the mounting cavity. The base cover 11 at the top of the base body 7, with its internal mounting cavity for accommodating components such as control units and power supply units, and the embedded display window 6 in the side wall of the base body 7 electrically connected to the internal components, allows the device to display test results in real time without an external display. This improves the integration and portability of the equipment, facilitating flexible deployment and use in industrial settings.
[0027] In one embodiment of the present invention, at least one of a control unit, a power supply unit, an image processing unit, and a communication unit is installed in the mounting cavity; wherein, the power supply unit is used to provide working power to the camera 8, the lens module 3, the display window 6, and the image processing unit, and the image processing unit is used to perform defect identification processing on the acquired milling cutter surface image, thereby improving the integration level and automatic detection capability of the milling cutter defect detection device.
[0028] In one embodiment of the present invention, the image processing unit may be disposed within the local base body 7, or it may be connected to an edge computing device or a remote server via a communication unit.
[0029] In one embodiment of the present invention, a display window 6 is embedded on the surface of the base body 7 and is used to display at least one of the following in real time during the detection process: the acquired image of the milling cutter to be detected, the defect location, the defect type, the defect degree, the detection status, or the alarm information, so as to realize real-time feedback of the detection results.
[0030] To further optimize the design, anti-slip pads 12 are installed on the bottom of the base body 7. These pads improve the stability of the device and reduce the impact of external vibrations on the image acquisition process. The anti-slip pads 12 on the bottom of the base body 7 increase the friction between the device and the placement surface, preventing the device from sliding due to external force or vibration during the detection process. This ensures the relative position of the camera 8 and the worktable 5 remains stable, avoiding image acquisition deviations and repetitive positioning errors caused by device movement.
[0031] To further optimize the design, a top cover 1 is installed on the top of the rack 2 to reduce interference from stray light on image acquisition. The top cover 1 is fixed to the top of the rack 2, so that the top cover 1 and the rack 2 form a relatively stable imaging space that at least partially blocks light, thereby reducing the impact of stray light, dust and mechanical collisions on the detection results.
[0032] This invention also discloses a detection method for a computer vision-based milling cutter defect detection device, comprising the following steps: Place the milling cutter to be tested on the worktable 5, and ensure that the area of the milling cutter to be tested is within the effective field of view of the camera 8 and the lens module 3. Visible light images of the milling cutter surface to be detected are acquired through a dual-view collaborative acquisition structure formed by camera 8 and lens module 3. The first imaging channel formed by the lens module completes imaging through the lens module itself or an image sensor set in cooperation with it. The acquired visible light image is preprocessed to obtain a preprocessed image of the milling cutter to be detected; wherein, at least one of the following processes is performed on the acquired image: cropping, size normalization, brightness correction, noise reduction, reflection suppression, and edge enhancement to obtain a preprocessed image.
[0033] The preprocessed milling cutter image is input into a defect recognition model based on the improved TS-Unet to obtain the recognition results of the surface defects of the milling cutter to be detected. Based on the identification results, determine the defect type, location, or severity on the milling cutter surface, and output the detection results; Among them, the automated detection of defects on the surface of the milling cutter is achieved through the collaborative acquisition of data by camera 8 and lens module 3 and the recognition and processing of the defect recognition model.
[0034] Further optimization of the scheme: The defect recognition model's working process includes: deep features output by the CNN encoding module are mapped into feature embedding sequences by the linear projection module and then input into the Transformer encoding module; deep semantic features output by the Transformer encoding module are upsampled step by step by the decoding module and fused with shallow detail features output by the CNN encoding module through skip connections; finally, the segmentation output module outputs pixel-level segmentation results; wherein, a ConvTransBlock hybrid module is set between the CNN encoding module and the Transformer encoding module, the ConvTransBlock hybrid module is located before the linear projection module or is set in conjunction with the linear projection module, and is used to fuse local texture features and global semantic features. The defect recognition model includes an input module, a CNN encoding module, a ConvTransBlock hybrid module, and a Transformer encoding module. The system comprises an RMER encoding module, a linear projection module, a decoding module, a skip connection module, and a segmentation output module. The CNN encoding module extracts local texture features, edge features, and cutting edge morphology features from the milling cutter image. The linear projection module maps the deep features output by the CNN encoding module into a feature embedding sequence. The Transformer encoding module models the global contextual relationships in the feature embedding sequence using a multi-head self-attention mechanism and enhances the nonlinear feature representation capability through a multilayer perceptron. The decoding module upsamples the deep semantic features output by the Transformer encoding module stepwise. The skip connection module fuses the upsampled features output by the decoding module with the shallow detail features output by the CNN encoding module. The segmentation output module outputs pixel-level segmentation results for the defect areas on the milling cutter surface, improving the recognition accuracy of small defects, edge defects, and complex reflective defects on the milling cutter surface.
[0035] In one embodiment of the present invention, the specific steps for improving the defect identification model of TS-Unet are as follows: 1. Input data is an image or feature map. The input can be a preprocessed image or a feature map taken from real-world data. Input image example: in, Input the number of channels. and These represent the height and width of the input image, respectively.
[0036] 2. The input image first enters the encoder module. The encoder consists of multiple convolutional and pooling layers, and its main function is to extract local features of the image layer by layer and gradually expand the receptive field. Taking two-dimensional convolution as an example, the convolution operation can be represented as: in: Input image; For convolution kernel; , The kernel size; These are the output feature values after convolution.
[0037] The size of the output of a convolutional layer is typically determined by the following formula: In equation (4), the width output should use W_in as the input width parameter, i.e., W_out=(W_in-K_w+2P) / S+1.
[0038] in: These are the height and width of the input feature map; , These are the height and width of the convolution kernel; , These represent the height and width of the output feature map; P indicates padding; S indicates stride.
[0039] Convolutional outputs are typically non-linearly mapped using activation functions. In TS-Unet, the CNN portion usually employs the ReLU activation function. Through multi-layer convolution and downsampling, the network can gradually extract edge, texture and local structural information in the image.
[0040] 3. In the encoding stage, the input image undergoes multiple convolutional blocks and downsampling operations to obtain feature maps at different scales. Let the output features of the l-th layer be: in, =X.
[0041] The downsampling process can be represented as: 4. Unlike the traditional U-Net, TS-Unet further maps the deep feature maps extracted by the CNN into sequence representations for input into the Transformer module.
[0042] Let the deep feature map be The total number of its spatial locations is: Flattening it yields the sequence features: Then, each token is mapped to a D-dimensional embedding space using linear projection, and positional encoding is added to obtain the input sequence: in: It is a linear projection matrix; For position encoding; The input is the embedding sequence of the Transformer.
[0043] 5. The embedded sequence then enters multiple TransformerLayers. Each encoding block consists of LayerNormalization LN + Multi-Head Self-Attention MSA + residual connections + LayerNormalization + MLP + residual connections, consistent with the structure on the left side of the figure.
[0044] The input sequence is normalized using the following expression: in, and These are the mean and variance, respectively. , These are learnable parameters.
[0045] Let the normalized input be Then the query, key, and value matrices are respectively: Single-head self-attention can be represented as: in, The dimension of the key vector.
[0046] If m attention heads are used, the multi-head self-attention output is: in, = , This is for outputting the projection matrix.
[0047] The first residual output of the Transformer's l-th layer is: Then we proceed to the MLP module. An MLP typically consists of two fully connected layers and an activation function. in, The GELU activation function is typically used.
[0048] The second residual output is: If the number of Transformer layers is n, the final output will be: 6. After multi-layer Transformer encoding, the output sequence is rearranged into a two-dimensional feature map for feature fusion with the U-shaped decoder.
[0049] here, This is a deep semantic feature map of the Transformer encoder, containing richer global contextual information.
[0050] 7. In the decoding stage, TS-Unet adopts a step-by-step upsampling structure similar to U-Net. First, the Transformer output features are upsampled: Then compared with the feature map of the corresponding scale in the encoder. To splice: After splicing, further fusion is achieved through convolutional blocks: Continue with upsampling and skip connections at each level: This process achieves high-resolution segmentation feature recovery by fusing shallow detail information with deep global semantic information.
[0051] 8. There are two feature maps to be spliced: After splicing along the channel dimension, we get: The concatenated feature dimensions are: In TS-Unet, the Concat operation is mainly used to fuse the shallow features output by the encoder with the upsampled features by the decoder to enhance the ability to recover boundary details and spatial structure.
[0052] 9. TS-Unet's output is not bounding box coordinates and class confidence, but rather the class label for each pixel. Therefore, its Head should be set to the Segmentation Head.
[0053] The segmentation head typically uses a 1×1 convolution to map features to the class space: in, To output the response graph.
[0054] For multi-class segmentation tasks, the Softmax function is used to obtain the probability that each pixel belongs to the k-th class: in, This represents the total number of categories.
[0055] For binary classification tasks, the Sigmoid function is used: The final output segmentation result is: 10. Since TS-Unet is an image segmentation network, its optimization goal is to improve pixel-level classification accuracy, rather than bounding box regression accuracy. Therefore, the loss function is usually cross-entropy loss, Dice loss, or a combination of both.
[0056] Cross-entropy loss: in, For pixels The actual category label is displayed.
[0057] The Dice coefficient is defined as: The corresponding Dice loss is: The final loss function is usually expressed as: in, and These are the weighting coefficients.
[0058] Further optimization of the scheme involves the following steps in training the defect identification model: Obtain a dataset of milling cutter defect images; The Labelme annotation platform is used to perform pixel-level annotations on the milling cutter area and defect area in the milling cutter defect image. The annotation categories include at least one of the following: slight wear, moderate wear, heavy wear, chipping, crack, notch, and normal tool area. The labeled milling cutter defect images were divided into training, validation and test sets in a ratio of 7:2:1. The defect identification model is trained using the training set, and the identification accuracy of the model is tested and verified using the validation set and the test set.
[0059] Further optimization of the scheme and output of detection results include the following steps: Based on the results of the milling cutter surface defect identification, calculate at least one of the following defect evaluation parameters: defect area, defect length, defect width, defect percentage, or defect location. The obtained defect evaluation parameters are compared with the preset defect thresholds; When the defect evaluation parameters exceed the preset defect threshold, it is determined that the milling cutter under test has an abnormal defect, and alarm information is output through display window 6, audible and visual alarm module or communication unit; When the defect evaluation parameters do not exceed the preset defect threshold, the milling cutter under test is determined to be in a normal state or a state that can continue to be used, and a qualified prompt or a prompt to continue testing is output through the display window 6.
[0060] In one embodiment of the invention, the defect category may include at least one of slight wear, moderate wear, heavy wear, chipping, cracks, notches, scratches, and normal areas.
[0061] In one embodiment of the present invention, the present invention can improve the stability of defect identification, location and severity assessment in scenarios with significant differences in milling cutter surface reflection, cutting edge curvature and defect size.
[0062] In the description of this invention, it should be understood that the terms "longitudinal", "lateral", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this invention, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.
[0063] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A computer vision based cutter defect detection apparatus, characterized by, include: A frame (2) is provided inside the frame (2), and a lens module (3) is provided in the imaging area of the lens module (3) for placing the milling cutter to be tested. The base body (7) is fixed on the base body (7). A camera (8) is installed inside the base body (7). The camera (8) faces the worktable (5). The lens module (3) and the camera (8) form a first imaging channel and a second imaging channel, respectively. The imaging optical axis of the camera (8) is arranged at an angle to the central axis of the lens module (3), forming a dual-view collaborative acquisition structure. The device also includes an image processing unit, which is communicatively connected to the lens module (3) and the camera (8) to receive dual-view acquired images and has an embedded defect recognition model based on the improved TS-Unet. The defect recognition model includes a CNN encoding module, a ConvTransBlock hybrid module, a linear projection module, a Transformer encoding module, a decoding module, a skip connection module, and a segmentation output module. The CNN encoding module extracts local texture features, edge features, and cutting edge morphology features from the milling cutter image. The ConvTransBlock hybrid module fuses local texture features with global semantic features. The linear projection module maps the deep features output by the CNN encoding module into a feature embedding sequence. The skip connection module fuses the upsampled features output by the decoding module with the shallow detail features output by the CNN encoding module. The Transformer encoding module performs global context modeling on the features output by the CNN encoding module. The decoding module upsamples and restores the features output by the Transformer encoding module. The segmentation output module outputs pixel-level defect segmentation results.
2. The computer vision based cutter defect detection apparatus of claim 1, wherein: The imaging optical axis of the camera (8) is arranged at an angle of 60° to 120° with the central axis of the lens module (3).
3. The computer vision based cutter defect detection apparatus of claim 2, wherein: The lens module (3) is fixed inside the frame (2) by a connecting block (4). A spacer (10) is provided at the bottom of the lens module (3) or at the connection between the lens module (3) and the connecting block (4) to reduce the impact of vibration transmission on the image acquisition clarity.
4. The computer vision based cutter defect detection apparatus of claim 1, wherein: The base body (7) is provided with a base cover (11) at the top, and an installation cavity for installing components is formed in the base body (7); a display window (6) is embedded in the side wall of the base body (7), and the display window (6) is electrically connected to the components in the installation cavity.
5. The computer vision based cutter defect detection apparatus as claimed in claim 1, wherein: The base body (7) is provided with anti-slip pads (12) at the bottom. The anti-slip pads (12) are used to improve the stability of the device and reduce the impact of external vibration on the image acquisition process.
6. The computer vision based cutter defect detection apparatus of claim 1, wherein: The top of the rack (2) is provided with a top cover (1) to reduce the interference of external stray light on image acquisition.
7. A computer vision based milling tool defect detection method based on the computer vision based milling tool defect detection apparatus of any of claims 1-6, characterized in that, Includes the following steps: Place the milling cutter to be tested on the worktable (5) and ensure that the area to be tested of the milling cutter is within the effective field of view of the camera (8) and the lens module (3); The visible light image of the milling cutter surface to be detected is acquired by the dual-view collaborative acquisition structure formed by the camera (8) and the lens module (3), wherein the first imaging channel formed by the lens module completes the imaging through the lens module itself or the image sensor set in cooperation with it. The obtained visible light image is preprocessed to obtain a preprocessed image of the milling cutter to be detected, wherein the preprocessing includes at least one of image cropping, size normalization, brightness correction, noise reduction, reflection suppression and edge enhancement; The preprocessed milling cutter image is input into the defect recognition model based on the improved TS-Unet to obtain the recognition results of the surface defects of the milling cutter to be detected; Based on the identification results, determine the defect type, location, or severity on the milling cutter surface, and output the detection results; The automatic detection of defects on the surface of the milling cutter is achieved through the collaborative acquisition of the camera (8) and the lens module (3) and the recognition processing of the defect recognition model.
8. The milling cutter defect detection method based on computer vision according to claim 7, characterized in that: The defect recognition model operates as follows: deep features output by the CNN encoding module are mapped into feature embedding sequences by the linear projection module and then input into the Transformer encoding module; deep semantic features output by the Transformer encoding module are upsampled step by step by the decoding module and fused with shallow detail features output by the CNN encoding module through skip connections; finally, the segmentation output module outputs pixel-level segmentation results; wherein, a ConvTransBlock hybrid module is set between the CNN encoding module and the Transformer encoding module, and the ConvTransBlock hybrid module is located before the linear projection module or set in conjunction with the linear projection module to fuse local texture features and global semantic features.
9. The milling cutter defect detection method based on computer vision according to claim 7, characterized in that: The training of the defect identification model includes the following steps: Obtain a dataset of milling cutter defect images; The milling cutter area and defect area in the milling cutter defect image are annotated at the pixel level based on the Labelme annotation platform. The annotation categories include at least one of slight wear, moderate wear, heavy wear, chipping, crack, notch and normal tool area. The labeled milling cutter defect images were divided into training, validation and test sets in a ratio of 7:2:
1. The defect identification model is trained using the training set, and its segmentation accuracy, recall, Dice coefficient, or intersection-union ratio is tested and validated using the validation set and test set.
10. The computer vision-based milling cutter defect detection method according to claim 7, characterized in that: The steps for outputting the detection results include: Based on the results of the milling cutter surface defect identification, calculate at least one of the following defect evaluation parameters: defect area, defect length, defect width, defect percentage, or defect location. The obtained defect evaluation parameters are compared with a preset defect threshold, which is preset according to the milling cutter model, material or machining conditions. When the defect evaluation parameters exceed the preset defect threshold, it is determined that the milling cutter under test has an abnormal defect, and alarm information is output through the display window (6), the sound and light alarm module or the communication unit. When the defect evaluation parameters do not exceed the preset defect threshold, the milling cutter to be tested is determined to be in a normal state or a state that can continue to be used, and a qualified prompt or a prompt to continue testing is output through the display window (6).