Diffusion-model-based three-dimensional point cloud defect detection method for machined surface
Patent Information
- Application Number
- PCT/CN2025/108609
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-03-17
- Filing Date
- 2025-07-15
- Publication Date
- 2026-09-24
Smart Images

Figure CN2025108609_24092026_PF_FP_ABST
Abstract
Description
A method for detecting 3D point cloud defects on machined surfaces based on a diffusion model Technical Field
[0001] This invention relates to a method for detecting defects on machined surfaces, and specifically to a method for detecting three-dimensional point cloud defects on machined surfaces based on a diffusion model. Background Technology
[0002] The goal of defect detection is to identify data instances containing defects and precisely locate their specific positions. This task has wide applications in multiple fields and plays a crucial role in quality control during industrial production. 3D point clouds possess inherent pattern advantages, avoiding blind spots that occur in 2D image-based defect detection, leading to false positives or false negatives. Consequently, 3D point cloud-based defect detection technology has developed and is playing an increasingly important role in advanced manufacturing and precision machining.
[0003] However, the discreteness and disorder of 3D point cloud data make feature extraction more difficult than from 2D images. Furthermore, due to the relatively small number of defect cases, using only normal instances as the sole training source leads to domain offset issues in the trained defect detector, preventing it from correctly handling anomalous instances. These problems highlight the necessity and urgency of developing an efficient 3D point cloud defect detection framework. Similar to traditional 2D image defect detection, current 3D point cloud defect detection methods can be broadly categorized into embedding-based and reconstruction-based methods. Embedding-based methods involve extracting features using a pre-trained encoder and mapping them to a normal distribution for learning. If the distribution falls outside a predetermined interval, it is considered a defect. Most existing 3D defect detection methods rely on a memory mechanism, storing representative features during the training phase to implicitly construct a feature distribution. During the testing phase, the presence of a defect is determined by calculating the Euclidean distance between the input test object and all template point clouds stored in the memory. Reconstruction-based methods, on the other hand, train a network capable of accurately reconstructing normal point clouds. Since defective point cloud instances are not included in the training process, models trained using only normal point cloud instances cannot correctly reconstruct defective point cloud instances encountered during the testing phase.
[0004] Existing methods face two key problems: high resource costs and irreparable reconstruction. First, memory-based methods store all features from the training phase, meaning each test point cloud needs to be compared with all samples in the memory, significantly increasing memory overhead and inference time costs. This inefficiency makes such methods virtually unusable in real-world industrial production lines. Second, masked autoencoder mechanisms only reconstruct the masked portion of the input, preserving potential defects in the unmasked parts. This contradicts the fundamental assumption of comparing the original defective point cloud with the reconstructed, error-free version. These methods inevitably lead to erroneous reconstructions, thus diminishing their effectiveness in accurately locating defects. In summary, existing techniques struggle to achieve fast and accurate 3D point cloud defect detection. Summary of the Invention
[0005] To address the problems existing in the background art, the present invention provides a method for detecting three-dimensional point cloud defects on processed surfaces based on a diffusion model.
[0006] The technical solution adopted in this invention is:
[0007] The present invention provides a method for detecting three-dimensional point cloud defects on machined surfaces based on a diffusion model, comprising:
[0008] 1) Obtain the 3D point cloud of the processed surface of several defect-free industrial products and perform data augmentation and point cloud preprocessing in sequence to obtain the defective 3D point cloud and construct it as 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 the reconstructed model after training.
[0010] 3) Obtain the 3D point cloud of the processed surface of the industrial product to be inspected and perform the same point cloud preprocessing as in step 1). Then input it into the reconstruction model for processing. After processing, the reconstructed point cloud is obtained.
[0011] 4) By detecting and segmenting the three-dimensional point cloud to be detected and its reconstructed point cloud through detection functions, the defect detection classification and localization results are obtained, and the defect detection of the processed surface of industrial products is completed.
[0012] This invention focuses on three-dimensional representation. It reconstructs the defect-free features corresponding to the input sample based on a diffusion model, performs detection and segmentation by comparing the original features with the reconstructed features using a clustering algorithm and a distance function, and performs data augmentation through a novel three-dimensional point cloud defect simulation strategy.
[0013] In step 1), for the 3D point cloud of the processed surface of each defect-free industrial product, data augmentation is performed on the 3D point cloud through global random rotation and local random deformation. During global random rotation, a randomly generated 3×3 rotation matrix is multiplied by the point cloud matrix of the 3D point cloud to obtain the rotated 3D point cloud. This random rotation method simulates partial point clouds obtained from scanning from different angles to enhance the robustness of the model to point clouds input from arbitrary angles. Then, local random deformation is performed, and some points are randomly selected in the rotated 3D point cloud for displacement to simulate defect patterns in the 3D point cloud, including various forms such as protrusions, depressions, and damage. This enhances the model's ability to reconstruct corresponding defect-free samples when dealing with real 3D defects, and finally, the data-augmented 3D point cloud is obtained.
[0014] In step 1), the augmented 3D point cloud is preprocessed. First, it is normalized, then the augmented 3D point cloud is translated and scaled. Then, it is randomly downsampled to a preset number of point clouds, and finally the processed defect 3D point cloud is obtained and constructed as a training set.
[0015] In step 2), the improved diffusion model based on displacement iterative reconstruction includes a PointNet encoder and an improved diffusion decoder. During training, the improved diffusion model also includes a noise-adding function. The shape encoding features of the defective 3D point cloud are obtained by feature extraction through the PointNet encoder and used as the latent shape embedding encoding. Simultaneously, the defective 3D point cloud is used to generate a set of occlusion point clouds at time T with Markov chain properties through a noise-adding function. The shape encoding features of the defect 3D point cloud are input into the improved diffusion decoder for processing, and the displacement vector at time T-1 is output. The occlusion point cloud at time T and the displacement vector at time T-1 The summation yields the reconstructed point cloud at time T-1. The displacement vector at time T-1 and latent shape embedding encoding The input is processed by the improved diffusion decoder and outputs the displacement vector at time T-2. The process is repeated iteratively. In each iteration, the displacement vector at the current time step output by the improved diffusion decoder is added to the reconstructed point cloud at the next time step to obtain the reconstructed point cloud at the previous time step. The displacement vector at the current time step and the latent shape are then embedded and encoded. The input is processed by the improved diffusion decoder and outputs the displacement vector of the previous time step, until the displacement vector of time step 0 is output. The displacement vector at time 0 The reconstructed point cloud at time 0 is output by adding it to the reconstructed point cloud at time 1. As the final output of the improved diffusion model, the reconstructed point cloud is processed together with the defective 3D point cloud obtained from the training set and the final output of the improved diffusion decoder. The network weights of the improved diffusion decoder are updated by the optimizer until the loss function converges to obtain the trained improved diffusion decoder, that is, the trained reconstruction model.
[0016] The displacement vector is as follows:
[0017]
[0018] in, and These are the displacement vectors at time t and time t-1, respectively. and Let be the noise variance and its cumulative variance at time t, respectively. α s Let be the noise variance at time s. The noise variance is scheduled at time t. ; This is a denoising function; The standard deviation of noise; It is standard Gaussian noise.
[0019] In step 4), the detection function includes a clustering algorithm and a distance function. First, K-nearest neighbor clustering is performed on the 3D point cloud to be detected and its reconstructed point cloud to obtain two sets of clustered point clouds. The clustered point clouds of the 3D point cloud to be detected and its reconstructed point cloud contain several initial point cloud clusters and reconstructed point cloud clusters, respectively. Then, the two sets 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. The shortest Euclidean distance 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, the location of the current initial point cloud cluster is free of defects; otherwise, there are defects. At the same time, the size of the defects can be determined based on the segmentation result, thereby obtaining the defect location result of the processed surface of the industrial product to be detected. Simultaneously, 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 3D point cloud to be detected is free of defects; otherwise, there are defects, thereby obtaining 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 coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described above.
[0021] The present invention provides a computer-readable storage medium having program data stored thereon, which, when executed by a processor, implements the method described above.
[0022] This invention utilizes a data distribution transformation based on a diffusion process, taking the geometric features of the input anomalous 3D point cloud as a condition. The model learns a strict point-by-point displacement behavior from the random Gaussian noise 3D point cloud. By progressively correcting the anomalous 3D point cloud, the normal 3D point cloud corresponding to the defect sample is finally obtained. The reconstructed defect-free samples and their corresponding original defect samples are clustered separately. A distance function is used to compare the clustered 3D reconstructed point cloud with the 3D input point cloud. Outliers with large distance differences are considered anomalous points, thus obtaining the classification and segmentation results for defect detection. Furthermore, the method introduces a novel 3D point cloud defect simulation strategy to generate realistic and diverse defect shapes, thereby reducing the domain gap and distribution differences between the training and test sets.
[0023] The beneficial effects of this invention are:
[0024] This invention is applicable to defect detection based on 3D representation, primarily focusing on 3D point cloud defect detection for the processed surfaces of industrial products. It helps address issues such as missing defect detection data, large differences in training and testing domain distribution, and the low accuracy, high resource consumption, and long inference time of existing methods. It helps solve the problems of slow inference speed and high memory consumption in existing 3D defect detection methods, achieving fast and accurate 3D point cloud defect detection. This method can be used for online inspection of industrial products to improve production efficiency and product quality. By monitoring products on the production line in real time, defective products can be promptly identified and removed, reducing waste while ensuring the reliability and consistency of the final product. This contributes to efficient, fast, and accurate 3D defect detection and aids in the quality inspection of industrial assembly line products. Attached Figure Description
[0025] Figure 1 is a flowchart of the training process of the diffusion model of the present invention;
[0026] Figure 2 is a basic architecture diagram of the diffusion model of the present invention;
[0027] Figure 3 is a flowchart of the test process for the diffusion model of the present invention;
[0028] Figure 4 is a flowchart of the three-dimensional defect simulation of the present invention;
[0029] Figure 5 is a diagram showing the three-dimensional defect detection and segmentation results of the present invention;
[0030] Figure 6 is a diagram of the three-dimensional defect simulation results on the Real3D-AD dataset of the present invention;
[0031] Figure 7 shows the simulation results of three-dimensional defects on the Anomaly-ShapeNet dataset of the present invention. Detailed Implementation
[0032] To more clearly illustrate the present invention, it will be further described below with reference to the accompanying drawings and embodiments. Those skilled in the art should understand that the specific description below is illustrative rather than restrictive and should not limit the scope of protection of the present invention.
[0033] The method for detecting three-dimensional point cloud defects on processed surfaces based on a diffusion model, as described in this invention, is as follows:
[0034] First, 3D point clouds of the processed surfaces of several defect-free industrial products are acquired and then subjected to data augmentation and point cloud preprocessing. For each 3D point cloud of the processed surface of a defect-free industrial product, data augmentation is performed on the 3D point cloud through global random rotation and local random deformation. During global random rotation, a randomly generated 3×3 rotation matrix is multiplied by the point cloud matrix of the 3D point cloud to obtain the rotated 3D point cloud. This random rotation method simulates partial point clouds obtained from scanning from different angles to enhance the robustness of the model to point clouds input from arbitrary angles. Then... Local random deformation is performed by randomly selecting some points in the rotated 3D point cloud for displacement, simulating various defect styles of the 3D point cloud, including convexity, depression, and damage, to enhance the model's ability to reconstruct corresponding defect-free samples when dealing with real 3D defects, ultimately obtaining a data-enhanced 3D point cloud. The data-enhanced 3D point cloud is then preprocessed. First, it is normalized, then translated and scaled, and then randomly downsampled to a preset number of point clouds, finally obtaining a processed defective 3D point cloud and constructing it as a training set.
[0035] In its specific implementation, this invention utilizes global random rotation and local random deformation for three-dimensional defect data augmentation. A randomly generated rotation matrix transforms the input three-dimensional point cloud, and the nearest points to a reference point are randomly selected for displacement to simulate a defect sample in the three-dimensional point cloud that conforms to a real defect. The global random rotation is as follows:
[0036] Given that a small number of normal samples hinders the model's ability to learn diversity and essential features, the trained model becomes sensitive to the angle of the input point cloud. This invention proposes a method to simulate rotation from a non-abnormal shape to enhance the model's robustness to the angle of the input point cloud. As shown in Figure 4, the input normal point cloud is first randomly rotated. The purpose of this random spatial rotation is to improve the model's generalization ability to spatial transformations of the test samples, which may be very different. The global random rotation enhancement is defined as follows:
[0037]
[0038] in, and These are normal samples and samples after rotation enhancement. The rotation matrix obtained by randomly selecting rotation angles through all three axes can be in the following form:
[0039]
[0040] The specific details of the local random deformation are as follows:
[0041] In addition to improving the model's robustness to the overall shape of the point cloud through random rotation, this invention further performs fine-grained local random deformation, prompting the reconstruction model to learn the irregularities of local features. Anomaly-free point clouds and their diverse anomaly patterns are integrated into the training pairs to learn distinguishing features between normal and anomalous surfaces. The intuition is that simulated negative sample diversity forces the network to learn how to reconstruct anomaly-free shapes, rather than memorizing their complete appearance. As shown in Figure 4, this invention randomly selects a viewpoint from the surface of a cube. And determine the source from this perspective The recent Patches at each point The local random deformation is defined as follows:
[0042]
[0043] in, This represents the normalization operation on a vector. It is a predefined hyperparameter used to control the scaling of patch points. It is calculated by sampling from a random Gaussian distribution. Arranging data in ascending or descending order allows for control over the protrusions or depressions of local defects. Direct sampling and superposition of random Gaussian distributions are also possible. This allows for the simulation of localized damage. The final simulated defect point cloud is shown. Only by updating patch areas The remaining points are obtained by sampling from the original point cloud.
[0044] Then, an improved diffusion model based on displacement iterative reconstruction is established. The model includes a PointNet encoder and an improved diffusion decoder. During training, the improved diffusion model also includes a noise-adding function. The shape encoding features of the defective 3D point cloud are obtained by feature extraction through the PointNet encoder and used as the latent shape embedding encoding. Simultaneously, the defective 3D point cloud is used to generate a set of occlusion point clouds at time T with Markov chain properties through a noise-adding function. The shape encoding features of the defect 3D point cloud are input into the improved diffusion decoder for processing, and the displacement vector at time T-1 is output. The occlusion point cloud at time T and the displacement vector at time T-1 The summation yields the reconstructed point cloud at time T-1. The displacement vector at time T-1 and latent shape embedding encoding The input is processed by the improved diffusion decoder and outputs the displacement vector at time T-2. The process is repeated iteratively. In each iteration, the displacement vector at the current time step output by the improved diffusion decoder is added to the reconstructed point cloud at the next time step to obtain the reconstructed point cloud at the previous time step. The displacement vector at the current time step and the latent shape are then embedded and encoded. The input is processed by the improved diffusion decoder and outputs the displacement vector of the previous time step, until the displacement vector of time step 0 is output. The displacement vector at time 0 The reconstructed point cloud at time 0 is output by adding it to the reconstructed point cloud at time 1. As the final output of the improved diffusion model, the reconstructed point cloud is processed together with the defective 3D point cloud obtained from the training set and the final output of the improved diffusion decoder. The network weights of the improved diffusion decoder are updated by the optimizer until the loss function converges to obtain the trained improved diffusion decoder, that is, the trained reconstruction model.
[0045] This invention utilizes an improved diffusion model to reconstruct an input 3D point cloud. The diffusion model uses features extracted from the input point cloud by a PointNet encoder from completely random Gaussian noise as conditions, and reconstructs the defect-free point cloud corresponding to the input point cloud step-by-step from the noise using a Markov chain approach. Specifically, an improved denoising diffusion probability model is used for point cloud reconstruction. This model includes a diffusion process and a reverse process. The forward Markov process progressively adds Gaussian noise to clean samples from the data distribution, transforming 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.
[0046] This invention formulates the point cloud reconstruction task without anomalies as a conditional generation problem, which decodes the target distribution. The explicit displacement in, where This refers to the decoding condition, namely latent shape embedding encoding. The core problem of 3D point cloud anomaly detection is how to conditionally reconstruct anomaly-free shapes when referenced to input point clouds with different spatial transformations. In the self-supervised reconstruction process, effective global features are extracted from the input as a denoising function. The invention employs auxiliary conditional embedding encoding. It embeds and encodes the latent shape during the back-diffusion process. Use conditional inputs to guide the reconstruction.
[0047] This invention employs a feature encoder to encode point clouds into latent shape embedding codes containing high-level features. The feature encoder, used in the conditional generation process, mainly consists of a cascaded multilayer perceptron based on the PointNet architecture. It processes point clouds... After mapping to different dimensions, max pooling is performed, and then they are compressed to extract global shape embeddings. To progressively generate point embeddings, a series of global features are extracted from the input point cloud through a 4-layer convolutional-based multilayer perceptron. ,in, It is a hierarchical index, representing the feature extracted at the j-th layer; This is the total number of layers, representing the total number of layers in a convolutional basic multilayer perceptron. Here, is the number of feature channels, and N is the number of points in the point cloud, representing the size of the input point cloud. These features are then subjected to max pooling and fed into a three-layer linear basic multilayer perceptron to learn the latent feature vectors. , This is the dimension of the latent feature vector, representing the size of the encoded feature representation. The output latent shape embedding encoding... It represents the global structure and attitude information and serves as the conditional input to the decoder.
[0048] As shown in Figure 1, in order to achieve point cloud reconstruction with transformation consistency while maintaining the structure of non-abnormal regions, the method of this invention embeds the latent shape at each step of the back-diffusion process. Inject the decoder. In principle, during the training phase, the denoising function... This invention models the conditional probability distribution by learning Gaussian noise added during the forward diffusion process using a decoder. It utilizes Gaussian noise during the forward process to completely occlude point cloud objects, thus solving the mapping degradation problem of traditional autoencoders. The occluded points... and latent shape embedding encoding This serves as input to the decoder. A point-level displacement vector is generated at each step of the iteration process. This separates the predicted noise from the expected anomaly-free shape. The displacement vector can be represented as:
[0049]
[0050] in, and These are the displacement vectors at time t+i and t+i+1, respectively. and Let be the noise variance and its cumulative variance at time t+i+1, respectively. α s Let be the noise variance at time s. For the noise variance scheduling at time t+i+1, ; This is a denoising function used to estimate noise; The noise standard deviation is an adjustable parameter. Standard Gaussian noise, .
[0051] Network usage Let's decode the denoising function from the previous step. and latent shape embedding encoding Using variance scheduling Generate triangular position embedding Triangular position embedding With latent shape embedding encoding After connection, the input is fed into the linear module of the network, containing the residual function. The output of the reconstructed point cloud is:
[0052]
[0053] During model training, when including When performing object reconstruction tasks at individual points, the network learns a... A diffusion model of the mapping relationship is used. Through iterative denoising and under the semantic conditions of point embedding, prediction of point displacement is achieved. Specifically, the network is trained to learn the noise to be removed in order to restore anomaly-free shapes; this process is based on the relationship between ground truth values and denoised reconstructed points. distance.
[0054] To evaluate the original point cloud and reconstructed point clouds For element-level distances between elements, this invention uses mean squared error loss as the primary reconstruction loss, as detailed below:
[0055]
[0056] in, This represents a point from the original anomalous point cloud, while The superscript (0) of the original point cloud represents the point cloud in its initial state, i.e., the state in which no noise has been added or the denoising process has just begun during the diffusion process. It is the number of points. It is for all Sum of points, This represents the squared Euclidean distance between two points. This loss function calculates the mean squared distance between all point pairs between the original point cloud and the reconstructed point cloud, aiming to minimize the difference between the two and thus improve the reconstruction quality.
[0057] During training, by minimizing the loss function, the network learns how to progressively remove Gaussian noise added during forward diffusion, ultimately generating a point cloud with a shape close to the original and free of anomalies. This method helps preserve the structural features of the point cloud while correcting anomalies, ensuring that the reconstruction results reflect the true shape of the input object as accurately as possible.
[0058] This invention addresses the mapping degradation problem of traditional autoencoders by minimizing the difference between the reconstructed model and the input point cloud after each denoising step. The defective 3D point cloud is completely obscured by Gaussian noise during the forward pass using a noise-adding function. This invention reconstructs the input 3D point cloud using an improved diffusion model. The diffusion decoder uses features extracted from the input point cloud by the PointNet encoder from completely random Gaussian noise as conditions, and generates point-level displacement vectors from the noise step-by-step using a Markov chain. Using the generated point cloud group as the target reference and a mean square loss function as the loss function, a defect-free point cloud corresponding to the input point cloud is iteratively reconstructed. By updating the weights of the neural network using the Adam optimizer to minimize the loss function, the diffusion model gains the ability to progressively denoise from random noise and ultimately reconstruct the original point cloud.
[0059] In practice, the 3D point cloud of the processed surface of the industrial product to be inspected is acquired and preprocessed. This preprocessed point cloud is then input into the reconstruction model for further processing, resulting in a reconstructed point cloud. Finally, a detection function is used to detect and segment the 3D point cloud and its reconstructed point cloud. This detection function includes a clustering algorithm and a distance function. First, K-nearest neighbor clustering is performed on both the 3D point cloud and its reconstructed point cloud to obtain two sets of clustered point clouds. Each cluster contains several initial point cloud clusters and reconstructed point cloud clusters. Then, a distance function is used to measure the two sets of clustered point clouds. For each initial point cloud cluster, the Euclidean distance between the initial point cloud cluster and each reconstructed point cloud cluster is obtained. The shortest Euclidean distance is selected as the segmentation result for the current initial point cloud cluster. For each initial point cloud cluster, if the segmentation result is not greater than the distance threshold, then the current initial point cloud cluster is defect-free; otherwise, it is defective. The segmentation result also determines the size of the defect, thus obtaining the defect location result of the processed surface of the industrial product to be inspected. Simultaneously, the longest Euclidean distance among the segmentation results of the initial point cloud cluster is obtained as the classification result. If the classification result is not greater than the distance threshold, then the current 3D point cloud to be inspected is defect-free; otherwise, it is defective. This obtains the defect classification result of the processed surface of the industrial product to be inspected, completing the defect detection of the processed surface of the industrial product.
[0060] In the training phase, the input 3D point cloud is preprocessed and then augmented using a 3D defect simulation strategy. Using the augmented point cloud as a condition and the preprocessed input point cloud as the target, the diffusion model is trained to reconstruct the corresponding 3D point cloud from completely random noise. In the testing phase, the preprocessed input point cloud is used as a condition, and the trained reconstruction model reconstructs the defect-free point cloud corresponding to the input sample from completely random noise. The final defect detection, classification, and segmentation results are obtained through comparison using clustering algorithms and Euclidean distance. This invention focuses on 3D representation, reconstructing the defect-free features corresponding to the input sample based on a diffusion model, performing detection and segmentation by comparing the original features and the reconstructed features using clustering algorithms and distance functions, and employing a novel 3D point cloud defect simulation strategy for data augmentation.
[0061] As shown in Figure 2, the inference stage of the method of the present invention compares the defect point cloud of the input reconstruction model through a detection function. Reconstructed point cloud after diffusion model The process yields a defect map M containing information such as the location and confidence level of specific defects. The diffusion model comprises two main components: an encoder and a decoder. The diffusion model network is trained end-to-end on a given category of 3D point cloud data using the backpropagation algorithm, ultimately obtaining the reconstruction model. Clustering algorithms and distance functions are used to detect and segment the original and reconstructed point clouds. K-nearest neighbor clustering is performed on both the input and reconstructed point clouds, and the clustered point clouds are measured using a distance function. Based on the measurement results, the defect detection classification and segmentation results of the point clouds are obtained. Specifically, the following steps are included:
[0062] First, point cloud preprocessing and clustering are performed. The input point cloud data is standardized to eliminate the influence of different scales. For point clouds... , where each point Represented as This invention applies a normalization transformation to all points. The original point cloud after normalization is shown below. and reconstructing point clouds The sets of coordinates of the K nearest neighbors obtained after K-nearest neighbor clustering are respectively denoted as: and For each sample ,turn up The nearest other sample And return the tensor composed of these neighbors.
[0063] Then, point cloud defect detection and segmentation are performed, as shown in Figure 3. This invention calculates the distance function within the detection function. and The similarity between them is determined. Euclidean distance is used to measure the distance between two points. This is achieved by calculating the similarity between clusters. and The distance between the two point clouds is calculated to obtain the relative distance matrix between them. The maximum value is taken as the classification score for anomaly detection, and all values greater than a certain threshold are taken as the segmentation score for anomaly detection.
[0064] In its specific implementation, this invention uses 3D point clouds of the processed surfaces of industrial products to train and test the model. The Real3D-AD dataset, a real 3D point cloud defect detection dataset, contains 12 categories, with each category having a training set of 4 samples and a test set of 100 samples. The Anomaly-ShapeNet dataset, a simulated 3D point cloud defect dataset, contains 40 categories, with each category containing 4 training samples and approximately 400 test samples.
[0065] This invention is implemented using PyTorch and performs end-to-end training within the network. The optimization process employs the Adam optimizer with an initial learning rate of 0.001. The training process comprises 40,000 iterations with a total batch size of 128 to ensure comprehensive learning. All input point cloud data undergoes preprocessing: on the Real3D-AD dataset (a real 3D point cloud defect detection dataset), 4096 points are randomly downsampled; while on the Anomaly-ShapeNet dataset (a simulated 3D point cloud defect dataset), 2048 points are downsampled. Furthermore, this invention optimizes the diffusion process by standardizing the point clouds by setting their centroid to the origin and scaling their size to the range of -1 to 1.
[0066] Figure 5 shows the qualitative results of the Real3D-AD dataset for detecting defects in real 3D point clouds. Different color intensities represent different levels of anomaly scores, i.e., confidence levels. The left side of Figure 5 shows samples from the Real3D-AD dataset, while the right side shows samples from the Anomaly-ShapeNet dataset for detecting defects in simulated 3D point clouds. By comparing the defect predictions and ground truth values of the input and reconstructed point clouds, it can be seen that the present invention accurately reconstructs defective parts in the point clouds across various samples: for example, deep depressions in the hippocampus sample, concavities in the bag sample, and bulges in the jar sample. Using the accurately reconstructed point clouds, the present invention also generates a final point cloud segmentation map, further demonstrating the effectiveness of the method.
[0067] Figures 6 and 7 illustrate anomalous samples in the test set, normal samples in the training set, and anomalous samples obtained through the 3D defect simulation strategy. This demonstrates that the present invention can comprehensively simulate defects across different categories, proving that its method effectively compensates for the domain gap caused by training with only positive samples in 3D anomaly detection. By generating simulated anomalous samples, the model can be exposed to a wider variety of anomalies during the training phase, thereby improving its generalization ability and accuracy in detecting real-world anomalies. This enhanced data diversity helps improve the model's robustness and adaptability, enabling it to perform better when facing real-world anomalies.
[0068] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this 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 this application can be implemented using various computer languages. This application is described with flowcharts of methods, systems, and computer program products according to embodiments of this application.
[0069] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, this invention is intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0070] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations of this application fall within the scope of the equivalent technology of this invention, this application also intends to include these modifications and variations.
Claims
1. A method for detecting three-dimensional point cloud defects on a machined surface based on a diffusion model, characterized in that, include: 1) Obtain the 3D point cloud of the processed surface of several defect-free industrial products and perform data augmentation and point cloud preprocessing in sequence to obtain the defective 3D point cloud and construct it as 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 reconstructed model after training. 3) Obtain the 3D point cloud of the processed surface of the industrial product to be inspected and perform the same point cloud preprocessing as in step 1), then input it into the reconstruction model for processing. After processing, the reconstructed point cloud is obtained. 4) By detecting and segmenting the three-dimensional point cloud to be detected and its reconstructed point cloud through detection functions, the defect detection classification and localization results are obtained, and the defect detection of the processed surface of industrial products is completed.
2. The method for detecting three-dimensional point cloud defects on a machined surface based on a diffusion model according to claim 1, characterized in that: In step 1), for the three-dimensional point cloud of the processed surface of each defect-free industrial product, data augmentation is performed on the three-dimensional point cloud by global random rotation and local random deformation in sequence. When performing global random rotation, the randomly generated rotation matrix and the point cloud matrix of the three-dimensional point cloud are multiplied by a dot to obtain the rotated three-dimensional point cloud. Then, local random deformation is performed, and some points are randomly selected in the rotated three-dimensional point cloud for displacement, and finally the data-augmented three-dimensional point cloud is obtained.
3. The method for detecting three-dimensional point cloud defects on a machined surface based on a diffusion model according to claim 1, characterized in that: In step 1), the augmented 3D point cloud is preprocessed. First, it is normalized, then the augmented 3D point cloud is translated and scaled. Then, it is randomly downsampled to a preset number of point clouds, and finally the processed defect 3D point cloud is obtained and constructed as a training set.
4. The method for detecting three-dimensional point cloud defects on 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 and an improved diffusion decoder. During training, the improved diffusion model also includes a noise-adding function. The shape encoding features of the defective 3D point cloud are obtained by feature extraction through the PointNet encoder and used as the latent shape embedding encoding. Simultaneously, the defective 3D point cloud is used to generate a set of occlusion point clouds at time T with Markov chain properties through a noise-adding function. The shape encoding features of the defect 3D point cloud are input into the improved diffusion decoder for processing, and the displacement vector at time T-1 is output. The occlusion point cloud at time T and the displacement vector at time T-1 The summation yields the reconstructed point cloud at time T-1. The displacement vector at time T-1 and latent shape embedding encoding The input is processed by the improved diffusion decoder and outputs the displacement vector at time T-2. The process is repeated iteratively. In each iteration, the displacement vector at the current time step output by the improved diffusion decoder is added to the reconstructed point cloud at the next time step to obtain the reconstructed point cloud at the previous time step. The displacement vector at the current time step and the latent shape are then embedded and encoded. The input is processed by the improved diffusion decoder and outputs the displacement vector of the previous time step, until the displacement vector of time step 0 is output. The displacement vector at time 0 The reconstructed point cloud at time 0 is output by adding it to the reconstructed point cloud at time 1. As the final output of the improved diffusion model, the reconstructed point cloud is processed together with the defective 3D point cloud obtained from the training set and the final output of the improved diffusion decoder. The network weights of the improved diffusion decoder are updated by the optimizer until the loss function converges to obtain the trained improved diffusion decoder, that is, the trained reconstruction model.
5. [Correction 17.07.2025 based on Rule 91] The method for detecting three-dimensional point cloud defects on a machined surface based on a diffusion model according to claim 4 is characterized in that: The displacement vector is as follows: in, and These are the displacement vectors at time t and time t-1, respectively. and Let be the noise variance and its cumulative variance at time t, respectively. The noise variance is scheduled at time t. ; This is a denoising function; The standard deviation of noise; It is standard Gaussian noise.
6. [Corrected according to Rule 91, 17.07.2025] The method for detecting three-dimensional point cloud defects on a machined surface based on a diffusion model according to claim 1 is characterized in that: In step 4), the detection function includes a clustering algorithm and a distance function. First, K-nearest neighbor clustering is performed on the 3D point cloud to be detected and its reconstructed point cloud to obtain two sets of clustered point clouds. The clustered point clouds of the 3D point cloud to be detected and its reconstructed point cloud contain several initial point cloud clusters and reconstructed point cloud clusters, respectively. Then, the two sets 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. The shortest Euclidean distance 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, the location of the current initial point cloud cluster is free of defects; otherwise, there are defects. Thus, the defect location result of the processed surface of the industrial product to be detected is obtained. 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 3D point cloud to be detected is free of defects; otherwise, there are defects. Thus, the defect classification result of the processed surface of the industrial product to be detected is obtained.
7. [Corrected according to Rule 91, July 17, 2025] An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-6.
8. [Correction 17.07.2025 based on Rule 91] A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the method as described in any one of claims 1-6.
9. [Corrected 17.07.2025 according to Rule 91]