A two-stage tool surface defect detection method and system
By employing a two-stage tool surface defect detection method that combines Radon transform, edge structure features, and a lightweight twin transform detection network, the problems of model complexity and environmental influence in existing technologies are solved, achieving efficient and reliable tool surface defect detection.
Patent Information
- Application Number
- CN202411877675.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-12-19
AI Technical Summary
Existing technologies rely on large amounts of labeled data, have complex models and high computational costs, poor interpretability and low generalization performance, and are easily affected by the environment, resulting in low accuracy, poor reliability and limited efficiency in tool surface defect detection.
A two-stage tool surface defect detection method is adopted. First, Radon transform and edge structure feature fusion are used to perform coarse localization using residual network and support vector machine. Then, a lightweight twin transform detection network is used for accurate segmentation, which reduces the need for massive labeled samples and enhances the interpretability and robustness of the model.
It improves the accuracy, reliability, and efficiency of tool surface defect detection, reduces data acquisition and annotation costs, enhances the model's generalization performance and robustness, and is suitable for diverse detection scenarios.
Smart Images

Figure CN120031791B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a two-stage tool surface defect detection method and system. BACKGROUND
[0002] Tool surface defect detection is an important link to ensure tool performance and machining quality, which aims to identify cracks, chipping, wear, coating peeling and other problems generated during tool use or production. However, due to the complexity of tool surface, the variety of defect types and the small size, combined with the high reflectivity and curved surface of the tool, the detection process faces significant difficulties, including the diversity and irregularity of defect features, and the influence of external light and environmental noise.
[0003] Traditional detection methods mainly include manual detection and contact detection, among which manual detection relies on the experience of skilled workers, and identifies defects through visual inspection or simple instruments. Although the cost is low, the efficiency is low, the subjectivity is strong, and it is difficult to ensure consistency; the contact detection method uses probe measurement or hardness tester detection, which improves the accuracy to a certain extent, but may cause damage to the tool surface, and cannot meet the needs of complex curved surface and batch detection.
[0004] In order to overcome the limitations of traditional methods, in recent years, non-contact automatic detection technology has been widely applied and rapidly developed. Existing non-contact automatic detection technology includes: computer vision-based detection technology, which can identify common defects on the tool surface through high-resolution image acquisition, edge detection and texture analysis; laser scanning technology, which realizes high-precision surface topography detection through three-dimensional modeling, especially suitable for analysis of complex-shaped tools; ultrasonic and acoustic emission technology, which detects deep cracks or internal defects by signal analysis; infrared thermal imaging technology, which reveals hidden defects by monitoring surface temperature distribution; multi-sensor fusion technology, which integrates features by using fusion algorithm through combining vision, laser, infrared and other means, realizing high-precision, multi-angle defect analysis; artificial intelligence technology, which trains and learns the relationship between features and defects of preprocessed tool images through deep learning model (such as CNN), and then uses the trained model to detect new images to judge defects.
[0005] In recent years, artificial intelligence technology based on deep learning convolutional neural network (CNN) and target detection algorithm (such as YOLO, Faster R-CNN) has been widely applied in defect detection, which has significantly improved the automation level and precision of detection. However, this technology relies on a large amount of labeled data, has high model complexity and high calculation cost, poor interpretability and low generalization performance, and is easily affected by the environment, with poor robustness, resulting in low accuracy and poor reliability of tool surface defect detection and limited efficiency. SUMMARY
[0006] To this end, the technical problem to be solved by the present application is to overcome the dependence on a large amount of labeled data, high computational cost of complex models, poor interpretability, low generalization performance, and poor robustness in the prior art, resulting in low accuracy, poor reliability, and limited efficiency of tool surface defect detection.
[0007] To solve the above technical problems, the present application provides a two-stage tool surface defect detection method, comprising:
[0008] Obtain multiple tool surface channel images, perform a grayscale operation on each tool surface channel image to obtain a tool surface grayscale image, perform a posture correction operation on each tool surface grayscale image to obtain a tool surface corrected grayscale image, perform a cropping operation on each tool surface corrected grayscale image according to a preset size to obtain multiple sub-images corresponding to each tool surface corrected grayscale image, and sequentially label each sub-image corresponding to each tool surface corrected grayscale image according to a cropping order to obtain a number of each sub-image corresponding to each tool surface corrected grayscale image.
[0009] Extract Radon domain features of each sub-image corresponding to the tool surface corrected grayscale image using Radon transformation, and use the Radon domain features to label a Radon real label of each sub-image corresponding to the tool surface corrected grayscale image; construct a Radon training set based on each sub-image corresponding to each tool surface corrected grayscale image and the Radon real label thereof; and train a residual network using the Radon training set to obtain a trained residual network for outputting a first predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image.
[0010] Extract edge structure features of each sub-image corresponding to the tool surface corrected grayscale image using edge structure operator convolution, and use the edge structure features to label an edge real label of each sub-image corresponding to the tool surface corrected grayscale image; construct an edge structure feature dataset based on each sub-image corresponding to each tool surface corrected grayscale image and the edge real label thereof; and train a support vector machine using the edge structure feature dataset to obtain a trained support vector machine for outputting a second predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image.
[0011] Weighted average the first predicted defect probability value and the second predicted defect probability value of each sub-image corresponding to each tool surface corrected grayscale image to obtain a fusion defect probability value of each sub-image corresponding to each tool surface corrected grayscale image.
[0012] Sub-images with a fusion defect probability value greater than or equal to a threshold value are regarded as abnormal sub-images.
[0013] The sub-images corresponding to the same number of each tool surface correction gray image are divided into a group to obtain sub-image groups of different numbers; according to the number of the abnormal sub-image, a normal sub-image in the sub-image group corresponding to the abnormal sub-image is found to form a defect pair of the abnormal sub-image, and defect pairs of all abnormal sub-images are sequentially obtained to form a defect pair dataset; the defect pair dataset is used to train a twin transformation detection network to obtain a trained twin transformation detection network for detecting feature information and segmentation results of the defect region in each abnormal sub-image.
[0014] Preferably, the twin transformation detection network comprises an input layer, two weight-shared convolution layers, a transformation layer and an output layer; wherein the two weight-shared sub-networks each comprise a shared convolution layer and a feature vector output layer;
[0015] The input layer is used for inputting the defect pairs of all abnormal sub-images, and outputting normal sub-images and abnormal sub-images of all image pairs;
[0016] The first weight-shared convolution layer is composed of two convolution kernels with a size of 3, one convolution kernel with a size of 8 and one convolution kernel with a size of 12, and is used for extracting features of the normal sub-image of each defect pair, and outputting a feature vector of the normal sub-image of each defect pair;
[0017] The second weight-shared convolution layer is composed of two convolution kernels with a size of 3, one convolution kernel with a size of 8 and one convolution kernel with a size of 12, and is used for extracting features of the abnormal sub-image of each defect pair, and outputting a feature vector of the abnormal sub-image of each defect pair; wherein the normal sub-image of each defect pair is input into the first shared convolution layer at the same time, and the abnormal sub-image of the image pair is input into the second shared convolution layer;
[0018] The transformation layer is composed of 3 convolution stacks, and is used for feature alignment of the feature vector of the normal sub-image of each defect pair and the feature vector of the abnormal sub-image of the image pair, and outputs a transformation matrix corresponding to each defect pair;
[0019] The output layer is used for outputting feature information and segmentation results of the defect region in each abnormal sub-image according to the transformation matrix corresponding to each defect pair.
[0020] Preferably, the gray-scale operation is performed on the tool surface channel image to obtain a tool surface gray image, which comprises:
[0021] The tool surface channel image is collected by a CCD line array camera; a gray-scale mathematical model is constructed according to the weighted average method combined with the weight corresponding to each channel, and the expression is:
[0022] ;
[0023] wherein, represents a gray value of the i-th pixel point in the gray image of the tool surface; represents a weight corresponding to a red channel in the channel image of the tool surface; represents a component value of the red channel of the i-th pixel point in the channel image of the tool surface; represents a weight corresponding to a green channel in the channel image of the tool surface; represents a component value of the green channel of the i-th pixel point in the channel image of the tool surface; represents a weight corresponding to a blue channel in the channel image of the tool surface; represents a component value of the blue channel of the i-th pixel point in the channel image of the tool surface;
[0024] According to the gray mathematical model, the channel image of the tool surface is subjected to a gray operation to obtain a gray image of the tool surface.
[0025] Preferably, the gray image of the tool surface is subjected to a posture correction operation to obtain a corrected gray image of the tool surface, which comprises:
[0026] A vertical reference line is determined through the center point of the gray image of the tool surface; an angle bisector of the tool is obtained based on a line connecting the center point of the gray image of the tool surface and the top corner of the tool; and an included angle between the angle bisector of the tool and the reference line is taken as a rotation angle;
[0027] Based on the coordinates of each pixel point in the gray image of the tool surface and the rotation angle, a posture correction mathematical model is constructed, and the expression thereof is:
[0028] ;
[0029] wherein, represents a corrected horizontal coordinate component of the i-th pixel point in the gray image of the tool surface; represents a corrected vertical coordinate component of the i-th pixel point in the gray image of the tool surface; represents a horizontal coordinate component of the i-th pixel point in the gray image of the tool surface; represents a vertical coordinate component of the i-th pixel point in the gray image of the tool surface; represents an angle of the rotation angle;
[0030] Based on the attitude correction mathematical model, attitude correction operation is performed on the grayscale image of the tool surface to obtain the corrected horizontal and vertical coordinate components of each pixel in the grayscale image of the tool surface; based on the corrected horizontal and vertical coordinate components of each pixel in the grayscale image of the tool surface, the corrected grayscale image of the tool surface is obtained.
[0031] Preferably, the step of using edge structure operator convolution to extract the edge structure features of each sub-image corresponding to each tool surface correction grayscale image includes:
[0032] The edge structure operator convolution includes HOG operator convolution and LBP operator convolution;
[0033] Using HOG operator convolution, the HOG operator feature matrix of each sub-image corresponding to each tool surface correction grayscale image is obtained; using LBP operator convolution, the LBP operator feature matrix of each sub-image corresponding to each tool surface correction grayscale image is obtained; by matrix concatenation, the HOG operator feature matrix and LBP operator feature matrix of each sub-image corresponding to each tool surface correction grayscale image are fused to obtain the edge structure feature matrix of each sub-image corresponding to each tool surface correction grayscale image.
[0034] Preferably, the residual network loss function is the cross-entropy loss function, whose expression is:
[0035] ;
[0036] in, Represents the residual network loss function; This indicates the number of grayscale images for all tool surface corrections; This indicates the number of all sub-images corresponding to each grayscale image of tool surface correction; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The Radon true label of Zhang Zi's image, if This indicates that the sub-image is defect-free. This indicates that the sub-image has a defect; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The first predicted defect probability value of the Zhangzi image.
[0037] Preferably, the loss function for training the support vector machine includes: the hinge loss function in the training stage of the standard support vector machine classifier and the cross-entropy loss function in the training stage of the logistic regression.
[0038] The expression for the hinge loss function in the training standard support vector machine classifier stage is as follows:
[0039] ;
[0040] in, This represents the hinge loss function during the training phase of the standard support vector machine classifier. Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The true edge label of the Zhangzi image, if This indicates that the sub-image is defect-free. This indicates that the sub-image has a defect; Represents the decision function; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... Zhang Zi's image;
[0041] The expression for the cross-entropy loss function in the logistic regression training phase is as follows:
[0042] ;
[0043] in, This represents the cross-entropy loss function during the logistic regression training phase. This indicates the number of grayscale images for all tool surface corrections; This indicates the number of all sub-images corresponding to each grayscale image of tool surface correction; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The true edge label of the Zhangzi image, if This indicates that the sub-image is defect-free. This indicates that the sub-image has a defect; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The second predicted defect probability value of the Zhangzi image.
[0044] Preferably, the loss function of the twin transform detection network is a contrastive loss function, the expression of which is:
[0045] ;
[0046] in, This represents the loss function of the twin transform detection network; Indicates the number of all image pairs; Indicates the first A distance metric between the feature vectors of the normal sub-image and the feature vectors of the abnormal sub-image in a defect pair. ; Indicates the first Feature vectors of normal sub-images in a defect pair; represents the feature vector of the abnormal sub-image of the first defect pair; represents the label of the first defect pair, if represents that the image pair is a similar sample, if the image pair is an unlike sample; represents the boundary threshold value.
[0047] Preferably, the feature information and segmentation result of the defect area corresponding to the tool surface channel image to be detected are obtained by acquiring the tool surface channel image to be detected, and obtaining the feature information and segmentation result of the defect area corresponding to the tool surface channel image to be detected includes:
[0048] acquiring the tool surface channel image to be detected; sequentially performing grayscale, posture correction, cropping operation and labeling operation on the tool surface channel image to be detected, to obtain each sub-image corresponding to the tool surface corrected grayscale image to be detected and the number thereof;
[0049] inputting each sub-image corresponding to the tool surface corrected grayscale image to be detected into the trained residual network, to output the first predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image to be detected;
[0050] inputting each sub-image corresponding to the tool surface corrected grayscale image to be detected into the trained support vector machine, to output the second predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image to be detected;
[0051] performing weighted average on the first predicted defect probability value and the second predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image to be detected, to obtain the fusion defect probability value of each sub-image corresponding to the tool surface corrected grayscale image to be detected;
[0052] taking the sub-image with the fusion defect probability value greater than or equal to the threshold value as an abnormal sub-image;
[0053] acquiring a normal tool surface sub-image set, finding the normal sub-image with the same number as the abnormal sub-image in the normal tool surface sub-image set according to the number of each abnormal sub-image, and constructing the defect pair of the abnormal sub-image and the normal sub-image with the same number as the abnormal sub-image, to sequentially obtain the defect pairs of all abnormal sub-images;
[0054] inputting the defect pairs of all abnormal sub-images into the trained twin transformation detection network, to output the feature information and segmentation result of the defect area in each abnormal sub-image, and further obtain the feature information and segmentation result of the defect area corresponding to the tool surface channel image to be detected.
[0055] The application also provides a two-stage tool surface defect detection system, which comprises:
[0056] The image labeling module: obtains multiple tool surface channel images, performs a grayscale operation on each tool surface channel image to obtain a tool surface grayscale image, performs a posture correction operation on each tool surface grayscale image to obtain a tool surface corrected grayscale image, performs a cropping operation on each tool surface corrected grayscale image according to a preset size to obtain multiple sub-images corresponding to each tool surface corrected grayscale image, and sequentially labels each sub-image corresponding to each tool surface corrected grayscale image according to a cropping sequence to obtain a number of each sub-image corresponding to each tool surface corrected grayscale image.
[0057] The first detection module: extracts a Radon domain feature of each sub-image corresponding to each tool surface corrected grayscale image by using Radon transformation, labels a defect result of each sub-image corresponding to each tool surface corrected grayscale image based on the Radon domain feature of each sub-image, constructs a Radon training set based on each sub-image corresponding to each tool surface corrected grayscale image and the defect result thereof, and trains a residual network by using the Radon training set to obtain a trained residual network for outputting a first probability value of the presence of a defect in each sub-image corresponding to the tool surface corrected grayscale image.
[0058] The second detection module: extracts an edge structure feature of each sub-image corresponding to each tool surface corrected grayscale image by using edge structure operator convolution, labels a defect result of each sub-image corresponding to each tool surface corrected grayscale image based on the edge structure feature of each sub-image, constructs an edge structure feature data set based on each sub-image corresponding to each tool surface corrected grayscale image and the defect result thereof, and trains a support vector machine by using the edge structure feature data set to obtain a trained residual network for outputting a second probability value of the presence of a defect in each sub-image corresponding to the tool surface corrected grayscale image.
[0059] The fusion detection module: performs a weighted average on the first probability value and the second probability value of the presence of a defect in each sub-image corresponding to each tool surface corrected grayscale image to obtain a third probability value of the presence of a defect in each sub-image corresponding to each tool surface corrected grayscale image.
[0060] The abnormal sub-image determination module: takes a sub-image with a third probability value greater than or equal to a threshold value as an abnormal sub-image.
[0061] The defect feature detection module: each tool surface correction grayscale image corresponding to the same number of sub-images is divided into a group, different number of sub-image groups are obtained; according to the number of abnormal sub-images, a normal sub-image is found in the sub-image group corresponding to the abnormal sub-image, a defect pair of the abnormal sub-image is formed, and the defect pairs of all abnormal sub-images are obtained in turn, and a defect pair dataset is formed; the defect pair dataset is used to train the twin transformation detection network, and a trained twin transformation detection network is obtained, which is used to detect the feature information of the defect area in each abnormal sub-image.
[0062] The above technical scheme of the present application has the following beneficial effects compared with the prior art:
[0063] The two-stage tool surface defect detection method provided by the present application processes all tool surface grayscale images through the posture correction link, ensures the standardized processing of each tool surface grayscale image, and lays a foundation for improving the generalization performance of the tool surface defect detection model in the subsequent stage; the tool surface defect detection process is divided into two stages: in the first stage, a classification model is designed based on the fusion of Radon domain features and edge structure features, residual network and support vector machine are used for coarse positioning of abnormal areas; in this stage, Radon transformation and edge structure operator convolution operation are used to respectively mine the intrinsic features of the image, reduce the demand for a large number of labeled samples, so as to realize effective preliminary screening and positioning of the defect area in the case of few samples, reduce the data acquisition and labeling cost and workload, and improve the detection efficiency, which has a significant advantage in the data scarce scene; at the same time, the Radon domain features and the edge structure features increase the interpretability of the model; in addition, the residual network and the support vector machine can extract deep semantic features while avoiding excessive complex structure, reducing the model calculation cost; in the second stage, the difference information between the normal image and the abnormal image in each defect pair is learned based on the designed lightweight twin transformation detection network, and the defect area in the abnormal image is accurately segmented; in this stage, the twin transformation detection network focuses on the difference between the image pair, efficiently mines the defect features from a relatively small amount of data, relieves the data labeling pressure and cost, effectively controls the parameter quantity and the calculation complexity, improves the running speed of the twin transformation detection network, and enhances the interpretability of the twin transformation detection network; at the same time, the range of environmental noise influence is reduced in the process of screening abnormal images, the commonality is weakened and the defect characteristics are highlighted when learning the diversity feature of the image pair, the robustness and generalization of the twin transformation detection network are enhanced, and the tool surface defect detection accuracy, reliability and efficiency are improved. BRIEF DESCRIPTION OF DRAWINGS
[0064] In order to make the content of the present application more easily understood, the present application will be further described in detail below according to specific embodiments of the present application and in conjunction with the drawings, in which:
[0065] Figure 1 is a flow chart of a two-stage tool surface defect detection method provided by the present application;
[0066] Figure 2 is a pose correction schematic diagram of a tool image;
[0067] Figure 3 is a clipping process schematic diagram of a tool image;
[0068] Figure 4 is a Radon transform schematic diagram of a tool image;
[0069] Figure 5 is a ResNet network structure configuration schematic diagram;
[0070] Figure 6 is a classification process schematic diagram of a tool image;
[0071] Figure 7 is a defect pair data schematic diagram of a tool image; wherein, Figure 7 (a) in (a) represents a normal sub-image; Figure 7 (b) in (b) represents an abnormal sub-image;
[0072] Figure 8 is a schematic diagram of a twin transformation detection network and segmentation result;
[0073] Figure 9 is a schematic diagram of a two-stage tool surface defect detection system provided by the present application. DETAILED DESCRIPTION
[0074] The present application will be further described below in conjunction with the drawings and specific embodiments, so that those skilled in the art can better understand the present application and implement it, but the embodiments are not limiting to the present application.
[0075] Referring to Figure 1 , as shown in Figure 1 is a flow chart of a two-stage tool surface defect detection method provided by the present application; specifically comprising:
[0076] S1: acquiring multiple tool surface channel images, performing a gray-scale operation on each tool surface channel image to obtain each tool surface gray-scale image; performing a pose correction operation on each tool surface gray-scale image to obtain a tool surface corrected gray-scale image; performing a clipping operation on each tool surface corrected gray-scale image according to a preset size to obtain multiple sub-images corresponding to each tool surface corrected gray-scale image; sequentially labeling each sub-image corresponding to each tool surface corrected gray-scale image according to a clipping order to obtain a number of each sub-image corresponding to each tool surface corrected gray-scale image;
[0077] Wherein, the tool surface channel image is subjected to a gray-scale operation to obtain a tool surface gray-scale image, comprising:
[0078] A CCD line array camera is used to collect the tool surface channel image; a gray-scale mathematical model is constructed according to the weighted average method and in combination with the weight corresponding to each channel, and the expression is:
[0079] ;
[0080] Wherein, represents the gray-scale value of the i-th pixel point in the tool surface gray-scale image; represents the weight corresponding to the red channel in the tool surface channel image; represents the component value of the red channel of the i-th pixel point in the tool surface channel image; represents the weight corresponding to the green channel in the tool surface channel image; represents the component value of the green channel of the i-th pixel point in the tool surface channel image; represents the weight corresponding to the blue channel in the tool surface channel image; represents the component value of the blue channel of the i-th pixel point in the tool surface channel image; According to the gray-scale mathematical model, each tool surface channel image is subjected to a gray-scale operation to obtain each tool surface gray-scale image; the gray-scale image can simplify the image processing task, and for Radon transform, the inherent characteristics of the image are not excessively lost; Wherein, the CCD line array industrial camera is used to collect image data of the track surface, and it should be noted that in the image collection process, in order to facilitate subsequent data processing, the collection environment light source should be good, and the influence of the environment on the classification effect should be reduced;
[0081] Wherein, the tool surface gray-scale image is subjected to a posture correction operation to obtain a tool surface corrected gray-scale image, comprising:
[0082] The vertical reference line is determined through the center point of the tool surface gray-scale image; the angle bisector of the tool is obtained based on the line connecting the center point of the tool surface gray-scale image and the top angle of the tool; the included angle between the angle bisector of the tool and the reference line is taken as the rotation angle; the coordinate system is rotated by the angle
[0083]
[0084] The vertical reference line is determined through the center point of the tool surface gray-scale image; the angle bisector of the tool is obtained based on the line connecting the center point of the tool surface gray-scale image and the top angle of the tool; the included angle between the angle bisector of the tool and the reference line is taken as the rotation angle; the coordinate system is rotated by the angle Rotation adjusts the orientation of the tool image; this adjustment ensures that the tool's line of symmetry aligns with the vertical reference line, providing a standardized reference for subsequent defect detection and analysis. This step is crucial for reducing variability in the tool orientation, thereby achieving consistent and accurate defect feature extraction. Furthermore, this tool image alignment method has good generalization ability and is applicable to various types of tools, further enhancing its practicality in diverse inspection scenarios. The rotation process is as follows: Figure 2 As shown;
[0085] Based on the coordinates and rotation angle of each pixel in the grayscale image of the tool surface, a mathematical model for attitude correction is constructed, the expression of which is:
[0086] ;
[0087] in, The grayscale image of the tool surface represents the first... The horizontal coordinate components of each pixel after correction; The grayscale image of the tool surface represents the first... The vertical coordinate components of each pixel after correction; The grayscale image of the tool surface represents the first... The horizontal coordinate components of each pixel; The grayscale image of the tool surface represents the first... The vertical coordinate components of each pixel; Angle representing the angle of rotation;
[0088] Based on the attitude correction mathematical model, attitude correction is performed on each tool surface grayscale image to obtain the corrected horizontal and vertical coordinate components of each pixel in each tool surface grayscale image; based on the corrected horizontal and vertical coordinate components of each pixel in each tool surface grayscale image, a corrected grayscale image of each tool surface is obtained.
[0089] Wherein, the preset size is Pixels; the cropping order is from left to right and from top to bottom, numbered as follows: The cutting operation is as follows: Figure 3 As shown;
[0090] S2: Using Radon transform, extract the Radon domain features of each sub-image corresponding to the tool surface correction grayscale image, which are used to label the Radon ground truth label of each sub-image corresponding to the tool surface correction grayscale image; construct a Radon training set based on each sub-image corresponding to each tool surface correction grayscale image and its Radon ground truth label; train the residual network using the Radon training set to obtain the trained residual network, which is used to output the first predicted defect probability value of each sub-image corresponding to the tool surface correction grayscale image; wherein, the Radon transform process is as follows: Figure 4 As shown; the ResNet network structure configuration is as follows. Figure 5 As shown;
[0091] The Radon transform includes:
[0092] Processing a subimage using the Radon transform essentially involves performing a spatial transformation on the subimage, mapping points on the subimage to a line determined by an angle. The value of the line determined by the angle is the accumulation of points on the mapped line. Therefore, the mathematical description of the Radon transform is:
[0093] ;
[0094] ;
[0095] ;
[0096] ;
[0097] ;
[0098] in, Indicates sub-image in Line integrals over rays; express Rays and The included angle of the axes determines The direction of the ray, by changing It can scan features in different directions of the sub-image; express Determine the perpendicular distance parameter from the ray to the origin. Ray position; and The second formula above represents the horizontal and vertical variables of the sub-image's planar coordinates; Rays about and Parametric equations; Represents the sub-image in planar coordinates The pixel value function; the third formula above represents the sub-image with respect to... The fourth formula is an extension of the first to third formulas; the fifth formula represents the mathematical expression of the Radon transform; the Radon transform is a linear transform, and the transformed image has rotation invariance, and has strong explainability for deep learning classification tasks that depend on feature extraction; after the Radon transform, the deep features of the defects are further extracted, and converting the features to the Radon domain helps the features to be more stable representation;
[0099] The Resnet network is used to train and learn the Radon dataset, and the Resnet is a residual neural network that can effectively extract deeper semantic features;
[0100] The residual network loss function is a cross-entropy loss function, and its expression is:
[0101] ;
[0102] Wherein, represents the residual network loss function; represents the number of all tool surface correction gray images; represents the number of all sub-images corresponding to each tool surface correction gray image; represents the th tool surface correction gray image corresponding to the th sub-image, if , it means that the sub-image has no defects, if , it means that the sub-image has defects; represents the th tool surface correction gray image corresponding to the th sub-image;
[0103] S3: Use edge structure operator convolution to extract the edge structure features of each sub-image corresponding to the tool surface correction gray image, and use the edge structure features to label the edge real label of each sub-image corresponding to the tool surface correction gray image.
[0104] Wherein, the edge structure operator convolution includes HOG operator convolution and LBP operator convolution; the two kinds of operators can well describe the edge structure features of the image, and the large difference between the foreground defect area and the background area in the defect detection task is an important judgment way for defect detection, so extracting the edge structure information helps to detect the defect area;
[0105] The HOG operator convolution is used to obtain the HOG operator feature matrix of each sub-image corresponding to each tool surface corrected gray image; the LBP operator convolution is used to obtain the LBP operator feature matrix of each sub-image corresponding to each tool surface corrected gray image; the HOG operator feature matrix and the LBP operator feature matrix of each sub-image corresponding to each tool surface corrected gray image are fused through matrix splicing to obtain the edge structure feature matrix of each sub-image corresponding to each tool surface corrected gray image;
[0106] The fusion formula of the HOG operator feature matrix and the LBP operator feature matrix of any sub-image is as follows:
[0107] ;
[0108] Wherein, represents the edge structure feature matrix of the sub-image; represents the HOG operator feature matrix of the sub-image; represents the LBP operator feature matrix of the sub-image;
[0109] Based on each sub-image corresponding to each tool surface corrected gray image and the edge real label thereof, an edge structure feature data set is constructed; the edge structure feature data set is used to train a support vector machine to obtain a trained support vector machine for outputting a second predicted defect probability value of each sub-image corresponding to the tool surface corrected gray image;
[0110] The loss function for training the support vector machine includes a hinge loss function in a training standard support vector machine classifier stage and a cross-entropy loss function in a training logistic regression stage.
[0111] The expression of the hinge loss function in the training standard support vector machine classifier stage is as follows:
[0112] ;
[0113] Wherein, represents the hinge loss function in the training standard support vector machine classifier stage; represents the edge real label of the i-th sub-image corresponding to the j-th tool surface corrected gray image, if the sub-image is defect-free, if the sub-image has a defect; represents a decision function; represents the i-th sub-image corresponding to the j-th tool surface corrected gray image;
[0114] The expression of the cross-entropy loss function of the training logistic regression stage is:
[0115] ;
[0116] wherein, represents the cross-entropy loss function of the training logistic regression stage; represents the number of all tool surface correction gray images; represents the number of all sub-images corresponding to each tool surface correction gray image; represents the edge real label of the i-th sub-image corresponding to the j-th tool surface correction gray image, if the sub-image is defect-free, if the sub-image is defective; represents the second predicted defect probability value of the i-th sub-image corresponding to the j-th tool surface correction gray image. S4: The first predicted defect probability value and the second predicted defect probability value of each sub-image corresponding to each tool surface correction gray image are weighted and averaged to obtain a fusion defect probability value of each sub-image corresponding to each tool surface correction gray image; wherein, in one specific embodiment of the present application, for a sub-image corresponding to a defect-free original image, based on the first predicted defect probability value, the second defect probability value and the fusion defect probability value of the sub-image, the support vector machine classification result, the Resent classification result and the fusion classification result are obtained, as shown in
[0117] Figure 6
[0118] S5: The sub-image with a fusion defect probability value greater than or equal to a threshold value is regarded as an abnormal sub-image;
[0119] S6: The sub-images corresponding to the same number of each tool surface correction gray image are divided into a group to obtain different numbered sub-image groups; according to the number of the abnormal sub-image, a normal sub-image is found in the sub-image group corresponding to the abnormal sub-image to form a defect pair of the abnormal sub-image, and the defect pairs of all abnormal sub-images are obtained in turn and constitute a defect pair data set; the defect pair data set is used to train a twin transformation detection network to obtain a trained twin transformation detection network for detecting the feature information and segmentation result of the defect area in each abnormal sub-image; wherein, the defect pair diagram is shown in Figure 7 Figure 8 The twin transformation network learns the difference between two images to detect the difference part. For the defect detection task, the feature of the random defect area is difficult to extract. The twin network learns the difference between the background and the defect, thereby revealing the feature of the defect on the other side, which helps to learn the defect feature.
[0120] The twin transformation detection network comprises an input layer, two weight-shared convolution layers, a transformation layer and an output layer. The two weight-shared sub-networks each comprise a shared convolution layer and a feature vector output layer.
[0121] The input layer is used for inputting the defect pairs of all abnormal sub-images, and outputs the normal sub-images and abnormal sub-images of all image pairs.
[0122] The first weight-shared convolution layer is composed of two convolution kernels with a size of 3, one convolution kernel with a size of 8 and one convolution kernel with a size of 12, and is used for extracting the features of the normal sub-images of each defect pair, and outputs the feature vectors of the normal sub-images of each defect pair.
[0123] The second weight-shared convolution layer is composed of two convolution kernels with a size of 3, one convolution kernel with a size of 8 and one convolution kernel with a size of 12, and is used for extracting the features of the abnormal sub-images of each defect pair, and outputs the feature vectors of the abnormal sub-images of each defect pair. The normal sub-image of each defect pair is input into the first shared convolution layer, and the abnormal sub-image of the image pair is input into the second shared convolution layer at the same time.
[0124] The transformation layer is composed of three convolution stacks, and is used for feature alignment of the feature vectors of the normal sub-images of each defect pair and the feature vectors of the abnormal sub-images of the image pair, and outputs the corresponding transformation matrix of each defect pair.
[0125] The output layer is used for outputting the feature information and segmentation result of the defect area in each abnormal sub-image according to the corresponding transformation matrix of each defect pair.
[0126] The loss function of the twin transformation detection network is a contrast loss function, and its expression is as follows:
[0127] ;
[0128] Wherein, represents the loss function of the twin transformation detection network; represents the number of all image pairs; represents the distance measure between the feature vector of the normal sub-image and the feature vector of the abnormal sub-image in the th defect pair, ; represents the distance measure between the feature vector of the normal sub-image and the feature vector of the abnormal sub-image in the a feature vector of a normal sub-image in the i-th defect pair; a feature vector of an abnormal sub-image in the i-th defect pair; a feature vector of an abnormal sub-image in the i-th defect pair; a feature vector of an abnormal sub-image in the i-th defect pair; a label of the i-th defect pair, wherein if the label is 1, the image pair is a similar sample, and if the label is 0, the image pair is an unsimilar sample; a label of the i-th defect pair, wherein if the label is 1, the image pair is a similar sample, and if the label is 0, the image pair is an unsimilar sample; a label of the i-th defect pair, wherein if the label is 1, the image pair is a similar sample, and if the label is 0, the image pair is an unsimilar sample; a boundary threshold.
[0129] In summary, the two-stage tool surface defect detection method provided by the present application is inspired by the physical characteristics of the cutting tool structure and the specific requirements of the surface defect detection task. Compared with traditional image processing techniques, the method has better generalization performance and exhibits excellent results in classic semantic segmentation networks. The present application is accurate for most defect classifications and has stronger robustness compared to the original image classification task.
[0130] In a specific embodiment of the present application, the feature information and segmentation results of the defect area corresponding to the tool surface channel image to be detected are obtained by:
[0131] The tool surface channel image to be detected is obtained. The tool surface channel image to be detected is sequentially subjected to grayscale, posture correction, cropping operation and labeling operation to obtain each sub-image corresponding to the tool surface correction grayscale image to be detected and its number.
[0132] Each sub-image corresponding to the tool surface correction grayscale image to be detected is input into the trained residual network, and the first predicted defect probability value of each sub-image corresponding to the tool surface correction grayscale image to be detected is output.
[0133] Each sub-image corresponding to the tool surface correction grayscale image to be detected is input into the trained support vector machine, and the second predicted defect probability value of each sub-image corresponding to the tool surface correction grayscale image to be detected is output.
[0134] The first predicted defect probability value and the second predicted defect probability value of each sub-image corresponding to the tool surface correction grayscale image to be detected are weighted and averaged to obtain the fusion defect probability value of each sub-image corresponding to the tool surface correction grayscale image to be detected.
[0135] The sub-image with a fusion defect probability value greater than or equal to a threshold value is taken as an abnormal sub-image.
[0136] Obtain a normal tool surface sub-image set, find a normal sub-image with the same number as the abnormal sub-image in the normal tool surface sub-image set according to the number of each abnormal sub-image, and construct a defect pair of the abnormal sub-image and the normal sub-image with the same number as the abnormal sub-image, to obtain defect pairs of all abnormal sub-images in turn;
[0137] Input the defect pairs of all abnormal sub-images into the trained twin transformation detection network, output the feature information and segmentation result of the defect area in each abnormal sub-image, and further obtain the feature information and segmentation result of the defect area corresponding to the tool surface channel image to be detected.
[0138] Referring to Figure 9 The application also provides a two-stage tool surface defect detection system, which specifically comprises:
[0139] The image labeling module 100: obtains multiple tool surface channel images, performs a grayscale operation on each tool surface channel image to obtain a tool surface grayscale image, performs a posture correction operation on each tool surface grayscale image to obtain a tool surface corrected grayscale image, performs a cropping operation on each tool surface corrected grayscale image according to a preset size to obtain multiple sub-images corresponding to each tool surface corrected grayscale image, and sequentially labels each sub-image corresponding to each tool surface corrected grayscale image according to a cropping sequence to obtain the number of each sub-image corresponding to each tool surface corrected grayscale image.
[0140] The first detection module 200: extracts the Radon domain feature of each sub-image corresponding to each tool surface corrected grayscale image by using Radon transformation, labels the defect result of each sub-image corresponding to each tool surface corrected grayscale image based on the Radon domain feature of each sub-image, constructs a Radon training set based on each sub-image corresponding to each tool surface corrected grayscale image and the defect result thereof, and trains a residual network by using the Radon training set to obtain a trained residual network for outputting a first probability value of the existence of a defect in each sub-image corresponding to the tool surface corrected grayscale image.
[0141] The second detection module 300: edge structure operator convolution is used to extract the edge structure features of each sub-image corresponding to each tool surface corrected gray image; based on the edge structure features of each sub-image corresponding to each tool surface corrected gray image, the defect results of each sub-image corresponding to each tool surface corrected gray image are labeled; based on each sub-image corresponding to each tool surface corrected gray image and its defect result, an edge structure feature dataset is constructed; using the edge structure feature dataset, a support vector machine is trained to obtain a trained residual network for outputting a second probability value of the existence of defects in each sub-image corresponding to the tool surface corrected gray image.
[0142] The fusion detection module 400: the first probability value and the second probability value of the existence of defects in each sub-image corresponding to each tool surface corrected gray image are weighted and averaged to obtain a third probability value of the existence of defects in each sub-image corresponding to each tool surface corrected gray image.
[0143] The abnormal sub-image determination module 500: the sub-image with a third probability value greater than or equal to a threshold value is taken as an abnormal sub-image.
[0144] The defect feature detection module 600: the sub-images with the same number corresponding to each tool surface corrected gray image are divided into a group to obtain sub-image groups with different numbers; according to the number of the abnormal sub-image, a normal sub-image is found in the sub-image group corresponding to the abnormal sub-image to form a defect pair of the abnormal sub-image, and defect pairs of all abnormal sub-images are sequentially obtained and form a defect pair dataset; using the defect pair dataset, a twin transformation detection network is trained to obtain a trained twin transformation detection network for detecting the feature information of the defect region in each abnormal sub-image.
[0145] The device of the embodiment is used to implement the two-stage tool surface defect detection method described above, so the specific embodiments of the two-stage tool surface defect detection device can be seen in the two-stage tool surface defect detection method embodiment part in the foregoing, for example, the image labeling module 100, the first detection module 200, the second detection module 300, the fusion detection module 400, the abnormal sub-image determination module 500, and the defect feature detection module 600 are respectively used to implement S1 to S6 in the two-stage tool surface defect detection method described above, so the specific embodiments can refer to the description of each part of the embodiment of the corresponding two-stage tool surface defect detection method, and will not be repeated here.
[0146] Obviously, the above embodiments are merely example for clearly illustrating, and are not limitation to the embodiments. Based on the above description, other different forms of changes or variations can be made by those skilled in the art. Here, all the embodiments are not required to be enumerated, and the obvious changes or variations derived from the above are still within the protection scope of the present application.
Claims
1. A two-stage tool surface defect detection method, characterized by, The method comprises the following steps: Obtain multiple tool surface channel images, and perform a grayscale operation on each tool surface channel image to obtain a tool surface grayscale image; Perform a posture correction operation on each tool surface grayscale image to obtain a tool surface corrected grayscale image; According to a preset size, perform a cropping operation on each tool surface corrected grayscale image to obtain multiple sub-images corresponding to each tool surface corrected grayscale image; and according to a cropping sequence, sequentially label each sub-image corresponding to each tool surface corrected grayscale image to obtain a number of each sub-image corresponding to each tool surface corrected grayscale image; Extract a Radon domain feature of each sub-image corresponding to the tool surface corrected grayscale image by using Radon transformation, and use the Radon domain feature to label a Radon real label of each sub-image corresponding to the tool surface corrected grayscale image; Based on each sub-image corresponding to each tool surface corrected grayscale image and the Radon real label thereof, a Radon training set is constructed; and the Radon training set is used to train a residual network to obtain a trained residual network, which is used to output a first predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image; An edge structure feature of each sub-image corresponding to the tool surface corrected grayscale image is extracted by using edge structure operator convolution, and the edge structure feature is used to label an edge real label of each sub-image corresponding to the tool surface corrected grayscale image; Based on each sub-image corresponding to each tool surface corrected grayscale image and the edge real label thereof, an edge structure feature data set is constructed; The edge structure feature data set is used to train a support vector machine to obtain a trained support vector machine, which is used to output a second predicted defect probability value of each sub-image corresponding to the tool surface corrected grayscale image; The first predicted defect probability value and the second predicted defect probability value of each sub-image corresponding to each tool surface corrected grayscale image are weighted and averaged to obtain a fusion defect probability value of each sub-image corresponding to each tool surface corrected grayscale image; Sub-images with a fusion defect probability value greater than or equal to a threshold value are regarded as abnormal sub-images; Sub-images with the same number corresponding to each tool surface corrected grayscale image are divided into a group to obtain sub-image groups with different numbers; a normal sub-image is found in a sub-image group corresponding to an abnormal sub-image according to the number of the abnormal sub-image to form a defect pair of the abnormal sub-image, and defect pairs of all abnormal sub-images are sequentially obtained to form a defect pair data set; The defect pair data set is used to train a twin transformation detection network to obtain a trained twin transformation detection network, which is used to detect feature information and segmentation results of a defect region in each abnormal sub-image. The twin transformation detection network comprises an input layer, two weight-shared convolution layers, a transformation layer and an output layer; wherein the two weight-shared sub-networks each comprise a shared convolution layer and a feature vector output layer; the transformation layer is composed of three convolution stacks and is used for feature alignment of the feature vector of the normal sub-image of each defect pair and the feature vector of the abnormal sub-image of the image pair, and outputs the transformation matrix corresponding to each defect pair; and the output layer is used for outputting the feature information and segmentation result of the defect area in each abnormal sub-image according to the transformation matrix corresponding to each defect pair.
2. A two-stage tool surface defect detection method according to claim 1, characterized in that, The twin transformation detection network comprises an input layer, two weight-shared convolution layers, a transformation layer and an output layer; wherein the two weight-shared sub-networks each comprise a shared convolution layer and a feature vector output layer; The input layer is used for inputting the defect pairs of all abnormal sub-images and outputting the normal sub-images and abnormal sub-images of all image pairs; The first weight-shared convolution layer is composed of two convolution kernels with a size of 3, one convolution kernel with a size of 8 and one convolution kernel with a size of 12, and is used for extracting the features of the normal sub-image of each defect pair and outputting the feature vector of the normal sub-image of each defect pair; The second weight-shared convolution layer is composed of two convolution kernels with a size of 3, one convolution kernel with a size of 8 and one convolution kernel with a size of 12, and is used for extracting the features of the abnormal sub-image of each defect pair and outputting the feature vector of the abnormal sub-image of each defect pair; wherein the normal sub-image of each defect pair is inputted into the first shared convolution layer at the same time, and the abnormal sub-image of the image pair is inputted into the second shared convolution layer; The transformation layer is composed of three convolution stacks and is used for feature alignment of the feature vector of the normal sub-image of each defect pair and the feature vector of the abnormal sub-image of the image pair, and outputs the transformation matrix corresponding to each defect pair; The output layer is used for outputting the feature information and segmentation result of the defect area in each abnormal sub-image according to the transformation matrix corresponding to each defect pair.
3. A two-stage tool surface defect detection method according to claim 1, characterized in that, The tool surface channel image is subjected to a grayscale operation to obtain a tool surface grayscale image, comprising: A CCD line array camera is used to collect the tool surface channel image; a grayscale mathematical model is constructed according to the weighted average method and the weight corresponding to each channel, and the expression is: ; in, The grayscale image of the tool surface represents the first... The grayscale value of each pixel; This indicates the weight of the red channel in the tool surface channel image; Indicating the first channel in the tool surface image The red channel component values of each pixel; This indicates the weight of the green channel in the tool surface channel image; Indicating the first channel in the tool surface image The green channel component values of each pixel; This indicates the weight of the blue channel in the tool surface channel image; Indicating the first channel in the tool surface image The blue channel component values of each pixel; The tool surface channel image is subjected to a grayscale operation according to the grayscale mathematical model to obtain a tool surface grayscale image.
4. The two-stage tool surface defect detection method of claim 1, wherein, The tool surface grayscale image is subjected to a posture correction operation to obtain a tool surface corrected grayscale image, comprising: A vertical reference line is determined through the center point of the tool surface grayscale image; an angle bisector of the tool is obtained based on the line connecting the center point of the tool surface grayscale image and the top corner of the tool; and the included angle between the angle bisector of the tool and the reference line is taken as a rotation angle; A posture correction mathematical model is constructed based on the coordinates of each pixel point in the tool surface grayscale image and the rotation angle, and the expression is: ; wherein, represents the corrected horizontal coordinate component of the i-th pixel point in the gray-scale image of the tool surface; represents the corrected vertical coordinate component of the i-th pixel point in the gray-scale image of the tool surface; represents the horizontal coordinate component of the i-th pixel point in the gray-scale image of the tool surface; represents the vertical coordinate component of the i-th pixel point in the gray-scale image of the tool surface; represents the angle of the rotation angle; According to the pose correction mathematical model, the pose correction operation is performed on the tool surface gray image, so as to obtain the horizontal direction coordinate component and the vertical direction coordinate component of each pixel point in the tool surface gray image after correction; and based on the horizontal direction coordinate component and the vertical direction coordinate component of each pixel point in the tool surface gray image after correction, the tool surface corrected gray image is obtained.
5. The two-stage tool surface defect detection method of claim 1, wherein, The edge structure operator convolution is used to extract the edge structure features of each sub-image corresponding to each tool surface corrected gray image, which includes: The edge structure operator convolution includes HOG operator convolution and LBP operator convolution; The HOG operator convolution is used to obtain the HOG operator feature matrix of each sub-image corresponding to each tool surface corrected gray image; the LBP operator convolution is used to obtain the LBP operator feature matrix of each sub-image corresponding to each tool surface corrected gray image; and the HOG operator feature matrix and the LBP operator feature matrix of each sub-image corresponding to each tool surface corrected gray image are fused through matrix splicing, so as to obtain the edge structure feature matrix of each sub-image corresponding to each tool surface corrected gray image.
6. The two-stage tool surface defect detection method of claim 1, wherein, The residual network loss function is a cross-entropy loss function, and its expression is: ; in, Represents the residual network loss function; This indicates the number of grayscale images for all tool surface corrections; This indicates the number of all sub-images corresponding to each grayscale image of tool surface correction; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The Radon true label of Zhang Zi's image, if This indicates that the sub-image is defect-free. This indicates that the sub-image has a defect; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The first predicted defect probability value of the Zhangzi image.
7. The two-stage tool surface defect detection method of claim 1, wherein, The loss function for training the support vector machine includes: a hinge loss function for training a standard support vector machine classifier stage and a cross-entropy loss function for training a logistic regression stage; The expression of the hinge loss function for training the standard support vector machine classifier stage is: ; in, This represents the hinge loss function during the training phase of the standard support vector machine classifier. Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... The true edge label of the Zhangzi image, if This indicates that the sub-image is defect-free. This indicates that the sub-image has a defect; Represents the decision function; Indicates the first The grayscale image corresponding to the surface correction of the Zhang tool corresponds to the first... Zhang Zi's image; The expression of the cross-entropy loss function for training the logistic regression stage is: ; wherein, represents the cross-entropy loss function of the training logistic regression stage; represents the number of all tool surface corrected gray-scale images; represents the number of all sub-images corresponding to each tool surface corrected gray-scale image; represents the number of all sub-images corresponding to the i-th tool surface corrected gray-scale image; represents the edge true label of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image, if the j-th sub-image has no defect, then represents the edge true label of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image, if the j-th sub-image has a defect, then represents the edge true label of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image, if the j-th sub-image has no defect, then represents the edge true label of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image, if the j-th sub-image has a defect, then represents the second predicted defect probability value of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image. represents the second predicted defect probability value of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image. represents the second predicted defect probability value of the j-th sub-image corresponding to the i-th tool surface corrected gray-scale image.
8. The two-stage tool surface defect detection method of claim 1, wherein, The twin transformation detection network loss function is a contrast loss function, and its expression is: ; wherein, represents a twin transformation detection network loss function; represents the number of all image pairs; represents the feature vector of the normal sub-image in the th defect pair; ; represents the feature vector of the normal sub-image in the th defect pair; represents the feature vector of the abnormal sub-image in the th defect pair; represents the label of the th defect pair, if represents that the image pair is a similar sample, if the image pair is a dissimilar sample; represents a boundary threshold value.
9. The two-stage tool surface defect detection method of claim 1, wherein, The tool surface channel image to be detected is obtained, and the feature information and the segmentation result of the defect area corresponding to the tool surface channel image are obtained, which includes: The tool surface channel image to be detected is obtained; the tool surface channel image to be detected is sequentially subjected to grayscale, pose correction, cutting operation and labeling operation, so as to obtain each sub-image corresponding to the tool surface corrected gray image to be detected and the number of each sub-image; Each sub-image corresponding to the tool surface corrected gray image to be detected is input into the trained residual network, and the first predicted defect probability value of each sub-image corresponding to the tool surface corrected gray image to be detected is output; Each sub-image corresponding to the tool surface corrected gray image to be detected is input into the trained support vector machine, and the second predicted defect probability value of each sub-image corresponding to the tool surface corrected gray image to be detected is output; The first predicted defect probability value and the second predicted defect probability value of each sub-image corresponding to the tool surface corrected gray image to be detected are weighted and averaged, so as to obtain the fusion defect probability value of each sub-image corresponding to the tool surface corrected gray image to be detected; The sub-image with the fusion defect probability value greater than or equal to the threshold value is taken as an abnormal sub-image; The normal tool surface sub-image set is obtained, the normal sub-image with the same number as each abnormal sub-image is found in the normal tool surface sub-image set according to the number of each abnormal sub-image, and the abnormal sub-image and the normal sub-image with the same number as the abnormal sub-image are taken as a defect pair of the abnormal sub-image, so as to obtain the defect pairs of all abnormal sub-images. The defect pairs of all abnormal sub-images are input into the trained twin transform detection network, and the feature information and segmentation result of the defect area in each abnormal sub-image are output, and then the feature information and segmentation result of the defect area corresponding to the tool surface channel image to be detected are obtained.
10. A two-stage tool surface defect detection system, characterized by, Comprise: An image labeling module: a plurality of tool surface channel images are obtained, and each tool surface channel image is subjected to a grayscale operation to obtain a tool surface grayscale image; Each tool surface grayscale image is subjected to a posture correction operation to obtain a tool surface corrected grayscale image; Each tool surface corrected grayscale image is subjected to a cutting operation according to a preset size to obtain a plurality of sub-images corresponding to each tool surface corrected grayscale image; each sub-image corresponding to each tool surface corrected grayscale image is sequentially labeled according to a cutting order to obtain a number of each sub-image corresponding to each tool surface corrected grayscale image; A first detection module: Radon transform is used to extract the Radon domain feature of each sub-image corresponding to each tool surface corrected grayscale image; based on the Radon domain feature of each sub-image corresponding to each tool surface corrected grayscale image, the defect result of each sub-image corresponding to each tool surface corrected grayscale image is labeled; based on each sub-image corresponding to each tool surface corrected grayscale image and its defect result, a Radon training set is constructed; A residual network is trained using the Radon training set to obtain a trained residual network for outputting a first probability value of the existence of defects in each sub-image corresponding to the tool surface corrected grayscale image; A second detection module: edge structure operator convolution is used to extract the edge structure feature of each sub-image corresponding to each tool surface corrected grayscale image; based on the edge structure feature of each sub-image corresponding to each tool surface corrected grayscale image, the defect result of each sub-image corresponding to each tool surface corrected grayscale image is labeled; based on each sub-image corresponding to each tool surface corrected grayscale image and its defect result, an edge structure feature dataset is constructed; A support vector machine is trained using the edge structure feature dataset to obtain a trained residual network for outputting a second probability value of the existence of defects in each sub-image corresponding to the tool surface corrected grayscale image; A fusion detection module: the first probability value and the second probability value of the existence of defects in each sub-image corresponding to each tool surface corrected grayscale image are weighted and averaged to obtain a third probability value of the existence of defects in each sub-image corresponding to each tool surface corrected grayscale image; An abnormal sub-image determination module: a sub-image with a third probability value greater than or equal to a threshold value is regarded as an abnormal sub-image; A defect feature detection module: sub-images corresponding to the same number of each tool surface corrected grayscale image are divided into a group to obtain sub-image groups with different numbers; a normal sub-image is found in a sub-image group corresponding to an abnormal sub-image according to the number of the abnormal sub-image to form a defect pair of the abnormal sub-image, and defect pairs of all abnormal sub-images are sequentially obtained to form a defect pair dataset. The training of the twin transformation detection network is performed on the defect pair data set, and a trained twin transformation detection network is obtained, which is used for detecting feature information of a defect region in each abnormal sub-image. The twin transformation detection network comprises an input layer, two weight-shared convolution layers, a transformation layer and an output layer; wherein the two weight-shared sub-networks each comprise a shared convolution layer and a feature vector output layer; the transformation layer is composed of three convolution stacks, and is used for performing feature alignment on the feature vector of the normal sub-image of each defect pair and the feature vector of the abnormal sub-image of the image pair, and outputting a corresponding transformation matrix of each defect pair; and the output layer is used for outputting feature information and a segmentation result of the defect region in each abnormal sub-image according to the corresponding transformation matrix of each defect pair.
Citation Information
Patent Citations
Mobile phone screen defect detection method, device and system, computer equipment and medium
CN111612763A
Rail locomotive surface defect detection method and system
CN116416234A
Cited By
Multi-scale milling and grinding tool defect detection method based on tool failure mechanism constraint
CN121904034A
Multi-scale milling-grinding tool defect detection method based on tool failure mechanism constraint
CN121904034B