Visual positioning and processing path planning method for laser engraving machine

The intelligent visual positioning of the laser engraving machine and the path planning of the three-layer multi-factor evolutionary algorithm are carried out through the SSD deep neural network, which solves the problem of position deviation of the laser engraving machine under special working conditions and realizes the efficient automatic positioning and Efficient path optimization improves processing accuracy and efficiency.

CN118720429APending Publication Date: 2024-10-01CHONGQING UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410661379.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The deviation of the workpiece position of the laser engraving machine under special working conditions leads to processing errors. The existing technology requires manual adjustment of the position, which reduces the processing accuracy and efficiency, and the existing path planning algorithm is difficult to achieve efficient utilization of large-scale engraving tasks.

Method used

A real-time target detection model based on SSD deep neural network is used for intelligent visual positioning of the laser engraving machine, and a three-layer multi-factor evolutionary algorithm is used for processing path planning to achieve automatic positioning of the laser and efficient path optimization.

Benefits of technology

It greatly reduces the burden of manual work, improves the positioning accuracy and processing efficiency of laser engraving machines, realizes optimal path planning for large-scale laser processing points, and improves time and energy efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118720429A_ABST
    Figure CN118720429A_ABST
Patent Text Reader

Abstract

The invention discloses a visual positioning and processing path planning method for a laser engraving machine. The method comprises the following steps: 1) constructing a real-time target detection model of the laser engraving machine; (2) image data of a device to be machined are collected in real time through a laser engraving machine vision module and input into the real-time target detection model, and detection and coordinate obtaining of the device to be machined and registration of a laser are conducted; 3) inputting to-be-engraved image data processed based on the halftone technology, and obtaining processing point location data of the laser engraving machine; 4) performing path planning on the processing point location data based on a three-layer multi-factor evolutionary algorithm; and (5) according to the processing point location data after path planning, the processing task of the laser engraving machine is completed, and a final processing device is generated. According to the invention, path planning of the laser engraving machine for large-scale laser processing point location data can be completed, and the time and energy efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of laser engraving machine control, in particular to a visual positioning and processing path planning method for a laser engraving machine. Background Art

[0002] As an important carrier of laser intelligent manufacturing, laser engraving machines can process the materials used, such as drilling, cutting, welding, surface treatment, etc., and have the characteristics of high processing accuracy, strong processing adaptability, optimized selection of processing technology, and flexible processing of large-size workpieces. Its development can improve the accuracy and fineness of the manufacturing process, especially for the manufacturing and processing of parts that require high precision, which helps to improve the overall level of my country's manufacturing industry and promote the development of high-end manufacturing technology.

[0003] Considering that the workpiece may produce unnecessary offsets during processing under special working conditions, resulting in position errors between the laser and the target workpiece, the laser processing point cannot meet the expected effect, causing the workpiece to be scrapped. It is urgently needed that the laser engraving machine can detect and obtain the workpiece position information in real time and adjust the laser position in an intelligent way. Most of the current laser engraving machines need to manually adjust the workpiece position to ensure that the laser is correctly positioned in the target area, but this method is not conducive to improving processing accuracy, efficiency and automation level.

[0004] In addition, the shortcomings of existing laser engraving machine technology are that for extremely complex and large-scale laser processing tasks, the engraving process of the laser engraving machine will be very time-consuming, which greatly reduces the time efficiency and energy efficiency in the laser intelligent manufacturing process. Moreover, the current processing path planning algorithms of laser engraving machines have their limitations, and it is difficult to obtain the global optimal solution. For large-scale engraving tasks, it is impossible to effectively realize the efficient use of laser engraving machines.

[0005] Therefore, in order to improve production and processing efficiency, reduce human intervention, ensure processing quality, and reduce safety hazards caused by human misoperation, and at the same time to improve the time and energy efficiency of laser engraving machines in the manufacturing process, it is urgent to provide a visual positioning and processing path planning method for laser engraving machines, use intelligent visual positioning technology to realize automatic positioning and alignment of laser engraving machines, and design an advanced processing path planning algorithm to solve the above technical problems. Summary of the invention

[0006] The object of the present invention is to provide a method for visual positioning and processing path planning for a laser engraving machine, comprising the following steps:

[0007] 1) Build a real-time target detection model for laser engraving machines;

[0008] 2) Obtaining a target detection data set of the laser engraving machine to be processed, and performing data preprocessing to construct a training set for a real-time target detection model; and using the training set to train the real-time target detection model;

[0009] 3) Using the laser engraving machine vision module to collect the image data of the device to be processed in real time, and input it into the real-time target detection model to detect the device to be processed, obtain the coordinates and align the laser;

[0010] 4) Input the image data to be engraved after processing based on halftone technology, and obtain the processing point data of the laser engraving machine;

[0011] 5) Path planning for processing point data based on a three-layer multi-factor evolutionary algorithm;

[0012] 6) According to the processing point data after path planning, the processing task of the laser engraving machine is completed to generate the final processing device.

[0013] Furthermore, the real-time target detection model is constructed based on the SSD deep neural network;

[0014] The real-time target detection model includes a convolution module for extracting image features, a classification and positioning module;

[0015] The convolution module includes multiple convolution layers for extracting image features of different scales;

[0016] The classification and positioning module uses a non-maximum suppression method to process image features of different scales to complete the detection of the device to be processed, the acquisition of coordinates and the positioning of the laser.

[0017] Furthermore, the real-time target detection model uses feature layers of different scales to detect objects of different sizes, and the steps include:

[0018] 1) Extract features from the image data of the device to be processed and generate a feature map of the device to be processed;

[0019] 2) Generate a series of default boxes of different sizes with each pixel of the feature map of the device to be processed as the center;

[0020] The default box sizes are as follows:

[0021]

[0022] Among them, s min Indicates the size of the shallow default box, s max represents the size of the deep default box, m represents the number of feature extraction layers, k∈[1,m]; Indicates the default box width. Indicates the height of the default box, a r Indicates the aspect ratio; s k 、s' k Indicates size parameter; s k+1 Indicates the size parameter corresponding to the k+1th feature extraction layer;

[0023] 3) Performing bounding box regression on the default box to generate a predicted box, and using the predicted box as the detection result of the device to be processed;

[0024] The boundary position information of the prediction box is as follows:

[0025]

[0026] in, b w ,b h It is the boundary position information of the prediction box B; d w ,d h The default box is B d The boundary location information of g w ,g h is the real target box B gt Δx is the change in x-coordinate of the center point of the frame, Δy is the change in y-coordinate of the center point of the frame, Δw is the change in width of the frame, and Δh is the change in height of the frame.

[0027] Furthermore, the loss function L(x,t class ,B,B gt ) is as follows:

[0028]

[0029] Among them, N represents the number of default boxes that match the real target box, L conf represents the target category loss function, t class represents the confidence of each category, x = {0, 1} represents whether it matches, η represents the weight, L loc represents the regression loss function; represents the predicted value of location regression, represents the true value, b w ,b h It is the boundary position information of the prediction box B;

[0030] Regression loss function L loc (x,B,B gt ) is as follows:

[0031]

[0032] Among them, Pos represents the positive sample; Indicates whether it matches; c x 、c y , w, h represent the boundary position information; Smooth L1 represents a smooth function; They represent the predicted value and true value of location regression respectively.

[0033] Furthermore, the steps of performing data preprocessing to construct a training set for a real-time target detection model include:

[0034] 1) In the working environment of the laser engraving machine, use the industrial camera to obtain the image of the device to be processed and generate the custom model training data set data (n i ), the state category t corresponding to the custom model training data set class Including: inclined plane workpieces, rectangular workpieces, triangular workpieces, cylindrical workpieces, symmetrical inclined plane workpieces, and conical workpieces;

[0035] 2) Training the custom model with the data set data(n i ) is randomly offset and cropped to obtain the data set data'(n i );

[0036] 3) For the data set data'(n i ) performs threshold processing on the image of the device to be processed to extract the region of interest;

[0037] 3) Extract and connect the edge features of the device to be processed in the region of interest;

[0038] 4) Fit the smallest rotated rectangle according to the result of connecting the contour edges of the device to be processed, and generate the real frame of the device to be processed based on the rotated rectangle, obtain the center point coordinates, width and height of the real frame, and then construct a training set for the real-time target detection model.

[0039] Furthermore, when constructing a training set for the real-time target detection model, a portion of the images of the device to be processed are selected as the training set, and the remaining processed device images are selected as the test set;

[0040] After the real-time object detection model is trained, the real-time object detection model is also tested using the test set.

[0041] Furthermore, the steps of detecting the device to be processed, acquiring coordinates and aligning the laser include:

[0042] 1) Use the laser engraving machine vision module to collect the image data of the device to be processed in real time G WP, and perform threshold processing to extract the region of interest where the device to be processed exists, then extract and connect the edge features of the device to be processed, and fit the minimum rotated rectangle to generate the real frame B of the device to be processed gt' , and obtain the coordinates of the center point of the real frame coordinate_w(X,Y), complete the detection and coordinate acquisition of the device to be processed; X represents the x-coordinate value of the device to be processed in the workspace of the laser engraving machine, and Y represents the y-coordinate value of the device to be processed in the workspace of the laser engraving machine;

[0043] 2) The coordinate data information coordinate_w(X,Y) of the device to be processed in the working space of the laser engraving machine is transmitted to the motion controller of the laser engraving machine through serial communication. The motion controller drives the X-axis and Y-axis motors according to the coordinate data information of the device to be processed, and positions the laser above the area of ​​the device to be processed to realize automatic alignment of the laser;

[0044] The X-axis motor drive coordinate information and Y-axis motor drive coordinate information received by the actual motion controller are as follows:

[0045]

[0046] Among them, X' represents the X-axis motor drive coordinate information received by the actual motion controller, Y' represents the Y-axis motor drive coordinate information received by the actual motion controller, and α and β respectively represent the proportional relationship between the image movement coordinates of the laser positioned in the area of ​​the device to be processed and the X and Y-axis motor drive coordinate information received by the actual motion controller for calibration and registration.

[0047] Further, the step of obtaining the processing point data of the laser engraving machine includes:

[0048] 1) Select the original image data G to be engraved p , and grayscale processing;

[0049] The grayscale processing expression is as follows:

[0050]

[0051] Among them, m, n, k, and l represent pixel coordinates, g(m,n) represents the pixels in the corresponding area of ​​the image in grayscale format, and g * (m,n) represents the sum of the original gray pixel value and the error feedback, b(m,n) represents the output value, e(m,n) represents the error value, and w(k,l) represents the error diffusion filter, which determines the weight ratio of the selection of the allocated pixel and the allocated error;

[0052] 2) Compare the pixel coordinates of each pixel of the image to be engraved after grayscale processing with the threshold value. If the pixel is greater than the threshold value, the output value = 1, otherwise the output value = 0, thereby realizing the transformation of the image to be engraved based on the halftone technology into a binary image suitable for laser engraving;

[0053] The output value b(m,n) is as follows:

[0054]

[0055] Wherein, Q[] represents the threshold quantization function; e(mk,nl) represents the error value;

[0056] 3) By looping the entire binary image, calculate the coordinate value coordinate_black(x i ,y i ), and stored in the set C = {c1,c2,···,c n}, get the final laser engraving machine processing point data; where x i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the X-axis motor, y i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the Y-axis motor, c i = coordinate_black(x i ,y i ), i = 1, 2, ···, n; n is the number of processing points.

[0057] Furthermore, the steps of performing path planning on processing point data based on the three-layer multi-factor evolutionary algorithm include:

[0058] 1) According to the K-Medoids algorithm, the laser engraving machine processing point data C = {c1, c2, ···, c n} is divided into several medium-sized laser processing point clusters, and the center of each medium-sized point cluster is calculated as {K i |i=1,2,···,N}, where N represents the number of medium-sized point clusters;

[0059] 2) The K-Medoids algorithm is used to divide these medium-sized point clusters into several small-scale laser processing point clusters, and the center of each small-scale point cluster is calculated as Where L represents the number of small-scale point clusters;

[0060] 3) At the top level, a genetic algorithm is used to optimize the TSP composed of the centers of each medium-sized laser processing point cluster to obtain a non-closed path R:

[0061] R={R i =Index(K j )|i,j=1,2,···,N} (12)

[0062] Among them, Index(K j ) represents the serial number of the laser processing point j, R1 represents the serial number of the starting laser processing point, R N Indicates the serial number of the laser processing point where it ends, and R1 and R N There is no connection between i Indicates the serial number of the laser processing point in the non-closed path R;

[0063] 4) In the middle layer, a genetic algorithm is used to optimize the TSP composed of the centers of each small-scale laser processing point cluster in each medium-scale laser processing point cluster to obtain N non-closed paths r j :

[0064] r j = {r i =Index(KK m )|i,m=1,2,···,L} (13)

[0065] Where, j = 1, 2, · · ·, N, Index (KK m ) represents the serial number of the laser processing point m, r1 represents the serial number of the starting laser processing point, r L Indicates the serial number of the laser processing point where it ends, and r1 and r L There is no connection between them. i Represents a non-closed path r j The serial number of the laser processing point;

[0066] 5) Use the multi-factor evolutionary algorithm at the bottom layer to optimize the TSP composed of each small-scale laser processing point cluster to obtain N*L closed paths p j :

[0067] p j = {P i =Index(C s )|i=1,2,···,Q+1,s=1,2,···,Q} (14)

[0068] Among them, Index(C s ) represents the serial number of the laser processing point, P1 represents the serial number of the starting laser processing point, P Q Indicates the sequence number of the laser processing point where it ends, and P1 and P Q P is connected between them, and Q represents the number of small-scale laser processing points. i represents a closed path p jThe serial number of the laser processing point;

[0069] 6) The optimal path p of each small-scale laser processing point cluster obtained based on the bottom layer j , and then use the optimization result r of the middle layer j The medium-scale laser processing point clusters where the L small-scale laser processing point clusters are located are spliced ​​together, and then connected as a whole; finally, the top-level optimization result R is used to complete the path splicing of the N medium-scale laser processing point clusters, and then connected as a whole, to obtain the laser processing point data C' after the final path planning:

[0070] C'={C i =Index(c i )|i=1,2,···,n} (15)

[0071] Among them, Index(c i ) represents the serial number of the laser processing point i, c1 represents the serial number of the starting laser processing point, c n Indicates the serial number of the laser processing point at which the laser processing is completed, and n indicates the total number of laser processing points. i Indicates the serial number of the laser processing point in the laser processing point data C'.

[0072] Further, the steps to complete the laser engraving machine processing task include:

[0073] According to the laser processing point data C' after path planning, the coordinate information coordinate_black(x i ,y i ) is converted into G code format, and then the converted information is used as the input of the motion controller of the laser engraving machine to drive the XY axis motor of the laser engraving machine to rotate according to the processing point data after path planning, and control the laser to move along the specified path above the device area to be processed to engrave the final target workpiece.

[0074] The technical effect of the present invention is undoubted, and the beneficial effects of the present invention are as follows:

[0075] The present invention takes into account the position deviation of workpieces caused by special working conditions. In order to improve the problem of workpiece scrapping caused by such conditions, the target detection algorithm based on SSD deep neural network is adopted. By analyzing the image data captured by the monitoring equipment, the edge features of various devices to be processed are extracted to realize the intelligent recognition and detection of the laser engraving machine, and the position information is fed back to ensure that the laser is accurately positioned at the target workpiece, greatly reducing the burden of manual work. At the same time, combined with the "divide and conquer" idea, a three-layer multi-factor evolutionary algorithm is used to perform optimal path planning for large-scale laser processing points, ensuring that the algorithm efficiency and the quality of the optimal path solution can be improved on the basis of the existing path optimization algorithm;

[0076] By adopting the method of the present invention, the laser engraving machine can quickly and efficiently complete the real-time detection and positioning of the device to be processed during the laser processing and manufacturing process, realize the control effect of automatic positioning and registration of the laser engraving machine, and at the same time complete the path planning of the laser engraving machine for large-scale laser processing point data, thereby improving its time and energy efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 A design flow chart for the visual positioning and processing path planning method for laser engraving machines;

[0078] Figure 2 This is the structure diagram of the real-time target detection model for laser engraving machines based on SSD deep neural network;

[0079] Figure 3 This is a sample image of the original image to be engraved by the laser engraving machine;

[0080] Figure 4 The image to be engraved is processed based on halftone technology;

[0081] Figure 5 It is a flowchart of the three-layer multi-factor evolutionary algorithm;

[0082] Figure 6 Schematic diagram of optimizing laser engraving processing point data using a three-layer multi-factor evolutionary algorithm. DETAILED DESCRIPTION

[0083] The present invention is further described below in conjunction with the embodiments, but it should not be understood that the above subject matter of the present invention is limited to the following embodiments. Without departing from the above technical ideas of the present invention, various substitutions and changes are made according to the common technical knowledge and customary means in the art, which should all be included in the protection scope of the present invention.

[0084] Embodiment 1:

[0085] See also Figures 1 to 6 , a visual positioning and processing path planning method for a laser engraving machine, comprising the following steps:

[0086] 1) Build a real-time target detection model for laser engraving machines;

[0087] 2) Obtaining a target detection data set of the laser engraving machine to be processed, and performing data preprocessing to construct a training set for a real-time target detection model; and using the training set to train the real-time target detection model;

[0088] 3) Using the laser engraving machine vision module to collect the image data of the device to be processed in real time, and input it into the real-time target detection model to detect the device to be processed, obtain the coordinates and align the laser;

[0089] 4) Input the image data to be engraved after processing based on halftone technology, and obtain the processing point data of the laser engraving machine;

[0090] 5) Path planning for processing point data based on a three-layer multi-factor evolutionary algorithm;

[0091] 6) According to the processing point data after path planning, the processing task of the laser engraving machine is completed to generate the final processing device.

[0092] Embodiment 2:

[0093] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as that of Example 1, and further, the real-time target detection model is constructed based on an SSD deep neural network;

[0094] The real-time target detection model includes a convolution module for extracting image features, a classification and positioning module;

[0095] The convolution module includes multiple convolution layers for extracting image features of different scales;

[0096] The classification and positioning module uses a non-maximum suppression method to process image features of different scales to complete the detection of the device to be processed, the acquisition of coordinates and the positioning of the laser.

[0097] Embodiment 3:

[0098] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-2, further, the real-time target detection model uses feature layers of different scales to realize the detection of objects of different sizes, and the steps include:

[0099] 1) Extract features from the image data of the device to be processed and generate a feature map of the device to be processed;

[0100] 2) Generate a series of default boxes of different sizes with each pixel of the feature map of the device to be processed as the center;

[0101] The default box sizes are as follows:

[0102]

[0103]

[0104] Among them, s min Indicates the size of the shallow default box, s max represents the size of the deep default box, m represents the number of feature extraction layers, k∈[1,m]; Indicates the default box width. Indicates the height of the default box, a r Indicates the aspect ratio; s k 、s' k Indicates size parameter; s k+1 Indicates the size parameter corresponding to the k+1th feature extraction layer;

[0105] 3) Performing bounding box regression on the default box to generate a predicted box, and using the predicted box as the detection result of the device to be processed;

[0106] The boundary position information of the prediction box is as follows:

[0107]

[0108] in, b w ,b h It is the boundary position information of the prediction box B; d w ,d h The default box is B d The boundary location information of g w ,g h is the real target box B gt Δx is the change in x-coordinate of the center point of the frame, Δy is the change in y-coordinate of the center point of the frame, Δw is the change in width of the frame, and Δh is the change in height of the frame.

[0109] Embodiment 4:

[0110] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-3, further, the loss function L(x,t class ,B,B gt ) is as follows:

[0111]

[0112] Among them, N represents the number of default boxes that match the real target box, Lconf represents the target category loss function, t class represents the confidence of each category, x = {0, 1} represents whether it matches, η represents the weight, L loc represents the regression loss function; represents the predicted value of location regression, represents the true value, b w ,b h It is the boundary position information of the prediction box B;

[0113] Regression loss function L loc (x,B,B gt ) is as follows:

[0114]

[0115] Among them, Pos represents the positive sample; Indicates whether it matches; c x 、c y , w, h represent the boundary position information; Smooth L1 represents a smooth function; They represent the predicted value and true value of location regression respectively.

[0116] Embodiment 5:

[0117] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-4, and further, the step of performing data preprocessing to construct a training set of a real-time target detection model comprises:

[0118] 1) In the working environment of the laser engraving machine, use the industrial camera to obtain the image of the device to be processed and generate the custom model training data set data (n i ), the state category t corresponding to the custom model training data set class Including: inclined plane workpieces, rectangular workpieces, triangular workpieces, cylindrical workpieces, symmetrical inclined plane workpieces, and conical workpieces;

[0119] 2) Training the custom model with the data set data(n i ) is randomly offset and cropped to obtain the data set data'(n i );

[0120] 3) For the data set data'(n i ) performs threshold processing on the image of the device to be processed to extract the region of interest;

[0121] 3) Extract and connect the edge features of the device to be processed in the region of interest;

[0122] 4) Fit the smallest rotated rectangle according to the result of connecting the contour edges of the device to be processed, and generate the real frame of the device to be processed based on the rotated rectangle, obtain the center point coordinates, width and height of the real frame, and then construct a training set for the real-time target detection model.

[0123] Embodiment 6:

[0124] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of embodiments 1-5, and further, when constructing a training set for a real-time target detection model, a portion of the images of the device to be processed is selected as a training set, and the remaining processed device images are selected as a test set;

[0125] After the real-time object detection model is trained, the real-time object detection model is also tested using the test set.

[0126] Embodiment 7:

[0127] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-6, and further, the steps of detecting the device to be processed, acquiring the coordinates and aligning the laser include:

[0128] 1) Use the laser engraving machine vision module to collect the image data of the device to be processed in real time G WP , and perform threshold processing to extract the region of interest where the device to be processed exists, then extract and connect the edge features of the device to be processed, and fit the minimum rotated rectangle to generate the real frame B of the device to be processed gt' , and obtain the coordinates of the center point of the real frame coordinate_w(X,Y), complete the detection and coordinate acquisition of the device to be processed; X represents the x-coordinate value of the device to be processed in the workspace of the laser engraving machine, and Y represents the y-coordinate value of the device to be processed in the workspace of the laser engraving machine;

[0129] 2) The coordinate data information coordinate_w(X,Y) of the device to be processed in the working space of the laser engraving machine is transmitted to the motion controller of the laser engraving machine through serial communication. The motion controller drives the X-axis and Y-axis motors according to the coordinate data information of the device to be processed, and positions the laser above the area of ​​the device to be processed to realize automatic alignment of the laser;

[0130] The X-axis motor drive coordinate information and Y-axis motor drive coordinate information received by the actual motion controller are as follows:

[0131]

[0132] Among them, X' represents the X-axis motor drive coordinate information received by the actual motion controller, Y' represents the Y-axis motor drive coordinate information received by the actual motion controller, and α and β respectively represent the proportional relationship between the image movement coordinates of the laser positioned in the area of ​​the device to be processed and the X and Y-axis motor drive coordinate information received by the actual motion controller for calibration and registration.

[0133] Embodiment 8:

[0134] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-7, and further, the step of obtaining processing point data of the laser engraving machine includes:

[0135] 1) Select the original image data G to be engraved p , and grayscale processing;

[0136] The grayscale processing expression is as follows:

[0137]

[0138] Among them, m, n, k, and l represent pixel coordinates, g(m,n) represents the pixels in the corresponding area of ​​the image in grayscale format, and g * (m,n) represents the sum of the original gray pixel value and the error feedback, b(m,n) represents the output value, e(m,n) represents the error value, and w(k,l) represents the error diffusion filter, which determines the weight ratio of the selection of the allocated pixel and the allocated error;

[0139] 2) Compare the pixel coordinates of each pixel of the image to be engraved after grayscale processing with the threshold value. If the pixel is greater than the threshold value, the output value = 1, otherwise the output value = 0, thereby realizing the transformation of the image to be engraved based on the halftone technology into a binary image suitable for laser engraving;

[0140] The output value b(m,n) is as follows:

[0141]

[0142] Wherein, Q[] represents the threshold quantization function; e(mk,nl) represents the error value;

[0143] 3) By looping the entire binary image, calculate the coordinate value coordinate_black(x i ,y i ), and stored in the set C = {c1,c2,···,c n}, get the final laser engraving machine processing point data; where x i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the X-axis motor, yi Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the Y-axis motor, c i = coordinate_black(x i ,y i ), i = 1, 2, ···, n; n is the number of processing points.

[0144] Embodiment 9:

[0145] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-8, and further, the step of performing path planning on processing point data based on a three-layer multi-factor evolutionary algorithm includes:

[0146] 1) According to the K-Medoids algorithm, the laser engraving machine processing point data C = {c1, c2, ···, c n} is divided into several medium-sized laser processing point clusters, and the center of each medium-sized point cluster is calculated as {K i |i=1,2,···,N}, where N represents the number of medium-sized point clusters;

[0147] 2) The K-Medoids algorithm is used to divide these medium-sized point clusters into several small-scale laser processing point clusters, and the center of each small-scale point cluster is calculated as Where L represents the number of small-scale point clusters;

[0148] 3) At the top level, a genetic algorithm is used to optimize the TSP composed of the centers of each medium-sized laser processing point cluster to obtain a non-closed path R:

[0149] R={R i =Index(K j )|i,j=1,2,···,N} (12)

[0150] Among them, Index(K j ) represents the serial number of the laser processing point j, R1 represents the serial number of the starting laser processing point, R N Indicates the serial number of the laser processing point where it ends, and R1 and R N There is no connection between i Indicates the serial number of the laser processing point in the non-closed path R;

[0151] 4) In the middle layer, a genetic algorithm is used to optimize the TSP composed of the centers of each small-scale laser processing point cluster in each medium-scale laser processing point cluster to obtain N non-closed paths r j :

[0152] rj = {r i =Index(KK m )|i,m=1,2,···,L} (13)

[0153] Where, j = 1, 2, · · ·, N, Index (KK m ) represents the serial number of the laser processing point m, r1 represents the serial number of the starting laser processing point, r L Indicates the serial number of the laser processing point where it ends, and r1 and r L There is no connection between them. i Represents a non-closed path r j The serial number of the laser processing point;

[0154] 5) Use the multi-factor evolutionary algorithm at the bottom layer to optimize the TSP composed of each small-scale laser processing point cluster to obtain N*L closed paths p j :

[0155] p j = {P i =Index(C s )|i=1,2,···,Q+1,s=1,2,···,Q} (14)

[0156] Among them, Index(C s ) represents the serial number of the laser processing point, P1 represents the serial number of the starting laser processing point, P Q Indicates the sequence number of the laser processing point where it ends, and P1 and P Q P is connected between them, and Q represents the number of small-scale laser processing points. i represents a closed path p j The serial number of the laser processing point;

[0157] 6) The optimal path p of each small-scale laser processing point cluster obtained based on the bottom layer j , and then use the optimization result r of the middle layer j The medium-scale laser processing point clusters where the L small-scale laser processing point clusters are located are spliced ​​together, and then connected as a whole; finally, the top-level optimization result R is used to complete the path splicing of the N medium-scale laser processing point clusters, and then connected as a whole, to obtain the laser processing point data C' after the final path planning:

[0158] C'={C i =Index(c i )|i=1,2,···,n} (15)

[0159] Among them, Index(c i) represents the serial number of the laser processing point i, c1 represents the serial number of the starting laser processing point, c n Indicates the serial number of the laser processing point at which the laser processing is completed, and n indicates the total number of laser processing points. i Indicates the serial number of the laser processing point in the laser processing point data C'.

[0160] Embodiment 10:

[0161] A method for visual positioning and processing path planning for a laser engraving machine, the technical content of which is the same as any one of Embodiments 1-9, and further, the steps of completing the processing task of the laser engraving machine include:

[0162] According to the laser processing point data C' after path planning, the coordinate information coordinate_black(x i ,y i ) is converted into G code format, and then the converted information is used as the input of the motion controller of the laser engraving machine to drive the XY axis motor of the laser engraving machine to rotate according to the processing point data after path planning, and control the laser to move along the specified path above the device area to be processed to engrave the final target workpiece.

[0163] Embodiment 11:

[0164] A method for visual positioning and processing path planning for a laser engraving machine, the steps are as follows:

[0165] S1: Building a real-time object detection model for laser engraving machines based on SSD deep neural network;

[0166] S2: Perform data preprocessing based on the target detection data set of the laser engraving machine to be processed, and train the target detection model based on the processed data;

[0167] S3: Detect the components to be processed, obtain coordinates and position the laser according to the image data collected in real time by the vision module of the laser engraving machine;

[0168] S4: Input the image data to be engraved after processing based on halftone technology according to design requirements and specifications, and obtain the processing point data of the laser engraving machine;

[0169] S5: Path planning for processing point data based on a three-layer multi-factor evolutionary algorithm;

[0170] S6: According to the processing point data after path planning, the processing task of the laser engraving machine is completed to generate the final processing device.

[0171] The real-time target detection model of the laser engraving machine is built based on the SSD deep neural network. The process includes:

[0172] The target detection model of the laser engraving machine is built based on the SSD deep neural network, which can achieve efficient target detection and is suitable for real-time applications of the laser engraving machine.

[0173] The real-time target detection model based on the SSD deep neural network consists of three parts. First, the convolutional layers Conv1 to Conv5 in VGG16 are retained as the basic framework, and then two convolutional layers Conv6 and Conv7 are used to extract image features; secondly, four convolutional layers Conv8_2 to Conv11_2 of different scales are added to extract features of different scales; finally, the features of the six different scale feature layers are extracted into the classification and positioning layer, and the non-maximum suppression is applied to select the best result. The network structure of the SSD is as follows: Figure 1 As shown, the real-time target detection model of the laser engraving machine involved in the present invention is built based on this.

[0174] The real-time object detection model based on the SSD deep neural network uses feature layers of different scales to detect objects of different sizes. The model uses anchor frame processing, that is, a series of default frames of different sizes are generated with each pixel of the feature map as the center. The size of the default frame of each feature layer can be expressed as:

[0175]

[0176] Among them, s min Indicates the size of the shallow default box, s max represents the size of the deep default box, m represents the number of feature extraction layers, k∈[1,m].

[0177] The default box size is calculated as follows:

[0178]

[0179] in, Indicates the default box width. Indicates the height of the default box, a r Indicates the aspect ratio, when a r =1, a square default box needs to be added, and the calculation formula for its size is:

[0180]

[0181] The real-time target detection model based on the SSD deep neural network needs to perform border regression on the default box to generate a prediction box, and thus more accurately locate the center point of the device to be processed. d Represents the default box, and its four boundary position information is d w ,dh ; B represents the prediction box, and its four boundary position information is b w ,b h ; B gt Represents the default box, and its four boundary position information is g w ,g h The bounding box regression is to find the mapping relationship between the default box and the predicted box. The calculation formula is as follows:

[0182]

[0183] Default box B d After regression, the prediction box B can be obtained, and its calculation formula is:

[0184]

[0185] The loss function of the real-time target detection model based on the SSD deep neural network includes a target category loss function and a regression loss function, and a weighted sum is performed according to the following calculation formula:

[0186]

[0187] Among them, N represents the number of default boxes that match the real target box, L conf represents the target category loss function, t class represents the confidence of each category, x = {0, 1} represents whether it matches, η represents the weight, L loc Represents the regression loss function, which is calculated as follows:

[0188]

[0189] in, represents the predicted value of location regression, represents the true value, and Pos represents the positive sample.

[0190] Data preprocessing is performed based on the target detection data set of the laser engraving machine to be processed. The process includes:

[0191] The target detection data set of the laser engraving machine to be processed is used in the training process of the SSD deep neural network. The present invention uses an industrial camera in the working environment of the laser engraving machine to obtain the image data of the device to be processed with an image resolution of 1280×1024, and finally generates a custom model training data set data (n i ), the corresponding state category t class Including: inclined plane workpieces, rectangular workpieces, triangular workpieces, cylindrical workpieces, symmetrical inclined plane workpieces, conical workpieces, etc. The number of image data samples of various types of parts to be processed is 400.

[0192] The data preprocessing process of the data set is based on Halcon's workpiece annotation method to accurately annotate the device to be processed to help the model learn the correct features. First, the image of the device to be processed is thresholded to extract the area of ​​interest; secondly, the edge features of the device to be processed are extracted and connected; finally, the smallest rotated rectangle is fitted according to the result of the edge connection of the contour of the device to be processed, and the real frame of the device to be processed is generated on the basis of the rotated rectangle, and the center point coordinates, width and height of the real frame can be obtained. In order to increase the diversity of training samples and avoid overfitting of training, the collected image data of the device to be processed is randomly offset and then cropped to a size of 300×300 to obtain the data set data'(n i ), and use it as input for a real-time object detection model based on SSD deep neural network.

[0193] The target detection data set of the laser engraving machine to be processed components adopts a random picking method to prepare training sets and test sets for various types of workpieces, and divides the data set according to a training set:test set ratio of 7:3.

[0194] Detection of the components to be processed, acquisition of coordinates and positioning of the laser, the process includes:

[0195] The preprocessed data set data'(n i ) Input the real-time target detection model of the laser engraving machine based on the SSD deep neural network for training to obtain the trained model, and finally use the trained and tested target detection model to realize the function of real-time detection of the position of the device to be processed and positioning the laser during the operation of the laser engraving machine.

[0196] The detection and coordinate acquisition of the device to be processed collects the image data G in the working space of the laser engraving machine in real time through the visual module of the laser engraving machine WP , and call the real-time target detection model based on SSD to detect the real-time image data G in the workspace NL Perform threshold processing to extract the region of interest where the device to be processed exists, extract and connect the edge features of the device to be processed, and further fit the minimum rotated rectangle to generate the real frame B of the device to be processed. gt' , you can get the coordinates of the center point of the real frame coordinate_w(X,Y), and complete the detection and coordinate acquisition of the device to be processed, where X represents the x-coordinate value of the device to be processed in the laser engraving machine workspace, and Y represents the y-coordinate value of the device to be processed in the laser engraving machine workspace.

[0197] The positioning of the laser transmits the coordinate data information coordinate_w(X,Y) of the device to be processed in the working space of the laser engraving machine to the motion controller of the laser engraving machine through serial communication. The motion controller drives the X-axis and Y-axis motors according to the coordinate data information of the device to be processed, and positions the laser above the area of ​​the device to be processed, thereby realizing automatic alignment of the laser engraving machine.

[0198] The positioning of the laser needs to be achieved by calibrating and registering the image movement coordinates of the laser positioned in the area of ​​the device to be processed with the XY axis motor drive coordinate information received by the actual motion controller, and the calculation formula is as follows:

[0199]

[0200] Among them, X' represents the X-axis motor drive coordinate information received by the actual motion controller, Y' represents the Y-axis motor drive coordinate information received by the actual motion controller, and α and β respectively represent the proportional relationship between the image movement coordinates of the laser positioned in the area of ​​the device to be processed and the X and Y-axis motor drive coordinate information received by the actual motion controller for calibration and registration.

[0201] Based on the halftone technology, the processing point data of the laser engraving machine is obtained according to the image to be engraved. The process includes:

[0202] The laser engraving machine only recognizes black and white binary colors when engraving images. p And grayscale it, and compare the pixel coordinates of each pixel in the grayscale format of the image to be engraved with the threshold ξ, and then diffuse the pixel difference between the input and output to the area that has not been processed, so as to realize the transformation of the image to be engraved based on halftone technology into a binary image suitable for laser engraving. The calculation process and formula are as follows:

[0203]

[0204] Among them, m, n, k, and l represent pixel coordinates, g(m,n) represents the pixels in the corresponding area of ​​the image in grayscale format, and g * (m,n) represents the sum of the original gray pixel value and the error feedback, b(m,n) represents the output value, e(m,n) represents the error value, and w(k,l) represents the error diffusion filter, which determines the weight ratio of the selection of the allocated pixel and the allocated error.

[0205] The output threshold is calculated as follows:

[0206]

[0207] Where Q[] represents the threshold quantization function, through g *Comparison between (m,n) and the threshold, when the former is greater than the latter, Q[] takes 1, otherwise it takes 0.

[0208] The image to be engraved is processed based on the halftone technology according to the above calculation process and calculation formula. After the grayscale format data of the entire image to be engraved is circulated, a binary image G' suitable for laser engraving can be obtained. p .

[0209] The processing point data acquisition of the laser engraving machine is mainly carried out based on the binary image obtained from the image data to be engraved, by looping the entire binary image and calculating the coordinate value coordinate_black (x i ,y i ) and stored in the set C = {c1,c2,···,c n}, get the final laser engraving machine processing point data, where x i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the X-axis motor, y i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the Y-axis motor, c i = coordinate_black(x i ,y i ), i=1,2,···,n.

[0210] The path planning of processing point data is carried out based on a three-layer multi-factor evolutionary algorithm. The process includes:

[0211] The input of the three-layer multi-factor evolutionary algorithm is the laser engraving machine processing point data set C = {c1, c2, ···, c n The coordinate data and serial number in} are outputted as the optimal path and the optimal path length. The three-layer multi-factor evolutionary algorithm solves the optimal path of the laser engraving processing points through three layers, the top layer and the middle layer use the genetic algorithm for TSP optimization, and the bottom layer uses the multi-factor evolutionary algorithm for TSP optimization.

[0212] The three-layer multi-factor evolutionary algorithm first transforms the laser engraving machine processing point data C = {c1, c2, ···, c n} is divided into several medium-sized laser processing point clusters, and the center of each medium-sized point cluster is calculated as {K i |i=1,2,···,N}, where N represents the number of medium-sized point clusters; and the K-Medoids algorithm is used to divide these medium-sized point clusters into several small-scale laser processing point clusters, and the center of each small-scale point cluster is calculated as Where L represents the number of small-scale point clusters.

[0213] The three-layer multi-factor evolutionary algorithm uses a genetic algorithm at the top level to optimize the TSP composed of the centers of each medium-sized laser processing point cluster to obtain a non-closed path R:

[0214] R={R i =Index(K j )|i,j=1,2,···,N} (11)

[0215] Among them, Index(K j ) represents the serial number of the laser processing point j, R1 represents the serial number of the starting laser processing point, R N Indicates the serial number of the laser processing point where it ends, and R1 and R N There is no connection between them.

[0216] The three-layer multi-factor evolutionary algorithm uses a genetic algorithm in the middle layer to optimize the TSP composed of the center of each small-scale laser processing point cluster in each medium-scale laser processing point cluster to obtain N non-closed paths r j :

[0217] r j = {r i =Index(KK m )|i,m=1,2,···,L} (12)

[0218] Where, j = 1, 2, · · ·, N, Index (KK m ) represents the serial number of the laser processing point m, r1 represents the serial number of the starting laser processing point, r L Indicates the serial number of the laser processing point where it ends, and r1 and r L There is no connection between them.

[0219] The three-layer multi-factor evolutionary algorithm uses a multi-factor evolutionary algorithm at the bottom layer to optimize the TSP composed of each small-scale laser processing point cluster to obtain N*L closed paths p j :

[0220] p j = {P i =Index(C s )|i=1,2,···,Q+1,s=1,2,···,Q} (13)

[0221] Among them, Index(C s ) represents the serial number of the laser processing point, P1 represents the serial number of the starting laser processing point, P Q Indicates the sequence number of the laser processing point where it ends, and P1 and PQ are connected, and Q represents the number of small-scale laser processing points.

[0222] The three-layer multi-factor evolutionary algorithm obtains the optimal path p of each small-scale laser processing point cluster based on the bottom layer. j , and then use the optimization result r of the middle layer j The medium-scale laser processing point clusters where the L small-scale laser processing point clusters are located are spliced ​​together, and then connected as a whole; finally, the top-level optimization result R is used to complete the path splicing of the N medium-scale laser processing point clusters, and then connected as a whole. The laser processing point data C' after the final path planning is obtained:

[0223] C'={C i =Index(c i )|i=1,2,···,n} (14)

[0224] Among them, Index(c i ) represents the serial number of the laser processing point i, c1 represents the serial number of the starting laser processing point, c n Indicates the serial number of the laser processing point at which the laser processing is completed, and n indicates the total number of laser processing points.

[0225] Complete the processing task of the laser engraving machine and generate the final processing device. The process includes:

[0226] According to the laser processing point data C' after path planning, the coordinate information coordinate_black(x i ,y i ) is converted into G code format and used as the input of the motion controller of the laser engraving machine to drive the XY axis motor of the laser engraving machine to rotate according to the processing point data after path planning, and control the laser to move along the specified path above the device area to be processed to engrave the final target workpiece.

[0227] Embodiment 12:

[0228] A method for visual positioning and processing path planning for a laser engraving machine, the steps are as follows:

[0229] like Figure 1 As shown, this embodiment uses a visual positioning and processing path planning method for a laser engraving machine to achieve laser engraving processing of a device to be processed, as follows:

[0230] S1, this embodiment builds a real-time target detection model for a laser engraving machine based on an SSD deep neural network:

[0231] The real-time target detection model based on the SSD deep neural network consists of three parts. First, the convolutional layers Conv1 to Conv5 in VGG16 are retained as the basic framework, and then two convolutional layers Conv6 and Conv7 are used to extract image features; secondly, four convolutional layers Conv8_2 to Conv11_2 of different scales are added to extract features of different scales; finally, the features of the six different scale feature layers are extracted into the classification and positioning layer, and the non-maximum suppression is applied to select the best result. The network structure of the SSD is as follows: Figure 2 As shown, the real-time target detection model of the laser engraving machine involved in this embodiment is built accordingly;

[0232] The real-time object detection model based on the SSD deep neural network uses feature layers of different scales to detect objects of different sizes. The model uses anchor frame processing, that is, a series of default frames of different sizes are generated with each pixel of the feature map as the center. The size of the default frame of each feature layer can be expressed as Among them, s min Indicates the size of the shallow default box, s max represents the size of the deep default box, m represents the number of feature extraction layers, in this embodiment the number of layers is 6, the size of the shallow default box is 0.2, the size of the deep default box is 0.9, k∈[1,m];

[0233] The default box size is calculated as: in, Indicates the default box width. Indicates the height of the default box, a r Indicates the aspect ratio, when a r =1, a square default frame needs to be added. In this embodiment, the range of the aspect ratio is: r ∈{1,2,3,1 / 2,1 / 3};

[0234] The real-time target detection model based on the SSD deep neural network needs to perform border regression on the default box to generate a prediction box, and thus more accurately locate the center point of the device to be processed. d Represents the default box, and its four boundary position information is d w ,d h ; B represents the prediction box, and its four boundary position information is b w ,b h ; B gt Represents the default box, and its four boundary position information is g w ,g hThe bounding box regression is to find the mapping relationship between the default box and the predicted box. The calculation formula is as follows: Default box B d After regression, the prediction box B can be obtained, and its calculation formula is:

[0235] The loss function of the real-time target detection model based on the SSD deep neural network includes a target category loss function and a regression loss function, and a weighted sum is performed according to the following calculation formula: Among them, N represents the number of default boxes that match the real target box, L conf represents the target category loss function, t class represents the confidence of each category, x = {0, 1} represents whether it matches, η represents the weight, L loc represents the regression loss function;

[0236] The calculation formula of the regression loss function is as follows:

[0237]

[0238] in, represents the predicted value of location regression,

[0239] represents the true value, and Pos represents the positive sample.

[0240] S2, this embodiment performs data preprocessing according to the target detection data set of the laser engraving machine to be processed, and trains the target detection model based on the processed data:

[0241] The target detection dataset of the laser engraving machine to be processed is used in the training process of the SSD deep neural network. In this embodiment, the image data of the device to be processed is obtained by an industrial camera in the working environment of the laser engraving machine with an image resolution of 1280×1024, and finally a custom model training dataset data (n i ), the corresponding state category t class Including: inclined plane workpieces, rectangular workpieces, triangular workpieces, cylindrical workpieces, symmetrical inclined plane workpieces, conical workpieces, etc. The number of image data samples of various types of parts to be processed is 400;

[0242] The data preprocessing process of the data set is based on Halcon's workpiece annotation method to accurately annotate the device to be processed to help the model learn the correct features. In this embodiment, the image of the device to be processed is first thresholded to extract the area of ​​interest; secondly, the edge features of the device to be processed are extracted and connected; finally, the smallest rotated rectangle is fitted according to the result of the contour edge connection of the device to be processed, and the real frame of the device to be processed is generated on the basis of the rotated rectangle, and the center point coordinates, width and height of the real frame can be obtained. In order to increase the diversity of training samples and avoid overfitting of training, the collected image data of the device to be processed is randomly offset and then cropped to a size of 300×300 to obtain the data set data'(n i ), and use it as input for a real-time object detection model based on SSD deep neural network.

[0243] The target detection data set of the laser engraving machine to be processed is randomly selected to prepare training sets and test sets for various types of workpieces in this embodiment, and the data set is divided according to a training set:test set ratio of 7:3.

[0244] S3, this embodiment detects the device to be processed, obtains the coordinates and positions the laser according to the image data collected in real time by the vision module of the laser engraving machine:

[0245] In this embodiment, the data set after data preprocessing is input into the real-time target detection model of the laser engraving machine based on the SSD deep neural network for training to obtain a trained model, and finally the trained and tested target detection model is used to realize the function of real-time detection of the position of the device to be processed and positioning the laser during the working process of the laser engraving machine;

[0246] The detection and coordinate acquisition of the device to be processed is performed by collecting the image data G in the working space of the laser engraving machine in real time through the visual module of the laser engraving machine in this embodiment. WP , and call the real-time target detection model based on SSD to detect the real-time image data G in the workspace NL Perform threshold processing to extract the region of interest where the device to be processed exists, extract and connect the edge features of the device to be processed, and further fit the minimum rotated rectangle to generate the real frame B of the device to be processed. gt' , you can get the coordinates of the center point of the real frame coordinate_w(X,Y), and complete the detection and coordinate acquisition of the device to be processed, where X represents the x-coordinate value of the device to be processed in the laser engraving machine workspace, and Y represents the y-coordinate value of the device to be processed in the laser engraving machine workspace.

[0247] In this embodiment, the coordinate data information coordinate_w(X,Y) of the device to be processed in the working space of the laser engraving machine is transmitted to the motion controller of the laser engraving machine through serial communication. The motion controller drives the X-axis and Y-axis motors according to the coordinate data information of the device to be processed, and positions the laser above the area of ​​the device to be processed, thereby realizing automatic alignment of the laser engraving machine.

[0248] The positioning of the laser needs to be achieved by calibrating and registering the image movement coordinates of the laser positioned in the area of ​​the device to be processed with the XY axis motor drive coordinate information received by the actual motion controller, and the calculation formula is as follows: Among them, X' represents the X-axis motor drive coordinate information received by the actual motion controller, Y' represents the Y-axis motor drive coordinate information received by the actual motion controller, and α and β respectively represent the proportional relationship between the image movement coordinates of the laser positioned in the area of ​​the device to be processed and the X-axis and Y-axis motor drive coordinate information received by the actual motion controller for calibration and registration. In this embodiment, α = 0.75, β = 0.73.

[0249] S4, in this embodiment, according to the design requirements and specifications, the image data to be engraved after being processed based on the halftone technology is input to obtain the processing point data of the laser engraving machine:

[0250] In this embodiment, the original image data G to be engraved is selected p like Figure 3 As shown, grayscale processing is performed on it, and the pixel coordinates of each pixel in the grayscale format of the image to be engraved are compared with the threshold ξ, and then the pixel difference between the input and output is diffused to the area that has not been processed, so as to realize the transformation of the image to be engraved based on halftone technology into a binary image suitable for laser engraving. The calculation process and formula are as follows:

[0251] Among them, m, n, k, and l represent pixel coordinates, g(m,n) represents the pixels in the corresponding area of ​​the image in grayscale format, and g * (m,n) represents the sum of the original gray pixel value and the error feedback, b(m,n) represents the output value, e(m,n) represents the error value, and w(k,l) represents the error diffusion filter, which determines the weight ratio of the selection of the allocated pixel and the allocated error.

[0252] The output threshold is calculated as follows:

[0253] Where Q[] represents the threshold quantization function, through g * Comparison between (m,n) and the threshold, when the former is greater than the latter, Q[] takes 1, otherwise it takes 0.

[0254] This embodiment processes the image to be engraved based on the halftone technology. After the grayscale format data of the entire image to be engraved is cyclically completed, a binary image G' of the image to be engraved suitable for laser engraving can be obtained. p ,like Figure 4 shown.

[0255] The processing point data of this embodiment is obtained according to the binary image obtained from the image data to be engraved, by looping the entire binary image and calculating the coordinate value coordinate_black (x i ,y i ) and stored in the set C = {c1,c2,···,c n}, get the final laser engraving machine processing point data, where x i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the X-axis motor, y i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the Y-axis motor, c i = coordinate_black(x i ,y i ), i=1,2,···,n.

[0256] S5, this embodiment performs path planning on the processing point data based on a three-layer multi-factor evolutionary algorithm:

[0257] The input of the three-layer multi-factor evolutionary algorithm in this embodiment is the laser engraving machine processing point data set C = {c1, c2, ···, c n}, the output is the optimal path and the optimal path length. The three-layer multi-factor evolutionary algorithm solves the optimal path of the laser engraving processing point through three layers. The top and middle layers use genetic algorithms for TSP optimization, and the bottom layer uses multi-factor evolutionary algorithms for TSP optimization. The algorithm flow chart of the three-layer multi-factor evolutionary algorithm is as follows: Figure 5 As shown;

[0258] In this embodiment, the laser engraving machine processing point data C={c1,c2,···,c n} is divided into several medium-sized laser processing point clusters, and the center of each medium-sized point cluster is calculated as {K i |i=1,2,···,N}, where N represents the number of medium-sized point clusters; and the K-Medoids algorithm is continued to be used to divide these medium-sized point clusters into several small-scale laser processing point clusters, and the center of each small-scale point cluster is calculated as {KK i j|i=1,2,···,N,j=1,2,···,N*L}, where L represents the number of small-scale point clusters. In this embodiment, N=40, L=10.

[0259] This embodiment uses a genetic algorithm at the top level of the three-layer multi-factor evolutionary algorithm to optimize the TSP composed of the centers of each medium-sized laser processing point cluster, and obtains a non-closed path R = {R i =Index(K j )|i,j=1,2,···,N}, where Index(K j ) represents the serial number of the laser processing point j, R1 represents the serial number of the starting laser processing point, R N Indicates the serial number of the laser processing point where it ends, and R1 and R N There is no connection between them.

[0260] This embodiment uses a genetic algorithm in the middle layer of the three-layer multi-factor evolutionary algorithm to optimize the TSP composed of the center of each small-scale laser processing point cluster in each medium-scale laser processing point cluster, and obtains N non-closed paths: r j = {r i =Index(KK m )|i,m=1,2,···,L}where,j=1,2,···,N,Index(KK m ) represents the serial number of the laser processing point m, r1 represents the serial number of the starting laser processing point, r L Indicates the serial number of the laser processing point where it ends, and r1 and r L There is no connection between them.

[0261] This embodiment uses a multi-factor evolutionary algorithm at the bottom of the three-layer multi-factor evolutionary algorithm to optimize the TSP composed of each small-scale laser processing point cluster to obtain N*L closed paths p j = {P i =Index(C s )|i=1,2,···,Q+1,s=1,2,···,Q}, where Index(C s ) represents the serial number of the laser processing point, P1 represents the serial number of the starting laser processing point, P Q Indicates the sequence number of the laser processing point where it ends, and P1 and P Q , Q represents the number of small-scale laser processing points. In this embodiment, Q is as follows Figure 4 The number of laser processing points obtained.

[0262] This embodiment adopts a three-layer multi-factor evolutionary algorithm to obtain the optimal path p of each small-scale laser processing point cluster based on the bottom layer. j, and then use the optimization result r of the middle layer j The medium-scale laser processing point clusters where the L small-scale laser processing point clusters are located are spliced ​​together to form a whole; finally, the top-level optimization result R is used to splice the paths of the N medium-scale laser processing point clusters to form a whole. Figure 4 The laser processing point data after the final path planning C'={C i =Index(c i )|i=1,2,···,n}, where Index(c i ) represents the serial number of the laser processing point i, c1 represents the serial number of the starting laser processing point, c n The schematic diagram of the laser engraving processing point data optimization using a three-layer multi-factor evolutionary algorithm in this embodiment is shown in FIG. Figure 6 shown.

[0263] S6, this embodiment completes the processing task of the laser engraving machine according to the processing point data after path planning, and generates the final processing device:

[0264] This embodiment is based on Figure 4 The laser processing point data obtained by the three-layer multi-factor evolutionary algorithm is converted into coordinate information coordinate_black(x i ,y i ) is converted into G code format and used as the input of the motion controller of the laser engraving machine to drive the XY axis motor of the laser engraving machine to rotate according to the processing point data after path planning, and control the laser to move along the specified path above the device area to be processed to engrave the final target workpiece.

[0265] Figure 6 This is a schematic diagram of optimizing laser engraving processing point data using a three-layer multi-factor evolutionary algorithm. A, B, C, and D represent medium-sized point clusters obtained by dividing the laser processing point data. R represents the path obtained by TSP optimization of the centers of each medium-sized point cluster using a genetic algorithm at the top level. The points numbered 1 to 32 in each point cluster represent each laser processing point. The sample laser engraving path after the final path planning is shown in the figure.

Claims

1. A visual positioning and processing path planning method for laser engraving machine, It is characterized in that The following steps are involved: 1) Build a real-time object detection model for laser engraving machines. 2) Obtaining a target detection data set of the laser engraving machine to be processed, and performing data preprocessing to construct a training set for a real-time target detection model; and using the training set to train the real-time target detection model; 3) Using the laser engraving machine vision module to collect the image data of the device to be processed in real time, and input it into the real-time target detection model to detect the device to be processed, obtain the coordinates and align the laser; 4) Input the image data to be engraved after processing based on halftone technology, and obtain the processing point data of the laser engraving machine; 5) Path planning for processing point data based on a three-layer multi-factor evolutionary algorithm; 6) According to the processing point data after path planning, the processing task of the laser engraving machine is completed to generate the final processing device.

2. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The real-time target detection model is constructed based on the SSD deep neural network; The real-time target detection model includes a convolution module for extracting image features, a classification and positioning module; The convolution module includes multiple convolution layers for extracting image features of different scales; The classification and positioning module uses a non-maximum suppression method to process image features of different scales to complete the detection of the device to be processed, the acquisition of coordinates and the positioning of the laser.

3. A method for visual positioning and processing path planning for a laser engraving machine according to claim 2, It is characterized in that The real-time object detection model uses feature layers of different scales to detect objects of different sizes. The steps include: 1) Extract features from the image data of the device to be processed and generate a feature map of the device to be processed; 2) Generate a series of default boxes of different sizes with each pixel of the feature map of the device to be processed as the center; The default box sizes are as follows: Among them, s min Indicates the size of the shallow default box, s max represents the size of the deep default box, m represents the number of feature extraction layers, k∈[1,m]; Indicates the width of the default box. Indicates the height of the default box, a r Indicates the aspect ratio; s k 、s' k Indicates size parameter; s k+1 Indicates the size parameter corresponding to the k+1th feature extraction layer; 3) Performing bounding box regression on the default box to generate a predicted box, and using the predicted box as the detection result of the device to be processed; The boundary position information of the prediction box is as follows: in, b w ,b h It is the boundary position information of the prediction box B; d w ,d h The default box is B d The boundary location information of g w ,g h is the real target box B gt Δx is the change in x-coordinate of the center point of the frame, Δy is the change in y-coordinate of the center point of the frame, Δw is the change in width of the frame, and Δh is the change in height of the frame.

4. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The loss function L(x,t class ,B,B gt ) is as follows: Among them, N represents the number of default boxes that match the real target box, L conf represents the target category loss function, t class represents the confidence of each category, x = {0, 1} represents whether it matches, η represents the weight, L loc represents the regression loss function; represents the predicted value of location regression, represents the true value, b w ,b h It is the boundary position information of the prediction box B; Regression loss function L loc (x,B,B gt ) is as follows: Among them, Pos represents the positive sample; Indicates whether it matches; c x 、c y , w, h represent the boundary position information; Smooth L1 represents a smooth function; Represent the predicted value and true value of position regression respectively.

5. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The steps for data preprocessing to build a training set for a real-time object detection model include: 1) In the working environment of the laser engraving machine, use the industrial camera to obtain the image of the device to be processed and generate the custom model training data set data (n i ), the state category t corresponding to the custom model training data set class Including: inclined plane workpieces, rectangular workpieces, triangular workpieces, cylindrical workpieces, symmetrical inclined plane workpieces, and conical workpieces; 2) Training the custom model with the data set data(n i ) is randomly offset and cropped to obtain the data set data'(n i ); 3) For the data set data'(n i ) performs threshold processing on the image of the device to be processed to extract the region of interest; 3) Extract and connect the edge features of the device to be processed in the region of interest; 4) Fit the smallest rotated rectangle according to the result of connecting the contour edges of the device to be processed, and generate the real frame of the device to be processed based on the rotated rectangle, obtain the center point coordinates, width and height of the real frame, and then construct a training set for the real-time target detection model.

6. A method for visual positioning and processing path planning for a laser engraving machine according to claim 5, It is characterized in that When constructing the training set of the real-time target detection model, a portion of the images of the components to be processed are selected as the training set, and the remaining images of the components to be processed are selected as the test set; After the real-time object detection model is trained, the real-time object detection model is also tested using the test set.

7. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The steps of detecting the components to be processed, acquiring coordinates and aligning the laser include: 1) Use the laser engraving machine vision module to collect the image data of the device to be processed in real time G WP , and perform threshold processing to extract the region of interest where the device to be processed exists, then extract and connect the edge features of the device to be processed, and fit the minimum rotated rectangle to generate the real frame B of the device to be processed gt' , and obtain the coordinates of the center point of the real frame coordinate_w(X,Y), complete the detection and coordinate acquisition of the device to be processed; where X represents the x-coordinate value of the device to be processed in the workspace of the laser engraving machine, and Y represents the y-coordinate value of the device to be processed in the workspace of the laser engraving machine; 2) The coordinate data information coordinate_w(X,Y) of the device to be processed in the working space of the laser engraving machine is transmitted to the motion controller of the laser engraving machine through serial communication. The motion controller drives the X-axis and Y-axis motors according to the coordinate data information of the device to be processed, and positions the laser above the area of ​​the device to be processed to realize automatic alignment of the laser; The X-axis motor drive coordinate information and Y-axis motor drive coordinate information received by the actual motion controller are as follows: Among them, X' represents the X-axis motor drive coordinate information received by the actual motion controller, Y' represents the Y-axis motor drive coordinate information received by the actual motion controller, and α and β respectively represent the proportional relationship between the image movement coordinates of the laser positioned in the area of ​​the device to be processed and the X and Y-axis motor drive coordinate information received by the actual motion controller for calibration and registration.

8. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The steps to obtain the processing point data of the laser engraving machine include: 1) Select the original image data G to be engraved p , and grayscale processing; The grayscale processing expression is as follows: Among them, m, n, k, and l represent pixel coordinates, g(m,n) represents the pixels in the corresponding area of ​​the image in grayscale format, and g * (m,n) represents the sum of the original gray pixel value and the error feedback, b(m,n) represents the output value, e(mk,nl) represents the error value, and w(k,l) represents the error diffusion filter, which determines the weight ratio of the selection of the allocated pixel and the allocated error; 2) Compare the pixel coordinates of each pixel of the image to be engraved after grayscale processing with the threshold value. If the pixel is greater than the threshold value, the output value = 1, otherwise the output value = 0, thereby realizing the transformation of the image to be engraved based on the halftone technology into a binary image suitable for laser engraving; The output value b(m,n) is as follows: Wherein, Q[] represents the threshold quantization function; e(mk,nl) represents the error value; 3) By looping the entire binary image, calculate the coordinate value coordinate_black(x i ,y i ), and store it in the set C = {c 1 ,c 2 ,···,c n }, get the final laser engraving machine processing point data; where x i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the X-axis motor, y i Indicates the driving coordinate information of the i-th processing point transmitted to the motion controller to drive the Y-axis motor, c i = coordinate_black(x i ,y i ), i = 1, 2, ···, n; n is the number of processing points.

9. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The steps of path planning for processing point data based on the three-layer multi-factor evolutionary algorithm include: 1) According to the K-Medoids algorithm, the laser engraving machine processing point data C = {c 1 ,c 2 ,···,c n } is divided into several medium-sized laser processing point clusters, and the center of each medium-sized point cluster is calculated as {K i |i=1,2,···,N}, where N represents the number of medium-sized point clusters; 2) The K-Medoids algorithm is used to divide these medium-sized point clusters into several small-scale laser processing point clusters, and the center of each small-scale point cluster is calculated as Where L represents the number of small-scale point clusters; 3) At the top level, a genetic algorithm is used to optimize the TSP composed of the centers of each medium-sized laser processing point cluster to obtain a non-closed path R: R={R i =Index(K j )|i,j=1,2,···,N} (12) Among them, Index(K j ) represents the serial number of the laser processing point j, R 1 Indicates the serial number of the starting laser processing point, R N Indicates the serial number of the laser processing point at which the laser processing is completed, and R 1 and R N There is no connection between i Indicates the serial number of the laser processing point in the non-closed path R; 4) In the middle layer, a genetic algorithm is used to optimize the TSP composed of the centers of each small-scale laser processing point cluster in each medium-scale laser processing point cluster to obtain N non-closed paths r j : r j ={r i =Index(KK m )|i,m=1,2,···,L} (13) Where, j = 1, 2, · · ·, N, Index (KK m ) represents the serial number of the laser processing point m, r 1 Indicates the serial number of the starting laser processing point, r L Indicates the serial number of the laser processing point at which the laser processing ends, and r 1 and r L There is no connection between i Represents a non-closed path r j The serial number of the laser processing point; 5) Use the multi-factor evolutionary algorithm at the bottom layer to optimize the TSP composed of each small-scale laser processing point cluster to obtain N*L closed paths p j : p j ={P i =Index(C s )|i=1,2,···,Q+1,s=1,2,···,Q} (14) Among them, Index(C s ) represents the serial number of the laser processing point, P 1 Indicates the serial number of the starting laser processing point, P Q Indicates the serial number of the laser processing point at which the laser processing is completed, and P 1 and P Q are connected, Q represents the number of small-scale laser processing points; P i represents a closed path p j The serial number of the laser processing point; 6) The optimal path p of each small-scale laser processing point cluster obtained based on the bottom layer j , and then use the optimization result r of the middle layer j The medium-scale laser processing point clusters where the L small-scale laser processing point clusters are located are spliced ​​together, and then connected as a whole; finally, the top-level optimization result R is used to complete the path splicing of the N medium-scale laser processing point clusters, and then connected as a whole, to obtain the laser processing point data C' after the final path planning: C'={C i =Index(c i )|i=1,2,···,n} (15) Among them, Index(c i ) represents the serial number of the laser processing point i, c 1 Indicates the serial number of the starting laser processing point, c n Indicates the serial number of the laser processing point at which the laser processing is completed, and n indicates the total number of laser processing points; C i Indicates the serial number of the laser processing point in the laser processing point data C'.

10. A method for visual positioning and processing path planning for a laser engraving machine according to claim 1, It is characterized in that The steps to complete a laser engraving machine processing task include: According to the laser processing point data C' after path planning, the coordinate information coordinate_black(x i ,y i ) is converted into G code format, and then the converted information is used as the input of the motion controller of the laser engraving machine to drive the XY axis motor of the laser engraving machine to rotate according to the processing point data after path planning, and control the laser to move along the specified path above the device area to be processed to engrave the final target workpiece.

Citation Information

Cited By

  • Laser surgery positioning method, system and program product for path widening and de-overlapping

    CN121154283A

  • Visual perception enhancement method based on multilayer laser microscopic carving and surface texture reconstruction

    CN121616603A