Weld segmentation and milling identification method and device based on area array structured light 3D vision

Through area array structured light 3D vision technology, the improved U-Net network and the approximately linearly separable support vector machine model are used to solve the problems of inaccurate close adjacent segmentation and slow recognition speed in weld segmentation and milling discrimination, and achieve High-precision and efficient automated welding processing.

CN114170202BActive Publication Date: 2024-08-23CHANGSHU INSTITUTE OF TECHNOLOGY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111516497.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-13
Publication Date
2024-08-23
Estimated Expiration
2041-12-13

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately segment closely adjacent welds and determine whether the welds have been milled, and there are problems such as inaccurate segmentation and slow recognition speed.

Method used

A weld seam segmentation method based on area array structured light 3D vision is adopted. Through the improved U-Net network and approximately linear separable support vector machine model, image and point cloud data are combined to achieve instance segmentation and milling discrimination of weld seams. The improved U-Net network improves the segmentation accuracy of closely adjacent welds by adding an attention mechanism module and an ROI Align module. The approximately linearly separable support vector machine model uses point cloud data feature ratios for rapid judgment.

Benefits of technology

It achieves accurate segmentation of closely adjacent welds and rapid judgment of the weld milling status, improves segmentation accuracy and discrimination speed, and meets the needs of high-precision and efficient automated milling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114170202B
    Figure CN114170202B
Patent Text Reader

Abstract

The present invention discloses a weld segmentation method based on planar array structured light 3D vision, including: collecting images of weld workpieces for manual weld mask annotation, and constructing a training set; using SE, CBAM and ROI Align modules to improve the U‑Net network to construct an instance segmentation model and train it; inputting the image to be detected into the final weld instance segmentation model to obtain the segmentation mask of the weld image, and completing the weld segmentation. The present invention also discloses a weld milling discrimination method based on planar array structured light 3D vision, including constructing a training set through the feature ratio of the covariance matrix of the manually labeled weld point cloud to train an approximate linearly separable support vector machine model, and then obtaining the corresponding weld point cloud after obtaining the weld mask using the segmentation model, and inputting the trained vector machine model for milling discrimination. The present invention solves the problem of difficulty in segmenting closely adjacent welds, and realizes the discrimination of whether the weld has been milled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and a device for distinguishing weld segmentation and milling, and in particular to a method and a device for distinguishing weld segmentation and milling based on planar array structured light 3D vision. Background Art

[0002] As a basic connection process in industrial manufacturing, welding is widely used in all walks of life. As modern society places higher and higher demands on product functions and quality, there is an increasing demand for milling and grinding of formed welds after welding. However, due to the complexity of the weld milling and grinding problem itself and the complexity of the associated systems and environment, the technical requirements for its specific implementation and development are becoming increasingly higher.

[0003] In the past, the welds after welding were mainly polished manually. The disadvantages of manual milling and grinding are very obvious. Milling and grinding are labor-intensive and require relatively high skills and precision. The noise, splashing and dust problems during milling and grinding are all very unfriendly and even dangerous to the human body. Therefore, there is an increasing need for the emergence of automated weld milling and grinding methods to replace manual labor. For automated weld milling and grinding, the primary task is to identify the weld, and the precise grasp of the weld position and shape is the difficulty in implementing automated grinding. This is mainly because the weld comes from the hot working of the metal, so its own forming shape varies to a certain extent, such as the length, width, height and even appearance of the weld, which brings challenges to weld milling, especially the precise control of the allowance and the surface flatness of the processing. In addition, due to the influence of thermal processing, the parent material at the weld and its joints often undergoes thermal deformation. In addition, due to the problems in the control of the cutting and assembly process before welding, there are often differences in the weld parent material and undesirable conditions such as misalignment at the weld joint. The above comprehensive situation poses a great challenge to the requirement that weld milling and grinding should remove the weld itself as well as possible without damaging the parent material and form a smooth transition with the parent material that meets the process requirements, especially in some applications where high flatness requirements are required.

[0004] In the prior art, a Chinese patent with publication number CN102175700A discloses a digital X-ray image weld segmentation and defect detection method, which adopts a segmentation method based on the horizontal width and vertical continuity of the weld in the welding image, which includes filtering, image enhancement, threshold segmentation, finding the weld position and weld extraction. This technology can only segment vertical bar X-ray weld images within a specific width range, and cannot segment workpieces of various shapes. A Chinese patent with publication number CN109993741A discloses a rail weld contour automatic positioning method based on K-means clustering, which belongs to the traditional image processing method and mainly solves the positioning of the weld contour, but cannot solve the problem of inaccurate segmentation caused by the close proximity of welds. A Chinese patent with publication number CN112288707A discloses a robot weld grinding algorithm based on feature point recognition, which mainly segments the entire weld, then identifies it according to the point cloud data of each weld segment, and then updates the global weld information, solving the problem of slow recognition speed caused by large data volume using point cloud data recognition. The above-mentioned prior arts are all difficult to solve the problem of inaccurate segmentation caused by closely adjacent welds, and are unable to determine whether the weld has been milled. Summary of the invention

[0005] In view of the defects of the above-mentioned prior art, the present invention provides a weld segmentation method based on planar array structured light 3D vision to solve the problem of difficulty in segmenting closely adjacent welds. The present invention also provides a weld milling discrimination method based on planar array structured light 3D vision to solve the problem of difficulty in judging whether a weld has been milled by image feature extraction, and provide a basis for subsequent further milling processing. The present invention also provides a weld segmentation device and a milling discrimination device based on planar array structured light 3D vision.

[0006] The technical solution of the present invention is as follows: A weld segmentation method based on planar array structured light 3D vision comprises the following steps:

[0007] Step 1: Collect a certain number of images of weld workpieces; manually annotate the images of weld workpieces with weld masks, build a training set and perform data enhancement;

[0008] Step 2: Use the improved U-Net network to build an instance segmentation model, and train the instance segmentation model with the training set obtained in step 1 to obtain the final weld instance segmentation model;

[0009] Step 3: Collect the image of the workpiece that needs to be welded and input the image into the final weld instance segmentation model to obtain the segmentation mask of the weld image and complete the weld segmentation;

[0010] The improved U-Net network selects at least two blocks from the four blocks of the compression path and the underlying connection blocks of the compression path and the extension path to add an attention mechanism module, wherein the attention mechanism module is an SE module or a CBAM module, and the attention mechanism module is located after the last convolution operation of the block. The outputs of the four blocks of the compression path in the improved U-Net network are all transmitted to the block corresponding to the extension path through the ROI Align module instead of the cropping module.

[0011] Furthermore, the improved U-Net network adds an SE module to the second block of the compression path, and adds an SE module to the bottom connection block of the compression path and the expansion path.

[0012] Furthermore, the loss function of the improved U-Net network is

[0013]

[0014] Where P l(x) (x) is the softmax loss function, l:Ω→{1,2,…,K} is the label value of the pixel, ω: is the weight of the pixel. The closer the pixel is to the annotation boundary, the higher the weight is given to it.

[0015]

[0016] where ω c : is the weight to balance the category ratio, d1: is the distance from the pixel to its nearest boundary, d2: is the distance from a pixel to its second closest boundary, ω0 and σ are hyperparameters.

[0017] A weld milling identification method based on planar array structured light 3D vision includes the following steps:

[0018] Step 1: Collect a certain amount of point cloud data of weld workpieces, and obtain weld point clouds through manual annotation;

[0019] Step 2, calculate the ratio of the minimum eigenvalue to the maximum eigenvalue of the covariance matrix of the manually annotated weld point cloud, and construct a feature ratio training set of unmilled and milled welds;

[0020] Step 3, construct an approximately linearly separable support vector machine model, and use the feature ratio training set in step 2 for training to obtain the final weld discrimination approximately linearly separable support vector machine model;

[0021] Step 4: Collect the image and corresponding point cloud data of the workpiece that needs to be inspected for welds;

[0022] Step 5: Input the image of the workpiece that needs to be welded into the final weld instance segmentation model obtained by the aforementioned weld segmentation method to obtain the segmentation mask of the weld image, obtain the predicted weld point cloud data through the correspondence between the image and the point cloud, and calculate the predicted weld point cloud data feature ratio;

[0023] Step 6: Input the predicted weld point cloud data feature ratio into the final weld discrimination approximate linear separable support vector machine model to obtain the judgment of whether the weld has been milled.

[0024] Furthermore, in order to reduce the workload of manual annotation when generating the training set, a certain number of images and point cloud data of the weld workpiece are simultaneously collected in the step 1; the image of the weld workpiece is manually annotated with a weld mask, and the manually annotated mask is used to obtain a manually annotated weld point cloud through the correspondence between the image and the point cloud.

[0025] Furthermore, the image and point cloud data of the workpiece collected in step 1 and step 4 are simultaneously acquired by an area array structured light camera.

[0026] A weld segmentation device based on planar array structured light 3D vision comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the weld segmentation method based on planar array structured light 3D vision is implemented.

[0027] And a weld milling identification device based on area array structured light 3D vision, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the weld milling identification method based on area array structured light 3D vision is implemented.

[0028] The advantages of the technical solution provided by the present invention are:

[0029] In the U-Net network, the underlying feature maps obtain more low-frequency information of the image; the high-level feature maps obtain more detailed information of the image, including the edge information of closely adjacent welds. Adding SE modules or CBAM modules to the network can improve the model's sensitivity to channels and spaces, amplify the edge information of closely adjacent welds, and enable the adjacent welds to be better separated in the final segmentation. By adding SE or CBAM attention mechanism modules to the U-Net network and replacing the clipping operation with the ROI Align module, the U-Net's ability to segment closely adjacent objects is fully utilized and the problem of reduced segmentation accuracy caused by the clipping operation is avoided, thus achieving the segmentation of closely adjacent welds. In addition, on the basis of realizing weld segmentation, the ratio of the minimum eigenvalue to the maximum eigenvalue of the covariance matrix for distinguishing whether it is milled is constructed through the corresponding point cloud data, and the rapid judgment of whether the weld is milled is realized through the approximate linear separable support vector machine model; by utilizing the correspondence between the image and the point cloud, the corresponding manually annotated point cloud is obtained by manually annotating the image, and at the same time, in the recognition process, the weld point cloud is obtained by predicting the weld image, which avoids direct weld segmentation and discrimination through point cloud data and improves the discrimination speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a flow chart of the weld segmentation method based on planar array structured light 3D vision of Example 1.

[0031] Figure 2 It is a schematic diagram of the structure of the improved U-Net network instance segmentation model of Example 1.

[0032] Figure 3 Schematic diagram of weld segmentation result in Example 1.

[0033] Figure 4 It is a flow chart of the weld milling identification method based on planar array structured light 3D vision of Example 2.

[0034] Figure 5 It is the covariance matrix discriminant diagram of whether the weld morphology is milled in Example 2. DETAILED DESCRIPTION

[0035] The present invention is further described below in conjunction with examples. It should be understood that these examples are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading this description, various equivalent modifications to this description by those skilled in the art fall within the scope defined by the claims attached to this application.

[0036] Example 1, please combine Figure 1 As shown, the weld segmentation method based on planar array structured light 3D vision of this embodiment includes the following steps:

[0037] Step 1: A certain number of images of workpieces with welds are acquired through an area array structured light camera, weld masks are manually annotated on the workpiece images, a training set is constructed, and data enhancement is performed.

[0038] The area array structured light camera uses a grating structured light sensor and uses the deep learning image annotation tool - Labelme to annotate the RGB image of the workpiece with a polygon mask, and annotates the unmilled and milled welds as the same category (welds). Data enhancement methods include random flipping, random rotation, random contrast transformation, and random brightness transformation, which can increase the training data while allowing the model to learn elastic deformation invariance.

[0039] Step 2: Use the improved U-Net network to build an instance segmentation model, and train the instance segmentation model with the training set obtained in step 1 to obtain the final weld instance segmentation model.

[0040] In order to solve the problem of inaccurate segmentation caused by close proximity of welds, we improve the typical U-Net network by combining Figure 2 As shown in Figure 2, the improvement is to add an attention mechanism module to the four blocks of the compression path on the left side of the U-Net network and to the underlying connection blocks of the compression path on the left side and the expansion path on the right side ( Figure 2 ), the attention mechanism module is a SE module or a CBAM module. In this embodiment, the SE module is used in the first and second blocks of the compression path, and the CBAM module is used in the third, fourth blocks and the bottom connection block. The attention mechanism module is located after the last convolution operation of the connection block. For the four blocks of the compression path, after the last convolution, they are passed through the attention mechanism module and then divided into two paths, one is passed to the extension path on the right, and the other is down-sampled and passed to the block of the next layer. For the bottom connection blocks of the compression path and the extension path, after the last convolution, they are up-sampled and passed to the bottom block of the extension path through the attention mechanism module. Another aspect of the improvement of the U-Net network is that the outputs of the four blocks of the compression path are all passed to the blocks corresponding to the extension path through the ROI Align module instead of the cropping module.

[0041] Although the SE module or the CBAM module and the ROI Align module are all existing modules in the prior art, in order to facilitate understanding of the functions of each module, the SE module, the CBAM module and the ROI Align module are introduced below respectively.

[0042] The SE module belongs to the channel attention mechanism. It first compresses the feature map obtained by convolution and uses average pooling to obtain the global features at the channel level. It then performs an excitation operation on the global features to learn the relationship between channels and obtain the weights of different channels. Finally, it multiplies the original feature map to obtain the final features.

[0043] 1) The compression operation part uses a global average filter to obtain global information. The formula is as follows

[0044]

[0045] where u c is the feature map of the cth channel, W and H are the width and height of the feature map.

[0046] 2) Incentive operation, the formula is as follows:

[0047]

[0048] Where W1 represents the fully connected layer parameters responsible for compression, W2 represents the fully connected layer parameters responsible for restoring the dimension, σ represents the Sigmoid function, δ represents the ReLU function, and the variable r is the compression ratio. So far, we have Then s is multiplied by the previous convolution feature in each spatial position to obtain the output of the SE module, as shown in the following formula:

[0049]

[0050] The CBAM module uses the channel attention mechanism and the spatial attention mechanism in series. The channel attention mechanism is similar to the SE module, except that the maximum pooling and average pooling are used simultaneously when performing compression operations. The spatial attention mechanism calculates the average and maximum values ​​from the channel dimension respectively, and merges them to obtain a convolution layer with a channel number of 2. Then, through a convolution, a spatial attention weight with a channel number of 1 is obtained, and finally multiplied by the original feature map to obtain the final feature.

[0051] Given a feature map with attributes of height H, width W, dimension C, F as input, it can be expressed as follows:

[0052]

[0053] The CBAM module obtains a one-dimensional channel attention map M in turn. c and a 2D spatial attention map M s , the whole process can be summarized as:

[0054]

[0055]

[0056] in, Indicates the corresponding element multiplication operation. Let’s take a look at the implementation process of the attention module in the channel domain and the attention module in the spatial domain.

[0057] 1) Channel Attention Mechanism

[0058] For the input feature map, average pooling and maximum pooling are performed to aggregate spatial information, and two C-dimensional pooled feature maps F are obtained. avg and F max . F avg and F max The two channel attention maps are sent to a multilayer perceptron (MLP) with one hidden layer to obtain two 1×1×C channel attention maps. In order to reduce the number of parameters, the number of hidden layer neurons is C / r, where r is also called the compression ratio. The two channel attention maps obtained by MLP are added and activated to obtain the final channel attention map M. c The formula is as follows:

[0059]

[0060] Where W1 represents the fully connected layer parameters responsible for compression, W2 represents the fully connected layer parameters responsible for dimension restoration, and σ represents the Sigmoid function.

[0061] 2) Spatial Attention Mechanism

[0062] For F′, first perform maximum pooling and average pooling along the channel direction to obtain two two-dimensional feature maps F avg and F max , the size is 1×H×W, the two feature maps are concatenated to obtain a concatenated feature map of size 2×H×W. Based on the concatenated feature map, a convolutional layer of size k×k is used to generate a spatial attention map M s , k is generally 3 or 7.

[0063]

[0064] The ROI Align module is a regional feature aggregation method proposed in Mask-RCNN, which can effectively solve the problem of regional mismatch caused by quantization. The cropping operation in the U-Net network will lose some feature map edge information and reduce the accuracy of the final segmentation result. The ROI Align module cancels the quantization operation and uses the bilinear interpolation method to obtain the image value at the pixel point with floating point coordinates, thereby converting the entire feature aggregation process into a continuous operation, which can effectively solve the problem of reduced accuracy caused by U-Net cropping.

[0065] The ROI Align back propagation formula is as follows:

[0066]

[0067] Where d(.) represents the distance between two points, Δh and Δw represent the difference between the horizontal and vertical coordinates of i and i*(r,j), which are used as the coefficients of bilinear interpolation to multiply the original gradient. The intuitive understanding is that the closer the integer coordinate point is to the sampling point, the greater the proportion. In ROI Align, i*(r,j) is a floating point coordinate position (the sampling point calculated during forward propagation), so in the feature map before pooling, every point with a horizontal and vertical coordinate less than 1 with i*(r,j) should accept the corresponding point y rj The gradients passed back.

[0068] The loss function of the improved U-Net network is

[0069]

[0070] Where P l(x) (x) is the softmax loss function, l:Ω→{1,2,…,K} is the label value of the pixel, ω: is the weight of the pixel. The closer the pixel is to the annotation boundary, the higher the weight is given to it.

[0071]

[0072] where ω c : is the weight to balance the category ratio, d1: is the distance from the pixel to its nearest boundary, d2: is the distance from a pixel to its second closest boundary, ω0 and σ are hyperparameters.

[0073] The data processing process of the above improved U-Net network is as follows:

[0074] In the first layer on the left side of the network, a 572*572 RGB image is input, and then a 570*570*64 (64 is the number of channels in the feature map) feature map is obtained through a convolution with a step size of 1, 3*3*64 (3*3 is the convolution kernel size (size), 64 is the number of convolution kernels), and then a 568*568*64 feature map is obtained through a convolution with a step size of 1, 3*3*64 (these two convolution operations are the same), and then an attention mechanism module (this layer is the SE module, and the other layers are the attention mechanism module) is used to obtain the feature map. The corresponding SE / CBAM module) obtains a 568*568*64 feature map, and finally performs 2*2 maximum pooling and enters the RoIAlign module. After 2*2 maximum pooling, a 284*284*64 feature map is obtained as the input of the second layer on the left, and enters the RoIAlign module to obtain a 392*392*64 feature map, which is then spliced ​​with the 392*392*64 feature map of the first layer on the right to obtain a 392*392*128 feature map, and so on.

[0075] The input of the fifth layer is a 32*32*512 feature map. Through two convolutions with a step size of 1, 3*3*1024, a 28*28*1024 feature map is obtained. Then, a CBAM module (in other embodiments, a SE module) is used to obtain a 28*28*1024 feature map. Then, a 2*2 deconvolution is performed to obtain a 56*56*512 feature map, which is concatenated with the 56*56*512 feature map obtained by the RoIAlign module on the fourth layer on the left to obtain a 56*56*1024 feature map. Then, two convolutions with a step size of 1, 3*3*512 are performed to obtain a 52*52*512 feature map, and so on.

[0076] Finally, a 388*388*64 feature map is obtained in the first layer on the right, and then the number of channels is changed through a 1*1*2 convolution to obtain a 388*388*2 pixel-by-pixel category probability result. Then, the RoIAlign module is used to obtain a 572*572*2 final pixel-by-pixel category probability result, which is then processed into a segmentation result.

[0077] Step 3: Collect the image of the workpiece that needs to be welded and input the image into the final weld instance segmentation model to obtain the segmentation mask of the weld image and complete the weld segmentation. Figure 3 As shown, the left side is the input image and the right side is the output weld segmentation result.

[0078] Based on this embodiment, a weld progress identification test was conducted on 36 test samples, and the results were

[0079] AP = 68.673 AP IoU=.50 =97.056 APIoU=0.75 =91.140, AP stands for "AveragePrecision", which means average precision.

[0080] The structure of the improved U-Net network in this embodiment is adjusted and weld progress recognition tests are performed respectively, and the results are as follows:

[0081] Add SE module to the second block of compression path and add SE module to the bottom connection block of compression path and expansion path. The result is AP = 68.857 AP IoU=0.50 =97.450 AP IoU=0.75 =91.289.

[0082] Add CBAM modules to the first and third blocks of the compression path, and add SE modules to the underlying connection blocks of the compression path and the expansion path. The result is AP = 68.498 AP I0U=0.50 =97.015 AP IoU=0.75 =90.983.

[0083] Add SE modules to the third and fourth blocks of the compression path, and add CBAM modules to the bottom connection blocks of the compression path and the expansion path. The result is AP = 68.622 AP IoU=0.50 =97.138 AP IoU=0.75 =91.203.

[0084] Example 2, please combine Figure 4 As shown, a weld milling identification method based on planar array structured light 3D vision includes the following steps:

[0085] Step 1. A certain number of images and point cloud data of workpieces with welds are acquired through an array structured light camera; the workpiece images are manually annotated with weld masks, a training set is constructed and data enhancement is performed. The array structured light camera uses a grating structured light sensor, which can synchronously acquire the RGB image and point cloud data of the workpiece. The acquired RGB graph is annotated and data enhanced to construct a training set in the same manner as step 1 of Example 1. The acquired point cloud is ordered, and it has a one-to-one correspondence with the RGB image in terms of pixels. The width of the ordered point cloud is the width of the image, and the height of the ordered point cloud is the height of the image. If the pixel position of the RGB image is known, the point cloud coordinates corresponding to the pixel can be directly obtained. Therefore, the point cloud data corresponding to the manually annotated weld can be directly obtained through the manually annotated weld mask.

[0086] After the above data processing is completed, it is divided into two parts, one of which is to build an instance segmentation model similar to Example 1 and train it for subsequent use to obtain the weld segmentation mask, specifically: use the improved U-Net network to build an instance segmentation model, and train the instance segmentation model with the training set obtained in step 1 to obtain the final weld instance segmentation model. The improved U-Net network uses the SE module in the second block of the compression path, and the CBAM module in the underlying connection block connecting the compression path and the extension path, and the remaining blocks are not adjusted. The outputs of the four blocks of the compression path are all passed to the blocks corresponding to the extension path through the ROI Align module instead of the cropping module. The specific data processing flow of this network will not be repeated here

[0087] The other part is to judge whether the segmented weld has been milled, including:

[0088] Step 2, calculate the ratio of the minimum eigenvalue to the maximum eigenvalue of the covariance matrix of the manually annotated weld point cloud, and construct a feature ratio training set of unmilled and milled welds;

[0089] The eigenvector corresponding to the maximum eigenvalue of the covariance matrix always points to the direction of the maximum variance; the eigenvector corresponding to the second largest eigenvalue is orthogonal to the eigenvector corresponding to the maximum eigenvalue and points to the direction of the second largest variance; and so on. Point cloud is three-dimensional data. The eigenvalues ​​and eigenvectors of the covariance matrix of the point cloud are as follows: Figure 5 shown.

[0090] For each point p in the point cloud i , the corresponding covariance matrix C is as follows:

[0091]

[0092]

[0093] Where N is the number of points in the point cloud, is the point cloud centroid, λ j is the jth eigenvalue of the covariance matrix, is the j-th eigenvector of the covariance matrix.

[0094] Finding the eigenvalues ​​and eigenvectors of the covariance matrix is ​​equivalent to finding an ellipsoid so that all data points are within the ellipsoid, and the directions of the three coordinate axes of the ellipsoid correspond to the directions of v1v2v3. v1 is the first eigenvector, λ1 is its corresponding eigenvalue, and v1 points to the direction with the largest data variance. v2 is perpendicular to v1. Under the premise that v2 is perpendicular to v1, v2 points to the direction with the largest data variance. v3 is perpendicular to both v1 and v2. Under the condition that v2 and v1 are determined, v3 is unique. Based on the above, its mathematical meaning is very clear. v1 points to the direction with the largest variance, and v3 points to the direction with the smallest variance. The physical meaning in space is also very obvious. If the entire point cloud is planar, such as a weld point cloud, then v3 must point to the direction of its plane normal.

[0095] Therefore, the eigenvectors v1v2v3 and eigenvalues ​​λ1λ2λ3 (λ1≥λ2≥λ3) of the covariance matrix are calculated for the point cloud, where v1 is the first eigenvector, v2 is the second eigenvector, and v3 is the third eigenvector. v1 points to the direction with the largest variance, corresponding to the length of the weld, while λ3 is the direction with the smallest variance, pointing to the direction of the plane normal, corresponding to the thickness of the weld. Since the milled weld is thinner than the unmilled one, the characteristic ratio (eigenvalue in the normal direction to eigenvalue in the length direction λ3 / λ1) can be used to distinguish whether the weld has been milled.

[0096] Step 3, construct an approximately linearly separable support vector machine model, and use the feature ratio training set in step 2 for training to obtain the final weld discrimination approximately linearly separable support vector machine model;

[0097] Through step 2, the feature ratios corresponding to the unmilled and milled welds are obtained. Generally speaking, the milled welds are thinner than the unmilled welds, that is to say, the feature ratios of the milled welds are generally smaller than those of the unmilled welds. However, it cannot be guaranteed that the feature ratios of the unmilled welds and the milled welds are linearly separable. Therefore, an approximate linearly separable support vector machine model is constructed to train the one-dimensional data feature ratios, and the final approximate linearly separable support vector machine model for weld discrimination is obtained.

[0098] The approximately linearly separable support vector machine model is as follows

[0099]

[0100] sty i (w·x i +b)≥1-ξ i i=1,2,…,N

[0101] Among them, ξ i is a slack variable, and ξ i≥0, C is the penalty coefficient, which indicates the penalty for misclassification, and C>0.

[0102] Step 4: Also collect the image and corresponding point cloud data of the workpiece to be inspected by the area array structured light camera;

[0103] Step 5: Input the image of the workpiece that needs to be welded into the final weld instance segmentation model obtained in the other part above to obtain the segmentation mask of the weld image, obtain the predicted weld point cloud data through the correspondence between the image and the point cloud, and calculate the predicted weld point cloud data feature ratio;

[0104] Step 6: Input the predicted weld point cloud data feature ratio into the final weld discrimination approximate linear separable support vector machine model to obtain the judgment of whether the weld has been milled.

[0105] The method of this embodiment was used to perform milling identification on 40 test samples, 70% of which were images of milled welds, and the accuracy of the identification result was 100%.

[0106] It should be noted that the present application can be implemented in hardware, software, or a combination of hardware and software, or constitute a computer device comprising at least one processor and a memory, wherein the memory stores a computer program for implementing the above-mentioned process steps, and the processor is used to execute the computer program on the memory to perform the method steps of the above-mentioned embodiment.

Claims

1. A weld segmentation method based on planar structured light 3D vision, characterized in that: The following steps are involved: Step 1: Collect a certain number of images of weld workpieces; manually annotate the images of weld workpieces with weld masks, build a training set and perform data enhancement; Step 2: Use the improved U-Net network to build an instance segmentation model, and train the instance segmentation model with the training set obtained in step 1 to obtain the final weld instance segmentation model; Step 3: Collect the image of the workpiece that needs to be welded and input the image into the final weld instance segmentation model to obtain the segmentation mask of the weld image and complete the weld segmentation; The improved U-Net network selects at least two blocks in the four blocks of the compression path and the underlying connection blocks of the compression path and the expansion path to add an attention mechanism module, the attention mechanism module is an SE module or a CBAM module, and the attention mechanism module is located after the last convolution operation of the connection block. The outputs of the four blocks of the compression path in the improved U-Net network are all transferred to the blocks corresponding to the expansion path through the ROI Align module instead of the clipping module; the loss function of the improved U-Net network is , in is the softmax loss function, is the label value of the pixel, is the weight of the pixel. The closer the pixel is to the annotation boundary, the higher the weight is given to it. , in is the weight to balance the category ratio, is the distance from a pixel to its nearest boundary, is the distance from a pixel to the second closest boundary, and is a hyperparameter.

2. The weld segmentation method based on planar array structured light 3D vision according to claim 1 is characterized in that: The improved U-Net network adds an SE module to the second block of the compression path, and adds an SE module to the bottom connection block of the compression path and the expansion path.

3. A weld milling identification method based on planar array structured light 3D vision, comprising the following steps: Step 1: Collect a certain amount of point cloud data of weld workpieces, and obtain weld point clouds through manual annotation; Step 2, calculate the ratio of the minimum eigenvalue to the maximum eigenvalue of the covariance matrix of the manually annotated weld point cloud, and construct a feature ratio training set of unmilled and milled welds; Step 3, construct an approximately linearly separable support vector machine model, and use the feature ratio training set in step 2 for training to obtain the final weld discrimination approximately linearly separable support vector machine model; Step 4: Collect the image and corresponding point cloud data of the workpiece that needs to be inspected for welds; Step 5: Input the image of the workpiece that needs to be welded into the final weld instance segmentation model to obtain the segmentation mask of the weld image, obtain the predicted weld point cloud data through the correspondence between the image and the point cloud, and calculate the predicted weld point cloud data feature ratio; Step 6: Input the predicted weld point cloud data feature ratio into the final weld discrimination approximate linear separable support vector machine model to obtain the judgment of whether the weld has been milled. The final weld instance segmentation model is obtained by the following method: Step S3-1, collecting a certain number of images of weld workpieces; manually marking the images of weld workpieces with weld masks, constructing a training set and performing data enhancement; Step S3-2, using the improved U-Net network to build an instance segmentation model, and training the instance segmentation model with the training set obtained in step S3-1 to obtain a final weld instance segmentation model; The improved U-Net network selects at least two blocks in the four blocks of the compression path and the underlying connection blocks of the compression path and the expansion path to add an attention mechanism module, the attention mechanism module is an SE module or a CBAM module, and the attention mechanism module is located after the last convolution operation of the connection block. The outputs of the four blocks of the compression path in the improved U-Net network are all transferred to the blocks corresponding to the expansion path through the ROI Align module instead of the clipping module. The loss function of the improved U-Net network is , in is the softmax loss function, is the label value of the pixel, is the weight of the pixel. The closer the pixel is to the annotation boundary, the higher the weight is given to it. , in is the weight to balance the category ratio, is the distance from a pixel to its nearest boundary, is the distance from a pixel to the second closest boundary, and is a hyperparameter.

4. The weld milling identification method based on planar array structured light 3D vision according to claim 3 is characterized in that: In the step 1, a certain number of images and point cloud data of weld workpieces are collected simultaneously; the images of the weld workpieces are manually annotated with weld masks, and the manually annotated masks are used to obtain manually annotated weld point clouds through the correspondence between the images and the point clouds.

5. The weld milling identification method based on planar array structured light 3D vision according to claim 4 is characterized in that: In step 1, the image of the weld workpiece is manually annotated with a weld mask, which is then used in step 3-1 to construct a training set and perform data enhancement.

6. The weld milling identification method based on planar array structured light 3D vision according to claim 3 is characterized in that: The image and point cloud data of the workpiece collected in step 1 and step 4 are obtained by simultaneously collecting them with an area array structured light camera.

7. A weld segmentation device based on planar array structured light 3D vision, comprising a processor and a memory, wherein a computer program is stored in the memory, characterized in that: When the computer program is executed by the processor, the weld segmentation method based on planar structured light 3D vision according to claim 1 or 2 is implemented.

8. A weld milling identification device based on planar array structured light 3D vision, comprising a processor and a memory, wherein a computer program is stored in the memory, characterized in that: When the computer program is executed by the processor, the weld milling identification method based on planar structured light 3D vision as described in any one of claims 3 to 6 is implemented.