A method for detecting surface defects of workpieces by integrating projection point set segmentation network
By integrating the projection point set segmentation network, combined with the improved point-level concave and convex defect segmentation model and projection network, and introducing a biased attention mechanism, the problems of high false detection rate and low accuracy in surface defect detection of curved workpieces are solved, and high efficiency is achieved. automated detection.
Patent Information
- Application Number
- CN202110855064.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-26
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-07-26
AI Technical Summary
Traditional methods have the problems of high false detection rate in surface defect detection of curved workpieces, are time-consuming and labor-intensive, and are difficult to handle concave-convex homogeneous area segmentation scenarios, especially in complex environments where it is difficult to ensure accuracy and efficiency.
The fused projection point set segmentation network is used. By combining the improved point-level concave and convex defect segmentation model with the projection network, a biased attention mechanism is introduced to aggregate local and global feature information to complete the defect segmentation task.
It improves the segmentation precision and accuracy of detection, simplifies the network configuration, facilitates mobile terminal deployment, reduces costs, and realizes automated defect detection on the workpiece surface.
Smart Images

Figure CN113744186B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of machine vision, and in particular relates to a method for detecting surface defects of a workpiece by integrating a projection point set segmentation network. Background Art
[0002] As a major manufacturing country, my country mainly relies on manual inspection for surface defect detection of curved workpieces, where quality inspectors compare the difference between the workpiece to be tested and the standard part to determine whether there are defects and define the defect type. This detection method is not only time-consuming and labor-intensive, but also has a high false positive rate. With the development of technology, workpiece surface defect detection technology based on machine vision can adapt to complex and harsh environments with high accuracy and efficiency, so it is increasingly used in the field of industrial intelligent manufacturing.
[0003] Due to the special configuration of casting curved surface workpieces, inspection can only be carried out from the outer surface. Defect feature extraction and the construction of defect detection models become very critical. Unlike planar workpieces, which can easily fit three-dimensional data into a planar model for inspection with the help of relevant algorithms, hyperbolic or even multi-surface workpieces themselves are difficult to fit the surface through relevant algorithms, and the accuracy and efficiency cannot be guaranteed during the fitting process. Traditional defect detection methods that rely on point cloud registration and point cloud segmentation are time-consuming and labor-intensive, with a high false detection rate, and cannot be used in concave-convex homogeneous area segmentation scenarios.
[0004] Therefore, a method for workpiece surface defect detection based on the fusion projection point set segmentation network is proposed to solve the above problems. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a method for detecting surface defects of workpieces by integrating a projection point set segmentation network, and the detection method comprises the following steps:
[0006] Step 1: Improve the point cloud network segmentation branch and build a point-level concave-convex defect segmentation model based on it, that is, the point set segmentation network;
[0007] Step 2: Build a projection network, fuse it with the point set concave-convex defect segmentation model, and aggregate the global feature descriptors obtained by the two;
[0008] Step 3: For the aggregated information, a biased attention mechanism is introduced to balance the weights of intermediate features, and then aggregated with the global feature descriptor to jointly learn point features and complete the defect segmentation task.
[0009] Preferably, in step 1, the point-level concave-convex defect segmentation model is constructed by performing concave-convex defect segmentation on a given N surface point cloud coordinates of a curved workpiece with F-dimensional input features, and then labeling each point with concave, normal and convex category labels to complete fine-grained defect detection.
[0010] Preferably, the construction of the point set segmentation network in step 1 consists of two parts: an improved segmentation branch of the point cloud network and a segmentation network module, wherein the improvements of the segmentation branch of the point cloud network include:
[0011] (1) Average pooling replaces global pooling;
[0012] (2) Incorporating orientation information for multi-feature learning;
[0013] (3) Replace the final cross entropy loss and SoftMax activation function of the model with the segmentation network module.
[0014] Preferably, the steps of building the segmented network module are:
[0015] Aggregate the 64-dimensional local features obtained by aligning the global feature descriptor with the segmentation branch of the point cloud network through the feature conversion module;
[0016] The defect semantic segmentation results of each point cloud coordinate are obtained through the MLP with the structure of {512, 256, 128} and the MLP with the structure of {128, C}. In addition, the segmentation network module contains an output layer;
[0017] The defect type C of the point cloud coordinates contained in each surface workpiece point cloud is the output data of the output layer, and the defect semantic segmentation result of each point cloud coordinate is output through the LogSoftMax classifier;
[0018] The model uses the Cross-Entropy Loss function to calculate the error between the predicted value and the true value, and corrects it through error back propagation to complete the model training.
[0019] Preferably, the projection network consists of the following three modules:
[0020] (1) Mirror projection transformation module based on normal vector;
[0021] (2) Density-based partitioning conversion module;
[0022] (3) Two-dimensional convolutional transformation module;
[0023] Preferably, the function of the projection conversion module is to transform the three-dimensional point cloud into a two-dimensional point cloud by Household mirror projection according to the normal vector learned by the normal vector network; the function of the division conversion module is to divide the two-dimensional point cloud into a 32×32 pseudo two-dimensional image form according to the density; the function of the two-dimensional convolution module is to perform feature extraction.
[0024] Preferably, the specific steps of step 2 are:
[0025] Step 21: The projection network converts the 3D point cloud into a 2D point cloud by normal vector mirror projection, and divides it into a 32×32 grid using density, and then extracts features through a 2D convolutional network;
[0026] Step 22: Aggregate the global feature descriptors obtained by the projection network and the improved point cloud segmentation network to obtain an overall global feature descriptor, and output the concave-convex defect category to obtain a point cloud segmentation network that fuses the projection point set;
[0027] Among them, the components of the point cloud segmentation network that fuses the projection point set include input layer, output layer, projection network, point cloud segmentation network and global feature aggregation module.
[0028] Preferably, the architecture part of the biased attention mechanism in step 3 extracts local features of 8 dimensions from the projection network and 4 and 64 dimensions from the point cloud network segmentation branch, and performs feature weight distribution through the biased attention mechanism after feature aggregation, thereby balancing the influence of local features extracted from different layers on the total features.
[0029] Compared with the prior art, the beneficial effects of the present invention are as follows: In order to solve the problem that the point set segmentation network ignores the orientation prior knowledge of different perspectives, resulting in the loss of some local feature information, the present invention proposes a segmentation network that fuses projection points. Considering that it ignores the aggregation of local information and global information, a method of extracting local intermediate features in point cloud network branches and projection networks and aggregating information with global feature descriptors is proposed. In addition, a biased attention mechanism is introduced to improve the segmentation accuracy. This relatively simple network configuration is easier to deploy on mobile terminals, which helps to realize automated defect detection of curved surface workpieces in factories at a low cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is the overall network architecture diagram of the present invention;
[0031] Figure 2 This is a diagram of the point set segmentation network architecture of the present invention;
[0032] Figure 3 This is a schematic diagram of the mirror projection conversion module of the present invention;
[0033] Figure 4 It is a simulation diagram of the partition conversion module of the present invention;
[0034] Figure 5 It is a two-dimensional convolution module architecture diagram of the present invention;
[0035] Figure 6 This is a diagram of the biased attention mechanism architecture of the present invention;
[0036] Figure 7 This is a visual display diagram of the defect concave-convex segmentation application of the present invention. DETAILED DESCRIPTION
[0037] The present invention is further described below in conjunction with the accompanying drawings:
[0038] Example:
[0039] As attached Figure 1 As shown in FIG. 1 , the present invention selects a point cloud segmentation network that integrates projection point sets as the backbone network, which includes three core components, including an input layer, an improved point set segmentation network, and a projection network. Figure 1 The framed part below is the introduced biased attention mechanism, which together provides a method for detecting surface defects of workpieces by integrating the projection point set segmentation network. The steps of the method are as follows:
[0040] Step 1:
[0041] As attached Figure 2 As shown, the input layer takes N points of the surface point cloud slice of the curved workpiece as input, and each point contains x, y, z three-dimensional spatial features, representing the x-axis coordinate, y-axis coordinate, and z-axis coordinate respectively;
[0042] The segmentation branch of the point cloud network is modified. The input conversion module and feature conversion module of this branch both have the core architecture T-Net, which is a micro point cloud network. The input point cloud is normalized and aligned by learning a 3×3 transformation matrix. It consists of a shared weight MLP with a structure of {64,128,1024}, a pooling operation, and an MLP with a structure of {512,256,9}. The output matrix is initially a unit matrix. An improvement to this is that the maximum pooling is replaced by average pooling, and the global feature descriptor of the defect is found by integrating the point cloud information;
[0043] Another change is to construct a prediction data set based on point cloud slices, mark and obtain the orientation offset information of point cloud slices in the surface workpiece point cloud, and add one-dimensional direction information d to the three-dimensional features output by the input conversion module for multi-feature learning. The specific addition strategy is as follows:
[0044] (1) Change the feature dimension of the input data from (x, y, z) to (x, y, z, d), where d represents the orientation of the point cloud slice in the surface point cloud;
[0045] (2) To avoid the increase of model training parameters and computational complexity caused by too many dimensions of orientation information, d uses a single feature dimension. Following the principle of dividing the x-axis and y-axis in a 3:2 ratio, a surface point cloud is cut into S point cloud slices. Therefore, the orientation information is marked with 0-S, with x as the row and y as the column, and the orientation features are integrated according to the (x-1)×(y-1) strategy.
[0046] (3) Since the transformation matrix output by T-Net in the input transformation module is to transform the point cloud to an angle that is easy to predict, the original input module is kept unchanged, and the corresponding orientation information is fused after the output of the aligned surface slice point cloud for multi-feature learning.
[0047] The cross entropy loss function and SoftMax of the point cloud network segmentation branch are replaced with the segmentation network module, and the global feature descriptor and the 64-dimensional local features obtained after feature alignment in the feature conversion module in the Point-PreNet branch are aggregated, and then the defect semantic segmentation results of each point cloud coordinate are obtained through the MLP with a structure of {512,256,128} and the MLP with a structure of {128,C}. In addition, the module contains an output layer. The defect type C of the point cloud coordinate contained in each surface workpiece point cloud is the output data of the output layer, and the defect semantic segmentation results of each point cloud coordinate are output through the Log SoftMax classifier.
[0048] Step 2:
[0049] In order to solve the problem of difficulty in capturing multi-view features, a projection network is constructed, which consists of three modules: a projection mirror transformation module, a partition transformation module and a two-dimensional convolution module.
[0050] The function of the projection mirror conversion module is to mirror the 3D point cloud into multiple 2D point clouds while maintaining the shape characteristics of the point cloud. Figure 3 As shown in the figure, this module learns a 4×3 normal vector matrix through N-Net. Each 1×3 normal vector can form a three-dimensional plane passing through the origin, 4 is the number of projection surfaces, and the matrix formula is:
[0051]
[0052] The plane equation is:
[0053]
[0054] The original 3D point cloud coordinates are (x, y, z), the projection point coordinates are (x', y', z'), and the 3D plane equation is:
[0055] Ax+By+Cz=0
[0056] Solve (x',y',z') using the following formula:
[0057]
[0058] Then, Householder transformation is performed on (x', y', z') to transform it into a two-dimensional point cloud (x", y", 0).
[0059] The partitioning conversion module of the projection network is a density-based partitioning conversion, that is, only the feature value of the point cloud density is taken, and each two-dimensional grid is divided into Width is In the space of , the number of projected two-dimensional point cloud coordinate points in each grid is taken as the density feature of this grid, and a two-dimensional density partition map is obtained, where the example of partition transformation is as follows Figure 4 shown.
[0060] As attached Figure 5 As shown in the figure, the input of the final two-dimensional convolutional transformation module is a 32×32×4 two-dimensional image determined by division, where 4 is the number of projection surfaces. The module uses 4 as the initial input channel and obtains a global feature descriptor through two convolutional layers and two pooling layers to achieve the purpose of feature extraction. Figure 1 As shown, the global feature descriptors obtained by the projection network and the point set segmentation network are aggregated to obtain the overall global feature descriptor, and the defect segmentation result is output.
[0061] Step 3:
[0062] In order to take into account the impact of different local feature weights on point features, a biased attention mechanism that is more suitable for point cloud learning is introduced to balance the intermediate feature weights, which are then aggregated with the global feature descriptor to jointly learn point features and complete the defect segmentation task.
[0063] As attached Figure 6 As shown in the figure, it is the biased attention mechanism architecture, whose input and output are both N×F feature matrices, where N is the number of point cloud coordinates and F is the feature dimension. The switch indicates whether to select SA or OA, and the dotted line indicates the selection of SA. SA first performs a linear transformation on the input feature matrix, calculates the similarity of different features of each point cloud coordinate point through SoftMax, and assigns weights to each feature to obtain a new attention feature map. Then, after linear transformation, normalization, and ReLU activation function transformation, a new SA-based feature matrix is obtained, and its calculation formula is:
[0064] F out =SA(F in )=LBR(F sa )+F in
[0065] The calculation formula of OA is:
[0066] F out =OA(F in )=LBR(F in -F sa )+F in
[0067] OA has the same input and output as SA. In the initial stage, the input feature matrix is linearly transformed and the obtained feature matrix is multiplied by the transposed feature matrix. However, the difference is that OA calculates the deviation between SA features and input features by subtracting each feature, and feeds the offset to LBR to obtain the attention feature map instead of SA. in -F sa It is an implicit Laplace operator. When obtaining the biased attention map, Softmax+L1-Norm is used instead of the simple normalization operation in SA.
[0068] As attached Figure 1 As shown, Figure 1 The lower part of the figure shows the biased attention mechanism. The 8-dimensional local features extracted from the projection network and the 4- and 64-dimensional local features extracted from the improved point cloud network segmentation branch are weighted by the biased attention mechanism after feature aggregation, balancing the influence of local features extracted from different layers on the total features.
[0069] Comparative Example 1:
[0070] In order to verify the superiority of the method of the present invention, a comparative experiment was conducted with other methods on the rotor point cloud data with surface defects:
[0071] The data selected is a rotor surface point cloud with relatively uniform concave and convex distribution. All experiments are implemented in the GeForce GTX 1080 / PCle / SSE2 environment using the PyTorch learning library.
[0072] It should be specially noted that in order to solve the problem that the amount of surface point cloud data is too large but the defect ratio is small and it is difficult to directly perform defect segmentation, the experiment introduces a defect ratio prediction model Point-PreNet based on point cloud slicing before defect segmentation. This model is an adjusted product of the point set segmentation network in the present invention. The two are mainly the same, and only the output layer uses MSE loss and sigmoid activation function instead of cross entropy loss and softmax to output a defect ratio prediction value in the range of [0,1]. Similarly, FPP-PreNet is an adjusted product of the fusion network in the present invention. The point cloud slices with a defect ratio of more than 0.5% are sorted and predicted as experimental input data for the control experiment of defect segmentation below.
[0073] like Figure 7As shown in the figure, (a) is the surface point cloud of the rotor to be tested, with concave and convex labels manually marked on the point cloud coordinates based on lines using Cloud Compare software; (b) is the segmentation result of the point set segmentation network after Point-PreNet processing; (c) is the segmentation result of the fusion network after FPP-PreNet processing; (d) is the segmentation result of the fusion network after FPP-PreNet processing with the biased attention mechanism added.
[0074] Experiments show that the introduction of a normal-based projection mirror network reduces the scale prediction error and improves segmentation accuracy while ensuring that end-to-end learning is completed directly with point clouds as input. At the same time, the introduction of a biased attention mechanism corrects the feature weights to a certain extent, improves segmentation accuracy, and can accurately process surface areas with large curvature changes.
[0075] In the description of the present invention, it is necessary to understand that the terms "coaxial", "bottom", "one end", "top", "middle", "the other end", "upper", "one side", "top", "inside", "front", "center", "both ends" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0076] In addition, the terms "first", "second", "third" and "fourth" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first", "second", "third" and "fourth" may explicitly or implicitly include at least one of such features.
[0077] In the present invention, unless otherwise clearly stipulated and limited, the terms such as "installation", "setting", "connection", "fixation" and "screw-on" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral one; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. Unless otherwise clearly defined, ordinary technicians in this field can understand the specific meanings of the above terms in the present invention according to the specific circumstances.
[0078] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for detecting surface defects of workpieces by integrating a projection point set segmentation network, characterized in that: The detection method includes the following steps: Step 1: Improve the point cloud network segmentation branch and build a point set concave-convex defect segmentation model based on it, namely the point set segmentation network; The construction of the point set segmentation network consists of two parts: the improved segmentation branch of the point cloud network and the segmentation network module. The improvements of the segmentation branch of the point cloud network include: (1) Average pooling replaces global pooling; (2) Incorporating orientation information for multi-feature learning; (3) Replace the final cross entropy loss and SoftMax activation function of the model with a segmentation network module; The point set concave-convex defect segmentation model is constructed to perform concave-convex defect segmentation for a given N surface point cloud coordinates of a curved workpiece with F-dimensional input features, and then label each point with concave, normal and convex category labels to complete fine-grained defect detection; The steps for building the segmentation network module are: Aggregate the 64-dimensional local features obtained by aligning the global feature descriptor with the segmentation branch of the point cloud network through the feature conversion module; The defect semantic segmentation results of each point cloud coordinate are obtained through the MLP with the structure of {512, 256, 128} and the MLP with the structure of {128, C}. In addition, the segmentation network module contains an output layer; The defect type C of the point cloud coordinates contained in each surface workpiece point cloud is the output data of the output layer, and the defect semantic segmentation result of each point cloud coordinate is output through the LogSoftMax classifier; The model uses the Cross-Entropy Loss function to calculate the error between the predicted value and the true value, and corrects it through error back propagation to complete the model training. Step 2: Build a projection network, fuse it with the point set concave-convex defect segmentation model, and aggregate the global feature descriptors obtained by the two; The projection network consists of the following three modules: (1) Mirror projection transformation module based on normal vector; The function of the projection conversion module is to transform the three-dimensional point cloud into a two-dimensional point cloud by Household mirror projection according to the normal vector learned by the normal vector network; (2) Density-based partitioning conversion module; The function of the division conversion module is to divide the two-dimensional point cloud into a 32×32 pseudo two-dimensional image form according to density; (3) Two-dimensional convolutional transformation module; The function of the two-dimensional convolution conversion module is to perform feature extraction; The specific steps of step 2 are: Step 21: The projection network converts the 3D point cloud into a 2D point cloud by normal vector mirror projection, and divides it into a 32×32 grid using density, and then extracts features through a 2D convolutional network; Step 22: Aggregate the global feature descriptors obtained by the projection network and the point set segmentation network to obtain an overall global feature descriptor, and output the concave-convex defect category to obtain a point cloud segmentation network that fuses the projection point set; Among them, the components of the point cloud segmentation network that integrates the projection point set include an input layer, an output layer, a projection network, a point cloud segmentation network, and a global feature aggregation module; Step 3: For the aggregated information, a biased attention mechanism is introduced to balance the weights of intermediate features, and then aggregated with the global feature descriptor to jointly learn point features and complete the defect segmentation task.
2. A method for detecting workpiece surface defects by integrating a projection point set segmentation network as claimed in claim 1, characterized in that: The architecture of the biased attention mechanism in step 3 extracts local features of 8 dimensions from the projection network and 4 and 64 dimensions from the segmentation branch of the point cloud network. After feature aggregation, feature weights are allocated through the biased attention mechanism to balance the impact of local features extracted from different layers on the total features.
