A method, device, medium and equipment for detecting parallelism of workpiece

By integrating multimodal data analysis of three-dimensional point clouds and two-dimensional images, a parallelism detection model is constructed, which solves the problems of low efficiency and insufficient accuracy in workpiece parallelism measurement in existing technologies, and realizes high-precision, automated parallelism detection and visual correction.

CN120388017BActive Publication Date: 2025-09-09NINGJIANG MASCH TOOL GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510875373.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-09-09
Estimated Expiration
2045-06-27

AI Technical Summary

Technical Problem

Existing technologies are inefficient in measuring workpiece parallelism, are susceptible to human operational errors and environmental interference, and are unable to fully capture subtle deformations of complex three-dimensional structures. They lack the ability to collaboratively analyze multimodal data, resulting in fuzzy positioning of parallelism error distribution and insufficient basis for correction, making them unable to meet the needs of high-precision, automation, and visualization of defect hotspots.

Method used

By collaboratively analyzing multimodal data of three-dimensional point clouds and two-dimensional images, combined with dynamic graph construction, deformable graph convolution, multi-scale attention mechanism and cross-modal cross-attention technology, a parallelism detection model is constructed. The parallelism error value and heat map of the workpiece are output through the training model.

Benefits of technology

It realizes high-precision and automated workpiece parallelism detection, accurately locates local deformation areas, provides visual basis, significantly improves detection efficiency and accuracy, and adapts to the needs of industrial scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120388017B_ABST
    Figure CN120388017B_ABST
Patent Text Reader

Abstract

This application discloses a method, device, medium, and equipment for detecting workpiece parallelism. The method comprises: obtaining parallelism benchmark data for the surfaces of both sides of a standard workpiece, as well as obtaining a three-dimensional point cloud map and a two-dimensional image of the surfaces of both sides of the workpiece to be measured; constructing and training a parallelism detection model; inputting the parallelism benchmark data for both sides of the standard workpiece, the three-dimensional point cloud map, and the two-dimensional image of the surfaces of both sides of the workpiece to be measured into the trained parallelism detection model, and outputting the parallelism error value and thermal map of the workpiece to be measured. This application enables accurate detection of workpiece parallelism errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of industrial automation and intelligent manufacturing technology, and specifically relates to a workpiece parallelism detection method, device, medium and equipment. Background Art

[0002] Existing technologies for measuring workpiece parallelism primarily rely on single-point or local sampling using contact tools such as micrometers and coordinate measuring machines (CMMs), or on single-modal data (such as 2D images or simple 3D point clouds). These methods suffer from low efficiency, susceptibility to human error and environmental interference (such as image distortion caused by uneven lighting), and difficulty in fully capturing subtle deformations in the workpiece's complex 3D structure. Furthermore, they lack the ability to collaboratively analyze multimodal data (3D geometry and 2D textures), resulting in ambiguous positioning of parallelism error distribution and insufficient basis for correction. These methods fail to meet the demands for high-precision, automated, and visualized defect hotspots in industrial scenarios. Summary of the Invention

[0003] In view of the deficiencies in the prior art, the purpose of this application is to provide a workpiece parallelism detection method, device, medium and equipment, which can accurately detect the parallelism error of the workpiece.

[0004] To achieve the above objectives, this application provides the following technical solutions:

[0005] A method for detecting the parallelism of a workpiece comprises: obtaining parallelism reference data of the surfaces on both sides of a standard workpiece, and obtaining a three-dimensional point cloud map and a two-dimensional image of the surfaces on both sides of the workpiece to be measured; constructing and training a parallelism detection model; inputting the parallelism reference data of the surfaces on both sides of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the surfaces on both sides of the workpiece to be measured into the trained parallelism detection model, and outputting a parallelism error value and a thermal map of the workpiece to be measured.

[0006] Optionally, the parallelism detection model includes: an input layer, a feature extraction layer, a geometric analysis layer and an output layer, wherein the input layer adopts three channels, which are respectively used to input the basic parallelism data of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the workpiece to be measured; the feature extraction layer includes a reference feature extraction subnetwork, a three-dimensional point cloud feature extraction subnetwork and a two-dimensional image feature extraction subnetwork, wherein the reference feature extraction subnetwork is used to encode the basic parallelism data into a conditional vector; the three-dimensional point cloud feature extraction subnetwork is used to perform feature extraction on the three-dimensional point cloud map to obtain three-dimensional point cloud features; the two-dimensional image feature extraction subnetwork is used to perform feature extraction on the two-dimensional image to obtain two-dimensional image features; the geometric analysis layer is used to perform geometric analysis on the workpiece to be measured based on the parallelism basic data and the extracted three-dimensional point cloud features and two-dimensional image features, and output the parallelism error and thermal map of the workpiece to be measured through the output layer.

[0007] Optionally, the parallelism detection model is trained by the following steps: collecting three-dimensional point cloud data, two-dimensional image data of multiple workpieces with annotated parallelism error values, and basic parallelism data of standard workpieces to form a data set, and dividing the data set into a training set and a validation set; setting training parameters, and training the model using the training set until a maximum number of iterations is met;

[0008] The trained model is verified using the validation set. During the verification process, if the mean absolute error, mean square error, and root mean square error, which are the model performance evaluation indicators, are all less than the threshold, the model verification passes; otherwise, the training parameters are adjusted or the training set samples are expanded to retrain the model until the verification passes.

[0009] The present application also provides a workpiece parallelism detection device, which includes: an acquisition module for acquiring parallelism reference data of the surfaces on both sides of a standard workpiece, and obtaining a three-dimensional point cloud map and a two-dimensional image of the surfaces on both sides of the workpiece to be measured; a model construction and training module for constructing and training a parallelism detection model; a detection module for inputting the parallelism reference data of the surfaces on both sides of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the surfaces on both sides of the workpiece to be measured into the trained parallelism detection model, and outputting the parallelism error value and the thermal map of the workpiece to be measured.

[0010] The present application also provides a storage medium comprising instructions, which, when executed on a computer, enables the computer to execute a workpiece parallelism detection method as described in any of the preceding items.

[0011] The present application also provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a workpiece parallelism detection method as described above is implemented.

[0012] Compared with the prior art, the present invention has the following beneficial effects:

[0013] This application achieves high-precision and automated workpiece parallelism detection by integrating multimodal data collaborative analysis of three-dimensional point clouds and two-dimensional images, combining dynamic graph construction, deformable graph convolution, multi-scale attention mechanism and cross-modal cross-attention technology, effectively overcoming the low efficiency, susceptibility to interference and single-modal data limitations of traditional contact measurement; the global error value and heat map it outputs not only quantify the parallelism deviation, but also accurately locate local deformation areas (such as the maximum error hot zone), providing a visual basis for process optimization and repair, and significantly improving detection efficiency, accuracy and adaptability to industrial scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1This is a flow chart of a method for detecting parallelism of a workpiece provided by one embodiment of the present application;

[0015] Figure 2 is a structural diagram of a parallelism detection model provided by another embodiment of the present application;

[0016] Figure 3 is a three-dimensional point cloud image of the surfaces on both sides of a workpiece provided by another embodiment of the present application;

[0017] Figure 4 is a YZ plane schematic diagram of a workpiece projected from the positive X direction provided by another embodiment of the present application;

[0018] Figure 5 is a schematic diagram of an XZ plane of a workpiece projected from the positive Y direction provided by another embodiment of the present application;

[0019] Figure 6 This is a workpiece thermal map provided by another embodiment of the present application;

[0020] Figure 7 It is a structural schematic diagram of a workpiece parallelism detection device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0021] Specific embodiments of the present application will be described in detail below with reference to the accompanying drawings. Although specific embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. Instead, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0022] It should be noted that certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that technicians may use different nouns to refer to the same component. This specification and claims do not use the difference in nouns as a way to distinguish components, but use the difference in the functions of the components as the criterion for distinction. As mentioned throughout the specification and claims, "including" or "comprising" is an open term, so it should be interpreted as "including but not limited to". The subsequent description of the specification is a preferred embodiment of the present application, but the description is based on the general principles of the specification and is not intended to limit the scope of the present application. The scope of protection of this application shall be as defined by the attached claims.

[0023] To facilitate understanding of the embodiments of the present application, further explanation will be given below using specific embodiments as examples in conjunction with the accompanying drawings, and the various drawings do not constitute a limitation on the embodiments of the present application.

[0024] Figure 1FIG. 1 is a structural diagram of a method for detecting parallelism of a workpiece provided by an exemplary embodiment of the present application. Figure 1 As shown, the method includes the following steps:

[0025] S100: Acquire parallelism benchmark data for both sides of the standard workpiece. Scan the workpiece 360° using a laser scanner to obtain a 3D point cloud image of both sides of the workpiece. Simultaneously, capture a 2D image of both sides of the workpiece. The parallelism benchmark data for both sides of the standard workpiece includes the ideal normal vector, ideal curvature distribution, key feature areas (specific areas on the standard workpiece that significantly affect parallelism, typically edges, holes, protrusions, or areas sensitive to local deformation), and reference directions. The workpieces include, but are not limited to, circular workpieces such as automotive drive shafts, pump housings, and steel pipes; rectangular workpieces such as machine tool worktables, switch cabinet door panels, and circuit boards; and other geometric workpieces with parallel sides.

[0026] S200: Build and train a parallelism detection model;

[0027] S300: Inputting the parallelism reference data of the two side surfaces of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the two side surfaces of the workpiece to be measured into the trained parallelism detection model, and outputting the parallelism error value and the thermal map of the workpiece to be measured.

[0028] In another exemplary embodiment, in step S300, Figure 2 As shown, the parallelism detection model includes: an input layer, a feature extraction layer, a cross-modal attention layer, a geometric analysis layer and an output layer, wherein the input layer adopts three channels, which are used to input the basic parallelism data of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the workpiece to be tested.

[0029] The feature extraction layer includes a reference feature extraction subnetwork, a three-dimensional point cloud feature extraction subnetwork and a two-dimensional image feature extraction subnetwork, wherein the reference feature extraction subnetwork includes a fully connected layer for encoding the parallelism basic data into a conditional vector .

[0030] The three-dimensional point cloud feature extraction subnetwork includes an input preprocessing layer, a dynamic graph construction module, a multi-scale attention fusion layer, a global Transformer module, a lightweight feature compression module and an output layer. The input preprocessing layer is used to input the three-dimensional point cloud image of the workpiece to be measured, and normalize the three-dimensional point cloud coordinates in the local coordinate system through adaptive normalization, with the center of mass of the workpiece as the origin to eliminate the influence of translation invariance; in addition, the input preprocessing layer also introduces random geometric enhancement to apply random small-angle rotation (±5°) and scale jitter (±5°) to the three-dimensional point cloud image to improve the robustness of the model. The input preprocessing layer outputs the normalized three-dimensional point cloud image with enhanced geometric transformation parameters.

[0031] The dynamic graph construction module uses a preprocessed 3D point cloud as input and employs an adaptive neighborhood construction strategy (KNN + radius search) combined with deformable graph convolution to dynamically capture the local geometric structure of the point cloud and generate multi-scale features. The adaptive neighborhood construction strategy includes: using KNN for dense areas (such as edges and holes), i.e., for each center point, selecting its K=16 nearest neighbor nodes to form a neighborhood set. This fixes the number of neighborhoods and ensures the stability of feature extraction in dense areas. For sparse areas, a radius search is used, i.e., with the center point as the center of a circle (for example, a radius of r=0.1m can be set), and all points within this range are selected as the neighborhood set. This adaptively adjusts the neighborhood range to cover the potential structure of sparse areas, thereby avoiding missed detections. Specifically, the dynamic graph construction module performs three radii of field search (0.05m, 0.1m, and 0.2m) on each point in the preprocessed 3D point cloud. Deformable graph convolution is independently applied to the neighborhood of each scale to generate features at different scales, including: Fine scale (radius 0.05m): Captures subtle deformations (such as edge burrs and local depressions) and is suitable for high-density areas. Medium scale (radius 0.1m): Balances detail and efficiency to extract the overall shape of local areas (such as holes and slopes). Coarse-grained scale (radius 0.2m): Covers a larger range and reflects the global geometric trends of the workpiece (such as overall tilt and symmetry).

[0032] The deformable graph convolution refers to adding deformable offset learning to traditional graph convolution, dynamically adjusting the geometric weights of neighborhood points to enhance the model's adaptability to local deformations. The deformable graph convolution first predicts the spatial offset of each neighbor point relative to the center point through a lightweight convolution layer, then adjusts the position of the neighbor points based on the offset, and finally uses the adjusted position to calculate the weighted features, namely:

[0033]

[0034] in, Representation node Output features of Represents a learnable weight matrix for linearly transforming neighbor nodes characteristics; Represents neighbor nodes The original input features of (such as coordinates, curvature); Represents neighbor nodes Relative to the node The learnable spatial offset of Represents the offset activation function.

[0035] The features of each scale mentioned above are transformed into three feature maps through independent deformable graph convolution, which are recorded as 、 and .

[0036] The multi-scale attention fusion layer includes a channel-space dual attention mechanism to extract feature maps at three scales. 、 and The fusion forms a multi-scale feature map. First, the channel attention mechanism is used to focus on the feature map. 、 and Compress along the spatial dimension respectively, then learn the relationship between channels through the fully connected layer, output scale-level weights, and apply the scale-level weights to the feature map of the corresponding scale. After multiplying channel by channel, the channel-weighted feature map is obtained. The spatial attention mechanism weights the feature map of the channel Capture spatial context through 3D convolution and generate spatial attention map through Sigmoid function Finally, the spatial attention map and channel-weighted feature maps Multiply element by element and compress the channel dimension through 2D convolution to generate the final multi-scale feature map .

[0037] The global Transformer module uses multi-scale feature maps As input, we first downsample the key points to 512 through FPS (Furthest Point Sampling) to reduce the amount of computation. Then, we divide the downsampled 512 key points into local windows (each group contains 32 points), and calculate the attention weights for the 32 points in each window to capture the local geometric relationship and long-range dependency relationship. Each window outputs the local feature. .

[0038] Furthermore, the global Transformer module selects a representative point (such as the centroid point) from each window to form a proxy point set, and calculates the global attention weight for the proxy point set to obtain the global feature . Then the global features Broadcast to each window, and local features The features of all points in the window are added element by element and aggregated through maximum pooling to finally generate a global semantic feature G, which contains the overall structural information of the workpiece.

[0039] In summary, the global Transformer module transforms the multi-scale feature map into Downsampling to 512 key points significantly reduces computational complexity while preserving the workpiece's key geometric information. The point cloud is then divided into local windows (32 points per group), capturing local geometric dependencies within the window through a self-attention mechanism. This module, combined with cross-window interactions, dynamically fuses global semantic features. This module leverages fine-grained analysis within the window and long-range correlations across windows to effectively integrate local details of the workpiece (such as edge deformation) with overall structural trends (such as tilt direction). It outputs a feature vector containing global semantics, providing robust geometric context for subsequent parallelism error calculations. This module combines high efficiency, dynamic adaptability (supporting point clouds with uneven density), and sensitivity to complex deformations, helping to improve detection accuracy and scene generalization capabilities.

[0040] The lightweight feature compression layer takes the global semantic features G as input and first adaptively selects keypoints through a dynamic max pooling layer. This layer dynamically adjusts the pooling region based on the strength of the feature response, prioritizing geometrically significant regions (such as maximum error hotspots and edge mutation points). Keypoint locations are determined using a sliding window strategy combined with local gradient analysis to ensure that details in high-error regions are not lost. Subsequently, feature compression is performed using depthwise separable convolution. This extracts local geometric patterns through channel-by-channel spatial convolution and fuses cross-channel information through point-by-point convolution. This reduces the number of parameters while preserving the core semantics of multi-scale features (the number of parameters is only 1 / 8 to 1 / 9 of that of standard convolution). The final output is a compact feature (e.g., compressing the dimensions from 512×256 to 512×64). By compressing the global semantic features G, the lightweight feature compression layer reduces subsequent computational complexity while ensuring high-fidelity transmission of key deformation information (such as local tilt angles and surface curvature anomalies). This provides an efficient and robust feature foundation for accurate parallelism error calculation and heatmap generation.

[0041] The output layer uses skip connections to construct the feature map output by the dynamic graph module 、 、 The global semantic feature G after lightweight feature compression is used as input and fused through channel splicing to finally output the global feature of the 3D point cloud , and input into the subsequent fusion layer for parallelism error calculation.

[0042] The two-dimensional image feature extraction subnetwork includes an input layer, a dynamic deformable convolution module, a multi-scale attention pyramid, and a local-global visual Transformer module. The input layer is used to take the YZ plane image projected in the positive X direction and the XZ plane image projected in the positive Y direction as dual-channel inputs to form a multi-view fusion feature map. .

[0043] The dynamic deformable convolution module includes a normalization layer, a deformable convolution layer and a depth-separable convolution layer. The normalization layer performs the normalization on the input feature map. Adaptive histogram equalization is performed to eliminate the interference of uneven lighting.

[0044] The deformable convolution layer first obtains the normalized feature map by the following formula Medium prediction offset :

[0045]

[0046] in, Represents the weight parameters of the offset generation convolution layer.

[0047] Then, for each sampling point position of the standard convolution kernel , according to the offset Adjust the actual sampling position:

[0048]

[0049] in, represents the first Coordinates of sampling points; Indicates the dynamically adjusted The coordinates of the sampling points.

[0050] Finally, the adjusted sampling points are weighted summed to generate the output feature map :

[0051]

[0052] in, Indicates the number of sampling points of the convolution kernel; Represents the weight parameters of the standard convolution kernel.

[0053] The depth-wise separable convolutional layer first performs depth-wise convolution on the input output feature map. Each channel of is independently spatially convolved, and the output depth convolution output feature map , then fuse the cross-channel information through point-by-point convolution and output the point-by-point convolution output feature map .

[0054] Finally, the dynamic deformable convolution module uses residual connections to connect the input feature map And point-by-point convolution output feature map Add element by element to get the final output feature map (including the initial information retained by the residual connection and the local deformation features of the workpiece, such as edge distortion, holes, etc.).

[0055] The local-global visual Transformer module first transforms the input final output feature map Perform dynamic window division, that is, according to the feature map The window size is dynamically adjusted according to the local complexity (such as gradient variance). For high-complexity areas (such as edges and deformation areas), a small window (such as 4×4) is used to capture fine details. For low-complexity areas (such as flat surfaces), a large window (such as 16×16) is used to speed up calculations.

[0056] The local-global visual Transformer module introduces a jump local attention mechanism, which first calculates the standard self-attention for each window to generate local features , then use the [CLS] tag (Classification Token) of each window as a global agent to interact across windows and pass information through a lightweight fully connected layer to generate cross-window association weights Finally, the local features Associate weights across windows Weighted fusion to generate enhanced features .

[0057] Finally, the local-global visual Transformer module enhances the features Perform global average pooling to obtain the semantic vector E, and broadcast E to the enhanced features Same size and with enhanced features Multiply channel by channel to highlight globally semantically relevant regions , and the feature map Regions related to global semantics Add to obtain two-dimensional image features that combine local details and global semantics .

[0058] The cross-modal attention layer uses the conditional vector and 3D point cloud global features (Conditional vector As an additional condition, by splicing into ,Right now As a query (each 3D point represents a key position on the workpiece surface (such as the center of mass, edge point), and carries geometric offset information (coordinates, curvature, etc.) and reference direction). (including texture, edge, color, etc.) as Key and Value (Key is used to calculate similarity, Value is used to transfer features), guiding the 3D point cloud features to focus on the corresponding area in the 2D image.

[0059] Specifically, for each feature point in the 3D point cloud (denoted as query ), calculate its similarity score with all feature regions in the two-dimensional image (recorded as key K) :

[0060]

[0061] in, Represents the query matrix, which is composed of the global features of the 3D point cloud and conditional vector Fusion generation; K represents two-dimensional image features , represents transpose; express and the dimensions of each vector in K; Represents calculation The dot product of each query vector in and all key vectors in K; Softmax represents the normalization of the attention score of each query to generate the attention weight.

[0062] The above formula is calculated by The similarity with all K guides the 3D point cloud features to extract the most relevant information from the 2D image. For example, if the 3D point cloud features represents the left edge of the workpiece, and its similarity score with the left edge area (K) in the image is the highest.

[0063] Furthermore, for each 3D point cloud feature All similarity scores are normalized by softmax to generate attention weights, where the larger the weight value, the more 3D point cloud features The stronger the correlation with the two-dimensional image feature K. For example, if the three-dimensional point cloud feature Corresponding to the upper left corner edge of the workpiece, its attention weight reaches a peak in the upper left corner edge pixel area of ​​the two-dimensional image.

[0064] Finally, according to the attention weight matrix, the two-dimensional image features (denoted as value V) are weighted and summed to generate the fused three-dimensional features. And output by the output layer.

[0065] The geometric analysis layer is used to analyze the fused three-dimensional features Geometric analysis is performed to calculate the parallelism error on both sides of the workpiece under test. The geometric analysis layer includes a dynamic segmentation module, a local normal vector extraction and alignment calculation module, a weighted adaptive mechanism, and a global error aggregation and heatmap generation module. The dynamic segmentation module dynamically segments the point cloud data of the workpiece under test into blocks based on the benchmark data of the standard workpiece (e.g., including the ideal curvature distribution and key feature areas). For example, for high-density areas (such as edges and holes), a small grid (e.g., 5mm×5mm) is used. In combination with sensitive areas marked in the benchmark data (e.g., easily deformed areas), the blocks are prioritized for high-precision capture of local deformation. For low-density areas (e.g., flat surfaces), a large grid (e.g., 20mm×20mm) is used. The grid size is dynamically adjusted based on the curvature threshold in the benchmark data to balance computational efficiency and coverage. A unique identifier (e.g., B-{region number}-{benchmark label}) is then generated for each block and associated with the corresponding block information of the standard workpiece (e.g., ideal normal vector and allowable error threshold), achieving precise mapping between the block under test and the benchmark data.

[0066] The local normal vector extraction and alignment calculation module uses the ideal normal vector of the standard workpiece As a reference direction, the local normal vector of each block of the workpiece to be measured Perform two-dimensional alignment calculation, including:

[0067] 1. Calculation Global reference direction of the surface on the same side as the workpiece Global angle error :

[0068]

[0069] 2. Calculation Normal vector of the block corresponding to the standard workpiece The local angle error :

[0070]

[0071] 3. Final alignment error is the weighted comprehensive value:

[0072]

[0073] in, Represents the weight coefficient, which is used to balance the global angle error and local angle error impact.

[0074] The weight adaptation mechanism is based on the final alignment error , the variance of the point cloud curvature within the block , the projected area of ​​the block on the vertical plane of the reference direction As input, the basic weight calculation is first performed:

[0075]

[0076] in, , Represents the adjustment coefficient, which is used to control the contribution strength of curvature and error to weight respectively; Represents the base weight.

[0077] Secondly, make area weight correction:

[0078]

[0079] in, Indicates the The modified area weight of the item; Represents the projected area of ​​the block on the plane perpendicular to the reference direction.

[0080] The global error aggregation and heat map generation module first integrates the weights and error Calculate global error :

[0081]

[0082] in, Indicates the total number of data points involved in the calculation.

[0083] And further calculate the minimum value of all block errors , maximum value and standard deviation , for heat map color mapping and key block screening.

[0084] Secondly, generate the heat map, including:

[0085] 1. Project the 3D point cloud of each block onto a plane perpendicular to the reference direction (such as the XY plane), preserving its 2D coordinate range.

[0086] Example: If the reference direction is the Z axis, the projection coordinate is (x,y).

[0087] 2. Color-code

[0088] Mapping rules:

[0089] Color intensity and error Linear or nonlinear associations, for example:

[0090]

[0091] Color scheme: Blue ( ), the error is close to the minimum; red ( ), the error is close to the maximum value.

[0092] Finally, block rendering is performed, specifically including: filling each block with a rectangular or fan-shaped area of ​​corresponding color intensity according to the projection coordinate range, and marking the boundaries, that is, superimposing the block boundary lines to distinguish the coverage of different blocks.

[0093] 3. Screen key blocks

[0094] First, perform dynamic threshold calculation:

[0095]

[0096] in, represents the dynamic threshold parameter; represents the sensitivity coefficient, represents the standard deviation of all block errors.

[0097] Next, mark the key areas:

[0098] Define the filter criteria: ;

[0099] Output marking information, including: block 3D coordinate range, error value and heat maps are marked with high-volume borders or symbols (such as red boxes).

[0100] The final output includes: global parallelism error value Error (quantifies the overall parallelism quality of the workpiece, used for qualification judgment, such as is qualified) and heat map (including color gradient (indicating error distribution), block boundary lines and color bars and coordinate axis labels).

[0101] For example, this application takes a cylindrical workpiece (such as a car transmission shaft) as an example and performs parallelism detection on it using the method described in this application.

[0102] First, a laser scanner is used to scan and obtain the three-dimensional point cloud images of the surfaces of both sides of the cylindrical workpiece (such as Figure 3 As shown), at the same time, two-dimensional images of both sides of the cylindrical workpiece are obtained (as shown Figure 4 and Figure 5 As shown, Figure 4 is the YZ plane graph projected from the positive X direction, Figure 5 is the XZ plane projected from the positive Y direction).

[0103] Secondly, Figure 3 The three-dimensional point cloud shown in Figure 4 as well as Figure 5 The two-dimensional image shown is input into the parallelism detection model for detection, and the specific detection results are as follows:

[0104] Global parallelism error index:

[0105] Mean Error: 1.2 mm

[0106] Maximum Error: 2.0 mm (in the middle area)

[0107] Minimum error: 0.1 mm (at the edge area)

[0108] Standard Deviation: 0.5 mm

[0109] The error distribution of key blocks is shown in Table 1:

[0110] Table 1

[0111]

[0112] Figure 6 It is the thermal map output after the cylindrical workpiece is tested, such as Figure 6 As shown, the colored area in the middle of the figure is the error hotspot, and the color changes from blue to red, indicating the change of parallelism error from small to large. Specifically, the left and right sides are the projections of the point cloud sections of the rectangular workpiece (represented by black dots), simulating the two-dimensional view observed from the positive X direction or the positive Y direction (similar to the Figure 3 、 Figure 4 The X- and Y-axes are two-dimensional coordinate systems used to locate the hot zone. The error value color bar is displayed on the right, in millimeters (mm), increasing from 0.0 to 2.0. Blue (error ≈ 0.0 mm): The surface is flat and essentially parallel to the opposite side; green-yellow (error ≈ 0.5-1.5 mm): Indicates a certain degree of error; red (error ≈ 2.0 mm): Represents the maximum error area, typically indicating tilt, unevenness, or deformation.

[0113] based on Figure 6 , we can see that the error distribution characteristics of the workpiece are:

[0114] The maximum error area is concentrated in the middle of the workpiece (block B-001), with an error value of 2.0 mm and distributed in a red oval shape.

[0115] The second largest error area is near the right edge (block B-002), with an error value of 1.8 mm, spreading in an orange fan shape.

[0116] Low error area: The four corners and edge areas of the workpiece (such as block B-003) have errors less than 0.5 mm and are blue.

[0117] based on Figure 6 , it can be diagnosed that the middle part of the cylindrical workpiece has deformed, which may be caused by insufficient fixture support or uneven material force during processing. The local deviation on the right side may be caused by tool path offset or thermal expansion effect. In addition, although the workpiece contour is symmetrical (such as Figure 3 ), but the heat map shows that the parallelism in the middle is significantly deteriorated, indicating that shape symmetry is not equivalent to functional compliance.

[0118] In summary, after model diagnosis, the global average error of the workpiece is 1.2 mm, which exceeds the preset qualified threshold (≤1.0 mm), and the parallelism of the workpiece is judged to be unqualified.

[0119] Furthermore, based on the above determination, this application provides the following repair suggestions:

[0120] 1. Local finishing: Finely grind or repair the red hot areas (B-001, B-002), giving priority to the areas with the largest errors.

[0121] 2. Adjust the fixture positioning strategy to enhance the middle support stiffness; optimize the processing path parameters to reduce deformation caused by tool vibration.

[0122] 3. Combined with the deformation trend of 3D point cloud ( Figure 3 ), reversely correct the robot arm's motion trajectory to improve processing consistency.

[0123] In another exemplary embodiment, in step S300, the parallelism detection model is trained by the following steps:

[0124] S301: Collect 3D point cloud data, 2D image data, and basic parallelism data of a plurality of workpieces with annotated parallelism error values ​​to form a data set, and divide the data set into a training set and a validation set, for example, with a division ratio of 7:3;

[0125] S302: Set training parameters. For example, booster selects the tree-based model gbtree by default, sets learning_rate to 0.01, max_depth to 3, and the maximum number of iterations to 300. The model is trained using the training set. During the model training process, when the number of model iterations meets the preset value, the model training is completed.

[0126] S303: Validate the trained model using the validation set. During the validation process, if the mean absolute error (MAE), mean square error (MSE), and root mean square error (RMSE) as the model performance evaluation indicators are all less than the threshold (for example, the threshold of MAE is set to 0.5mm, and the threshold of MSE is set to 0.25mm), the model is validated. 2 , the RMSE threshold is set to 0.6mm), the model validation passes; otherwise, adjust the training parameters (for example, adjust learning_rate to 0.005 and max_depth to 5) or expand the training set samples (for example, adjust the partition ratio to 8:2) and retrain the model until the validation passes.

[0127] In another exemplary embodiment, Figure 7 As shown, the present application also provides a workpiece parallelism detection device, which includes: an acquisition module 100, used to obtain the parallelism reference data of the surfaces on both sides of the standard workpiece, and obtain the three-dimensional point cloud map and two-dimensional image of the surfaces on both sides of the workpiece to be measured; a model construction and training module, used to construct a parallelism detection model and train it; a model construction and training module 200, used to construct a parallelism detection model and train it; a detection module 300, used to input the parallelism reference data of the surfaces on both sides of the standard workpiece, the three-dimensional point cloud map and two-dimensional image of the surfaces on both sides of the workpiece to be measured into the trained parallelism detection model, and output the parallelism error value and thermal map of the workpiece to be measured.

[0128] In another exemplary embodiment, the present application further provides a storage medium comprising instructions, which, when executed on a computer, enables the computer to execute a workpiece parallelism detection method as described in any of the preceding items.

[0129] In another exemplary embodiment, the present application also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a workpiece parallelism detection method as described in any of the foregoing is implemented.

[0130] The above embodiments are intended only to illustrate the technical concepts and features of this application. Their purpose is to enable those familiar with the art to understand the content of this application and implement it accordingly. They are not intended to limit the scope of protection of this application. Any equivalent changes or modifications made in accordance with the spirit of this application shall be included in the scope of protection of this application.

Claims

1. A method for detecting parallelism of a workpiece, characterized in that: The method comprises: Obtain parallelism benchmark data of both sides of the standard workpiece surface, as well as obtain three-dimensional point cloud maps and two-dimensional images of both sides of the workpiece surface to be measured; Build and train a parallelism detection model; Inputting the parallelism reference data of the two side surfaces of the standard workpiece, the three-dimensional point cloud image and the two-dimensional image of the two side surfaces of the workpiece to be tested into the trained parallelism detection model, and outputting the parallelism error value and the thermal map of the workpiece to be tested; The parallelism detection model includes a feature extraction layer, which includes a reference feature extraction subnetwork, a three-dimensional point cloud feature extraction subnetwork, and a two-dimensional image feature extraction subnetwork. The reference feature extraction subnetwork is used to encode the basic parallelism data into a conditional vector; the three-dimensional point cloud feature extraction subnetwork is used to extract features from the three-dimensional point cloud image to obtain three-dimensional point cloud features; and the two-dimensional image feature extraction subnetwork is used to extract features from the two-dimensional image to obtain two-dimensional image features. The parallelism detection model also includes a cross-modal attention layer, which uses the conditional vector and the global features of the 3D point cloud as the query and the 2D image features as the key and value to guide the 3D point cloud features to focus on the corresponding area in the 2D image; For each feature point in the 3D point cloud, calculate its similarity score with all feature regions in the 2D image. : in, represents the query matrix, which is generated by the fusion of the global features of the 3D point cloud and the conditional vector; K represents the 2D image features, represents transpose; express and the dimensions of each vector in K; Represents calculation The dot product of each query vector in and all key vectors in K; Softmax represents the normalization of the attention score of each query to generate the attention weight; The above formula is calculated by The similarity with all K guides the 3D point cloud features to extract the most relevant information from the 2D image; For each 3D point cloud feature All similarity scores are normalized by softmax to generate attention weights, where the larger the weight value, the more 3D point cloud features The stronger the correlation with the two-dimensional image feature K; According to the attention weight matrix, the two-dimensional image features are weighted and summed to generate the fused three-dimensional features.

2. A method for detecting parallelism of a workpiece according to claim 1, characterized in that: The parallelism detection model also includes: Input layer, geometric analysis layer and output layer, where The input layer uses three channels, which are used to input the basic data of parallelism of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the workpiece to be measured; The geometric analysis layer is used to perform geometric analysis on the workpiece to be measured based on the parallelism basic data and the extracted three-dimensional point cloud features and two-dimensional image features, and output the parallelism error and thermal map of the workpiece to be measured through the output layer.

3. A method for detecting parallelism of a workpiece according to claim 1, characterized in that: The parallelism detection model is trained by the following steps: Collect 3D point cloud data, 2D image data, and basic parallelism data of standard workpieces with annotated parallelism error values ​​to form a data set, and divide the data set into a training set and a validation set; Set the training parameters and train the model using the training set until the maximum number of iterations is met; The trained model is verified using the validation set. During the verification process, if the mean absolute error, mean square error, and root mean square error, which are the model performance evaluation indicators, are all less than the threshold, the model verification passes; otherwise, the training parameters are adjusted or the training set samples are expanded to retrain the model until the verification passes.

4. A workpiece parallelism detection device, characterized in that: The device comprises: An acquisition module is used to obtain the parallelism reference data of the surfaces on both sides of the standard workpiece, as well as to obtain a three-dimensional point cloud map and a two-dimensional image of the surfaces on both sides of the workpiece to be measured; Model building and training module, used to build and train the parallelism detection model; A detection module is used to input the parallelism reference data of the two side surfaces of the standard workpiece, the three-dimensional point cloud map and the two-dimensional image of the two side surfaces of the workpiece to be tested into the trained parallelism detection model, and output the parallelism error value and the thermal map of the workpiece to be tested; The parallelism detection model includes a feature extraction layer, which includes a reference feature extraction subnetwork, a three-dimensional point cloud feature extraction subnetwork, and a two-dimensional image feature extraction subnetwork. The reference feature extraction subnetwork is used to encode the basic parallelism data into a conditional vector; the three-dimensional point cloud feature extraction subnetwork is used to extract features from the three-dimensional point cloud image to obtain three-dimensional point cloud features; and the two-dimensional image feature extraction subnetwork is used to extract features from the two-dimensional image to obtain two-dimensional image features. The parallelism detection model also includes a cross-modal attention layer, which uses the conditional vector and the global features of the 3D point cloud as the query and the 2D image features as the key and value to guide the 3D point cloud features to focus on the corresponding area in the 2D image; For each feature point in the 3D point cloud, calculate its similarity score with all feature regions in the 2D image. : in, represents the query matrix, which is generated by the fusion of the global features of the 3D point cloud and the conditional vector; K represents the 2D image features, represents transpose; express and the dimensions of each vector in K; Represents calculation The dot product of each query vector in and all key vectors in K; Softmax represents the normalization of the attention score of each query to generate the attention weight; The above formula is calculated by The similarity with all K guides the 3D point cloud features to extract the most relevant information from the 2D image; For each 3D point cloud feature All similarity scores are normalized by softmax to generate attention weights, where the larger the weight value, the more 3D point cloud features The stronger the correlation with the two-dimensional image feature K; According to the attention weight matrix, the two-dimensional image features are weighted and summed to generate the fused three-dimensional features.

5. A storage medium, characterized in that: The method comprises instructions, which, when run on a computer, enable the computer to execute a workpiece parallelism detection method according to any one of claims 1 to 3.

6. An electronic device, characterized in that: The electronic device comprises: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, a workpiece parallelism detection method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Three-dimensional target detection method based on multi-modal fusion and deformable attention

    CN117975436A

  • Axis parallelism error detection method and related equipment

    CN120194592A