Intelligent positioning method for workpiece drilling based on CNC system

By extracting the edge communication domain and its chain code sequence in the workpiece drilling image, combining the evaluation of edge possibility and trend adaptability, the machine learning model is used to identify the optimal communication domain group, which solves the problem of incomplete edge information in the workpiece drilling positioning and improves the accuracy and efficiency of positioning.

CN119205767BActive Publication Date: 2025-03-04SHANXI PROVINCE WEIDA MASCH MFG CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411709675.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-04
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

The prior art causes incomplete edge information when drilling and positioning workpieces, which affects positioning accuracy.

Method used

By collecting the image after drilling of the workpiece, the edge connection domain and its boundary chain code sequence are extracted, the edge possibility and trend adaptability are calculated, and the optimal connection domain group is identified in combination with the machine learning model to improve the edge detection accuracy.

Benefits of technology

Effectively identify the optimal edge communication domain group, improve the accuracy and robustness of drilling edge detection and identification, and improve the accuracy and efficiency of drilling positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119205767B_ABST
    Figure CN119205767B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image data processing, and in particular to a method for intelligent positioning of workpiece drilling based on a CNC system, comprising: collecting an image of a workpiece after drilling; extracting multiple edge connected domains and their corresponding boundary chain code sequences in the image; traversing each boundary chain code sequence and counting the number of its sequential chain codes and reverse chain codes; calculating the edge possibility of each edge connected domain and the trend fitness of any two edge connected domains, taking the product of the edge possibility and the trend fitness of any two edge connected domains as the preferred degree of the two edge connected domains, responding that the two edge connected domains with the greatest preferred degree are the optimal connected domain group, inputting the optimal connected domain group into a machine learning model, and obtaining the workpiece drilling edge. The present invention solves the problem of low accuracy when positioning a workpiece for drilling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and more specifically, to a workpiece drilling intelligent positioning method based on a CNC system. Background Art

[0002] In the field of modern manufacturing, CNC systems, as one of the core technologies of precision machining, are used in the manufacturing and processing of various workpieces, especially in drilling operations, showing extremely high precision and efficiency. The automation characteristics of CNC systems enable them to achieve efficient batch processing, and complete complex processing tasks with extremely high precision through pre-set processing paths and coordinate parameters, significantly improving the consistency of product quality and production efficiency.

[0003] With the continuous development of intelligent manufacturing, CNC systems are gradually combining with modern sensing technology and image processing technology to further improve their processing accuracy and adaptability. In the process of workpiece processing, accurate positioning of the workpiece is one of the key links to ensure drilling accuracy, and the introduction of image processing technology enables the CNC system to obtain the position information of the workpiece in real time, providing data support for the intelligent adjustment of the processing path. High-precision sensing equipment such as depth cameras can capture the surface features and spatial position of the workpiece, and transmit the image data to the host computer for further image analysis and processing. By establishing a three-dimensional model library of the workpiece and performing template matching in the host computer, the specific type and feature position of the workpiece can be identified, providing a reliable positioning basis for subsequent drilling operations.

[0004] The patent application document with application publication number CN117011373A discloses a method for positioning workpiece drilling based on machine vision. The patent application document establishes a workpiece model library, uses a depth camera to take images of the target workpiece, and sends the images to a host computer; the host computer performs template matching based on the models in the model library to identify the type of workpiece, and calculates the position and posture of the drilling point on the target workpiece, thereby generating a drillable area centered on the drilling point.

[0005] However, although the above solution realizes intelligent positioning of the drilling area, the image edge may be broken when the image is captured, resulting in the inability to extract complete edge information, thereby causing the problem of low accuracy in drilling positioning of the workpiece. Summary of the invention

[0006] In order to solve the problem of low accuracy in drilling positioning of a workpiece raised in the above background technology, the present invention provides the following solution.

[0007] The present invention provides a workpiece drilling intelligent positioning method based on a CNC system, comprising: collecting an image of the workpiece after drilling, extracting multiple edge connected domains in the image and their corresponding boundary chain code sequences, traversing each boundary chain code sequence and counting the number of sequential chain codes and reverse chain codes; calculating the first The edge probability of an edge connected region , where For the The number of sequential chain codes of edge connected domains, For the The edge connected domain corresponds to the first chain code value, For the The edge connected domain corresponds to the first chain code value, For the The number of boundary chain codes in the boundary chain code sequence corresponding to an edge connected domain is obtained; the two nearest endpoints between any two edge connected domains are obtained, and half of the chain code of the corresponding boundary chain code sequence including the two endpoints is intercepted as the boundary half-chain code sequence; the trend fitness of any two edge connected domains is calculated, and the trend fitness is positively correlated with the mean of the chain code values ​​in the boundary chain code sequence corresponding to any two edge connected domains, and is negatively correlated with the mean of the chain code values ​​in the boundary half-chain code sequence corresponding to any two edge connected domains; the product of the edge possibility of any two edge connected domains and the trend fitness is taken as the preference degree of the two edge connected domains, and the two edge connected domains with the largest preference degree are regarded as the optimal connected domain group, and the optimal connected domain group is input into the machine learning model to obtain the drilling edge of the workpiece.

[0008] The above technical solution effectively identifies the optimal edge connected domain group by finely extracting and matching the edge connected domain in the workpiece drilling image, combined with the comprehensive evaluation of edge possibility and trend fitness, thereby improving the detection and recognition accuracy of the drilling edge. The optimal connected domain group is used to train and apply the machine learning model, further enhancing the model's ability to distinguish edge features and stability, and significantly improving the accuracy of drilling positioning.

[0009] Furthermore, the trend adaptability is:

[0010] ;

[0011] In the formula, For the The first The trend fitness of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary semi-chain code sequence of the edge-connected domain, For the The mean of the chain code values ​​in the boundary semi-chain code sequence of the edge-connected domain.

[0012] The above technical solution defines the trend fitness to measure the difference in the mean chain code value of two edge connected domains and the anti-correlation of the mean half chain code, so as to accurately evaluate the continuity and matching between edges and ensure the smoothness and consistency of edge connection. This calculation method effectively reduces the error in edge matching, improves the accuracy of edge splicing, makes the contour recognition of the workpiece drilling edge more accurate, and provides a more reliable foundation for subsequent precision positioning and shape reconstruction.

[0013] Furthermore, the trend adaptability is:

[0014] ;

[0015] In the formula, For the The first The trend fitness of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The boundary chain code sequence corresponding to the edge connected domain and the The Euclidean distance between the boundary chain code sequences corresponding to the edge connected domains.

[0016] The above technical solution defines a new trend fitness calculation method by combining the Euclidean distance with the chain code mean difference, which effectively evaluates the matching degree between two edge connected domains. In this way, not only the spatial proximity of the edge connected domains is considered, but also the similarity of the edge morphology is fully reflected, the matching error caused by inconsistent edge directions is reduced, the accuracy and stability of edge detection are further improved, and the accurate identification and effective reconstruction of the workpiece drilling edge are ensured.

[0017] Furthermore, a CMOS camera or a CCD camera is used to collect images of the workpiece after drilling.

[0018] Furthermore, the edge connected domains in the image and their corresponding boundary chain code sequences are extracted, specifically:

[0019] Performing Canny edge detection on the image to obtain a binary edge image; using an eight-connected algorithm to mark multiple edge connected domains in the binary edge image, and generating corresponding edge chain code sequences along the boundaries of each edge connected domain.

[0020] The above technical solution can efficiently extract clear edge connected domains and their corresponding boundary chain code sequences from images by using Canny edge detection and eight-connectivity algorithm. This method effectively improves the accuracy and robustness of edge detection, making the edge features in the image clearer and easier to process later, and can more accurately analyze and reconstruct the edges of workpieces, improving the accuracy and reliability of edge positioning in drilling or other precision operations.

[0021] Furthermore, the Euclidean metric method is used to obtain the two closest endpoints between any two edge-connected domains.

[0022] Furthermore, the machine learning model is a convolutional neural network model.

[0023] The above technical solution can effectively extract and identify edge features from complex images automatically by using a convolutional neural network model for training and prediction. The deep learning ability of the convolutional neural network enables the model to learn more complex edge patterns from a large amount of data, greatly improving the accuracy and robustness of edge detection, especially when dealing with delicate operations such as workpiece drilling, it can achieve more accurate edge positioning and reconstruction, thereby improving the performance and efficiency of the overall detection system.

[0024] Furthermore, it also includes training the machine learning model, specifically:

[0025] The training set is input into the pre-built machine learning model for training. During the training process, the loss between the output prediction value and the label is calculated; the machine learning model parameters are adjusted using the gradient descent method to minimize the prediction error; the machine learning model parameters are iteratively adjusted until the loss is less than a certain value or the set number of training times is reached, and finally a trained machine learning model is obtained.

[0026] The beneficial effects of the present invention are:

[0027] The present invention uses a machine learning model to further enhance the detection accuracy and robustness of the drilling edge by accurately extracting the edge connectivity domain in the workpiece drilling image and combining the edge possibility and trend fitness for optimization. The Canny edge detection and eight-connectivity algorithm are used to ensure the accuracy of edge extraction, and the edge matching is optimized by obtaining the nearest two end points through the Euclidean metric. The introduction of the convolutional neural network model makes the entire detection process more intelligent and adaptive, thereby improving the automation level and accuracy of drilling positioning, and effectively improving the quality and efficiency of workpiece processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0029] Figure 1 is a flowchart schematically showing a method for intelligent positioning of workpiece drilling based on a CNC system according to an embodiment of the present invention;

[0030] Figure 2 is a grayscale diagram schematically illustrating workpiece drill hole edge detection according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0032] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0033] An embodiment of a workpiece drilling intelligent positioning method based on a CNC system.

[0034] like Figure 1 As shown, the flow chart of the workpiece drilling intelligent positioning method based on the CNC system of an embodiment of the present invention includes the following steps:

[0035] S1: Collect an image of the workpiece after drilling, and extract multiple edge connected domains and their corresponding boundary chain code sequences in the image.

[0036] In one embodiment, a CMOS camera or CCD camera can be used to obtain images of the workpiece after drilling, ensuring the clarity and resolution of the image for subsequent processing. These cameras have high sensitivity and a high dynamic range, and are suitable for capturing fine drilling details. For specific application scenarios, devices such as infrared cameras can also be used to collect images of the workpiece after drilling, especially in situations where the temperature is high or the ambient light is weak. Infrared cameras can detect the thermal distribution of the workpiece, thereby providing more image information for the processing operation of drilling detection, and improving the comprehensiveness and reliability of detection.

[0037] In another embodiment, the collected image is grayed and median filtered to reduce image noise and improve image quality. Graying converts the image into a single-channel image with grayscale levels, which helps with subsequent edge detection and contour extraction operations and simplifies the calculation process. Median filtering can effectively suppress salt and pepper noise and other random noises in the image, maintain the sharpness of the edge, and thus provide a smoother image input for subsequent edge detection and contour extraction. Through the above processing steps, the entire system can more accurately identify the edge information of the workpiece drilling and improve the accuracy and reliability of image analysis.

[0038] In another embodiment, the collected image is preprocessed and edge features are extracted. First, the image is subjected to Canny edge detection to obtain a high-precision binary edge image of the drilling contour. The Canny operator can effectively detect the precise position of the edge, while suppressing the influence of noise, and ensuring the edge clarity and integrity of the image. On this basis, the eight-connected algorithm is used to mark multiple edge connected domains in the binary edge image, so that each edge area is independently distinguished. Then, the corresponding boundary chain code sequence is generated along the boundary of each edge connected domain, and the contour information of the edge is expressed by recording the relative position relationship between pixel points, which is convenient for subsequent geometric analysis and shape matching. This processing method can accurately describe the boundary morphology of the workpiece drilling and provide a reliable basis for drilling detection and contour recognition.

[0039] like Figure 2 As shown, a grayscale image of workpiece drilling edge detection according to an embodiment of the present invention.

[0040] S2: Calculate the edge possibility of the edge connected domain and the trend fitness between any two edge connected domains.

[0041] In one embodiment, the calculation The edge probability of an edge connected region :

[0042] ;

[0043] In the formula, For the The number of sequential chain codes of edge connected domains, For the The number of reverse chain codes of edge connected domains, For the The edge connected domain corresponds to the first chain code value, For the The edge connected domain corresponds to the first chain code value, For the The edge connected domain corresponds to the number of boundary chain codes in the boundary chain code sequence;

[0044] For example: Assume that the boundary chain code sequence of a certain edge connected domain is [1,3,1,3,4,5,7,2], the second chain code value 3 is the order of the first chain code value 1, the third chain code value 1 is the reverse order of the second chain code value 3, and so on. The number of sequential chain codes and the number of reverse chain codes of the edge connected domain are 5 and 2 respectively.

[0045] The above technical solution improves the stability and robustness of edge feature extraction by combining the ratio of the sequential chain code to the reverse chain code and the average change of the difference between adjacent chain codes. The calculation of the ratio of the sequential and reverse chain codes can measure the consistency of the edge direction and reduce the directional noise in edge detection, while the accumulation of the difference between adjacent chain codes reflects the continuity of the edge and can effectively identify discontinuous or irregular edge structures. This method ensures the accuracy of the edge connectivity domain, thereby improving the accurate detection of edges in the image, which helps to accurately locate and describe the boundary features of the workpiece.

[0046] And obtain the two closest endpoints between any two edge connected domains. In this embodiment, the Euclidean metric method can be used to obtain the two closest endpoints between any two edge connected domains; intercept half of the corresponding boundary chain code sequence including the two endpoints as the boundary half chain code sequence;

[0047] For example: Assume that The boundary chain code sequence of the edge connected domain is [1,3,1,3,4,5,7,2]. The boundary chain code sequence of the edge connected domain is [3,2,4,1,5,3,7,4], which is determined by the Euclidean metric method. and The two closest points are: The chain code value of the edge connected domain is 1, The chain code value of the edge connected domain is 4, then the corresponding boundary half-chain code sequences are [1,3,1,3] and [5,3,7,4].

[0048] Calculate the trend fitness of any two edge connected domains; the trend fitness is:

[0049] ;

[0050] In the formula, For the The first The trend fitness of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary semi-chain code sequence of the edge-connected domain, For the The mean of the chain code values ​​in the boundary semi-chain code sequence of the edge-connected domain.

[0051] The above technical solution reflects the continuity and matching degree of the edge by measuring the difference between the overall chain code mean and the half-chain code sequence mean of the two edge connected domains, making the edge connection smoother and more natural, thereby effectively reducing the discontinuity or mismatch between edges. This method further improves the accuracy of edge detection and shape description, and helps to accurately reconstruct the boundary morphology of the workpiece.

[0052] In another embodiment, the trend adaptability is:

[0053] ;

[0054] In the formula, For the The first The trend fitness of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The boundary chain code sequence corresponding to the edge connected domain and the The Euclidean distance between the boundary chain code sequences corresponding to the edge connected domains.

[0055] The above technical solution effectively improves the accuracy of edge matching by defining the trend adaptation as a function of the Euclidean distance between the edge connected domain chain code sequences and the difference between the chain code mean values. By taking the Euclidean distance as the dominant factor and introducing the adjustment term of the chain code mean difference, the solution takes into account the spatial proximity and directional consistency of the edge connected domain in the calculation, reducing the possibility of mismatching caused by spatial distance alone. This method can more accurately measure the continuation trend of two edge connected domains, making edge detection and contour matching more robust, and providing more reliable data support for subsequent workpiece boundary reconstruction.

[0056] S3: Multiply the edge possibility and trend fitness of any two edge connected domains to obtain the degree of preference of the two edge connected domains, and the two edge connected domains with the highest degree of preference are the optimal connected domain group.

[0057] In one embodiment, according to and The edge possibility of the edge connected domain and the trend adaptation degree are used to obtain the optimization degree of the two edges:

[0058] ;

[0059] In the formula, For the and The degree of preference of the edge connected domain, For the The edge possibility of an edge-connected domain, For the The edge possibility of an edge-connected domain, For the and The trend fitness of the edge connected domain.

[0060] In response to the two edge connected domains with the highest degree of preference being the optimal connected domain group, the above scheme can more accurately identify the best matching combination of the two edge connected domains, ensure the smoothness and structural rationality of the edge connection, and thus improve the stability of edge splicing and contour reconstruction.

[0061] S4: Input the optimal connected domain group into the machine learning model to obtain the drilling edge of the workpiece.

[0062] In one embodiment, the machine learning model is a convolutional neural network model.

[0063] Taking the convolutional neural network model as an example, the machine learning model is trained as follows:

[0064] First, a training set is constructed and obtained, which contains the edge data of the optimal connected domain group calculated above, and the labels are manually set to identify the category or location information of the edge features. The training set is input into the pre-built convolutional neural network model, and the predicted value output by the model is calculated by forward propagation, and compared with the label value to calculate the loss. During the training process, the model parameters are adjusted by the gradient descent method to minimize the prediction error. The model parameters are iteratively updated until the loss is less than the set threshold or the predetermined number of training times is reached, thereby obtaining a fully trained convolutional neural network model. After the training is completed, the model is used to realize automatic recognition and accurate detection of the edge of the workpiece.

[0065] The solution of the present invention provides an efficient intelligent positioning method for workpiece drilling by combining image processing, edge analysis and machine learning models. The edge connection domain of the workpiece after drilling is accurately identified by using Canny edge detection, eight-connectedness algorithm and boundary chain code sequence extraction technology, so as to achieve accurate positioning of the drilling edge. In addition, by calculating the edge possibility and trend fitness, and combining with the machine learning model, the accuracy and robustness of edge detection can be further improved, and finally the drilling accuracy and positioning efficiency are optimized, meeting the automation requirements in the high-precision manufacturing process.

[0066] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0067] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

Claims

1. A workpiece drilling intelligent positioning method based on a CNC system, characterized in that: include: Collect the image of the workpiece after drilling, extract multiple edge connected domains in the image and their corresponding boundary chain code sequences, traverse each boundary chain code sequence and count the number of its sequential chain codes and reverse chain codes; Calculate the The edge probability of an edge connected region , where For the The number of sequential chain codes of edge connected domains, For the The number of reverse chain codes of edge connected domains, For the The edge connected domain corresponds to the first chain code value, For the The edge connected domain corresponds to the first chain code value, For the The edge connected domain corresponds to the number of boundary chain codes in the boundary chain code sequence; The Euclidean metric method is used to obtain the two closest endpoints between any two edge connected domains, and half of the chain code of the corresponding boundary chain code sequence including the two endpoints is intercepted as the boundary half-chain code sequence; the trend fitness of any two edge connected domains is calculated, and the trend fitness of the two edge connected domains is positively correlated with the mean of the chain code values ​​in the boundary chain code sequence corresponding to the two edge connected domains, and is negatively correlated with the mean of the chain code values ​​in the boundary half-chain code sequence corresponding to the two edge connected domains; The product of the edge possibility and the trend fitness of any two edge connected domains is taken as the preference degree of the two edge connected domains. The two edge connected domains with the highest preference degree are regarded as the optimal connected domain group. The optimal connected domain group is input into the machine learning model to obtain the edge of the workpiece drilling hole; the machine learning model is used to automatically extract and identify edge features to realize the edge positioning and reconstruction of the workpiece drilling hole.

2. The workpiece drilling intelligent positioning method based on the CNC system according to claim 1 is characterized in that: The trend adaptability is: ; In the formula, For the The first The trend fitness of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary chain code sequence of the edge connected domain, For the The mean of the chain code values ​​in the boundary semi-chain code sequence of the edge-connected domain, For the The mean of the chain code values ​​in the boundary semi-chain code sequence of the edge-connected domain.

3. The workpiece drilling intelligent positioning method based on the CNC system according to claim 1 is characterized in that: Use a CMOS camera or CCD camera to capture images of the workpiece after drilling.

4. The workpiece drilling intelligent positioning method based on the CNC system according to claim 1 is characterized in that: Extract the edge connected domain in the image and its corresponding boundary chain code sequence, specifically: Perform Canny edge detection on the image to obtain a binary edge image; In the binary edge image, an eight-connectivity algorithm is used to mark a plurality of edge connected domains, and a corresponding edge chain code sequence is generated along the boundary of each edge connected domain.

5. The workpiece drilling intelligent positioning method based on CNC system according to claim 1 is characterized in that: The machine learning model is a convolutional neural network model.

6. The workpiece drilling intelligent positioning method based on CNC system according to claim 1 is characterized in that: The method also includes performing image grayscale conversion and median filtering on the image.

7. The workpiece drilling intelligent positioning method based on CNC system according to claim 1 is characterized in that: It also includes training the machine learning model, specifically: The training set is input into the pre-built machine learning model for training. During the training process, the loss between the output prediction value and the label is calculated; the machine learning model parameters are adjusted using the gradient descent method to minimize the prediction error; the machine learning model parameters are iteratively adjusted until the loss is less than the set threshold or the set number of training times is reached, and finally a trained machine learning model is obtained.

Citation Information

Patent Citations

  • Workpiece drilling positioning method based on machine vision

    CN117011373A

  • Broiler chicken breeding ecological early warning method and system based on artificial intelligence

    CN117422716A

  • Shell surface defect detection method for concentrator terminal production

    CN118096736A