Real-time detection method and system for tool wear of numerical control lathe based on machine vision
By integrating structural consistency factor, phase consistency and path integral, the problem of misjudgment and missed detection in wear profile detection in complex environments of CNC lathes is solved, and high-precision wear condition assessment is achieved.
Patent Information
- Application Number
- CN202511676192.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-11-17
AI Technical Summary
Existing edge detection algorithms based on image gradients are prone to misjudging interference and missing weak signal edges in the complex machining environment of CNC lathes, resulting in abnormal wear contours and inaccurate detection results.
The gradient magnitude is nonlinearly modulated by calculating the structural consistency factor and phase consistency. Combined with the integral of the exploration path, the initial boundary probability and path consistency score are fused, and the final boundary probability is calculated using Bayesian theory to extract the wear profile.
In environments with strong interference such as coolant and metal chips, high-precision and robust real-time extraction of tool wear profiles is achieved, improving the accuracy and reliability of wear detection.
Smart Images

Figure CN121120656B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image data processing, and particularly relates to a machine vision-based real-time detection method and system for tool wear of a numerical control lathe. BACKGROUND
[0002] The numerical control lathe plays a vital role in modern manufacturing industry, and its machining precision and efficiency directly affect product quality. Tool wear is inevitable in the cutting process of the lathe due to severe friction, high pressure and high temperature. Real-time detection of tool wear is the key to ensuring machining quality, prolonging tool life and avoiding equipment damage. Detection technology based on machine vision has become a research hotspot due to its non-contact and high efficiency. The core of the technology is to accurately segment the wear area through image processing, which lays a foundation for subsequent evaluation.
[0003] In a real numerical control machining environment, the reflection of cooling liquid, the adhesion of metal chips, the interference of oil stains and unstable illumination will cause a large number of false edges and strong noise in the tool image, and also lead to a blurred, discontinuous or even partially occluded real wear boundary. The clear distinction between the wear area and the tool base is the core prerequisite for accurate detection.
[0004] In related technologies, edge detection algorithms based on image gradients such as Canny and Sobel are used to extract the wear profile. The core is to calculate the pixel gray level change rate and set a threshold to filter edge points. After post-processing, the wear profile is formed, which lays a foundation for wear evaluation. However, in a complex numerical control machining environment, high gray interference blocks formed by the reflection of cooling liquid and the adhesion of chips are easily misjudged as real boundaries. Illumination fluctuations and oil stains weaken the gray difference, leading to missed detection of real weak signal edges, making the profile broken and deviated. This directly affects the calculation accuracy of wear area and other parameters, and the result deviates greatly from the actual situation, which is difficult to serve as a reliable basis for tool replacement. SUMMARY
[0005] To solve the technical problem of insufficient robustness of the above-mentioned image gradient-based edge detection algorithm, which easily misjudges interference and misses weak signal edges in a complex machining environment, resulting in abnormal wear profile and inaccurate detection results, the present application provides solutions in the following aspects.
[0006] In a first aspect, the present application provides a machine vision-based real-time detection method for tool wear of a numerical control lathe, which comprises the following steps:
[0007] Images of CNC lathe tools are acquired, and regions of interest (ROIs) are located. For each pixel within the ROI, a structural consistency factor characterizing its local structural anisotropy is calculated. This structural consistency factor is positively correlated with the difference between the maximum and minimum eigenvalues of the structural tensor in the pixel's neighborhood. Based on the structural consistency factor and the pixel's phase consistency, its gradient magnitude is nonlinearly modulated. Combined with the nonlinear amplification of the phase consistency, the initial boundary probability of the pixel is calculated. For each pixel within the ROI, an exploration path is constructed that passes through the pixel and extends along its local boundary direction. Based on the integral of the exploration path with respect to the product of the initial boundary probability and a preset weight, the path consistency score of the pixel is calculated. The initial boundary probability and the path consistency score of the pixel are fused to obtain the final boundary probability of the pixel. Wear contours are extracted based on the final boundary probabilities of each pixel within the ROI, and the tool wear state is evaluated based on the wear contours to achieve real-time detection.
[0008] This invention targets pixels within the region of interest (ROI) of a tool image, fusing their gradient magnitude, phase consistency, and local structural anisotropy to calculate initial boundary probabilities. By constructing an exploration path and weighting the initial boundary probabilities along it, path consistency is evaluated, effectively distinguishing true wear contours from noise. Finally, the initial boundary probabilities and path consistency scores are fused to obtain the final boundary probability, which is used to extract the wear contour and assess the tool wear state. This invention, by fusing initial boundary probabilities based on local features and path consistency scores based on macroscopic continuity, effectively distinguishes true wear contours from isolated pseudo-edges caused by coolant reflections, metal chips, etc., solving the technical problems of insufficient robustness and misjudging noise as boundaries in complex machining environments, thus improving the overall accuracy and reliability of wear detection.
[0009] Preferably, the initial boundary probabilities satisfy the following relationship:
[0010] ;
[0011] in, It is a pixel. The initial boundary probability; It is a pixel. The gradient magnitude; It is a pixel. Phase consistency value; It is a pixel. structural consistency factor, It is a standard normalized function; It is the hyperbolic tangent function.
[0012] The present application carries out nonlinear modulation on the gradient amplitude through an exponential term, and only when the gradient information is reliable and the structure information is obvious, the gradient information is greatly enhanced; meanwhile, the phase consistency is nonlinearly amplified through a hyperbolic tangent term to compensate the signal of the low-contrast real boundary. This mechanism ensures that the high-credibility clear boundary and the low-contrast real boundary can both obtain high response, and realizes the comprehensive enhancement of various boundary signals.
[0013] Preferably, the obtaining of the structure consistency factor comprises: calculating a structure tensor in a neighborhood window of the pixel point; performing eigenvalue decomposition on the structure tensor to obtain a maximum eigenvalue and a minimum eigenvalue; and taking a ratio of a difference value and a sum value of the maximum eigenvalue and the minimum eigenvalue as the structure consistency factor.
[0014] The present application provides a reliable evaluation index for the gradient information in the neighborhood of the pixel point by calculating the normalized difference value of the eigenvalue of the structure tensor, and the factor can effectively distinguish the real edge with consistent direction and the noise or flat area with chaotic gradient direction, thereby providing a key judgment basis for the subsequent probability fusion.
[0015] Preferably, the constructing of the exploration path passing through the pixel point and extending along the local boundary direction of the pixel point comprises: determining a feature vector of the minimum eigenvalue corresponding to the structure tensor of the pixel point, and taking a direction of the feature vector as an initial extension direction of the exploration path; and starting from the pixel point, performing pixel-by-pixel iterative tracking along the initial extension direction, and updating a forward direction according to a local boundary direction of each tracking node until a path length reaches a preset maximum exploration distance, so as to generate the exploration path.
[0016] The present application determines the initial extension direction of the path by using the feature vector of the minimum eigenvalue of the structure tensor, ensures that the exploration path is along the optimal tangent direction of the local boundary from the beginning, and guarantees the accuracy of the tracking. The subsequent iterative tracking and direction updating mechanism enables the path to more accurately fit the actual trend of the boundary, and provides a high-quality path basis for the path consistency evaluation.
[0017] Preferably, the obtaining of the preset weight comprises: obtaining a direction deviation between the local boundary direction of any pixel point on the exploration path and the initial extension direction of the exploration path; calculating a normalized value of a square value of the direction deviation, and performing negative exponential operation on the normalized value to obtain the preset weight.
[0018] Preferably, the obtaining of the final boundary probability of the pixel point by fusing the initial boundary probability and the path consistency score of the pixel point comprises: fusing the initial boundary probability and the path consistency score based on the Bayesian theory to obtain the final boundary probability.
[0019] Preferably, the final boundary probability satisfies the relationship:
[0020] ;
[0021] wherein, is the final boundary probability of the pixel point ; is the initial boundary probability of the pixel point ; is the path consistency score of the pixel point ; is a preset infinitesimal value.
[0022] The present application calculates the final boundary probability based on the Bayesian fusion theory, the numerator of which reflects the joint probability of two indicators supporting the boundary, and the denominator plays a normalizing role. This structure ensures that when the initial boundary probability and the path consistency score are both high, the final probability will be nonlinearly enhanced to a level closer to 1, thereby widening the contrast between the real boundary and the non-boundary region in the final probability map.
[0023] Preferably, the extraction of the wear profile based on the final boundary probability of each pixel point in the region of interest comprises: obtaining the final boundary probability of each pixel point in the region of interest to obtain a final boundary probability field; constructing an external potential field based on the final boundary probability field; under the driving of the external potential field, iteratively performing the active contour model until a preset termination condition is reached to extract the wear profile.
[0024] Preferably, the positioning of the region of interest comprises: performing gray scale processing on the numerical control lathe tool image to obtain a gray scale image; using a normalized cross-correlation template matching technique to position the region in the gray scale image that is most matched with a preset template image, and cutting it as the region of interest.
[0025] In a second aspect, the present application provides a machine vision-based real-time detection system for wear of a numerical control lathe tool, which comprises a memory and a processor, and the memory stores computer program instructions that, when executed by the processor, implement the machine vision-based real-time detection method for wear of a numerical control lathe tool of the first aspect of the present application.
[0026] By using the above technical solution, the machine vision-based real-time detection method for wear of a numerical control lathe tool of the first aspect of the present application is generated into a computer program and stored in the memory to be loaded and executed by the processor, so that a terminal device is manufactured according to the memory and the processor, and convenient use is achieved.
[0027] The present application has the beneficial effects: the present application constructs a dual verification mechanism combining pixel level and path level, at the pixel level, it improves the reliability of local edge detection by fusing multi-dimensional features such as gradient, phase consistency and structural tensor anisotropy; at the path level, the macroscopic continuity evaluation based on path integral is introduced, by judging whether the boundary point is located on the continuous and smooth path, the real wear profile and the isolated false edge are effectively distinguished. Finally, through the Bayesian theory, the evidences of the two different levels are optimally fused, so that in the strong interference environment of cooling liquid, metal chips and the like, the high-precision, high-robustness real-time extraction of the tool wear profile is realized. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 A flow chart of a machine vision-based real-time detection method for tool wear of a numerical control lathe is provided for the embodiments of the present application.
[0029] Figure 2 A structural block diagram of a machine vision-based real-time detection system for tool wear of a numerical control lathe is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0030] The first aspect of the embodiments of the present application provides a machine vision-based real-time detection method for tool wear of a numerical control lathe, as shown in the figure, the method comprises steps S100-S500: Figure 1
[0031] Step S100, collect the tool image of the numerical control lathe, and locate the region of interest.
[0032] It should be noted that the tool image collected in the machining field usually contains a large amount of irrelevant background, such as machine tool chuck, workpiece, cooling liquid pipeline, and the image size is large, direct processing will consume a large amount of computing resources, which cannot meet the real-time detection requirement. This step outputs input data with uniform size, optimal signal-to-noise ratio and only containing wear-related area through preprocessing and target positioning, realizes calculation focusing and algorithm efficiency improvement.
[0033] Specifically, first, image preprocessing is performed to convert the collected tool image into a gray image; at the same time, the gray image and the pre-off-line stored template image are subjected to illumination normalization processing, the template image is the tool tip image of a standard new tool or a slightly worn tool, and the illumination normalization ensures that the illumination conditions of the two are consistent, laying a foundation for subsequent matching.
[0034] Then, the region of interest (ROI) is located, the normalized cross-correlation template matching technology is adopted to globally search the template in the preprocessed gray image, the similarity score of the template and each region of the image is calculated, the region with the highest score is located, and the center point of the region is taken as the reference to cut off a rectangular region with a preset size as the region of interest, for example, a rectangular region with a size of 100*100 is selected. The size of the pixel, the specific size is set according to the tool model, the typical size of the relief wear area. The ROI needs to cover the tool relief completely, and the tool wear mainly occurs on the tool relief, so it is necessary to ensure that the potential wear part is covered, and all subsequent analyses, such as wear area segmentation, are only carried out in the ROI.
[0035] So far, the image preprocessing and the positioning of the region of interest are completed, providing high-quality input data for the accurate segmentation of the wear area in the subsequent step.
[0036] In step S200, for each pixel point in the region of interest, a structure consistency factor representing the local structure anisotropy of the pixel point is calculated, the gradient amplitude of the pixel point is nonlinearly modulated based on the structure consistency factor and the phase consistency of the pixel point, and the initial boundary probability of the pixel point is calculated by combining the nonlinear amplification result of the phase consistency.
[0037] It should be noted that, considering that the wear area is often accompanied by a gray level mutation, and the gradient feature can quickly capture the area of gray level mutation in the image, it can be used as a basic signal to identify the wear edge; considering that the light fluctuation in the machining environment easily leads to the reduction of the contrast of the wear boundary, and the phase feature is not sensitive to the light change, that is, even in a low-contrast scene, it can still stably reflect the structural information of the edge. Therefore, based on the complementarity of the two features, the initial boundary probability value of each pixel point in the ROI is calculated, which represents the possibility of belonging to the real physical boundary, and the real boundary signal is finally enhanced to the greatest extent at the pixel level, and the noise and artifacts are effectively suppressed.
[0038] Specifically, before calculating the initial boundary probability, two feature data required by the pixel point are first obtained: for the gradient feature, the gradient amplitude of the pixel point is obtained by the image gradient calculation method ; for the phase feature, the phase consistency value is calculated to represent the value, which can be obtained by using the frequency domain analysis method based on the Log-Gabor filter known in the art, as a mature prior art, which will not be described here; for the local structure anisotropy feature, the structure consistency factor is calculated to evaluate the consistency and reliability of the gradient information in the neighborhood of the pixel point, and the specific calculation method is described later.
[0039] Based on the above-mentioned feature data, a synergistic enhancement type fusion relationship is constructed in this step, which can obtain a highly reliable initial boundary probability according to the local characteristics of the image, combining the gradient amplitude, the phase consistency and the local structure anisotropy index.
[0040] According to the above logic, for any ROI, the initial boundary probability of the pixel point in the ROI satisfies the relationship:
[0041] ;
[0042] wherein, is the initial boundary probability of pixel point ; is the gradient amplitude of pixel point ; is the phase consistency value of pixel point ; is the structure consistency factor of pixel point , used for evaluating the consistency and reliability of gradient information in the neighborhood of pixel point , the specific calculation method of which is described later; is a standard normalization function; is a hyperbolic tangent function.
[0043] In the relationship, two functionally complementary terms are added to form, the first part takes the gradient amplitude as the basis and modulates it using the exponential term determined by and , only when the gradient information itself is reliable, the phase consistency can significantly enhance the gradient response through the exponential function. Only high-precision clear boundaries can obtain high response values. The second part is used to solve the problem of low-contrast boundaries. For real boundaries with small gradient amplitudes due to light and other reasons, they usually still maintain high phase consistency. The hyperbolic tangent function can nonlinearly amplify the high , ensuring that low-contrast real boundary information will not be lost in the fusion process.
[0044] For the calculation of the structure consistency factor in the relationship, it needs to be noted that in order to realize adaptive fusion of features in the probability fusion relationship, an index that can evaluate the local image information reliability is needed. Considering that clear and real edges have highly consistent gradient directions in their neighborhoods, showing obvious anisotropy; while noise points or flat areas have chaotic or non-existent gradient directions, showing isotropy. Based on this, the structure consistency factor is constructed by calculating the eigenvalues of the structure tensor, which is used to evaluate the consistency and reliability of local gradient information.
[0045] To achieve the above evaluation, first, the gradient direction of pixel point gradient components of the pixel point within a neighborhood window, which can be calculated by Sobel operator or Prewitt operator or other methods commonly used in the art; then, a structure tensor of the pixel point is constructed, and eigenvalue decomposition is performed on the structure tensor to obtain two non-negative eigenvalues and , which represent the strength accumulations of the gradient in the primary direction and the secondary direction, respectively. The size of the neighborhood window can be set according to the typical size of the tool wear region, for example or pixels. The calculation of the structure tensor and the two eigenvalues is a prior art, and will not be described in detail here. Based on the two eigenvalues, the structure consistency factor constructed by the present application satisfies the following relationship:
[0046] ;
[0047] wherein, is the structure consistency factor of the pixel point , , is the maximum and minimum eigenvalues of the structure tensor within the neighborhood window of the pixel point .
[0048] In the relationship, the numerator reflects the difference degree of the gradient strength in the primary direction and the secondary direction, and the denominator serves as a normalization function. When there is a strong edge with highly consistent direction within the neighborhood, , , tends to 1, indicating that the gradient information of the region is highly reliable; when the neighborhood is a noise region with chaotic gradient direction or a flat region without gradient, , are similar in size, tends to 0, indicating that the gradient information of the region is unreliable.
[0049] Preferably, when , it indicates that the region is a flat region without any gradient change, and in this case, .
[0050] To more intuitively illustrate how the above fusion mechanism distinguishes between the real boundary and the false edge, two representative pixel points are selected in the currently located tool wear ROI for analysis: point A is a pixel point at coordinates , which is located on a real, continuous and well-shaped wear boundary; point B is a pixel point at coordinates , which is located on an isolated strong interference scratch caused by metal chip reflection, and its local gray level change characteristics are highly similar to those of the real wear boundary.
[0051] Since point A Located on the real, clear boundary, the measured partial characteristic values are as follows: the normalized gradient amplitude is 0.90, the phase consistency value is 0.95, and the structure consistency factor is 0.98 due to the high consistency of the gradient direction. The initial boundary probability value is calculated by substituting the initial boundary probability relationship formula, and the initial boundary probability value is , which indicates that point A is extremely likely to be a boundary in the local view. However, point B Located on the isolated but clear scratch, the local characteristics are also very obvious, and the measured partial characteristic values are as follows: the normalized gradient amplitude is 0.92, the phase consistency value is 0.90, and the structure consistency factor is 0.95 due to the fact that the scratch is locally very like a boundary, and the gradient direction is also highly consistent. The initial boundary probability value is calculated by substituting the initial boundary probability relationship formula, and the initial boundary probability value is , which indicates that through the calculation of the present step, point B is also extremely likely to be a boundary in the local view.
[0052] At this point, the initial boundary probability of all pixel points in the ROI is obtained.
[0053] Step S300, for each pixel point in the region of interest, an exploration path is constructed which passes through the pixel point and extends along the local boundary direction of the pixel point. The path consistency score of the pixel point is calculated based on the integral of the product of the initial boundary probability and the preset weight along the exploration path.
[0054] It should be noted that the initial boundary probability can judge the boundary properties of the pixel point based on the local characteristics, and accurately identify the pixels with local boundary characteristics. However, it cannot distinguish the boundary types to which these boundary points belong: whether they belong to the long and continuous wear profile in the tool wear scene, or to the isolated noise points, scratches formed by metal chip reflection, or to the fine flaws of the non-wear area of the tool surface. In actual numerical control machining, the tool wear boundary is usually in the form of a continuous long strip due to the influence of the cutting motion law, and isolated boundary points or short segments are usually not part of the real wear profile. Therefore, the path consistency evaluation index is constructed in the present step to determine whether each boundary point is located on a continuous and smooth high-probability boundary path, so as to filter out isolated false boundary points and retain continuous boundary points corresponding to the real wear profile. At the same time, in order to consider the real-time detection, the present step first introduces a calculation efficiency optimization strategy, which only analyzes the path consistency of the boundary points with high initial boundary probability, avoiding the invalid calculation of low-probability non-boundary points.
[0055] Specifically, for each pixel point, an exploration path is constructed which passes through the point and extends along the local boundary direction of the point. The initial extension direction of the path is determined by the minimum eigenvalue of the structure tensor corresponding to the pixel point determined by the eigenvector of the local boundary, which represents the best tangent direction of the local boundary, ensuring that the initial direction of the path is consistent with the trend of the boundary. On this basis, a complete exploration path is generated by using a pixel-by-pixel tracking strategy: starting from a pixel point , moving one unit step in the initial extension direction, and selecting the nearest pixel as the next node; at the new node, the local boundary direction is recalculated, and the advancing direction is updated accordingly, and the iteration is pushed forward until the total length of the path reaches the preset maximum one-way exploration distance , this process is performed once in both positive and negative directions, forming a two-way exploration path centered on the pixel point with a total length of . , where the parameter represents the distance traveled along the path from the center point, is the pixel coordinate at the corresponding position of the distance.
[0056] It should be noted that a point that truly belongs to the wear profile should not only consist of high-probability points, but also have a smooth and directionally continuous geometric shape. Based on this, the present application evaluates the geometric quality of the path by introducing a direction consistency weight in the path integral.
[0057] According to the above logic, for any ROI, the path consistency score of the pixel point satisfies the relationship:
[0058] ;
[0059] wherein is the path consistency score of the pixel point ; is the preset maximum one-way exploration path length; is the distance from the pixel point ; is the parameterized path function, whose input is , and the output is the pixel coordinate corresponding to the distance on the path; is the initial boundary probability at the pixel point specified by the path function ; is the local boundary direction of the pixel point , which is the initial extension direction of the path of the pixel point ; is the local boundary direction at the pixel point specified by the path function ; is the preset direction tolerance coefficient, which is greater than 0; is the integral variable.
[0060] In the equation, the integral term is composed of two parts, which together determine the contribution of each point on the path to the final score: the first term is used to ensure that only when the exploration path travels in a region with high boundary probability itself, a high basic contribution is provided to the final integral value, and if the path enters a low-probability region, the contribution value of this segment of the path is very low. The negative exponential function term of the second term is used as a dynamic weight to evaluate the geometric quality of the path, and the core is the deviation square term in the numerator, which has good tolerance for small smooth bends of the path in a symmetrical manner, and when the direction changes drastically, the consistency weight decays rapidly and nonlinearly, significantly reducing the integral response of such discontinuous paths; and the denominator is used to normalize the deviation square term, and the entire fraction together evaluates the bending degree of the path at this point; the negative exponential function smoothly maps the fraction value to a consistency weight between 0 and 1, and when the fraction value is 0, the weight is 1, and the greater the fraction value, the weight tends to 0. is used to normalize the integral result to ensure that the score range is independent of the path length and is uniformly mapped to the interval.
[0061] It should be noted that the values of the one-way maximum exploration path length and the direction tolerance coefficient need to be set according to the actual working conditions: for a scene with a long and smooth expected wear pattern, it can be set to 15% of the ROI width, such as 40 pixels, it can be set to 0.5 to enhance the selectivity of long-range continuous structures; for a scene with a short or highly curved wear pattern, it can be appropriately reduced, such as 20 pixels, and increased, such as 1.0, to improve the adaptability to local patterns. In the present embodiment, 30 pixels are preferred, and 0.5 is preferred.
[0062] To more intuitively illustrate the distinguishing effect of path consistency evaluation on real boundaries and false edges, the path consistency scores of the aforementioned A point and B point are calculated according to the relationship, assuming , . Since the A point is located on a continuous and smooth wear boundary, when tracing the path from the coordinate A point in the direction of its boundary, the pixel points on the path maintain a high initial boundary probability and the direction is smooth and continuous. The selection of several representative points on the path is described as follows: for the starting point, the direction deviation is 0, and the contribution value of the integral term ; for the midpoint of the path Since the path is smooth and on the boundary, its initial boundary probability value is 0.89, when the path has a slight bend, the direction deviation is 0.1, and the consistency weight term At this time, the contribution value of the integrand ; for the far end of the path , assuming that the point is still at the boundary, its initial boundary probability value is 0.85, when the path has a large bend, the direction deviation is 0.2, and the consistency weight term At this time, the contribution value of the integrand ; it can be seen that the value of the integrand is maintained at a high level throughout the entire integration path from -30 to +30 at point A, so the cumulative result of the entire integration will be high, and after normalization, the path consistency score .
[0063] Since point B is located on an isolated scratch, when tracing the path from the coordinate B point along the boundary direction , the path will quickly leave this high-probability scratch and enter the low-probability background region. The selection of several representative points on the path is described as follows: for the starting point, the direction deviation is 0, and the contribution value of the integrand ; at the midpoint of the path , the path has left the scratch area and entered the flat background area, and the initial boundary probability has decreased to 0.1, while the background gradient direction is chaotic, and the direction deviation is 1.0, the consistency weight term At this time, the contribution value of the integrand ; for the far end of the path , the path has entered the background area, and the initial boundary probability value has further decreased to 0.05, and the direction deviation has increased to 1.5, and the consistency weight term At this time, the contribution value of the integrand ; it can be seen that throughout the entire integration path from -30 to +30 at point B, except for a few points near the starting point, the contribution value of the integrand of most of the path tends to zero due to the decrease in the boundary probability value. Therefore, the cumulative result of the entire integration will be very low, and after normalization, the path consistency score .
[0064] At this point, the path consistency score of each pixel point in the ROI is obtained.
[0065] Step S400, fuse the initial boundary probability and the path consistency score of the pixel point to obtain the final boundary probability of the pixel point.
[0066] It should be noted that in order to optimally fuse the initial boundary probability from the local structure and the path consistency score from the macro path, simple linear weighting or direct multiplication cannot reflect the mutual enhancement or weakening relationship between the two indicators. Therefore, the application adopts an index fusion relationship formula based on the Bayesian theory to calculate the final boundary probability, which calculates the final confidence by the ratio of the joint probability of supporting the boundary to the joint probability of not supporting the boundary, which fits the core logic of updating the posterior probability in the Bayesian theory, can significantly enhance the confidence when the two indicators are consistent, effectively suppress noise when the two indicators are contradictory, and ensure that the fusion process has clear theoretical support.
[0067] According to the above logic, the final boundary probability satisfies the relationship formula:
[0068] ;
[0069] Wherein, is the final boundary probability of the pixel point , the value range is , and the value closer to 1 indicates that the confidence of the pixel point as a real boundary is higher; is the initial boundary probability of the pixel point ; is the path consistency score of the pixel point ; is a preset small value for preventing the denominator from being 0, which can be set to 0.001.
[0070] In the relationship formula, the numerator represents the joint probability that both indicators support the boundary, and the denominator plays a normalizing role. When the initial boundary probability and the path consistency score are both at a high level, the final boundary probability result will be closer to 1 than a single indicator, realizing the mutual enhancement between indicators. When there is a contradiction between one indicator being strong and the other being weak, for example, a noise point with obvious local features but not on a continuous path, the final boundary probability result will be significantly lowered, effectively realizing the true from the false.
[0071] For example, still taking the A point and the B point as an example, for the A point, the initial boundary probability , the path consistency score , and the final boundary probability relationship formula can be calculated as: Therefore, the boundary confidence of the A point is significantly enhanced to close to 1, further verifying the reliability of the real boundary. For the B point, the initial boundary probability , the path consistency score , and the final boundary probability relationship formula can be calculated as: Therefore, the boundary confidence of the B point is obviously lowered from a local high value, effectively distinguishing the false boundary property thereof.
[0072] Finally, the final boundary probability of each pixel point in the ROI is calculated one by one, and the final boundary probability field of each pixel point in the ROI is obtained.
[0073] In step S500, the wear profile is extracted based on the final boundary probability of each pixel point in the region of interest, and the tool wear state is evaluated according to the wear profile to realize real-time detection.
[0074] It should be noted that, in order to extract the profile from the final boundary probability field, the active contour model regards the profile as an overall energy minimization curve with elasticity and rigidity. The advantage is that it will not only be attracted by the obvious features of the image, but also the inherent smoothness and continuity constraint can automatically bridge the small breakpoints on the boundary and suppress the interference of noise. Therefore, the model is selected in the present application in order to utilize its strong overall and geometric constraint ability to convert the final probability map into an absolutely closed, smooth and sub-pixel precision optimal boundary profile.
[0075] Specifically, first, the active contour model is used to construct an external potential field based on the final boundary probability field. The potential energy is negatively correlated with the boundary probability, and the higher the probability, the lower the potential energy of the region, so as to guide the profile to converge to the high-probability boundary. Under the driving of the external potential field, an accurate and closed wear boundary profile is extracted through iterative optimization, and the iterative optimization will continue until the profile energy converges or the preset iteration number is reached. It should be noted that how to construct the external potential field is prior art, which will not be described here.
[0076] Then, based on the extracted profile, a standard geometric measurement algorithm is used, in which the Gauss-Green relationship can be directly calculated by integrating the closed profile to calculate the area of the region, and the closed wear profile is adapted to calculate the key wear evaluation indicators such as the wear area and the maximum wear width. Finally, the calculated quantitative indicators are compared with the preset scrap threshold, and the current state of the tool, such as normal, warning, and scrap, is determined, and corresponding instructions are sent to the machine tool numerical control system or the operator, so as to complete the detection.
[0077] The setting of the scrap threshold depends on the machining process, workpiece material and surface quality requirements, and needs to take into account economic benefits. As a preferred embodiment, the setting scene of the scrap threshold can be specifically divided into: high-precision finishing scene: for example, when the final profile finishing is performed on the key bearing components of aviation, in order to ensure the extreme dimensional accuracy and surface integrity, such as surface roughness 0.8 μm, the sharpness of the tool is required to be extremely high, at this time, the scrap threshold is set very strictly, for example, 0.2 mm. Large excess rough machining scene: when the rough machining process is performed on the forging blank, the main target is to efficiently remove a large amount of material, and the surface quality requirement is not high, at this time, in order to maximize the tool life and reduce the cost, the scrap threshold can be set relatively loose, for example, 0.6 mm.
[0078] For example, an initial contour line is finally accurately fitted to the true wear boundary containing point A under the guidance of the potential field constructed according to the final boundary probability field, and completely ignores the interference area where point B is located. Based on the extracted optimal contour, the algorithm calculates the wear width of 35.4 pixels, and after completing the camera calibration according to the camera intrinsic parameters and the object distance parameters, the physical size is converted to 0.35 mm. Compare this value with the pre-set scrap threshold corresponding to the high-precision finishing scene in the system, since , it is determined that the tool has reached the scrap standard, and a tool changing instruction is sent to the machine tool.
[0079] The second aspect of the embodiment provides a machine vision-based real-time detection system for tool wear of a numerical control lathe, which comprises Figure 2 As shown in the figure, the machine vision-based real-time detection system for tool wear of a numerical control lathe comprises a memory and a processor, and the memory stores computer program instructions, which realize the machine vision-based real-time detection method for tool wear of a numerical control lathe of the first aspect of the application when executed by the processor.
[0080] The machine vision-based real-time detection system for tool wear of a numerical control lathe further comprises a communication bus, a communication interface and other components familiar to those skilled in the art, the settings and functions of which are known in the art, and therefore will not be described here.
[0081] In this disclosure, a "storage medium" or "computer readable medium" can be any available medium that can be accessed by a general purpose or special purpose computer system. By way of example, and not limitation, such computer readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code means in the form of computer-executable instructions or data structures and that can be accessed by a general purpose or special purpose computer system, or a combination thereof. When information is transferred or provided over a network or another communications connection (either hardwired, wireless, or combination thereof) to a computer, the computer properly views the connection as a computer readable medium. Thus, any such connection is properly termed a computer readable medium. Combinations of the above should also be included within the scope of the computer readable media.
[0082] The above are all preferred embodiments of the present application, and are not intended to limit the protection scope of the present application, therefore: any equivalent changes made in the structure, shape, principle of the present application should be covered within the protection scope of the present application.
Claims
1. A machine vision-based real-time detection method for tool wear of a numerical control lathe, characterized in that, The method comprises the following steps: Collecting a numerical control lathe tool image and positioning a region of interest; For each pixel point in the region of interest, a structure consistency factor representing the local structure anisotropy of the pixel point is calculated, and the structure consistency factor is positively correlated with the difference between the maximum eigenvalue and the minimum eigenvalue of the structure tensor in the neighborhood of the pixel point; Nonlinearly modulate the gradient amplitude of the pixel point based on the structure consistency factor and the phase consistency of the pixel point, combine the nonlinear amplification result of the phase consistency, calculate the initial boundary probability of the pixel point, meet the relationship: , is the initial boundary probability of the pixel point , is the gradient amplitude of the pixel point , is the phase consistency value of the pixel point , is the structure consistency factor of the pixel point , is a standard normalization function, is a hyperbolic tangent function; For each pixel point in the region of interest, an exploration path extending through the pixel point and along the local boundary direction of the pixel point is constructed, and a path consistency score of the pixel point is calculated based on the integral of the product of the initial boundary probability and a preset weight along the exploration path; fusing the initial boundary probability of the pixel point and the path consistency score to obtain a final boundary probability of the pixel point, including: fusing the initial boundary probability and the path consistency score based on Bayesian theory to obtain the final boundary probability, and the relationship is , is the final boundary probability of the pixel point , is the path consistency score of the pixel point , is a preset infinitesimal value; Based on the final boundary probability of each pixel point in the region of interest, a wear profile is extracted, including: obtaining the final boundary probability of each pixel point in the region of interest to obtain a final boundary probability field; constructing an external potential field based on the final boundary probability field; under the driving of the external potential field, iteratively updating an active contour model until a preset termination condition is reached to extract the wear profile; According to the wear profile, the tool wear state is evaluated to realize real-time detection.
2. The machine vision based real-time detection of CNC lathe tool wear method according to claim 1, wherein, The structure consistency factor is obtained by: Calculating the structure tensor in the neighborhood window of the pixel point; Performing eigenvalue decomposition on the structure tensor to obtain the maximum eigenvalue and the minimum eigenvalue; The ratio of the difference between the maximum eigenvalue and the minimum eigenvalue to the sum is taken as the structure consistency factor.
3. The machine vision-based real-time detection method of tool wear in a CNC lathe as claimed in claim 1, wherein, The construction of the exploration path through the pixel point and extending along the local boundary direction of the pixel point includes: Determining the eigenvector of the minimum eigenvalue corresponding to the structure tensor of the pixel point, and taking the direction of the eigenvector as the initial extension direction of the exploration path; Starting from the pixel point, iteratively tracking each pixel along the initial extension direction, and updating the advancing direction according to the local boundary direction of each tracking node until the path length reaches a preset maximum exploration distance to generate the exploration path.
4. The machine vision-based real-time detection method of tool wear in a CNC lathe as claimed in claim 1, wherein, The preset weight is obtained by: Obtaining the directional deviation between the local boundary direction of any pixel point on the exploration path and the initial extension direction of the exploration path; Calculating the normalized value of the square value of the directional deviation, and performing negative exponential operation to obtain the preset weight.
5. The machine vision-based real-time detection method of tool wear in a CNC lathe as claimed in claim 1, wherein, The positioning of the region of interest includes: Performing gray processing on the numerical control lathe tool image to obtain a gray image; Using a normalized cross-correlation template matching technique to locate the region in the gray image that is most matched with a preset template image, and cutting it as the region of interest.
6. A machine vision-based real-time detection system for tool wear in a CNC lathe, characterized by, The machine vision-based numerical control lathe tool wear real-time detection system comprises a processor and a memory, and the memory stores computer program instructions which, when executed by the processor, implement the machine vision-based numerical control lathe tool wear real-time detection method according to any one of claims 1-5.
Citation Information
Patent Citations
Bullet train axle box defect detection method, system and equipment based on image recognition
CN120912619A
System and method for dynamic multi-objective optimization of machine selection, integration and utilization
US20090210081A1
Cited By
Joint Monitoring Method for Tool Abnormalities and Coolant Interruption in CNC Machining Centers
CN122559769A