Online pipe defect detection method and system
Through optical path comparison and three-dimensional image reconstruction combined with dynamic threshold judgment, the problem of slow speed and high misjudgment rate in traditional detection methods is solved, and efficient and low-cost detection of warping defects of plastic pipe fittings is achieved.
Patent Information
- Application Number
- CN202510631006.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-05-16
AI Technical Summary
When detecting surface warping defects of plastic pipe fittings, there is a balance problem between rapid screening and accurate re-inspection. Traditional methods lead to slow detection speed and high computing power consumption, making it difficult to distinguish between continuous defects and point-shaped defects, and the fixed threshold has a high misjudgment rate when the material changes.
The optical path principle is used to compare the detection lines and reference lines in real time, mark the suspected warping areas, and generate a point cloud model through three-dimensional image reconstruction. The defect type is determined by combining the DBSCAN algorithm clustering and dynamic screening thresholds, and the threshold is dynamically adjusted to adapt to material changes.
It achieves a balance between rapid screening and accurate re-inspection, reduces hardware costs and energy consumption, improves detection speed and accuracy, reduces misjudgment rates, adapts to material batch changes, and reduces quality inspection costs.
Smart Images

Figure CN120142324B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and in particular to an online pipe defect detection method and system. Background Art
[0002] Online defect image detection for pipes is an automated inspection method based on vision technology. It uses industrial cameras to capture real-time images of the pipe surface and combines them with algorithmic analysis to identify defects.
[0003] The process mainly includes: 1) Image acquisition, using high-resolution linear or area array cameras and LED light sources to eliminate reflections and obtain high-definition images of the pipe surface; 2) Image preprocessing, optimizing image quality through filtering, enhancement, denoising and other technologies; 3) Feature extraction and defect recognition, using traditional algorithms (such as edge detection and threshold segmentation) or deep learning models (such as convolutional neural networks) to locate defects such as cracks, pits, scratches, and analyze their size and shape characteristics; 4) Real-time sorting, transmitting the inspection results to the control system to link the production line to eliminate defective products; It is widely used in continuous production lines of metal, plastic and other pipes, which can significantly improve the level of quality control and reduce the rate of manual missed detection; the key technical challenges lie in suppressing complex surface reflections, ensuring the clarity of high-speed motion images, and accurately identifying tiny defects;
[0004] The existing application publication number CN118429333A, entitled "A Method and Apparatus for Visually Detecting Surface Defects of Pipes," states that the detection method includes: obtaining a grayscale image of the pipe surface and calculating a first probability of a target pixel; obtaining a texture image of the pipe surface and calculating a second probability of the target pixel; determining a correction factor for the target pixel; and multiplying the correction factor by a preset threshold value as a correction threshold value for an edge detection algorithm to detect pipe defects. The technical solution of the present invention can improve the accuracy of pipe defect detection, reduce the risk of pipeline damage, and provide protection for pipeline safety. Although the threshold value is corrected, the factors considered are not guided corrections through result feedback. At the same time, image detection still needs to act on the entire surface of the pipe, thereby increasing the computing power consumption for image analysis.
[0005] In combination with the above documents and prior art:
[0006] When detecting warpage defects on the surface of plastic pipes: First, there is a balance between rapid screening and accurate re-inspection: Traditional pipe defect detection often uses global three-dimensional scanning or full-surface image analysis, resulting in slow detection speed and high computing power consumption; for example, full-surface modeling using a laser scanner takes several minutes per pipe, which cannot meet the needs of high-speed production lines; secondly, traditional methods rely on two-dimensional images or single-view detection, making it difficult to distinguish between continuous defects (such as linear warpage) and point defects (such as single-point concave warpage), resulting in an error rate of up to 15%-20%; finally, when judging whether the pipe with a point defect is a minor defect, the traditional method is to calculate the curvature of the point defect and compare it with a fixed threshold, using a fixed curvature threshold (such as k=1.0 mm -1 ), the misjudgment rate increases significantly when the material batch changes or the environment fluctuates; for example, the misjudgment rate of a fixed threshold soars from 5% to 25% after the material is changed. Summary of the Invention
[0007] (1) Technical problems solved
[0008] In view of the deficiencies in the prior art, the present invention provides an online pipe defect detection method and system. By adopting the detection method, the problems raised in the background art are effectively solved.
[0009] (2) Technical solution
[0010] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0011] The method for online defect detection of pipes includes the following steps:
[0012] Place the pipe to be inspected in a dark box environment, illuminate the rotating pipe with a light source, and display the pipe projection on the projection surface, with the upper end of the projection surface set as the inspection line;
[0013] Compare the test line with the set baseline in real time and mark the suspected warping area based on the local offset;
[0014] Perform 3D image reconstruction on the suspected warping area to generate a simulated 3D point cloud model;
[0015] After clustering the point cloud, the continuous local offsets are merged into the same defect and the rule engine is run. If the length S of the continuous offset exceeds the set value, it is determined to be a continuous defect; otherwise, it is determined to be a point defect.
[0016] If there are continuous defects in the pipe to be tested, the pipe will be judged as unqualified and an early warning signal will be issued;
[0017] When a point defect exists in the pipe to be inspected, the derivative curvature detection mechanism is executed to generate and extract the maximum curvature in the curvature data set, and the state of the pipe is determined based on the dynamic screening threshold.
[0018] The dynamic screening threshold is obtained as follows:
[0019] The average maximum curvature and variance in the historical data are obtained, and the initial dynamic screening threshold is obtained after weighted calculation. The spot check and model calibration strategy are triggered regularly to obtain the revised dynamic screening threshold.
[0020] Furthermore, in a darkroom environment, the light source is irradiated in a direction perpendicular to the axis of the tube to be inspected, and the rotation center of the tube to be inspected coincides with its axis; when the surface of the tube to be inspected is flat, the inspection line is the preset reference line.
[0021] Furthermore, the process of marking suspected warping areas based on local offset is as follows:
[0022] Point-by-point comparison: Calculate the local offset Δd(x) along the X-axis point by point:
[0023] ;
[0024] Where y_ac(x) is the height of the test line within the corresponding x interval, y_base(x) is the height of the reference line within the corresponding x interval, and x corresponds to the length interval of the pipe to be tested; the reference line is used as the X-axis.
[0025] Warping judgment: When the local offset Δd(x)≠0, it is judged as a suspected warping area and marked.
[0026] Furthermore, the process of generating a simulated 3D point cloud model is as follows:
[0027] Multi-angle image data acquisition: When dealing with suspected warping areas, the pipe to be inspected is rotated around its axis and images of the inspection line are captured from several angles;
[0028] Triangulation modeling: Based on the parallax principle, calculate the surface height difference z(x);
[0029] Point cloud generation: Fusing height data from various perspectives to generate a 3D point cloud;
[0030] The height data is the surface height difference z(x).
[0031] Furthermore, the DBSCAN algorithm is used to cluster the point cloud to form independent clusters, and the cluster length of the independent cluster is the length S.
[0032] Furthermore, the process of implementing the derivative curvature detection mechanism is as follows:
[0033] Path slicing: extract height data along the detection line direction;
[0034] Derivative calculation: Calculate the first-order derivative point by point along the detection line and the second-order derivative ;
[0035] Curvature model: Substitute , traverse all points to calculate the curvature k, and obtain the curvature data set.
[0036] Furthermore, based on the dynamic screening threshold, the process of determining the state of the pipe is as follows:
[0037] When k_max>dynamic screening threshold, the state of the pipe is determined to be: severe defect;
[0038] When k_max ≤ dynamic screening threshold, the state of the pipe is determined to be: slight defect.
[0039] Furthermore, the formula for calculating the initial dynamic screening threshold k0 is as follows:
[0040] ;
[0041] In the formula, α and β are weight coefficients, k avg 、k vac are the average maximum curvature and variance of historical data respectively.
[0042] Furthermore, the triggered spot check and model calibration strategies are as follows:
[0043] Sampling judgment: After completing Q tests, randomly select Q / 20 samples for re-inspection and calculate the judgment accuracy: Accuracy = number of correct judgments / (Q / 20)×100%;
[0044] Calibration logic: When the accuracy is not less than 95%, the initial dynamic screening thresholds α and β are maintained; when the accuracy is less than 95%, α and β are optimized through gradient descent iteration to minimize L.
[0045] The online pipe defect detection system includes:
[0046] The environmental debugging module places the pipe to be inspected in a dark box environment, illuminates the rotating pipe with a light source, and displays the projection of the pipe on the projection surface, with the upper end of the projection surface set as the inspection line;
[0047] The preliminary marking module compares the detection line with the set baseline in real time and marks the suspected warping area based on the local offset;
[0048] The 3D construction module reconstructs the 3D image of the suspected warping area and generates a simulated 3D point cloud model;
[0049] The defect judgment module clusters the point cloud and merges the consecutive local offsets into the same defect. It then runs the rule engine and determines if the length S of the consecutive offsets exceeds the set value, which is a continuous defect. Otherwise, it is determined to be a point defect.
[0050] The adjustment and correction module determines that if the pipe to be inspected has continuous defects, the pipe will be judged as unqualified and an early warning signal will be issued. If the pipe to be inspected has point defects, the derivative curvature detection mechanism will be executed to generate and extract the maximum curvature in the curvature data set, and the state of the pipe will be determined based on the dynamic screening threshold.
[0051] The dynamic screening threshold is obtained as follows:
[0052] The average maximum curvature and variance in the historical data are obtained, and the initial dynamic screening threshold is obtained after weighted calculation. The spot check and model calibration strategy are triggered regularly to obtain the revised dynamic screening threshold.
[0053] (3) Beneficial effects
[0054] The present invention provides a method and system for online pipe defect detection, which has the following beneficial effects:
[0055] (1) The preliminary judgment is made through the grading strategy of "rapid screening → accurate re-inspection", which balances the detection speed and accuracy. By using the optical path principle and threshold comparison, the positioning operation of the suspected warping area on the entire surface can be completed very quickly, and only the data of the local area (suspected warping area operation) is analyzed. The hardware cost and energy consumption are greatly reduced, meeting the needs of high-speed online detection, and providing reliable coordinate guidance for re-inspection.
[0056] (2) Adopting 3D defect precise modeling: Generate 3D point cloud model by multi-angle image acquisition and triangulation of suspected warping areas, avoiding global 3D construction of pipes; Multi-view data fusion: Obtain data from different perspectives, avoid single-view detection blind spots, and accurately realize the detection of tiny warping defects on the product surface;
[0057] (3) This solution can calculate the curvature through the first-order / second-order derivatives and quantify the degree of local bending. On the basis of determining the suspected warping area, it can achieve a more refined distinction between minor defects and serious defects in a targeted manner, solving the problem that the traditional method relies on a fixed threshold and cannot adapt to material batch differences or long-term production fluctuations. On the other hand, it dynamically calculates the dynamic screening threshold based on historical data and regularly calibrates the model to improve robustness, solving the problem that the existing technology lacks quantitative evaluation of minor defects (such as point warping), resulting in excessive elimination or missed detection.
[0058] (4) Dynamic adaptability: The dynamic screening threshold can be automatically adjusted with changes in production batches or materials to avoid misjudgment caused by fixed thresholds; Efficient calibration: The weight coefficient is optimized through gradient descent to improve the robustness of the model; Low-cost maintenance: Regular spot checks only require a small amount of cost (manual) for re-inspection, which greatly reduces the cost of quality inspection;
[0059] In summary, this solution realizes a high-precision, low-cost online detection closed loop. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 This is a schematic diagram showing the actual principle of S1 in the present invention;
[0061] Figure 2 The figure is a flow chart of the overall steps of the online pipe defect detection method of the present invention. DETAILED DESCRIPTION
[0062] The following will provide a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0063] Example 1:
[0064] See also Figures 1 to 2 This embodiment provides a method for online pipe defect detection, including the following specific steps:
[0065] S1. Place the pipe to be inspected in a dark box environment. Use a light source perpendicular to the axis of the pipe to be inspected to illuminate the rotating pipe to be inspected. The projection of the pipe is displayed on the projection surface, and the upper end of the projection surface is set as the inspection line.
[0066] It should be noted that:
[0067] Darkroom environment: A closed box (with blackened inner walls) to prevent interference from ambient light, with dimensions tailored to the length of the pipe (e.g., 2m x 0.5m x 0.5m). Light source: A highly collimated LED line light source (450nm wavelength, blue light) is used to illuminate the pipe surface. Projection surface: A high-contrast diffuse reflector (e.g., frosted glass) is installed on the other side of the darkroom to display the pipe projection. An industrial camera is installed on the projection surface to capture the projected image in real time (resolution ≥ 12 megapixels), targeting the inspection line. By clamping the pipe to be inspected and rotating it at a constant speed along its axis, comprehensive surface defect detection is facilitated.
[0068] Imaging principle:
[0069] When the pipe surface is flat, the detection line on the upper end of the projection surface is a uniform line;
[0070] If the surface of the pipe to be tested is warped, the height difference will cause some areas of the test line to twist and deform, and the location of the warping defect can be detected at this time.
[0071] The defect type to be detected in this embodiment is warpage;
[0072] The pipe to be tested is also a plastic pipe;
[0073] Warping is commonly known as deformation, bending, and twisting. Since the shrinkage rate in the flow direction during plastic molding is greater than that in the vertical direction, the parts shrink in different directions and warp. Warping is also caused by the large internal stress that inevitably remains inside the parts during injection molding. These are all manifestations of deformation caused by high stress orientation.
[0074] S2. Compare the test line with the baseline in real time and mark the suspected warping area based on the local offset;
[0075] Among them, the baseline is generated in advance and belongs to the calibration stage;
[0076] Calibration of standard pipe fittings: Select a defect-free pipe of the same model (such as a Φ50mm PVC pipe), clamp it firmly to facilitate subsequent rotation, and project a test line from the light source onto the surface, which serves as the reference line.
[0077] S2 also includes synchronous acquisition: the pipe to be inspected rotates at the same speed, and every 1° rotation of the encoder triggers the industrial camera to capture an image of the inspection line, extracting the actual inspection line coordinate point set. A two-dimensional coordinate system is constructed along the reference line as the X-axis, with either end of the reference line as the origin and the axis perpendicular to the X-axis as the Y-axis.
[0078] The process of marking suspected warping areas based on local offset is as follows:
[0079] Point-by-point comparison: Calculate the local offset Δd(x) along the X-axis point by point (pixel):
[0080] ;
[0081] Where y_ac(x) is the height of the test line within the corresponding x interval, and y_base(x) is the height of the baseline within the corresponding x interval. For example, within a continuous 50mm (x = 100-150mm, only an approximate range, the range may need to be expanded due to errors in lighting and material), Δd(x) = 0.5mm. x corresponds to the length of the pipe to be tested.
[0082] Warping judgment: When the local offset Δd(x)≠0, it is judged as a suspected warping area and marked;
[0083] Among them, it should be noted that:
[0084] When Δd>0: the detection line is convex (local bulging warping);
[0085] But when Δd<0: the detection line is concave (local concave warpage);
[0086] The above-mentioned optical path principle can quickly and effectively locate the location or area where there is suspected warping, facilitating subsequent targeted and detailed inspection. Due to the inevitable influence of pipe material and ambient light, the edge of the inspection line is blurred. The Canny algorithm can be used to improve the accuracy of the inspection line edge and distinguish subtle warping in subsequent modeling.
[0087] Therefore, it was preliminarily determined that the grading strategy of "rapid screening (S1 to S2) → precise re-inspection (S3 and subsequent steps)" balanced the detection speed and accuracy; rapid positioning: using the optical path principle and threshold comparison, the positioning operation of suspected warping areas on the entire surface can be completed extremely quickly; computing power optimization: only analyzing the data of local areas (suspected warping areas), hardware costs and energy consumption are greatly reduced; production line adaptation: meeting the needs of high-speed online detection, while providing reliable coordinate guidance for re-inspection.
[0088] S3, reconstructing a three-dimensional image of the suspected warping area to generate a simulated three-dimensional point cloud model;
[0089] The process of generating a simulated 3D point cloud model is as follows:
[0090] Multi-angle image data acquisition: For the marked suspected warping area (e.g. x = 100-150mm), the pipe to be inspected is driven to rotate around the axis, and the inspection line images are captured from three viewing angles: 0°, 45°, and 90°.
[0091] Triangulation modeling: Based on the parallax principle, calculate the surface height difference z(x):
[0092] ;
[0093] When θ=45°, for example: when Δd(x)=0.8mm, z(x)=0.8 / tan45°=0.8mm;
[0094] Point cloud generation: The height data of each viewpoint is integrated to generate a 3D point cloud with coordinate format (x, y, z) and an accuracy of ±0.05mm.
[0095] Here is an example:
[0096] Scenario: Detect suspected warping areas (x = 100-150 mm) of Φ50 mm PVC pipes.
[0097] Data: 0° viewing angle: Δd=0.8mm → z=0.8mm;
[0098] 45° viewing angle: Δd=1.2mm → z=1.2mm;
[0099] 90° viewing angle: Δd=0.6mm → z=0.6mm;
[0100] Output: Generate 50 point cloud coordinates to map the surface concave (warping) morphology.
[0101] In summary, precise 3D defect modeling is adopted: a 3D point cloud model is generated by multi-angle image acquisition and triangulation of suspected warping areas, avoiding global 3D construction of the pipe; multi-view data fusion: data is acquired from different viewpoints to avoid blind spots in single-view detection, and accurate detection of tiny warping defects on the product surface is achieved.
[0102] S4. Use the DBSCAN algorithm to cluster the point cloud, merge consecutive local offsets into the same defect, and run the rule engine. If the length S of the consecutive local offsets exceeds the set value, it is determined to be a continuous (line / surface) defect; if the length S of the consecutive local offsets does not exceed the set value, it is determined to be a point defect;
[0103] Among them, DBSCAN clustering:
[0104] For example, parameter settings: neighborhood radius ϵ=2mm, minimum number of points minPts=5;
[0105] Algorithm execution: Merge points with a spacing of <2 mm to form independent clusters;
[0106] Rule engine judgment:
[0107] Continuity defect: cluster length S = max(x) − min(x) > set value;
[0108] Point defects: cluster length S ≤ set value;
[0109] Here is an example:
[0110] Scenario: A cluster of point clouds accurately covers x = 120 ~ 135 mm, with a total of 15 points;
[0111] Calculation: S=135−120=15mm>5mm (set value) → Determined as a continuity defect;
[0112] Comparison: Another cluster with x=140~143mm, S=3mm ≤5mm (set value) → determined as a point defect;
[0113] In summary, the core operation of S3 is multi-view triangulation, with a point cloud density of ≥50 points / mm² and a processing time of 200ms / area. The core operation of S4 is density clustering + length threshold determination. Compared with baseline comparison alone, the classification accuracy is improved to >98%, and the processing time is 50ms / area. This solution achieves accurate identification of defect types through 3D modeling → intelligent classification, and is suitable for the needs of multiple scenarios.
[0114] S5. If there are continuous defects in the pipe to be tested, the pipe is judged as unqualified and an early warning signal is issued;
[0115] When a point defect exists in the pipe to be inspected, the derivative curvature detection mechanism is executed to generate and extract the maximum curvature in the curvature data set, and the state of the pipe is determined based on the dynamic screening threshold.
[0116] The dynamic screening threshold is obtained as follows:
[0117] Obtain the average maximum curvature and variance from historical data, perform weighted calculations to obtain the initial dynamic screening threshold, and regularly trigger spot checks and model calibration strategies to obtain the revised dynamic screening threshold;
[0118] The process of implementing the derivative curvature detection mechanism is as follows:
[0119] Path slicing: extract height data y(x) along the detection line direction (X axis);
[0120] Derivative calculation: First-order derivative:
[0121] ;
[0122] In this formula, y is the height data of the detection line direction (unit: mm), which represents the vertical offset of the pipe surface relative to the reference line; x is the position coordinate of the detection line direction (unit: mm); i is the data point index, which corresponds to the sequence number of the discretized sampling point (such as i=1, 2, ..., N); Δx is the sampling interval, that is, the distance between adjacent data points (such as Δx=0.1); y i+1 ,y i−1 : The height value of the adjacent data points, used to calculate the central difference derivative;
[0123] The first derivative represents the slope of the height along the detection line (unit: dimensionless);
[0124] Second-order derivative:
[0125] ;
[0126] y in this formula i : The height value of the current data point (unit: mm);
[0127] The second derivative represents the rate of change of the slope (unit: mm⁻¹);
[0128] Curvature model:
[0129] Substitution , traverse all points to calculate the curvature, and obtain the curvature data set;
[0130] It should be noted that the curvature k describes the degree of local bending on the surface of the pipe to be tested; the numerator reflects the "acceleration" of the bending, with larger values indicating more severe bending; the denominator is a correction factor that eliminates the influence of the slope on the curvature calculation; when the surface is flat (y′→0), the curvature is approximately equal to the absolute value of the second-order derivative;
[0131] An example of the process of generating and extracting the maximum curvature from a curvature dataset is as follows:
[0132] The curvature distribution of a certain point area is 0.2, 0.5, 1.3 mm −1 → k_max=1.3mm −1 ;
[0133] When determining the state of the pipe according to the dynamic screening threshold;
[0134] Judgment rules:
[0135] When k_max>dynamic screening threshold, the status of the pipe is determined to be: serious defect (need to be alarmed and removed);
[0136] When k_max ≤ dynamic screening threshold, the status of the pipe is determined to be: slight defect (allowed to enter the secondary product library);
[0137] Specifically, on the one hand, curvature is calculated through first-order and second-order derivatives to quantify the degree of local bending. Based on the identification of suspected warpage areas, a more targeted and refined distinction between minor defects and major defects is achieved. This solves the problem that traditional methods rely on fixed thresholds and cannot adapt to material batch differences or long-term production fluctuations. On the other hand, thresholds are dynamically calculated based on historical data (dynamic screening thresholds) and the model is regularly calibrated to improve robustness. This solves the problem that existing technologies lack quantitative evaluation of minor defects (such as point warpage), resulting in excessive rejection or missed detection.
[0138] The process of obtaining the average maximum curvature and variance in historical data and performing weighted calculation to obtain the initial dynamic screening threshold is as follows:
[0139] The average maximum curvature of historical data:
[0140] ;
[0141] Where N is the number of historical data samples, k avg is the average curvature of historical data, reflecting the overall defect level, k_max i is the maximum curvature of the i-th detection;
[0142] Variance of historical data:
[0143] ;
[0144] Where k vac is the variance of historical data, reflecting the volatility of defects;
[0145] Initial dynamic screening threshold:
[0146] ;
[0147] In the formula, α and β are weight coefficients, and α+β=1;
[0148] The recommended initial values are α=0.7 and β=0.3 (experienced values, calibrable).
[0149] It should be noted that the weight coefficient is determined using the coefficient of variation method, which assigns weights to each indicator based on the degree of variation between the current value of each evaluation indicator and the target value. If the numerical difference of an indicator is large, it can clearly distinguish the evaluated objects, indicating that the indicator has rich discrimination information, and thus the indicator should be given a larger weight. Conversely, if the numerical difference of each evaluated object on a certain indicator is small, then the ability of this indicator to distinguish the evaluated objects is weak, and thus the indicator should be given a smaller weight. This method directly uses the information contained in each indicator to calculate the weight of the indicator, and therefore is objective.
[0150] Example:
[0151] Historical data: k avg =0.8mm -1 , k vac =0.2;
[0152] Initial threshold: k0 = 0.7 × 0.8 + 0.3 × 0.2 = 0.62 mm -1 ;
[0153] The triggered spot check and model calibration strategies are as follows:
[0154] Sampling judgment: After completing Q tests, randomly select Q / 20 samples for re-inspection and calculate the judgment accuracy: Accuracy = number of correct judgments / (Q / 20)×100%;
[0155] The value range of Q is a positive integer greater than 0. In this embodiment, Q=1000, so the number of samples is 1000 / 20=50. For example, out of 50 samples randomly checked, 48 are judged to be correct → the accuracy rate is 96%. Combined with the following calibration logic, it is determined that the standard is met and no adjustment is required.
[0156] Calibration logic: When the accuracy is not less than 95%, the weight coefficients (α, β) in the initial dynamic screening threshold are maintained; when the accuracy is less than 95%, α and β are optimized through gradient descent iteration to minimize L;
[0157] The specific process of weight coefficient optimization is as follows:
[0158] Define the loss function (mean square error):
[0159] ;
[0160] Where M is the number of error samples, k id,j is a reasonable threshold for re-inspection. j has the same meaning as i in the formula for calculating the average maximum curvature of historical data, so we will not elaborate on it here.
[0161] Compute the gradient and update the coefficients:
[0162] ;
[0163] Where η is the learning rate, ranging from 0 to 1 (e.g. 0.01);
[0164] Example: When the number of error samples M = 5, the reasonable threshold is determined to be 0.7 mm⁻¹ (manual judgment is optional): L = 1 / 5∑(k0−0.7) 2 Through gradient descent iteration, optimize α and β to minimize L;
[0165] Specifically, the technical solutions provided by S5 have the following effects:
[0166] Dynamic adaptability: Dynamic screening thresholds can be automatically adjusted with production batches and material changes, avoiding misjudgments caused by fixed thresholds. Efficient calibration: Gradient descent is used to optimize weight coefficients, improving model robustness. Low-cost maintenance: Regular spot checks require only minimal (manual) re-inspections, significantly reducing quality inspection costs. This solution achieves a high-precision, low-cost online detection closed loop.
[0167] In summary, S1-S2+S3 (rapid screening + 3D reconstruction) implements a hierarchical strategy of "rapid positioning → precise re-inspection," balancing inspection speed and accuracy. This addresses the issues of traditional full-surface 3D inspection, which is slow, consumes a lot of computing power, and cannot meet online inspection needs. S3+S4 (3D modeling + cluster classification) uses 3D point clouds and intelligent classification to accurately identify defect types (such as linear / point-like), reducing the false positive rate and addressing the existing 2D inspection's inability to distinguish complex defect forms, leading to mismatched subsequent processing strategies. S5 dynamic thresholding + regular calibration dynamically adapts to production fluctuations, reduces manual intervention, and lowers quality inspection costs. This addresses the issues of traditional fixed thresholds, which require frequent manual adjustments, have high maintenance costs, and are prone to subjective errors.
[0168] Example 2:
[0169] Based on Example 1, this embodiment further provides an online pipe defect detection system, including:
[0170] The environmental debugging module places the pipe to be inspected in a dark box environment, illuminates the rotating pipe with a light source, and displays the projection of the pipe on the projection surface, with the upper end of the projection surface set as the inspection line;
[0171] The preliminary marking module compares the detection line with the set baseline in real time and marks the suspected warping area based on the local offset;
[0172] The 3D construction module reconstructs the 3D image of the suspected warping area and generates a simulated 3D point cloud model;
[0173] The defect judgment module clusters the point cloud and merges the consecutive local offsets into the same defect. It then runs the rule engine and determines if the length S of the consecutive offsets exceeds the set value, which is a continuous defect. Otherwise, it is determined to be a point defect.
[0174] The adjustment and correction module determines that if the pipe to be inspected has continuous defects, the pipe will be judged as unqualified and an early warning signal will be issued. If the pipe to be inspected has point defects, the derivative curvature detection mechanism will be executed to generate and extract the maximum curvature in the curvature data set, and the state of the pipe will be determined based on the dynamic screening threshold.
[0175] The dynamic screening threshold is obtained as follows:
[0176] The average maximum curvature and variance in the historical data are obtained, and the initial dynamic screening threshold is obtained after weighted calculation. The spot check and model calibration strategy are triggered regularly to obtain the revised dynamic screening threshold.
[0177] The overall technical advantages are as follows:
[0178] 1. Improved efficiency: Online detection speed reaches seconds to respond, meeting the needs of high-speed production lines;
[0179] 2. Accuracy assurance: 3D modeling and curvature quantification enable defect recognition accuracy to reach ±0.05mm;
[0180] 3. Adaptability: Dynamic threshold and model calibration achieve long-term stable detection and adapt to changes in multiple batches of materials;
[0181] 4. Cost optimization: The hierarchical detection strategy reduces computing power consumption, and the spot check and calibration mechanism reduces labor costs.
[0182] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. Those skilled in the art will appreciate that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution.
[0183] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, and may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment as needed.
[0184] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. A method for online defect detection of pipes, characterized in that: The steps include: Place the pipe to be inspected in a dark box environment, illuminate the rotating pipe with a light source, and display the pipe projection on the projection surface, with the upper end of the projection surface set as the inspection line; Compare the test line with the set baseline in real time and mark the suspected warping area based on the local offset; Perform 3D image reconstruction on the suspected warping area to generate a simulated 3D point cloud model; After clustering the point cloud, the continuous local offsets are merged into the same defect and the rule engine is run. If the length S of the continuous offset exceeds the set value, it is determined to be a continuous defect; otherwise, it is determined to be a point defect. If there are continuous defects in the pipe to be tested, the pipe will be judged as unqualified and an early warning signal will be issued; When a point defect exists in the pipe to be inspected, the derivative curvature detection mechanism is executed to generate and extract the maximum curvature in the curvature data set, and the state of the pipe is determined based on the dynamic screening threshold. The dynamic screening threshold is obtained as follows: The average maximum curvature and variance in the historical data are obtained, and the initial dynamic screening threshold is obtained after weighted calculation. The spot check and model calibration strategy are triggered regularly to obtain the revised dynamic screening threshold.
2. The method for online pipe defect detection according to claim 1, characterized in that: In a darkroom environment, the light source is irradiated in a direction perpendicular to the axis of the pipe to be inspected, and the rotation center of the pipe to be inspected coincides with its axis; when the surface of the pipe to be inspected is flat, the inspection line is the preset reference line.
3. The method for online pipe defect detection according to claim 1, characterized in that: The process of marking suspected warping areas based on local offset is as follows: Point-by-point comparison: Calculate the local offset Δd(x) along the X-axis point by point: ; Where y_ac(x) is the height of the test line within the corresponding x interval, y_base(x) is the height of the reference line within the corresponding x interval, and x corresponds to the length interval of the pipe to be tested; the reference line is used as the X-axis. Warping judgment: When the local offset Δd(x)≠0, it is judged as a suspected warping area and marked.
4. The method for online pipe defect detection according to claim 1, characterized in that: The process of generating a simulated 3D point cloud model is as follows: Multi-angle image data acquisition: When dealing with suspected warping areas, the pipe to be inspected is rotated around its axis and images of the inspection line are captured from several angles; Triangulation modeling: Based on the parallax principle, calculate the surface height difference z(x); Point cloud generation: Fusing height data from various perspectives to generate a 3D point cloud; The height data is the surface height difference z(x).
5. The method for online pipe defect detection according to claim 1, characterized in that: The DBSCAN algorithm is used to cluster the point cloud to form independent clusters, and the cluster length of the independent cluster is the length S.
6. The method for online pipe defect detection according to claim 4, characterized in that: The process of implementing the derivative curvature detection mechanism is as follows: Path slicing: extract height data along the detection line direction; Derivative calculation: Calculate the first-order derivative point by point along the detection line and the second-order derivative ; Curvature model: Substitute , traverse all points to calculate the curvature k, and obtain the curvature data set.
7. The method for online pipe defect detection according to claim 1, characterized in that: The process of determining the pipe status based on the dynamic screening threshold is as follows: When k_max>dynamic screening threshold, the state of the pipe is determined to be: severe defect; When k_max ≤ dynamic screening threshold, the state of the pipe is determined to be: slight defect.
8. The method for online pipe defect detection according to claim 1, characterized in that: The formula for calculating the initial dynamic screening threshold k0 is as follows: ; In the formula, α and β are weight coefficients, k avg 、k vac are the average maximum curvature and variance of historical data respectively.
9. The method for online pipe defect detection according to claim 8, characterized in that: The triggered spot check and model calibration strategies are as follows: Sampling judgment: After completing Q tests, randomly select Q / 20 samples for re-inspection and calculate the judgment accuracy: Accuracy = number of correct judgments / (Q / 20)×100%; Calibration logic: When the accuracy is not less than 95%, maintain the initial dynamic screening threshold α and β; when the accuracy is less than 95%, optimize α and β through gradient descent iteration to minimize L; L represents the mean square error.
10. The pipe online defect detection system is characterized by: include: The environmental debugging module places the pipe to be inspected in a dark box environment, illuminates the rotating pipe with a light source, and displays the projection of the pipe on the projection surface, with the upper end of the projection surface set as the inspection line; The preliminary marking module compares the detection line with the set baseline in real time and marks the suspected warping area based on the local offset; The 3D construction module reconstructs the 3D image of the suspected warping area and generates a simulated 3D point cloud model; The defect judgment module clusters the point cloud and merges the consecutive local offsets into the same defect. It then runs the rule engine and determines if the length S of the consecutive offsets exceeds the set value, which is a continuous defect. Otherwise, it is determined to be a point defect. The adjustment and correction module determines that if the pipe to be inspected has continuous defects, the pipe will be judged as unqualified and an early warning signal will be issued. If the pipe to be inspected has point defects, the derivative curvature detection mechanism will be executed to generate and extract the maximum curvature in the curvature data set, and the state of the pipe will be determined based on the dynamic screening threshold. The dynamic screening threshold is obtained as follows: The average maximum curvature and variance in the historical data are obtained, and the initial dynamic screening threshold is obtained after weighted calculation. The spot check and model calibration strategy are triggered regularly to obtain the revised dynamic screening threshold.
Citation Information
Patent Citations
Visual inspection method and device for surface defects of pipe
CN118429333A
New non-destructive detection method for morphology and distribution of pores in welding seam
CN103234990A
Automobile headlamp detection method and device
CN107702898A