Workpiece surface profile line convex-concave anomaly detection and quantification method
By using a line laser scanner and B-spline fitting technology, combined with differential sliding window and Jaccard similarity coefficient determination, the accurate detection and quantification of surface irregularities of workpieces is achieved. This solves the problem of difficulty in coordinating and optimizing multi-size adaptability, accuracy and noise resistance in existing technologies, and meets the high-precision quantification and high-efficiency response requirements of intelligent manufacturing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGSU BRANCH OF CHINA ACAD OF MASCH SCI & TECH GRP CO LTD
- Filing Date
- 2026-02-12
- Publication Date
- 2026-05-08
AI Technical Summary
Existing detection technologies suffer from limitations in multi-size adaptability, accuracy and noise resistance, weak quantification capabilities, and detection failures in scenarios without reference. These limitations make it difficult to meet the demands of intelligent manufacturing for detection technologies that require multi-scenario coverage, high-precision quantification, high-efficiency response, and flexible adaptation.
The surface contour data of the workpiece is acquired by a line laser scanner. Through precise parameter setting, multi-round B-spline fitting, differentiated sliding window recognition logic, false anomaly filtering, and Jaccard similarity coefficient iteration termination judgment, the accurate detection and quantification of concave and convex anomalies are achieved.
It achieves multi-size adaptation, complex contour compatibility, and referenceless detection compatibility, and features high-precision quantization and high-efficiency response, adapting to complex industrial environments and providing a reliable quality control solution.
Smart Images

Figure CN121705972B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of precision measurement technology, and in particular to a method for detecting and quantifying abnormalities in the contour lines of a workpiece surface. Background Technology
[0002] As a key link in precision manufacturing and quality control, the detection of unevenness in the surface contour of workpieces is becoming increasingly demanding in fields such as aerospace, semiconductor manufacturing, medical devices, and optical component processing. As a result, the market has put forward comprehensive requirements for "full-size adaptation, high-precision identification, strong anti-interference, and reference-free compatibility".
[0003] The existing detection technologies have some prominent technical shortcomings: (1) poor size and contour adaptability. Most solutions are designed for specific sizes or simple contours, making it difficult to simultaneously accommodate parts of different sizes such as large, medium and small. They are also less adaptable to complex structures such as free-form surfaces and non-standard parts, and lack flexibility in changeover detection. (2) it is difficult to balance accuracy and noise resistance. Optical methods are easily affected by noise from high-roughness surfaces, and high-precision detection technologies are subject to more stringent environmental requirements and cannot adapt to the complex environment of industrial sites. (3) limited detection efficiency and quantification capabilities. Contact methods take a long time to detect, and some non-contact solutions have a slow response speed. Moreover, most technologies can only make qualitative judgments on defects and cannot accurately output key quantitative indicators such as depth and length. (4) there are blank areas in the detection field without standard contour references. Traditional methods rely on preset standard models for comparison, which is difficult to apply effectively in non-standard customization and old workpiece detection scenarios.
[0004] Given these technological shortcomings, current testing technologies are insufficient to meet the development requirements of intelligent manufacturing for testing technologies, which demand "multi-scenario coverage, high-precision quantification, high-efficiency response, and flexible adaptation." Summary of the Invention
[0005] The technical problem to be solved by this invention is: in order to solve the technical problems of poor multi-size adaptability, difficulty in coordinating the optimization of accuracy and noise resistance, weak quantization capability, and detection failure in the absence of reference scenarios, existing detection technologies provide a method for detecting and quantifying the unevenness of workpiece surface contours. Through precise parameter setting, multi-round B-spline fitting, sliding window recognition logic with "inside / outside" difference of abnormal segment, false abnormal segment filtering, and Jaccard similarity coefficient iteration termination judgment, the invention achieves accurate detection, type differentiation and comprehensive quantification of unevenness.
[0006] The technical solution adopted by this invention to solve its technical problem is: a method for detecting and quantifying the unevenness of the contour line of a workpiece, comprising the following steps:
[0007] S1. Data Acquisition: The workpiece surface is scanned along a preset path using a line laser scanner to obtain two-dimensional coordinate data of multiple surface contour lines. The two-dimensional coordinate data includes x and z coordinate sequences, where x is the position information of the line direction and z is the height measurement value.
[0008] S2. Parameter settings: The parameters include the number of control points for B-spline curve fitting, the number of interpolation points, the sliding window size, the threshold for the angle between the fitted lines in the window, the Z-value proximity threshold, the Jaccard similarity coefficient threshold, the maximum number of iterations, and the threshold for the length of the false anomaly segment.
[0009] S3. Iterative Anomaly Segment Identification: Performing multiple rounds of iterative detection for a single contour line, the steps of which include:
[0010] S31. Iteration initialization: Set the initial value of the iteration round to 1, and initialize the exception flag array (initially all of them are "non-exception");
[0011] S32.B Spline Fitting and Interpolator Construction;
[0012] S33. Sliding window traversal to identify abnormal segments: The identification modes include an abnormal segment external identification mode, an abnormal segment internal identification mode, and a false abnormal segment identification mode. The abnormal segment external identification mode determines the starting point of the abnormal segment by the included angle threshold. The abnormal segment internal identification mode determines the ending point of the abnormal segment by the Z value approaching the threshold. The false abnormal segment identification mode determines the pseudo-abnormal segment by the pseudo-abnormal length threshold.
[0013] S34. Iteration Termination Judgment: If it is the first iteration, increment the iteration number by 1 and return to step S32; if it is not the first iteration, calculate the Jaccard similarity coefficient (intersection size / union size of the anomaly point sets) between the current iteration and the previous iteration's anomaly marker array; if the Jaccard similarity coefficient is greater than the Jaccard similarity coefficient threshold, terminate the iteration and use the current iteration's anomaly identification result as the initial anomaly segment; if the Jaccard similarity coefficient is less than or equal to the Jaccard similarity coefficient threshold, and the iteration number has not exceeded the maximum number of iterations, increment the iteration number by 1, update the anomaly marker array to the current iteration's result, and return to step S32; if the iteration number reaches the maximum number of iterations, terminate the iteration and use the last iteration's identification result as the initial anomaly segment;
[0014] S4. Refinement and Type Differentiation of Abnormal Segments: Extract the initial abnormal segments and determine their concavity and convexity attributes; then refine the identified abnormal segments.
[0015] S5. Anomaly Segment Quantification: Analyze and statistically process each refined continuous anomaly segment to generate a quantification result, and assign a unique number to each anomaly segment; the quantification result includes the actual height value of each anomaly point. Interpolator prediction The difference, the starting x-coordinate of the abnormal segment, the ending x-coordinate of the abnormal segment, and the length of the abnormal segment, wherein the length of the abnormal segment is the physical length or the point length;
[0016] S6. Quantification Result Output and Visualization: Multi-contour line comprehensive processing, repeat steps S2-S5 for all contour lines obtained in step S1, and summarize the quantification results of the concavity and convexity anomalies of all contour lines.
[0017] S7. Qualification judgment: Based on the quantification results of step S6, and combined with the preset qualification thresholds (maximum allowable height difference absolute value, maximum allowable abnormal segment length), determine whether the workpiece surface contour is qualified.
[0018] Therefore, this method achieves scale-adaptive modeling through multi-round non-uniform B-spline fitting, and effectively decouples the geometric differences and noise interference of multi-sized workpieces by combining a differentiated sliding window recognition mechanism and Jaccard similarity coefficient-driven iterative convergence determination. Under the condition of no standard reference contour, it completes the location of abnormal segments and the discrimination of concavity and convexity attributes by relying on the local curvature consistency of the contour line itself and global trend constraints. Finally, it outputs a structured quantization report with number, depth, length and position coordinates, which is adapted to the development needs of multi-scene coverage, high-precision quantization, high-efficiency response and flexible adaptation.
[0019] Furthermore, the parameter for the number of control points is set using a proportional coefficient method. Specifically, the proportional coefficient method is defined as follows: the total number of contour line data points is N, the proportional coefficient for the number of control points is α, and the number of control points is D. Then... ;
[0020] The control point ratio coefficient α ranges from 0.01 to 0.05, or a parameter sensitivity analysis experiment is conducted on any scan contour line, and the control point ratio coefficient corresponding to the maximum F1 score is used as the detection parameter for all contour lines.
[0021] Furthermore, the parameter setting for the number of interpolation points adopts the proportional coefficient method. Let the number of interpolation points be J, and the proportional coefficient for the number of interpolation points be β. Then: ,in ;
[0022] The interpolation point ratio coefficient β ranges from 0.5 to 2.0. Alternatively, a parameter sensitivity analysis experiment can be conducted on any scan contour line, and the interpolation point ratio coefficient with the minimum value without affecting the F1 score can be used as the detection parameter for all contour lines.
[0023] Furthermore, the parameter setting method for the included angle threshold is as follows: Define the sliding window size as W, and the included angle between the fitted lines of adjacent windows as θ. Then, the initial setting value of the included angle threshold is θ0 = median{θ1, θ2, …, θ n}, where n is the total number of sliding windows minus 1; the included angle threshold can be manually fine-tuned within ±10% of the initial value. Thus, this method, through the scale matching relationship between window size and included angle (the larger the window, the smaller the included angle), ensures that the included angle threshold is set reasonably, and can suppress noise to a certain extent while more sensitively capturing the start and end points of abnormal structural units.
[0024] Furthermore, the parameter setting method for the sliding window size is as follows: a contour line with typical concave-convex anomaly characteristics is randomly selected, and its concave-convex anomaly segments and anomaly point indices are manually labeled to form a truth label; the sliding window size W varies within the range of 30 to 60 or an appropriate range is selected based on the total number of data points. A complete detection process is performed for each W value, and the corresponding F1 score is calculated in combination with the included angle threshold. Finally, the W value that maximizes the F1 score is selected as the globally unified window size. This method automatically balances the ability to distinguish local details and the stability of the global structure by taking advantage of the negative correlation between the sliding window size and the included angle of the fitted line of adjacent windows, avoiding false detection of noise due to an excessively small window or missed detection of anomalies due to an excessively large window. This strategy significantly improves the generalization adaptability of the window size to anomaly structures of different scales by introducing scale matching constraints and an F1-driven multi-candidate selection mechanism; at the same time, by combining the median initialization of the included angle threshold and the ±10% elastic fine-tuning range, the robustness and reproducibility of anomaly discrimination under strong noise interference are ensured.
[0025] Furthermore, if the maximum F1 score corresponds to multiple window sizes, the largest window size is selected first. Thus, this selection strategy maximizes the window coverage while ensuring detection accuracy, thereby reducing computational redundancy and improving the stability of abnormal segment boundary localization. At the same time, the largest window size corresponds to a smoother fitting trend, which helps to suppress the disturbance of high-frequency noise to the angle calculation and further enhances the convergence robustness of the iteration process.
[0026] Furthermore, the parameter value for which the Z value approaches the threshold ranges from [0.05, 0.1], preferably 0.05 mm.
[0027] Furthermore, the parameter value range of the Jaccard similarity coefficient threshold is [0.9, 1], preferably 0.95.
[0028] Furthermore, the maximum number of iterations is greater than 3, preferably [5, 10].
[0029] Furthermore, the parameter setting method for the false anomaly segment length threshold is as follows: arbitrarily select 3 contour lines, perform pre-identification according to the sliding window size W, and statistically determine the maximum length of the abnormal segment that has been manually verified as noise as the threshold. This threshold can be finely adjusted according to the actual detection effect. Thus, this setting ensures that the threshold covers the span characteristics of typical noise clusters while avoiding discrimination conflicts with real small anomalies (such as knife marks and burrs), thereby effectively suppressing false positive outputs while maintaining a high recall rate.
[0030] Furthermore, the method for constructing the B-spline fitting and interpolator is as follows:
[0031] For the first iteration, a 3rd-order non-uniform B-spline curve is fitted using all contour data points.
[0032] If it is not the first iteration, a non-uniform B-spline curve of degree 3 is fitted using normal data points after removing the abnormal markers from the previous round; high-density sampling points are generated based on the fitting results, and a linear interpolator is constructed to output the height prediction value corresponding to any horizontal coordinate.
[0033] Furthermore, the identification method for the abnormal segment outer identification pattern is as follows: in the region outside the abnormal segment, scan point by point along the contour line with a sliding window size W, and... A line is fitted using the least squares method from w data points within the window, where w is the window size. The rate of change of the slope of the fitted line is used as a local curvature proxy index, and its calculation formula is as follows:
[0034]
[0035] Where k n k n-1 The nth and the nth respectively The slope of the least-squares fitted line with a sliding window;
[0036] like Continue sliding the window; if Mark this position as the start of the abnormal segment q, and switch to the abnormal segment identification mode;
[0037] Therefore, this anomaly segment identification mode dynamically captures local curvature changes in the contour line by the slope change rate, effectively distinguishing between real minute concavities and convexities and noise disturbances, avoiding the amplification effect of higher-order derivatives on noise, and significantly improving the noise resistance robustness of anomaly identification.
[0038] Furthermore, the analytical expression for the slope of the fitted line is: Let there be n data points within the window. , The mean of the x-axis is... The vertical axis represents the mean, and the horizontal axis represents the deviation of the mean. The mean deviation of the ordinate is Then the slope of the window-fitted line is:
[0039]
[0040] Furthermore, the method for identifying the pattern within the abnormal segment is as follows: within the abnormal segment, define the corresponding current sliding window as... Where i is the index of the left endpoint of the window, i+w-1 is the index of the right endpoint of the window, and the actual height value of the right endpoint of the window. The interpolator predicts the height value of the right endpoint of the window. Then the following relation is satisfied: ;
[0041] when If the Z value is close to the threshold, then The sliding window continues to move; when If the Z value is close to the threshold, then mark that position as the end point e of the abnormal segment.
[0042] Therefore, this strategy directly quantifies the degree of local deformation through interpolation error, avoids the accumulation of bias introduced by fitting, and ensures that the output results have engineering interpretability and process consistency.
[0043] Furthermore, when faced with noise interference on a high-roughness surface, the noise only causes localized, minute fluctuations, resulting in pseudo-anomaly regions that are remarkably short. Compared to the continuous, longer true anomaly segments corresponding to geometric depressions / protrusions, noise pseudo-anomalies often cover only a few data points and are closely adjacent to normal contour points. Based on this characteristic, let the anomaly segment length be defined as C. The identification method for the false anomaly segment identification pattern is as follows:
[0044] When C < the false anomaly segment length threshold, the anomaly segment is reset as a normal segment; when C ≥ the false anomaly segment length threshold, the anomaly segment is determined to be a real anomaly segment. Thus, through the false anomaly segment length threshold filtering mechanism, false anomaly segments are directly determined to be invalid and eliminated, avoiding them from being falsely detected as real geometric depressions / protrusions, thereby significantly improving the robustness and accuracy of contour anomaly detection.
[0045] Furthermore, in step S3, after the false anomaly segment identification mode determines the anomaly segment as a real anomaly segment, it uses the interpolator prediction value to replace the height value of all points in the segment, and then switches to the anomaly segment external identification mode; thus, when the sliding window continues to slide, the prediction value is used to fit the points of the newly entered window, avoiding the current anomaly segment from interfering with the detection of subsequent anomaly segments.
[0046] Further, in step S34, the analytical expression for the Jaccard similarity coefficient is: Let the first... The set of outliers obtained by B-spline fitting is , No. The set of outliers obtained by B-spline fitting is ,but:
[0047] Jaccard similarity coefficient ,
[0048] in:
[0049] This represents the number of elements in the intersection of set A and set B;
[0050] This represents the number of elements in the union of set A and set B.
[0051] Further, step S4 includes the following sub-steps:
[0052] S41. Extract continuous abnormal sub-regions from the initial abnormal segment;
[0053] S42. Calculate the actual height values of each point within each segment of a continuous abnormal sub-region. Interpolator prediction The relative positions are used to obtain three distribution characteristics: lower points, upper points, and equal points;
[0054] If the number of points below is greater than or equal to the number of points above, it is determined to be a concave anomaly; otherwise, it is determined to be a convex anomaly. Equal points are not included in the type determination.
[0055] Therefore, this concavity / convexity attribute discrimination mechanism is based on local geometric relationships rather than global reference contours, realizing structured anomaly semantic parsing under no-reference conditions; its judgment logic strictly follows the local reference surface constructed by the B-spline interpolator in the anomaly segment, ensuring that the definition of "concave / convex" is consistent with the direction of physical deformation in machining, and avoiding misclassification caused by global trend drift.
[0056] S43. Refine the abnormal sub-regions using the following method:
[0057] If it is a concave outlier segment, remove the points above the predicted value and keep the points below and the points with the same value.
[0058] If it is a convex anomaly segment, remove the points below the predicted value and keep the points above and the points with the same value;
[0059] If the refined part is split into multiple contiguous sub-regions, only the longest sub-region is retained;
[0060] This refinement mechanism achieves strict discrimination of concavity and convexity attributes through geometric position constraints, eliminating points that do not conform to the main trend (concave or convex) and ensuring the monotonicity of the abnormal segment attributes. At the same time, the length-first retention strategy ensures that the output abnormal segment has complete structural representation capabilities, providing a stable benchmark for subsequent structured quantification parameters such as depth, length, and coordinates. Thus, while suppressing pseudo-anomaly splitting, it ensures the integrity and measurability of the abnormal geometric features.
[0061] Furthermore, in step S41, the extraction method of the continuous abnormal sub-region is as follows: traverse the abnormal marker array, divide the continuous abnormal points into a sub-region, record the start index and end index of each sub-region, and extract the original contour data according to the index range to generate a sub-region point set; each sub-region point set independently participates in the subsequent concavity and convexity discrimination and refinement process to ensure that the abnormal structure is completely decoupled in space; this extraction strategy avoids cross-region interference, keeps the geometric semantics of a single sub-region cohesive and unified, and lays the data foundation for high-precision structured representation.
[0062] Furthermore, the criterion for judging the distribution characteristics in step S42 is as follows:
[0063] like If , then they are equal points;
[0064] like If , then it is the point above;
[0065] like Then it is the point below.
[0066] Furthermore, in step S43, if the number of continuous sub-regions is 0 after refinement, the abnormal segment is directly discarded.
[0067] Furthermore, in step S5, the quantization result also includes the type of each anomaly segment, the total number of anomaly points, the abscissa of each anomaly point, the actual height measurement value, and the reference model prediction value. Thus, this structured quantization result supports binary discrimination of anomaly types (protrusions / depressions), sub-millimeter precision output of depth and length, and backtracking of the spatial coordinates and deviation values of the entire anomaly point set.
[0068] Further, in step S7, the set of all contour lines of the workpiece surface contour is defined as L, for any contour line Its refined set of continuous abnormal segments is For each abnormal segment Let the absolute value of its maximum height difference be recorded. , length is The preset acceptable height difference threshold is... The preset length qualification threshold is ;
[0069] If the conditions are met: All have and If the surface contour of the workpiece is satisfactory, it is deemed to be acceptable; otherwise, it is deemed unacceptable, and all non-compliant components are output. or Details of abnormal segments.
[0070] The beneficial effects of this invention are:
[0071] 1. The workpiece surface contour contour anomaly detection and quantification method of the present invention has multi-dimensional technical advantages. Through a scientific and complete parameter setting system, combined with multi-round B-spline fitting, it not only ensures the basic reliability of the first round of full data fitting, but also avoids interference by removing abnormal points in the non-first round of fitting, thus greatly improving the accuracy of the reference model.
[0072] 2. The workpiece surface contour anomaly detection and quantification method of the present invention adopts a differentiated sliding window detection + false anomaly segment filtering strategy. First, it judges the fitting angle outside the anomaly segment to capture the local trend change caused by noise or real defects and lock the starting point of the anomaly segment. After entering the anomaly segment recognition mode, it does not need to repeatedly fit the straight line, but only determines the endpoint by comparing the height difference. Since the length of noise pseudo-anomalies is extremely short, the false anomaly segment length threshold filtering mechanism directly judges these noise pseudo-anomalies shorter than the threshold as invalid and removes them. This design significantly reduces the amount of computation while removing noise, ensuring the anti-interference ability in high roughness scenarios and improving the detection efficiency, achieving dual optimization of accuracy and noise resistance.
[0073] 3. The workpiece surface contour anomaly detection and quantification method of the present invention relies on the dual termination determination of Jaccard similarity coefficient and maximum number of iterations, which ensures the stability of anomaly identification results and avoids efficiency loss caused by invalid iterations.
[0074] 4. The workpiece surface contour line concavity and convexity anomaly detection and quantification method of the present invention accurately distinguishes concave and convex anomaly types by clarifying the rule that equal points do not participate in type judgment and the targeted fine-tuning strategy. Combined with the full-dimensional quantification of point-level height difference, segment-level position and length and unique number management, it provides accurate data support for quality analysis.
[0075] 5. The workpiece surface contour anomaly detection and quantification method of the present invention has comprehensive characteristics of full-size adaptation (only need to scan appropriate contour data points), complex contour compatibility (adapting to planes to freeform surfaces), and reference-free detection compatibility (generating normal contour reference values through multi-round iterative fitting). It completely breaks through the limitations of existing technologies in terms of adaptability, anti-interference, quantification capability, and application in reference-free scenarios. It can efficiently adapt to the quality control requirements of intelligent manufacturing production lines and provide a reliable solution for surface inspection of various precision workpieces and non-standard parts. Attached Figure Description
[0076] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0077] Figure 1 This is an overall flowchart of the workpiece surface contour anomaly detection and quantification method of the present invention.
[0078] Figure 2 This is a logic diagram for iterative anomaly segment identification.
[0079] Figure 3 This is a parameter sensitivity analysis plot of the B-spline control point scaling factor on the F1 score.
[0080] Figure 4 This is a parameter sensitivity analysis plot of the B-spline interpolation point scaling factor on the F1 score.
[0081] Figure 5 This is a graph showing the relationship between window size and the included angle threshold.
[0082] Figure 6 This is a graph showing the parametric sensitivity of window size to F1 score.
[0083] Figure 7 This is a parameter sensitivity analysis plot of the F1 score as the Z value approaches the threshold.
[0084] Figure 8 This is a graph showing the parametric sensitivity of the Jaccard similarity coefficient threshold to the F1 score.
[0085] Figure 9 This is a parameter sensitivity analysis diagram of the Jaccard similarity coefficient threshold on the number of iteration rounds.
[0086] Figure 10 This is a screenshot of the detection results from the filter module that removes false anomalies.
[0087] Figure 11 This is a screenshot of the detection results from the filter module that did not remove false anomalies.
[0088] Figure 12 This is a schematic diagram of a surface contour obtained by a line laser scanner.
[0089] Figure 13 This is the overall inspection result diagram of the third contour line of the cylindrical curved surface workpiece.
[0090] Figure 14 This is a detailed view of the convex anomaly segment 3-1.
[0091] Figure 15 This is a detailed view of section 3-2 of the concave anomaly.
[0092] Figure 16This is a summary table of the abnormality quantification results of the third contour line of the cylindrical curved surface workpiece.
[0093] Figure 17 This is a schematic diagram of a spherical workpiece.
[0094] Figure 18 This is the overall inspection result diagram of the 25th contour line of the spherical workpiece.
[0095] Figure 19 This is a detailed view of section 25-1 of the concave anomaly.
[0096] Figure 20 This is a detailed view of section 25-2 of the convex anomaly.
[0097] Figure 21 This is a summary table of the abnormality quantification results for the 25th contour line of the spherical workpiece.
[0098] Figure 22 This is a schematic diagram of a freeform surface workpiece.
[0099] Figure 23 This is the overall inspection result diagram of the 36th contour line of the freeform surface workpiece.
[0100] Figure 24 This is a detailed view of section 36-1 of the concave anomaly.
[0101] Figure 25 This is a detailed view of the convex anomaly segment 36-2.
[0102] Figure 26 This is a summary table of the abnormality quantification results for the 36th contour line of a freeform surface workpiece. Detailed Implementation
[0103] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0104] Example 1: This example, using the detection of the surface contour line of a cylindrical curved workpiece, details the implementation process of the present invention as follows:
[0105] Reference Figure 1 The specific implementation steps of the method for detecting and quantifying the unevenness of the workpiece surface contour include:
[0106] S1. Data Acquisition: Refer to... Figure 12 As shown, the line laser scanner is positioned directly above the cylindrical curved workpiece and scans at a uniform speed along the axial direction; the data point interval of the line laser scanner is 0.2 mm; it acquires (x, z) data of 50 contour lines, with each line containing 466 data points, x∈[24.8, 117.8] mm, z∈[35.2360, 50.9960] mm;
[0107] S2. Parameter setting: The third contour line was selected for parameter sensitivity analysis, and the results were as follows:
[0108] The B-spline control point scale factor is set to 0.01, the B-spline interpolation point scale factor is set to 0.2, and the number of control points is 466 × 0.01 = 4.66, taking the integer part as 4.
[0109] Number of interpolation points = 466 × 0.2 = 93.2, take 93;
[0110] The sliding window size is 46;
[0111] Angle threshold = 0.053° (median 0.038°, increased by 10%).
[0112] The Z-value is taken to be close to the threshold of 0.05 mm;
[0113] The Jaccard similarity coefficient threshold is set to 95%.
[0114] The maximum number of iterations is set to 10;
[0115] Take any 3 contour lines, initially set the false anomaly segment length threshold to 5, perform pre-detection, determine the maximum false anomaly segment length to 9, and set the false anomaly segment length threshold to 9 for formal detection;
[0116] S3. Iterative anomaly segment identification:
[0117] First iteration: Fit a non-uniform B-spline curve of order 3 using all data points. After sliding window traversal, there are 6 outlier segments, namely [48.6, 50.4], [52.6, 57.2], [68.4, 76.0], [76.4, 96.2], [102.4, 107.2], and [109.6, 113.2], with point lengths of 10, 24, 39, 100, 25, and 19, respectively.
[0118] Rounds 2-3: Fit B-splines with normal data after removing outliers, and repeat sliding window identification;
[0119] After the 4th iteration: Jaccard similarity coefficient = 1.00 (≥95%), the iteration is terminated, refer to... Figure 13 There are two initial outlier segments, x∈[52.8, 55.4] and [67.6, 74.4].
[0120] S4. Differentiation and Refinement of Abnormal Segment Types:
[0121] Statistical anomaly segment 1: Refer to Figure 14 If there is 1 point below, 13 points above, and 0 points of equal value, it is determined to be a convex anomaly.
[0122] Refine anomaly segment 1: Remove 1 lower point, leaving 13 points (without splits), as the final convex anomaly segment;
[0123] Statistical anomaly segment 2: Refer to Figure 15 The number of points below is 35, the number of points above is 0, and the number of points of equal value is 0, which is judged as a concave anomaly;
[0124] Fine-tuned abnormal segment 2: No fine-tuning is required; it can be directly used as the final concave abnormal segment.
[0125] S5. Quantization of Abnormal Segments:
[0126] Anomaly quantification results data reference Figure 16 ,
[0127] Anomaly segment 1: Δz∈[0.0926, 0.6170]mm; start and end x=52.8~55.2mm, physical length 2.4mm, numbered "convex anomaly segment 3-1";
[0128] Anomaly segment 2: Δz∈[-1.6871, -0.0015]mm; start and end x=67.6~74.4mm, physical length 6.8mm, numbered "concave anomaly segment 3-2".
[0129] S6. Quantitative Result Output and Visualization: A total of 3 concave anomaly segments and 3 convex anomaly segments were detected in the remaining 49 contour lines.
[0130] S7. Acceptance judgment: The preset maximum allowable length is 5mm. The length of "concave abnormal section 3-2" is 6.8mm > 5mm. Therefore, the surface quality of the cylindrical curved workpiece is deemed unacceptable.
[0131] Based on the detection results, a total of 4 concave abnormal segments and 4 convex abnormal segments were detected among the 50 contour lines. An Excel table of abnormal point height differences was output. An overall detection result image and a local detail image of the abnormal segments were generated to intuitively show the location and type of the abnormality.
[0132] in:
[0133] The F1 score is defined as: Accuracy P: Recall rate R: F1 score: Where: TP is the number of points correctly identified as abnormal, FP is the number of points incorrectly identified as abnormal, and FN is the number of points incorrectly identified as normal.
[0134] The specific steps of the parameter sensitivity analysis experiment are as follows:
[0135] (1) Before the experiment begins, the index value of the actual abnormal segment is determined manually;
[0136] (2) Conduct sensitivity analysis experiment on sliding window size parameters: the control point proportional coefficient is 0.01, the interpolation point proportional coefficient is 2, the included angle threshold is the value of the median adjusted by 10%, the Z value is close to the threshold of 0.05, and the Jaccard similarity coefficient is 0.95. The above parameters are all conservative estimates that can detect good results. The sliding window is varied in the range of 30~60, and increases by 1 each time. The F1 score under different windows is calculated.
[0137] (3) Conduct sensitivity analysis of B-spline control point proportional coefficient parameters: take the window size as the value corresponding to the maximum F1 score analyzed in step (2), the B-spline control point proportional coefficient changes in the range of 0.01~0.2, increasing by 0.01 each time, and take the values of other parameters according to step (2) to calculate the F1 score under different control point proportional coefficients;
[0138] (4) Conduct sensitivity analysis experiment of interpolation point proportional coefficient parameter: the interpolation point proportional coefficient varies in the range of 0.2~3, increasing by 0.2 each time. The proportional coefficient of B spline control point is taken as the value corresponding to the maximum F1 score analyzed in step (3). The other parameters are the same as in step (3). Calculate the F1 score under different interpolation point proportional coefficients.
[0139] (5) Conduct sensitivity analysis experiment of Z value approach threshold parameter: Z value approach threshold varies in the range of 0~0.5, increasing by 0.05 each time. The interpolation point proportional coefficient is taken as the value corresponding to the maximum F1 score analyzed in step (4). The other parameters are the same as in step (4). Calculate the F1 score under different Z value approach thresholds.
[0140] (6) Conduct a sensitivity analysis experiment on the Jaccard similarity coefficient threshold parameter: the Jaccard similarity coefficient threshold varies in the range of 0.9~1, increasing by 0.01 each time. The Z value is taken as the value corresponding to the maximum F1 score analyzed in (5) when it is close to the threshold. The other parameters are consistent with step (4). Calculate the F1 score and the final actual iteration round under different Jaccard similarity thresholds.
[0141] like Figure 3 As shown, the control point scale factor of the B-spline is between 0.01 and 0.07, and the F1 score is above 0.9, indicating good detection effect. The F1 score is the largest at 0.01. After exceeding 0.07, the F1 score shows a steep drop trend as the control point scale factor increases. The F1 score of concave anomalies drops sharply to 0, indicating that concave anomaly segments can no longer be detected correctly. The reason is that as the number of control points increases, the B-spline fitting curve becomes more and more complex, fitting both concave and convex trends into the curve, resulting in the inability to correctly detect concave and convex anomalies.
[0142] like Figure 4As shown, when the interpolation point ratio coefficient changes in the range of 0.2 to 3, the F1 score does not change. Since there are many data points on the detected contour line, 0.2 times the number of interpolation points is sufficient for interpolation accuracy, so it does not have a significant impact on the F1 score.
[0143] like Figure 5 As shown, the included angle threshold generally decreases as the window size increases.
[0144] like Figure 6 As shown, when the sliding window size varies from 30 to 60, the F1 score reaches its maximum at 39, 45, and 46, and the F1 score is above 0.88 for all three positions, indicating excellent detection performance.
[0145] like Figure 7 As shown, when the Z value approaches the threshold and varies within the range of 0 to 0.5, the maximum F1 score is reached at 0.05. After that, as the Z value gradually increases towards the threshold, the F1 score gradually decreases. However, when the Z value approaches the threshold at 0, the F1 score will also be 0, and detection cannot be achieved normally because the measured value and the reference value provided by the fitted B-spline curve will not be completely consistent. Therefore, 0.05 is preferred for detection.
[0146] like Figure 8 , Figure 9 As shown, when the Jaccard similarity coefficient threshold varies within the range of 0.9 to 1, the F1 score and the number of iterations do not change. This parameter is not sensitive to the detection results within this range, and a conservative estimate of 0.95 is usually recommended.
[0147] In iterative anomaly segment identification, a differentiated traversal of contour line data is employed using an "external anomaly segment identification mode" and an "internal anomaly segment identification mode" to achieve accurate identification of anomaly segments and filtering of false anomalies, as detailed below:
[0148] 1. Abnormal segment external identification mode (initial mode):
[0149] Select a continuous set of data points with a length equal to the preset sliding window size as the initial window. Calculate the dot product of the mean deviation of the horizontal coordinate and the mean deviation of the vertical coordinate within the window. Divide this product by the sum of the squares of the mean deviations of the horizontal coordinates to obtain the slope of the fitted line of the initial window.
[0150] Slide the window backward by one data point along the contour line extension direction, and repeat the above slope calculation process for the data in the new window; convert the slope of the fitted line between two adjacent windows into an angle, and calculate the absolute value of the angle; if the absolute value is less than the preset angle threshold, continue to slide the window backward and repeat the slope calculation and angle judgment; if the absolute value is greater than or equal to the preset angle threshold, mark the current window start position as the start point of the abnormal segment, and switch to the abnormal segment recognition mode;
[0151] 2. Abnormal segment identification mode:
[0152] The window continues to slide backward by one data point along the contour line, and the linear fitting operation is no longer performed;
[0153] Extract the x-coordinate of the right endpoint of the window, obtain the predicted height value at that location through a linear interpolation model, and calculate the absolute value of the difference between the actual measured height value and the predicted height value at that point.
[0154] If the absolute value of the difference is greater than the preset Z value and close to the threshold, continue sliding the window backward and repeat the difference judgment; if the absolute value of the difference is less than or equal to the preset Z value and close to the threshold, mark the current position as the end of the abnormal segment;
[0155] 3. Filtering of false anomaly segments:
[0156] Calculate the length of the abnormal segment, which is the difference between the end index and the start index of the abnormal segment plus 1;
[0157] If the length of the abnormal segment is less than or equal to the preset false abnormal segment length threshold, it is determined to be a false abnormal segment, and the status of the corresponding position in the abnormal tag array is reset to "non-abnormal".
[0158] If the length of the abnormal segment is greater than the preset threshold for the length of the false abnormal segment, it is determined to be a true abnormal segment. The state of the corresponding position of the segment in the abnormal marker array is set to "abnormal". The height measurement values of all data points in the segment are replaced by the height prediction values output by the linear interpolation model. After the replacement is completed, the system switches back to the abnormal segment external recognition mode.
[0159] Ablation experiment of the false anomaly filtering module: To illustrate how this method removes false anomaly segments caused by large noise such as roughness, the details are as follows:
[0160] The third contour line was selected for ablation experiments. The false anomaly length threshold was set to 0, meaning no false anomalies were filtered out. The detection results are as follows: Figure 10 As shown, only the points identified as abnormal in this detection are plotted. It was found that in addition to detecting semantic depressions and protrusions, this method also detects multiple small depressions and protrusions caused by large roughness or surface burrs as semantic depressions and protrusions.
[0161] Setting the false anomaly segment length threshold to 6, the detection results are as follows: Figure 11 As shown, only semantic depressions and protrusions are detected as anomalous segments. The experiment proves that the false anomalous segment filtering module can effectively eliminate misjudgments caused by roughness, etc., and significantly improve the robustness and accuracy of semantic feature recognition.
[0162] Example 2: Combining spherical workpieces (such as...) Figure 17 The implementation process of the present invention is described in detail below using a surface contour line detection example (shown).
[0163] The specific implementation steps of the method for detecting and quantifying anomalies in the contour lines of a workpiece include:
[0164] S1. Data Acquisition: The line laser scanner is positioned directly above the spherical workpiece. The data point interval of the line laser scanner is 0.2 mm. Acquire (x, z) data of 50 contour lines on the surface of the spherical workpiece, with each line containing 1484 data points, x∈[11.4, 308.0] mm, z∈[-50.9960, -35.2360] mm.
[0165] S2. Parameter Settings: The 25th contour line was selected for parameter sensitivity analysis. The B-spline control point scale factor was set to 0.01, and the B-spline interpolation point scale factor was set to 0.2. The number of control points was 1484 × 0.01 = 14.84, and the integer part was 14. The number of interpolation points was 1484 × 0.2 = 296.8, and the integer part was 296. The sliding window size was found to be above 0.94 in the range of 30 to 60, and the F1 score was the largest when the window size was 30. The parameter was set to 30, and the corresponding included angle threshold was 0.043° (median 0.039°, increased by 10%). The Z value threshold was set to 0.05mm, the Jaccard similarity coefficient threshold was set to 95%, and the maximum number of iterations was 10. Three contour lines were randomly selected, and the false anomaly segment length threshold was initially set to 5. Pre-detection was performed, and the maximum false anomaly segment length was found to be 8. The false anomaly segment length threshold for formal detection was set to 8.
[0166] S3. Iterative anomaly segment identification:
[0167] First iteration: Fit a non-uniform B-spline curve of order 3 using all data points. After sliding window traversal, there are 5 outlier segments, namely [51.0, 81.2], [259.6, 272.4], [272.8, 281.0], [282.0, 283.6], and [303.4, 308.0], with point lengths of 152, 65, 42, 9, and 24, respectively.
[0168] Second iteration: Fit B-splines with normal data after removing outliers, and repeat sliding window identification;
[0169] After the third iteration: Jaccard similarity coefficient = 1.00 (≥95%), the iteration terminates, and there are two initial outlier segments (see reference). Figure 18 ), respectively x∈[62.6, 68.2] and [265.2, 269.0].
[0170] S4. Detailed Repair and Type Differentiation of Abnormal Segments:
[0171] Statistical anomaly segment 1: Refer to Figure 19There are 29 points below, 0 points above, and 0 points of equal value, which is judged as a concave anomaly;
[0172] Fine-tuned abnormal segment 1: No fine-tuning is required; it can be directly used as the final concave abnormal segment.
[0173] Statistical anomaly segment 2: Refer to Figure 20 The number of points below is 1, the number of points above is 19, and the number of points with the same value is 0, which is determined to be a convex anomaly;
[0174] Refined anomaly segment 2: Remove 1 lower point, leaving 18 points that are not split, which are used as the final convex anomaly segment;
[0175] S5. Quantization of abnormal segments: such as Figure 21 As shown,
[0176] Abnormal segment 1:
[0177] Point level: Δz∈[-0.9997, -0.0228]mm;
[0178] Segment level: Start and end x = 62.6~68.2mm, physical length 5.6mm, numbered "Concave Anomalous Segment 25-1";
[0179] Abnormal segment 2:
[0180] Point level: Δz∈[0.0162, 0.9788]mm;
[0181] Segment level: Start and end x = 265.2~268.8mm, physical length 3.6mm, numbered "convex anomaly segment 25-2";
[0182] The overall abnormal segment identification results are as follows: Figure 18 As shown in the enlarged view of the "concave anomaly segment 25-1", see below. Figure 19 As shown in the enlarged view of "convex anomaly segment 25-2", Figure 20 As shown, the anomaly quantification results data are as follows: Figure 21 As shown.
[0183] S6. Quantitative results output and visualization: A total of 4 concave anomaly segments and 3 convex anomaly segments were detected in the remaining 49 contour lines;
[0184] S7. Acceptance judgment: The preset maximum allowable length is 5mm. The length of "concave abnormal section 25-1" is 5.6mm > 5mm. Therefore, the surface quality of the spherical workpiece is deemed unacceptable.
[0185] Implementation Results: A total of 5 concave anomalies and 4 convex anomalies were detected from 50 contour lines. An Excel table of anomaly point height differences was output. An overall detection result image and local detail images of the anomalies were generated, visually displaying the location and type of anomalies. The average F1 score of the detection results reached 0.9485, indicating high detection accuracy. The total time for single contour line detection, quantization, drawing, and outputting the Excel table was 2.67 seconds, while the time for detecting and outputting the detection results on the terminal was only 0.53 seconds. With parallel processing programming, it can process 18-23 contour lines per second. The CPU used was an AMD Ryzen 5, 6-core, 12 logic processors.
[0186] Example 3: The implementation process of this invention is explained in detail below, using an example of surface contour line detection for free-form surface workpieces:
[0187] The scanned freeform surface workpiece, such as Figure 22 As shown, zebra stripes are added to the surface to show its uneven shape.
[0188] The specific implementation steps of the method for detecting and quantifying anomalies in the contour lines of a workpiece include:
[0189] S1. Data Acquisition: The line laser scanner is positioned directly above the spherical workpiece. The data point interval of the line laser scanner is 0.2 mm. Acquire (x, z) data of 50 contour lines on the surface of the spherical workpiece, with each line containing 1484 data points, x∈[13.2, 309.8] mm, z∈[-47.5590, -32.3270] mm.
[0190] S2. Parameter Settings: The 36th contour line was selected for parameter sensitivity analysis. The B-spline control point scale factor was set to 0.01, and the B-spline interpolation point scale factor was set to 0.2. The number of control points was 1484 × 0.01 = 14.84, and the integer part was 14. The number of interpolation points was 1484 × 0.2 = 296.8, and the integer part was 296. The sliding window size was found to be above 0.95 in the range of 30 to 60, and the F1 score was the largest when the window size was 36. The window size was set to 36, and the corresponding included angle threshold was 0.031° (median 0.028°, adjusted up by 10%). The Z value was close to the threshold of 0.05 mm, the Jaccard similarity coefficient threshold was set to 95%, and the maximum number of iterations was 10. Three contour lines were randomly selected, and the false anomaly segment length threshold was initially set to 5. Pre-detection was performed, and the maximum false anomaly segment length was found to be 6. The false anomaly segment length threshold for formal detection was set to 6.
[0191] S3. Iterative anomaly segment identification:
[0192] First iteration: Fit a non-uniform B-spline curve of order 3 using all data points. After sliding window traversal, there are 4 outlier segments, namely [39.0, 41.0], [52.8, 83.6], [141.2, 161.2], and [162.6, 171.8], with point lengths of 11, 155, 101, and 47, respectively.
[0193] Second iteration: Fit B-splines with normal data after removing outliers, and repeat sliding window identification;
[0194] After the third iteration: Jaccard similarity coefficient = 0.9821 (≥95%), the iteration terminated, and there were two initial outlier segments (see reference). Figure 23 ), respectively x∈[65.4,71.6] and [155.8,160.4].
[0195] S4. Detailed Repair and Type Differentiation of Abnormal Segments:
[0196] Statistical anomaly segment 1: Refer to Figure 24 There are 31 points below, 1 point above, and 0 points of equal value, which is determined to be a concave anomaly;
[0197] Refined anomaly segment 1: Remove one upper point, leaving 31 points that are not split, which are used as the final concave anomaly segment;
[0198] Statistical anomaly segment 2: Refer to Figure 25 The number of points below is 0, the number of points above is 24, and the number of points with the same value is 0, which is determined to be a convex anomaly;
[0199] Fine-tuned anomaly segment 2: No fine-tuning required, directly used as the final convex anomaly segment;
[0200] S5. Quantization of Abnormal Segments: Refer to... Figure 26 The quantization results shown are as follows:
[0201] Abnormal segment 1:
[0202] Point level: Δz∈[-1.0454, -0.0566]mm;
[0203] Segment level: Start and end x = 65.4~71.4mm, physical length 6.0mm, numbered "Concave Anomalous Segment 36-1";
[0204] Abnormal segment 2:
[0205] Point level: Δz∈[0.0065, 1.0546]mm;
[0206] Segment level: start and end x = 155.8~160.4mm, physical length 4.6mm, numbered "convex anomaly segment 36-2";
[0207] The overall abnormal segment identification results are as follows: Figure 23As shown in the enlarged view of the "concave anomaly segment 36-1", see below. Figure 24 As shown in the enlarged view of "convex anomaly segment 36-2", Figure 25 As shown, the anomaly quantification results data are as follows: Figure 26 As shown.
[0208] S6. Quantitative results output and visualization: A total of 6 concave anomaly segments and 7 convex anomaly segments were detected in the remaining 49 contour lines;
[0209] S7. Acceptance judgment: The maximum allowable length is preset to 5mm. The length of "concave abnormal section 36-1" is 6.0mm > 5.0mm. Therefore, the surface quality of the free-form workpiece is deemed unacceptable.
[0210] Results: A total of 7 concave anomalies and 8 convex anomalies were detected from 50 contour lines. An Excel table showing the height differences of the anomaly points was output. An overall detection result image and detailed images of the anomalies were generated, visually displaying the location and type of the anomalies. The average F1 score of the detection results reached 0.9643, indicating high detection accuracy. The total time for detecting, quantizing, drawing, and outputting the Excel table for a single contour line was 2.61 seconds, while the time for detecting and outputting the results on the terminal was only 0.52 seconds. With parallel processing programming, it can process 20-24 contour lines per second. The CPU used was an AMD Ryzen 5 with 6 cores and 12 logic processors.
[0211] In summary, the workpiece surface contour anomaly detection and quantification method provided by this invention is more adaptable to the complex structures of free-form surfaces and non-standard parts compared with existing detection technologies. It significantly improves detection accuracy and efficiency, and its accuracy and noise resistance are significantly better than traditional threshold methods and template matching methods. It is suitable for complex industrial environments and meets the development needs of intelligent manufacturing for detection technology to have "multi-scenario coverage, high-precision quantification, high-efficiency response, and flexible adaptation".
[0212] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.
Claims
1. A method for detecting and quantifying anomalies in the contour lines of a workpiece, characterized in that, Includes the following steps: S1. Data Acquisition: Scan the workpiece surface along a preset path to obtain two-dimensional coordinate data of multiple surface contour lines; S2. Parameter settings: The parameters include the number of control points for B-spline curve fitting, the number of interpolation points, the sliding window size, the threshold for the angle between the fitted lines in the window, the Z-value proximity threshold, the Jaccard similarity coefficient threshold, the maximum number of iterations, and the threshold for the length of the false anomaly segment. S3. Iterative anomaly segment identification: Perform multiple rounds of iterative detection for a single contour line, identify anomaly segments and determine the start and end points of the anomaly segments. The length of the anomaly segment is obtained based on the two-dimensional coordinates of the start and end points provided by S1. The authenticity of the anomaly segment is determined based on its length. The Jaccard similarity coefficient is dynamically updated in each iteration. After the iteration is completed, the identification result of the last round is used as the initial anomaly segment. S4. Refinement and Type Judgment of Abnormal Segments: Extract the initial abnormal segments and determine their concavity and convexity attributes; then refine the identified abnormal segments. S5. Abnormal Segment Quantification: Analyze and statistically process each refined continuous abnormal segment to generate quantitative results, and assign a unique number to each abnormal segment; S6. Quantification Result Output and Visualization: Multi-contour line comprehensive processing, repeat steps S2-S5 for all contour lines obtained in step S1, and summarize the quantification results of the concavity and convexity anomalies of all contour lines. S7. Acceptance judgment: Based on the quantification results of step S6, and combined with the preset acceptance threshold, determine whether the surface contour of the workpiece is acceptable.
2. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that: The two-dimensional coordinate data in step S1 includes a sequence of x and z coordinates, where x is the position information of the line direction and z is the height measurement value.
3. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that: In step S2, the parameters for the number of control points and the number of interpolation points are set using the proportional coefficient method. Among them, the control point ratio coefficient ranges from 0.01 to 0.05, or any scan contour line is selected for parameter sensitivity analysis experiment, and the control point ratio coefficient corresponding to the maximum F1 score is used as the detection parameter for all contour lines. The interpolation point ratio coefficient ranges from 0.5 to 2.
0. Alternatively, a single scan profile can be selected for parameter sensitivity analysis. The interpolation point ratio coefficient with the minimum value that does not affect the F1 score can be used as the detection parameter for all profiles.
4. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that: In step S2, the sliding window size is defined as W, and the angle between the fitted lines of adjacent windows is defined as θ. Then, the parameter θ0 of the angle threshold satisfies the formula: , where n is the total number of sliding windows minus 1; the included angle threshold can be manually fine-tuned within a range of ±10% of the initial value; The parameter setting method for the sliding window size is as follows: randomly select a contour line with typical concave and convex anomalies, manually label its concave and convex anomaly segments and anomaly point indices to form true value labels; the sliding window size W varies within the range of 30 to 60 or selects an appropriate range based on the total number of data points, performs a complete detection process for each W value, calculates the corresponding F1 score in combination with the included angle threshold, and finally selects the W value that maximizes the F1 score as the globally unified window size.
5. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 4, characterized in that: If the maximum F1 score corresponds to multiple window sizes, the largest window size should be selected first.
6. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that, In step S2, the parameter value range for the Z value to be close to the threshold is [0.05, 0.1]; the parameter value range for the Jaccard similarity coefficient threshold is [0.9, 1]; and the maximum number of iterations is greater than 3. The parameter setting method for the false anomaly segment length threshold is as follows: randomly select 3 contour lines, perform pre-identification according to the sliding window size W, and count the maximum length of the abnormal segment that has been manually verified as noise as the threshold. It can be finely adjusted according to the actual detection effect.
7. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 6, characterized in that: The parameter for the Z value to be close to the threshold is 0.05 mm; the parameter for the Jaccard similarity coefficient threshold is 0.95; and the range of the maximum number of iterations is [5, 10].
8. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that, Step S3 includes the following sub-steps: S31. Iteration initialization: Set the initial value of the iteration round to 1, and initialize the exception flag array, initially all of which are "non-exception"; S32.B Spline Fitting and Interpolator Construction; S33. Sliding window traversal to identify abnormal segments: The identification modes include an abnormal segment external identification mode, an abnormal segment internal identification mode, and a false abnormal segment identification mode. The abnormal segment external identification mode determines the starting point of the abnormal segment by using an included angle threshold, and the abnormal segment internal identification mode determines the ending point of the abnormal segment by using a Z value close to a threshold. The false anomaly segment identification mode determines false anomaly segments by using a false anomaly length threshold. S34. Determine whether the iteration should terminate.
9. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 8, characterized in that, The method for constructing the B-spline fitting and interpolator in step S32 is as follows: For the first iteration, a 3rd-order non-uniform B-spline curve is fitted using all contour data points. If it is not the first iteration, a non-uniform B-spline curve of degree 3 is fitted using normal data points after removing the abnormal markers from the previous round; high-density sampling points are generated based on the fitting results, and a linear interpolator is constructed to output the height prediction value corresponding to any horizontal coordinate.
10. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 8, characterized in that, The identification method for the abnormal segment outside the identification mode in step S33 is as follows: In the region outside the abnormal segment, scan point by point along the contour line with a sliding window size W, and... A straight line is fitted using the least squares method from w data points within the window, where w is the size of the sliding window. The rate of change of the slope of the fitted line is used as a local curvature proxy index, and its calculation formula is as follows: ,in , The nth and the nth respectively The slope of the least-squares fitted line with a sliding window; if Continue sliding the window; if Mark this position as the start point q of the abnormal segment and switch to the abnormal segment identification mode.
11. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 10, characterized in that, The definition window contains n data points Then the analytical expression for the slope of the fitted line is: in: The mean of the x-axis is... The vertical axis represents the mean, and the horizontal axis represents the deviation of the mean. The mean deviation of the ordinate is .
12. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 10, characterized in that, The identification method for the abnormal segment identification pattern in step 33 is as follows: within the abnormal segment, define the corresponding current sliding window as... Where i is the index of the left endpoint of the window, i+w-1 is the index of the right endpoint of the window, and the actual height value of the right endpoint of the window. The interpolator predicts the height value of the right endpoint of the window. Then the following relation is satisfied: ; when If the Z value is close to the threshold, then The sliding window continues to move; when If the Z value is close to the threshold, then mark that position as the end point e of the abnormal segment.
13. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 12, characterized in that, The identification method for the false anomaly segment identification pattern in step 33 is as follows: Define the anomaly segment length as C, then... ; If C < the threshold for the length of a false anomaly segment, then the anomaly segment is reset as a normal segment. When C ≥ the false anomaly segment length threshold, the anomaly segment is determined to be a real anomaly segment. The height values of all points in the segment are replaced with the interpolator prediction value, and then the anomaly segment external recognition mode is switched.
14. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 8, characterized in that, The iteration termination judgment logic in S34 is as follows: If it is the first iteration, increment the iteration number by 1 and return to step S32; If it is not the first iteration, calculate the Jaccard similarity coefficient between the current iteration and the anomaly marker array of the previous iteration; When the Jaccard similarity coefficient is greater than the Jaccard similarity coefficient threshold, the iteration is terminated, and the anomaly identification result of the current round is used as the initial anomaly segment. When the Jaccard similarity coefficient is less than or equal to the Jaccard similarity coefficient threshold and the number of iterations has not exceeded the maximum number of iterations, increment the number of iterations by 1, update the anomaly marker array to the result of the current iteration, and return to step S32; When the maximum number of iterations is reached, the iteration is terminated, and the result of the last round of identification is used as the initial anomaly segment.
15. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 14, characterized in that, The analytical expression for the Jaccard similarity coefficient in step S34 is: Let the first... The set of outlier segments obtained by B-spline fitting is , No. The set of outlier segments obtained by B-spline fitting is ,but: Jaccard similarity coefficient , in: This represents the number of elements in the intersection of set A and set B; This represents the number of elements in the union of set A and set B.
16. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that, Step S4 includes the following sub-steps: S41. Extract continuous abnormal sub-regions from the initial abnormal segment: Traverse the abnormal marker array, divide the continuous abnormal points into a sub-region, and record the start index and end index of each sub-region; S42. Calculate the actual height values of each point within each segment of a continuous abnormal sub-region. Interpolator prediction The relative positions are used to obtain three distribution characteristics: lower points, upper points, and equal points; when the number of lower points is greater than or equal to the number of upper points, it is judged as a concave anomaly, otherwise it is judged as a convex anomaly. Equality points are not included in type judgment; S43. Refine the abnormal sub-regions.
17. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 16, characterized in that: The criteria for judging the distribution characteristics in step 42 are as follows: like If , then they are equal points; like If , then it is the point above; like Then it is the point below.
18. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 16, characterized in that, The refinement method in step 43 is as follows: If it is a concave outlier segment, remove the points above the predicted value and keep the points below and the points with the same value. If it is a convex anomaly segment, remove the points below the predicted value and keep the points above and the points with the same value; If the refined part is split into multiple contiguous sub-regions, only the longest sub-region is retained; If the number of consecutive sub-regions is 0, the abnormal segment is discarded directly.
19. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that: The quantization result in step S5 includes the actual height value of each outlier. Interpolator prediction The difference, the starting x-coordinate of the abnormal segment, the ending x-coordinate of the abnormal segment, the length of the abnormal segment, the type of each abnormal segment, the total number of abnormal points and the x-coordinate of each abnormal point, the actual height measurement value and the reference model prediction value.
20. The method for detecting and quantifying abnormalities in the contour lines of a workpiece as described in claim 1, characterized in that: The specific logic for the qualification judgment in step S7 is as follows: when the absolute value of the maximum height difference of all continuous abnormal segments after all contour lines is less than the preset height difference qualification threshold, and the length of all abnormal segments is less than the preset length qualification threshold, the workpiece surface contour is judged to be qualified; otherwise, it is judged to be unqualified, and a list of unqualified items is output.
Citation Information
Patent Citations
Quality detection system and method for glue injection laser contour
CN120782726A
Part defect self-adaptive machining path planning method based on point cloud
CN120852872A