Diffusion model-based processing surface three-dimensional point cloud defect detection method
Through data augmentation and iterative reconstruction technology based on diffusion model, combined with PointNet encoder and diffusion decoder, the problems of high resource occupation and long inference time in three-dimensional point cloud defect detection are solved, and fast and accurate defect detection is achieved, which is suitable for online detection of industrial assembly lines.
Patent Information
- Application Number
- CN202510309898.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-07-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing three-dimensional point cloud defect detection methods have problems such as high resource cost, long inference time and unreliable reconstruction, making it difficult to achieve fast and accurate defect detection.
Using a diffusion model-based method, through data augmentation and iterative reconstruction technology, the PointNet encoder and improved diffusion decoder are used, and the clustering algorithm and distance function are combined to perform defect detection and segmentation of three-dimensional point clouds.
It realizes fast and accurate three-dimensional point cloud defect detection, reduces resource occupation, improves production efficiency and product quality, and is suitable for online inspection of industrial assembly lines.
Smart Images

Figure CN120259204A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting machining surface defects, belonging to the field of defect detection, and particularly to a method for detecting three-dimensional point cloud defects on a machining surface based on a diffusion model. Background Art
[0002] The goal of defect detection is to identify data instances containing defects and accurately locate the specific positions of these defects. This task is widely applied in multiple fields and plays a crucial role in quality control in industrial production. Three-dimensional point clouds have inherent pattern advantages, which can avoid blind spots in defect detection based on two-dimensional images, resulting in false detections or missed detections. The technology of three-dimensional point cloud defect detection has thus developed and plays an increasingly important role in advanced manufacturing and precision machining.
[0003] However, the discreteness and disorder of three-dimensional point cloud data make it more difficult to extract features from them than from two-dimensional images. At the same time, due to the relatively small number of defect cases, using only normal instances as the single training source will also cause the trained defect detector to encounter the problem of domain shift, making it unable to correctly process abnormal instances. These problems highlight the necessity and urgency of developing an efficient three-dimensional point cloud defect detection framework. Similar to traditional two-dimensional image defect detection, current three-dimensional point cloud defect detection methods can mainly be divided into two categories: embedding-based methods and reconstruction-based methods. Embedding-based methods involve using a pre-trained encoder to extract features and mapping them to a normal distribution for learning. If the distribution falls outside a predetermined interval, it is regarded as a defect. Most existing three-dimensional defect detection methods are based on the memory bank mechanism, storing some representative features during the training stage to implicitly construct a feature distribution. During the testing stage, the Euclidean distance between the input test object and all template point clouds stored in the memory bank is calculated to determine whether there are defects. Reconstruction-based methods train a network to accurately reconstruct normal point clouds. Since defect point cloud instances are not included in the training process, for a model trained only with normal point cloud instances, it cannot correctly reconstruct the defect point cloud instances encountered during the testing stage.
[0004] Existing methods face two key problems: high resource costs and irreparable reconstruction. First, memory bank-based methods store all features during the training phase, which means that each tested point cloud needs to be compared with all samples in the memory bank, greatly increasing the memory burden and the cost of inference time. This inefficiency almost makes such methods difficult to apply in actual industrial production lines. Second, the masked autoencoder mechanism only reconstructs the masked part of the input, and defects that may exist in the unmasked part will be retained. This contradicts the basic assumption of comparing the original defective point cloud with the anomaly-free version after reconstruction. These methods inevitably lead to incorrect reconstructions, thus weakening their effectiveness in accurately locating defects. In summary, existing technologies are difficult to achieve fast and accurate three-dimensional point cloud defect detection tasks. Summary of the Invention
[0005] To solve the problems existing in the background technology, the present invention provides a three-dimensional point cloud defect detection method for a machining surface based on a diffusion model.
[0006] The technical solution adopted by the present invention is:
[0007] The three-dimensional point cloud defect detection method for a machining surface based on a diffusion model of the present invention includes:
[0008] 1) Obtain the three-dimensional point clouds of the machining surfaces of several defect-free industrial products, and sequentially perform data augmentation and point cloud preprocessing to obtain defective three-dimensional point clouds and construct them into a training set.
[0009] 2) Establish an improved diffusion model based on displacement iterative reconstruction, input the training set into the improved diffusion model for training until the loss function of the improved diffusion model converges, and obtain a trained reconstruction model.
[0010] 3) Obtain the three-dimensional point cloud of the machining surface of the industrial product to be detected and perform the same point cloud preprocessing as in step 1), then input it into the reconstruction model for processing, and obtain a reconstructed point cloud after processing.
[0011] 4) Detect and segment the three-dimensional point cloud to be detected and its reconstructed point cloud through a detection function to obtain defect detection classification and localization results, and complete the defect detection of the machining surface of the industrial product.
[0012] The present invention is oriented to three-dimensional form expression, reconstructs the defect-free features corresponding to the input samples based on a diffusion model, detects and segments by comparing the original features and the reconstruction through a clustering algorithm and a distance function, and performs data augmentation through a new three-dimensional point cloud defect simulation strategy.
[0013] In step 1), for the three-dimensional point cloud of the processing surface of each defect-free industrial product, data augmentation of global random rotation and local random deformation is performed on the three-dimensional point cloud in sequence. When performing global random rotation, the randomly generated 3×3 rotation matrix is multiplied by the point cloud matrix of the three-dimensional point cloud to obtain the rotated three-dimensional point cloud. Through this random rotation method, partial point clouds scanned from different angles are simulated to enhance the robustness of the model to input point clouds at any angle; then local random deformation is performed. Some points are randomly selected in the rotated three-dimensional point cloud for displacement to simulate defect patterns including various forms such as protrusions, depressions, and damages in the three-dimensional point cloud, so as to enhance the model's ability to still reconstruct the corresponding defect-free sample when dealing with real three-dimensional defects. Finally, the data-augmented three-dimensional point cloud is obtained.
[0014] In step 1), the data-augmented three-dimensional point cloud is preprocessed. First, after normalization, the data-augmented three-dimensional point cloud is translated and scaled, and then randomly downsampled to the preset number of point clouds. Finally, the processed defective three-dimensional point cloud is obtained and constructed into a training set.
[0015] In step 2), the improved diffusion model based on displacement iterative reconstruction includes a point cloud network PointNet encoder and an improved diffusion decoder. During the training process, a noise addition function is also included in the improved diffusion model. After the defective three-dimensional point cloud is feature-extracted through the point cloud network PointNet encoder, the shape encoding feature of the defective three-dimensional point cloud is obtained as the latent shape embedding encoding c. At the same time, the defective three-dimensional point cloud is passed through the noise addition function to generate a set of masked point clouds at time T with the property of Markov chain The shape encoding feature of the defective three-dimensional point cloud is input into the improved diffusion decoder for processing and then outputs the displacement vector △ at time T - 1 (T-1) , the masked point cloud at time T and the displacement vector △ at time T - 1 (T-1) are added together to obtain the reconstructed point cloud at time T - 1 The displacement vector △ at time T - 1 (T-1) and the latent shape embedding encoding c are input into the improved diffusion decoder for processing and then output the displacement vector △ at time T - 2 (T-2) , and the iterative process is repeated. Each time during the iteration, the current moment's displacement vector output by the improved diffusion decoder and the next moment's reconstructed point cloud are added together to obtain the previous moment's reconstructed point cloud, and the current moment's displacement vector and the latent shape embedding encoding c are input into the improved diffusion decoder for processing and then output the previous moment's displacement vector until the displacement vector △ at time 0 is output (0) , the displacement vector △ at time 0 (0) and the reconstructed point cloud at time 1 are added together to output the reconstructed point cloud at time 0 As the reconstructed point cloud that improves the final output of the diffusion model, the reconstructed point clouds of each final output obtained from the training set and the defective three-dimensional point cloud of the initial input are jointly processed by the loss function of the improved diffusion decoder, and the network weights of the improved diffusion decoder are updated through the optimizer until the loss function converges to obtain the trained improved diffusion decoder, that is, the trained reconstruction model is obtained.
[0016] The displacement vectors are specifically as follows:
[0017]
[0018] Among them, △ (t) and △ (t-1) are the displacement vectors at time t and time t - 1 respectively; α t and are the noise variance and its cumulative variance at time t respectively, α s is the noise variance at time s, β t is the noise variance schedule at time t, β t = 1 - α t ; ∈ θ is the denoising function; σ is the noise standard deviation; ∈ is the standard Gaussian noise.
[0019] In the step 4), the detection function includes a clustering algorithm and a distance function. First, the three-dimensional point cloud to be detected and its reconstructed point cloud are respectively subjected to K-nearest neighbor clustering to obtain two groups of clustered point clouds. The clustered point clouds of the three-dimensional point cloud to be detected and its reconstructed point cloud respectively contain several initial point cloud clusters and reconstructed point cloud clusters. Then, the two groups of clustered point clouds are measured by the distance function. For each initial point cloud cluster, the Euclidean distance between the initial point cloud cluster and each reconstructed point cloud cluster is obtained, and the shortest Euclidean distance among them is selected as the segmentation result of the current initial point cloud cluster. For the segmentation result of each initial point cloud cluster, if the segmentation result is not greater than the distance threshold, there is no defect at the position where the current initial point cloud cluster is located, otherwise there is a defect. At the same time, the size of the defect can also be determined according to the segmentation result, so as to obtain the defect localization result of the processed surface of the industrial product to be detected; at the same time, the longest Euclidean distance in the segmentation result of the initial point cloud cluster is obtained as the classification result. If the classification result is not greater than the distance threshold, the three-dimensional point cloud to be detected currently has no defect, otherwise there is a defect, so as to obtain the defect classification result of the processed surface of the industrial product to be detected.
[0020] The electronic device of the present invention includes: a memory and a processor that are coupled to each other. Among them, the memory stores program data, and the processor calls the program data to execute the method as described above.
[0021] The computer-readable storage medium of the present invention stores program data thereon, and when the program data is executed by a processor, the method described above is implemented.
[0022] Through data distribution conversion based on the diffusion process, the present invention uses the geometric features of the input abnormal three-dimensional point cloud as a condition. The model learns the strict point-by-point displacement behavior from the random Gaussian noise three-dimensional point cloud, and finally obtains the normal three-dimensional point cloud corresponding to the defect sample by gradually correcting the abnormal three-dimensional point cloud. The defect-free sample after reconstruction and the corresponding original defect sample are respectively clustered, and the distance function is used to compare the three-dimensional reconstructed point cloud and the three-dimensional input point cloud after clustering. Among them, the outlier points with large distance differences are regarded as abnormal points, and thus the classification result and segmentation result of defect detection are obtained. In addition, the method also introduces a new three-dimensional point cloud defect simulation strategy to generate realistic and diverse defect shapes, thereby reducing the domain gap and distribution difference between the training set and the test set.
[0023] The beneficial effects of the present invention are:
[0024] The present invention is applicable to defect detection based on three-dimensional expression forms, mainly for the three-dimensional point cloud defect detection of the processing surface of industrial products. It can help solve the problems of missing defect detection data, large differences in the training and test domain distributions, low accuracy, large resource occupancy, and long inference time of existing methods, and contribute to solving the problems of slow inference speed and large video memory consumption of existing three-dimensional defect detection methods, realizing fast and accurate three-dimensional point cloud defect detection. This method can be used for on-line detection of industrial products to improve production efficiency and product quality. By real-time monitoring the products on the production line, unqualified products can be found and removed in time, reducing waste, and at the same time ensuring the reliability and consistency of the final products, contributing to the realization of efficient, fast and accurate three-dimensional defect detection, and contributing to the quality detection of industrial assembly line products. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is the training flow chart of the diffusion model of the present invention;
[0026] Figure 2 is the basic architecture diagram of the diffusion model of the present invention;
[0027] Figure 3 is the test flow chart of the diffusion model of the present invention;
[0028] Figure 4 is the three-dimensional defect simulation flow chart of the present invention;
[0029] Figure 5 is the three-dimensional defect detection and segmentation result diagram of the present invention;
[0030] Figure 6It is a 3D defect simulation result diagram on the Real3D-AD, a real 3D point cloud defect detection dataset of the present invention;
[0031] Figure 7 It is a 3D defect simulation result diagram on the Anomaly-ShapeNet, a simulated 3D point cloud defect dataset of the present invention. Detailed implementation manners
[0032] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0033] To more clearly illustrate the present invention, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. Those skilled in the art should understand that the content specifically described below is illustrative rather than restrictive and should not limit the protection scope of the present invention.
[0034] The method for detecting 3D point cloud defects on the machined surface based on the diffusion model of the present invention is specifically as follows:
[0035] First, obtain the 3D point clouds of the machined surfaces of several defect-free industrial products and perform data augmentation and point cloud preprocessing in sequence. For the 3D point cloud of the machined surface of each defect-free industrial product, perform data augmentation on the 3D point cloud in sequence by global random rotation and local random deformation. When performing global random rotation, multiply the randomly generated 3×3 rotation matrix by the point cloud matrix of the 3D point cloud to obtain the rotated 3D point cloud. By this random rotation method, part of the point cloud scanned from different angles is simulated to enhance the robustness of the model to the input point cloud at any angle; then perform local random deformation. Randomly select some points in the rotated 3D point cloud for displacement to simulate various defect patterns of the 3D point cloud, including protrusions, depressions, damages, etc., to enhance the ability of the model to still reconstruct the corresponding defect-free sample when dealing with real 3D defects. Finally, obtain the 3D point cloud after data augmentation; perform point cloud preprocessing on the 3D point cloud after data augmentation. First, perform normalization processing and then translate and scale the 3D point cloud after data augmentation, and then randomly downsample to the preset number of point clouds. Finally, obtain the processed defective 3D point cloud and construct it into a training set.
[0036] When the present invention is specifically implemented, global random rotation and local random deformation are used for data augmentation of 3D defects. The input 3D point cloud is transformed by the randomly generated rotation matrix, and the defect samples of the 3D point cloud that conform to real defects are simulated by randomly selecting some points closest to the reference point for displacement. The global random rotation is specifically as follows:
[0037] Given that a small number of normal samples are not conducive to the model learning diversity and essential features, resulting in the trained model being sensitive to the angle of the input point cloud. The present invention proposes to simulate rotation from anomaly-free shapes to enhance the robustness of the model to the angle of the input point cloud. As Figure 4 shown, the input normal point cloud is first randomly rotated. The design purpose of the random spatial rotation is to improve the generalization ability of the model to spatial transformations of test samples, which may be very different. The global random rotation enhancement is defined as follows:
[0038]
[0039] where, are the normal sample and the sample after rotation enhancement respectively, The rotation matrix obtained by randomly selecting rotation angles for all three axes, and the form of the rotation matrix can be shown as follows:
[0040] [[-0.04696788 0.05267304 -0.99750668]
[0041] [-0.82655194 -0.56278526 0.00920072]
[0042] [-0.56089742 0.82492321 0.06996984]]
[0043] The local random deformation is specifically as follows:
[0044] In addition to enhancing the robustness of the model to the overall shape of the point cloud through random rotation, the present invention further performs fine-grained local random deformation to prompt the reconstruction model to learn the irregularity of local features. Among them, the anomaly-free point cloud and its diverse anomaly patterns are integrated into the training pairs to learn the distinguishing features between normal and abnormal surfaces. The intuition is that the simulated negative sample diversity forces the network to learn how to reconstruct anomaly-free shapes instead of memorizing their complete appearance. As Figure 4 shown, the present invention randomly selects a perspective from the cube surface and determines the patch of the nearest N points from according to this perspective The local random deformation is defined as follows:
[0045]
[0046] where, normalize represents the normalization operation on the vector, and S is a predefined hyperparameter used to control the scaling of the patch points. By sampling from a random Gaussian distribution Ascending or descending sorting can be performed to control the protrusion or depression of local defects. Direct sampling and direct superposition of random Gaussian distributions can obtain simulations of local damage. The final simulated defective point cloud is obtained only by updating the patch area while the remaining points still maintain the sampling from the original point cloud.
[0047] Then, an improved diffusion model based on displacement iterative reconstruction is established. The model includes a PointNet encoder for point clouds and an improved diffusion decoder. During the training process, a noise addition function is also included in the improved diffusion model. After the defective three-dimensional point cloud is feature-extracted through the PointNet encoder for point clouds, the shape encoding feature of the defective three-dimensional point cloud is obtained as the latent shape embedding encoding c. At the same time, the defective three-dimensional point cloud is passed through the noise addition function to generate a set of masked point clouds at time T with the property of a Markov chain The shape encoding feature of the defective three-dimensional point cloud is input into the improved diffusion decoder for processing and then outputs the displacement vector △ at time T - 1 (T-1) , and the masked point cloud at time T and the displacement vector △ at time T - 1 (T-1) are added together to obtain the reconstructed point cloud at time T - 1 The displacement vector △ at time T - 1 (T-1) and the latent shape embedding encoding c are input into the improved diffusion decoder for processing and then output the displacement vector △ at time T - 2 (T-2) , repeating the iterative process. Each time during the iteration, the displacement vector at the current time output by the improved diffusion decoder and the reconstructed point cloud at the next time are added together to obtain the reconstructed point cloud at the previous time, and the displacement vector at the current time and the latent shape embedding encoding c are input into the improved diffusion decoder for processing and then output the displacement vector at the previous time until the displacement vector △ at time 0 is output (0) , and the displacement vector △ at time 0 (0) and the reconstructed point cloud at time 1 are added together to output the reconstructed point cloud at time 0 as the reconstructed point cloud finally output by the improved diffusion model. The reconstructed point clouds finally output for each in the training set and the initially input defective three-dimensional point cloud are jointly processed by the loss function of the improved diffusion decoder, and the network weights of the improved diffusion decoder are updated through the optimizer until the loss function converges to obtain the trained improved diffusion decoder, that is, the trained reconstruction model.
[0048] The present invention uses an improved diffusion model to reconstruct the input 3D point cloud. Through the diffusion model, starting from completely random Gaussian noise, with the features extracted from the input point cloud by the PointNet encoder as the condition, the defect-free point cloud corresponding to the input point cloud is gradually reconstructed from the noise in a Markov chain manner. Specifically in implementation, an improved denoising diffusion probability model is used for point cloud reconstruction. The denoising diffusion probability model includes a diffusion process and a reverse process. The forward Markov process gradually adds Gaussian noise to the clean samples from the data distribution and transforms them into Gaussian noise; the reverse process is also a Markov process, which denoises through a series of steps to generate meaningful data from the target distribution. The reverse process denoises the noise from the fully masked distribution.
[0049] The present invention formulates the point cloud reconstruction task of the anomaly-free model as a conditional generation problem, which decodes the explicit displacement in the target distribution where c is the decoding condition, that is, the latent shape embedding encoding. The core problem of 3D point cloud anomaly detection is how to conditionally reconstruct the anomaly-free shape with reference to the input point cloud with different spatial transformations. During the self-supervised reconstruction process, effective global features are extracted from the input as the auxiliary condition embedding encoding for the denoising function ∈ θ The present invention uses the latent shape embedding encoding c as the conditional input in the reverse diffusion process to guide the reconstruction.
[0050] The present invention uses a feature encoder to encode the point cloud into a latent shape embedding encoding c containing high-level features for the conditional generation process. The feature encoder is mainly composed of a cascaded multi-layer perceptron based on the PointNet structure. It performs a max-pooling operation after mapping the point cloud to different dimensions, and then compresses them to extract the global shape embedding. To gradually generate point embeddings, a series of global features are extracted from the input point cloud through a 4-level cascaded convolutional-based multi-layer perceptron where j is the layer index, representing the features extracted in the j-th layer; m is the total number of layers, representing the total number of levels of the convolutional-based multi-layer perceptron; k is the number of feature channels, N is the number of points in the point cloud, representing the scale of the input point cloud. Subsequently, these features are fed into a 3-layer linear-based multi-layer perceptron after the max-pooling operation to learn the latent feature vector d is the dimension of the latent feature vector, representing the size of the encoded feature representation. The output latent shape embedding encoding c = F l represents the global structure and pose information and serves as the conditional input for the decoder.
[0051] Such as Figure 1As shown, in order to achieve point cloud reconstruction with transformation consistency while maintaining the structure of the non-anomaly region, the method of the present invention injects the latent shape embedding c into the decoder at each step of the reverse diffusion process. In principle, during the training phase, the denoising function ∈ θ models the conditional probability distribution by learning the Gaussian noise added during the forward diffusion process through the decoder. The present invention uses the Gaussian noise in the forward process to completely obscure the point cloud object to solve the mapping degradation problem of traditional autoencoders. The obscured points and the latent shape embedding encoding are used as the input to the decoder. At each step of the iterative process, a point-level displacement vector Δ (t) is generated to separate the predicted noise and the desired anomaly-free shape. The displacement vector can be expressed as:
[0052]
[0053] where, △ (t+i) and △ (t+i+1) are the displacement vectors at times t + i and t + i + 1 respectively; α t+i+1 and are the noise variance and its cumulative variance at time t + i + 1 respectively, α s is the noise variance at time s, β t+i+1 is the noise variance schedule at time t + i + 1, β t+i+1 = 1 - α t+i+1 ; ∈ θ is the denoising function used to estimate the noise; σ is the noise standard deviation, which is an adjustable parameter; ∈ is the standard Gaussian noise, ∈ ~ N(0, I).
[0054] The network uses Δ (t-1) to decode the denoising function ∈ θ from the previous step and the latent shape embedding encoding c. Using the variance schedule β t to generate the triangular positional embedding e p = (β t , sin(β t ), cos(β t )). The triangular positional embedding e p is concatenated with the latent shape embedding encoding c and input into the linear module of the network with a residual function. The output reconstructed point cloud at step t is:
[0055]
[0056] During the model training process, when performing the object reconstruction task containing N points, the network learns a A diffusion model of the mapping relationship. By iteratively denoising and under the semantic conditions of point embeddings, the prediction of point displacements is achieved. Specifically, the network is trained to learn the noise that needs to be eliminated to restore the anomaly-free shape, and this process is based on the L2 distance between the ground truth and the denoised reconstructed points.
[0057] To evaluate the original point cloud and the point cloud after reconstruction for the element-wise distance between them, the present invention uses the mean squared error loss as the main reconstruction loss, as follows:
[0058]
[0059] where, represents a point from the original anomalous point cloud, while represents a point from the reconstructed point cloud, the reconstructed point corresponding to that point; the superscript (0) of the original point cloud represents the point cloud in the initial state, that is, the state where no noise has been added or denoising has just started during the diffusion process. N is the number of points, and ∑ is the sum over all N points, ||·|| 2 represents the square of the Euclidean distance between two points. This loss function calculates the average squared distance between all point pairs of the original point cloud and the reconstructed point cloud, aiming to minimize the difference between the two, thereby improving the reconstruction quality.
[0060] During the training process, by minimizing the loss function, the network can learn how to gradually remove the Gaussian noise added during the forward diffusion process, and finally generate a point cloud close to the original anomaly-free shape. This method helps to maintain the structural features of the point cloud while correcting anomalies, ensuring that the reconstruction result reflects the true form of the input object as accurately as possible.
[0061] The method of the present invention can minimize the difference between the reconstructed model and the input point cloud after each step of denoising. The defective three-dimensional point cloud completely masks the point cloud object with Gaussian noise in the forward process through a noise addition function to solve the mapping degradation problem of traditional autoencoders. The present invention uses an improved diffusion model to reconstruct the input three-dimensional point cloud. From completely random Gaussian noise, the diffusion decoder generates point-level displacement vectors step by step in a Markov chain manner, conditioned on the features extracted from the input point cloud by the PointNet encoder. Using the generated point cloud group as the target reference and the mean squared loss function as the loss function, it iteratively reconstructs a defect-free point cloud corresponding to the input point cloud. By updating the weights of the neural network with the Adam optimizer in a way that minimizes the loss function, the diffusion model obtains the ability to gradually denoise from random noise and finally restore the original point cloud.
[0062] During specific implementation, the three-dimensional point cloud of the processed surface of the industrial product to be detected is obtained and preprocessed, and then input into the reconstruction model for processing. After the processing is completed, the reconstructed point cloud is obtained. Finally, the three-dimensional point cloud to be detected and its reconstructed point cloud are detected and segmented through a detection function. The detection function includes a clustering algorithm and a distance function. First, the K-nearest neighbor clustering is performed on the three-dimensional point cloud to be detected and its reconstructed point cloud respectively to obtain two groups of clustered point clouds. The clustered point clouds of the three-dimensional point cloud to be detected and its reconstructed point cloud respectively contain several initial point cloud clusters and reconstructed point cloud clusters. Then, the two groups of clustered point clouds are measured through the distance function. For each initial point cloud cluster, the Euclidean distance between the initial point cloud cluster and each reconstructed point cloud cluster is obtained, and the shortest Euclidean distance among them is selected as the segmentation result of the current initial point cloud cluster. For the segmentation result of each initial point cloud cluster, if the segmentation result is not greater than the distance threshold, there is no defect at the position where the current initial point cloud cluster is located, otherwise there is a defect. At the same time, the size of the defect can also be determined according to the segmentation result, so as to obtain the defect location result of the processed surface of the industrial product to be detected; at the same time, the longest Euclidean distance in the segmentation result of the initial point cloud cluster is obtained as the classification result. If the classification result is not greater than the distance threshold, the current three-dimensional point cloud to be detected has no defect, otherwise there is a defect, so as to obtain the defect classification result of the processed surface of the industrial product to be detected, and complete the defect detection of the processed surface of the industrial product.
[0063] In the training stage of the present invention, after the input three-dimensional point cloud is preprocessed, data augmentation is performed through a simulation strategy for three-dimensional defects. Taking the augmented point cloud as the condition and the preprocessed input point cloud as the target, the diffusion model is trained to reconstruct the ability to reconstruct the corresponding three-dimensional point cloud from completely random noise. In the testing stage, the input point cloud is preprocessed and used as the condition, and the trained reconstruction model reconstructs the defect-free point cloud corresponding to the input sample from completely random noise. Through the comparison method based on the clustering algorithm and the Euclidean distance, the final defect detection classification and segmentation results are obtained. The present invention is oriented to three-dimensional form expression, reconstructs the defect-free features corresponding to the input sample through a diffusion model, detects and segments by comparing the original features and the reconstruction through a clustering algorithm and a distance function, and performs data augmentation through a new simulation strategy for three-dimensional point cloud defects.
[0064] As Figure 2 shown, in the inference stage of the method of the present invention, the defective point cloud X input into the reconstruction model is compared with the reconstructed point cloud after passing through the diffusion model through the detection function Obtain a defect map M containing information such as the location and confidence of specific defects. The diffusion model includes two main components, an encoder and a decoder. The diffusion model network is trained end-to-end on a given 3D point cloud data category using the backpropagation algorithm to finally obtain a reconstruction model. The clustering algorithm and distance function of the detection function are used to detect and segment the original point cloud and the reconstructed point cloud. By performing K-nearest neighbor clustering on the input point cloud and the reconstructed point cloud respectively, and measuring the clustered point clouds using the distance function, the defect detection classification result and segmentation result of the point cloud are obtained according to the measurement results. The specific steps are as follows:
[0065] First, perform point cloud preprocessing and clustering. Standardize the input point cloud data to eliminate the influence of different scales. For the point cloud P = {p1, p2, …, p N}, where each point is represented as (x i , y i , z i ). The present invention applies a normalization transformation to all points. The original point cloud P and the reconstructed point cloud after standardization respectively obtain the coordinate sets of the K nearest neighbors through the K-nearest neighbor clustering algorithm, which are respectively represented as For each sample p i , find k other samples p j with the closest distances, and return the tensor composed of these neighbors.
[0066] Then, perform point cloud defect detection and segmentation. As Figure 3 shown, the present invention calculates the similarity between P knn and through the distance function in the detection function. Use the Euclidean distance to measure the distance between two points. By calculating the distance between the clustered , obtain the relative distance matrix between the two point clouds. Take the maximum value as the classification score for anomaly detection, and take all values greater than a certain threshold as the segmentation score for anomaly detection.
[0067] In the specific implementation of the present invention, the 3D point cloud of the processing surface of industrial products is used to implement the training and testing of the model. Among them, the real 3D point cloud defect detection dataset Real3D-AD contains 12 categories, and the training set and test set of each category include 4 samples and 100 samples respectively. The simulated 3D point cloud defect dataset Anomaly-ShapeNet contains 40 categories, and each category contains 4 training samples and about 400 test samples.
[0068] The present invention is implemented using PyTorch and undergoes end-to-end training in the network. The Adam optimizer is adopted in the optimization process, with an initial learning rate of 0.001. The training process includes a total of 40,000 iterations, and the total batch size is 128 to ensure comprehensive learning effects. All input point cloud data undergoes preprocessing steps: on the real 3D point cloud defect detection dataset Real3D-AD, it is randomly downsampled to 4,096 points; while on the simulated 3D point cloud defect dataset Anomaly-ShapeNet, it is downsampled to 2,048 points. In addition, the present invention normalizes these point clouds by setting the centroid of the point cloud as the coordinate origin and scaling its size to the range from -1 to 1, so as to optimize the diffusion process.
[0069] As Figure 5 shown, the qualitative results of the real 3D point cloud defect detection dataset Real3D-AD are presented, where different shades of color represent different levels of anomaly scores, that is, confidence levels. Figure 5 On the left in [Figure] is a sample from the real 3D point cloud defect detection dataset Real3D-AD, while on the right is a sample from the simulated 3D point cloud defect dataset Anomaly-ShapeNet. By comparing the defect predictions and ground truths of the input point cloud and the reconstructed point cloud, it can be seen that the present invention accurately reconstructs the defective parts in the point cloud in various samples: for example, the deep depression in the hippocampus sample, the concave inside in the bag sample, and the protrusion in the jar sample. By utilizing the accurately reconstructed point cloud, the present invention also generates the final point cloud segmentation map, further demonstrating the effectiveness of the method of the present invention.
[0070] As Figure 6 and Figure 7 shown, the abnormal samples existing in the test set, the normal samples in the training set, and the abnormal samples obtained by the 3D defect simulation strategy are presented. It can be seen that the present invention can comprehensively simulate the defects existing in different categories, which proves that the method of the present invention can well bridge the domain gap caused by only using positive samples for training in 3D anomaly detection. By generating the simulated abnormal samples, the model can encounter more diverse abnormal situations during the training stage, thereby enhancing its generalization ability and the detection accuracy of actual anomalies. This enhanced data diversity helps improve the robustness and adaptability of the model, making it perform better when facing anomalies in the real world.
[0071] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages. The present application is described according to the flowcharts of the method, system, and computer program product of the embodiments of the present application.
[0072] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the present invention is intended to be construed as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0073] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the equivalent technology of the present invention, the present application is also intended to include these changes and modifications.
Claims
1. A three-dimensional point cloud defect detection method for machined surfaces based on a diffusion model, characterized in that, Including: 1) Obtain the three-dimensional point cloud of the processed surface of several defect-free industrial products, and perform data augmentation and point cloud preprocessing in sequence, so as to obtain the defect three-dimensional point cloud and construct it into a training set; 2) Establish an improved diffusion model based on displacement iterative reconstruction, input the training set into the improved diffusion model for training until the loss function of the improved diffusion model converges, and obtain the trained reconstruction model; 3) Obtain the three-dimensional point cloud of the processed surface of the industrial product to be detected and perform the same point cloud preprocessing as in step 1), then input it into the reconstruction model for processing, and obtain the reconstructed point cloud after processing; 4) Detect and segment the three-dimensional point cloud to be detected and its reconstructed point cloud through a detection function, obtain the defect detection classification and localization results, and complete the defect detection of the processed surface of the industrial product.
2. The three-dimensional point cloud defect detection method for the machined surface based on the diffusion model according to claim 1, wherein: In the said step 1), for the three-dimensional point cloud of the processed surface of each defect-free industrial product, perform data augmentation of global random rotation and local random deformation on the three-dimensional point cloud in sequence. When performing global random rotation, multiply the randomly generated rotation matrix by the point cloud matrix of the three-dimensional point cloud to obtain the rotated three-dimensional point cloud; then perform local random deformation, randomly select some points in the rotated three-dimensional point cloud for displacement, and finally obtain the three-dimensional point cloud after data augmentation.
3. The three-dimensional point cloud defect detection method for machined surfaces based on diffusion models according to claim 1, characterized in that: In the said step 1), perform point cloud preprocessing on the three-dimensional point cloud after data augmentation. First, perform normalization processing, then translate and scale the three-dimensional point cloud after data augmentation, and then randomly downsample to the preset number of point clouds. Finally, obtain the processed defect three-dimensional point cloud and construct it into a training set.
4. The three-dimensional point cloud defect detection method for a machined surface based on a diffusion model according to claim 1, characterized in that: In step 2), the improved diffusion model based on displacement iterative reconstruction includes a PointNet encoder for point clouds and an improved diffusion decoder. During the training process, a noise addition function is also included in the improved diffusion model. After the defective three-dimensional point cloud is subjected to feature extraction through the PointNet encoder for point clouds, the shape encoding feature of the defective three-dimensional point cloud is obtained as the latent shape embedding encoding c. At the same time, the defective three-dimensional point cloud is passed through the noise addition function to generate a set of occluded point clouds at time T with the property of a Markov chain. The shape encoding feature of the defective three-dimensional point cloud is input into the improved diffusion decoder for processing and then outputs the displacement vector △ at time T-1. (T-1) , the occluded point cloud at time T and the displacement vector △ at time T-1 (T-1) are added together to obtain the reconstructed point cloud at time T-1. The displacement vector △ at time T-1 (T-1) and the latent shape embedding encoding c are input into the improved diffusion decoder for processing and then output the displacement vector △ at time T-2. (t-2) , repeating the iterative process. At each iteration, the displacement vector at the current time output by the improved diffusion decoder and the reconstructed point cloud at the next time are added together to obtain the reconstructed point cloud at the previous time, and the displacement vector at the current time and the latent shape embedding encoding t are input into the improved diffusion decoder for processing and then output the displacement vector at the previous time, until the displacement vector △ at time 0 is output. (0) , the displacement vector △ at time 0 (0) and the reconstructed point cloud at time 1 are added together to output the reconstructed point cloud at time 0. As the reconstructed point cloud finally output by the improved diffusion model, the reconstructed point clouds finally output for each obtained from the training set and the initially input defective three-dimensional point cloud are jointly processed by the loss function of the improved diffusion decoder, and the network weights of the improved diffusion decoder are updated through an optimizer until the loss function converges to obtain the trained improved diffusion decoder, that is, the trained reconstruction model is obtained.
5. The method for three-dimensional point cloud defect detection of a machined surface based on a diffusion model according to claim 4, wherein: The specific displacement vector is as follows: where, △ (t) and △ (t-1) are displacement vectors at time t and t - 1 respectively; α t and are the noise variance and its cumulative variance at time t respectively, β t is the noise variance schedule at time t, β t = 1 - α t ; ∈ θ is the denoising function; σ is the noise standard deviation; ∈ is the standard Gaussian noise.
6. The three-dimensional point cloud defect detection method for a machined surface based on a diffusion model according to claim 1, characterized in that: In the said step 4), the detection function includes a clustering algorithm and a distance function. First, perform K-nearest neighbor clustering on the three-dimensional point cloud to be detected and its reconstructed point cloud respectively to obtain two sets of clustered point clouds. The clustered point clouds of the three-dimensional point cloud to be detected and its reconstructed point cloud respectively contain several initial point cloud clusters and reconstructed point cloud clusters. Then, measure the two sets of clustered point clouds through the distance function. For each initial point cloud cluster, obtain the Euclidean distance between the initial point cloud cluster and each reconstructed point cloud cluster, and select the shortest Euclidean distance among them as the segmentation result of the current initial point cloud cluster. For the segmentation result of each initial point cloud cluster, if the segmentation result is not greater than the distance threshold, there is no defect at the position where the current initial point cloud cluster is located, otherwise there is a defect, so as to obtain the defect localization result of the processed surface of the industrial product to be detected; at the same time, obtain the longest Euclidean distance in the segmentation result of the initial point cloud cluster as the classification result. If the classification result is not greater than the distance threshold, the three-dimensional point cloud to be detected currently has no defect, otherwise there is a defect, so as to obtain the defect classification result of the processed surface of the industrial product to be detected.
7. An electronic device, characterized in that, Including: A memory and a processor coupled to each other, wherein the memory stores program data, and the processor calls the program data to execute the method according to any one of claims 1-6.
8. A computer-readable storage medium having program data stored thereon, characterized in that, When the program data is executed by the processor, the method according to any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Three-dimensional point cloud reconstruction method based on self-training conditional diffusion model
CN118691742A
Cited By
Three-dimensional defect segmentation method and system and storage medium
CN122090071A
A method for marine plate surface defect detection
CN122510277A
A method for marine plate surface defect detection
CN122510277B