A welding seam flatness detection method based on high-precision 3D camera
Patent Information
- Application Number
- CN202611274133.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-10-30
AI Technical Summary
1.脏污抗干扰能力弱:基于RGB纹理的视觉检测方案依赖表面颜色与纹理特征,钢轨表面油污、铁锈、灰尘、水渍会大幅提升焊缝漏识别率,工况适应性差;
1.通过标准廓形配准消除安装与位置偏差(第一类干扰),通过深度几何特征检测消除表面脏污干扰(第二类干扰);且配准并非仅服务于单次测量精度,更作为深度图归一化的前置环节实现检测基准统一,使单一YOLO模型可跨相机安装、跨线路、跨工况直接泛化,区别于现有技术中配准与检测相互独立的方案。
Smart Images

Figure CN123015501A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of track inspection technology, and in particular to a method for inspecting weld straightness based on a high-precision 3D camera. Background Technology
[0002] Rail welded joints are the weakest link in rail tracks. Weld straightness is a core indicator for measuring the longitudinal smoothness of the weld, directly affecting the stability and safety of train operation. Weld straightness is defined as the maximum vertical distance between a reference straightedge and the measured generatrix of the rail, with the weld centerline as the midpoint and a measurement span of 1m.
[0003] Existing testing methods are mainly divided into four categories: manual ruler and feeler gauge method, contact displacement sensing method, two-dimensional texture vision method, and three-dimensional profile measurement method. They generally have the following shortcomings: 1. Weak resistance to dirt and interference: The visual detection scheme based on RGB texture relies on surface color and texture features. Oil stains, rust, dust and water stains on the rail surface will significantly increase the weld seam leakage detection rate, resulting in poor adaptability to working conditions. 2. Inconsistent measurement benchmarks and poor generalization: Although existing 3D profile schemes can acquire geometric information, they mostly rely on manual calibration of starting points or template matching, and cannot automatically locate welds; moreover, profile registration is only used to improve the accuracy of a single measurement and has not formed a collaborative link with target detection technology. The detection model needs to be repeatedly adapted under different camera installation postures and different line conditions, and cannot be generalized across working conditions. 3. Insufficient positioning reliability: Weld seam positioning relies too much on deep learning black box models, lacks quantifiable geometric features as verification basis, has a high false detection rate in low confidence scenarios and modal conflict scenarios, and the results lack a fallback guarantee; 4. Insufficient compliance and real-time performance: The straightness measurement of most solutions does not correspond to the limits of the national railway maintenance regulations, and the processing speed cannot meet the real-time requirements of the track inspection vehicle's high-speed dynamic detection at 160km / h, requiring the occupation of track maintenance windows.
[0004] Therefore, there is an urgent need for a method to detect weld straightness in order to solve the problems of existing solutions. Summary of the Invention
[0005] In view of this, this application provides a weld straightness detection method based on a high-precision 3D camera to address the shortcomings of the existing technology.
[0006] The first aspect of this application provides a method for detecting the straightness of weld seams based on a high-precision 3D camera, comprising the following steps: S1. A line structured light 3D camera is used to continuously scan along the length of the rail to collect three-dimensional profile data of the rail cross section; S2. Perform noise reduction and smoothing processing on the three-dimensional profile data of each section in sequence to obtain smoothed three-dimensional profile data of the section; S3. Based on the pre-set standard rail profile template, rigid registration is performed on the smoothed measured cross-sectional three-dimensional profile data to eliminate camera installation angle deviation and rail position deviation, and all measured cross-sectional three-dimensional profile data are unified under the standard profile coordinate system. S4. Extract the rail top surface area height data from the 3D profile data of each cross section after registration, arrange them along the rail length direction in the order of acquisition to form a height data matrix, and perform linear normalization mapping on the height values to generate a normalized depth image under a unified coordinate system. S5. Input the normalized depth image into the pre-trained target detection model and output candidate detection results. The candidate detection results include candidate weld region bounding boxes and corresponding confidence scores. Calculate the weld geometric signature using the depth image region corresponding to the candidate weld region bounding box as the calculation range. Verify the validity of the candidate detection results using the weld geometric signature. If the verification passes, determine the weld center using the center position of the candidate weld region bounding box. S6. Using the determined weld center as a reference, select a measurement interval of a set length in the longitudinal direction of the rail, fit the reference baseline, calculate the maximum absolute deviation of the rail top surface height relative to the reference baseline within the measurement interval, and obtain the weld straightness value.
[0007] In one possible implementation of the first aspect, in step S1, the cross-sectional acquisition frequency of the line structured light 3D camera is not less than 1000Hz, the spatial spacing between adjacent acquisition cross-sections along the length of the rail is not greater than 1mm, the measurement accuracy in the height direction is better than 0.05mm, and the lateral range of a single cross-sectional scan covers the complete width of the top surface of the rail.
[0008] In one possible implementation of the first aspect, in step S2, the denoising process uses k-nearest neighbor statistical filtering, where the value of k ranges from 8 to 12, and the criteria for determining outlier sampling points are: the average distance of the k-nearest neighbors of the sampling point is greater than the sum of the average distance of all sampling points and twice the standard deviation; the smoothing process uses moving average filtering, where the filtering window contains 5 to 10 sampling points, and the window slides along the extension direction of the top profile of the track.
[0009] In one possible implementation of the first aspect, step S3 specifically includes the following sub-steps: S31. A standard rail profile template of corresponding specifications is pre-set according to the target rail model. The standard rail profile template includes complete outline data of the top surface of the rail head, the side surface of the rail head, the web of the rail, and the bottom of the rail. S32. Extract key feature points from the smoothed measured cross-sectional three-dimensional profile data. The key feature points include the center point of the top surface of the rail head, the starting point of the arc on both sides of the rail head, and the center point of the rail web. Match the measured key feature points with the corresponding feature points of the standard rail profile template, calculate the initial rigid transformation matrix, and complete the coarse registration. S33. Using the coarse registration result as the initial value, the iterative nearest point algorithm is used to perform fine registration. The optimal rigid transformation matrix that minimizes the sum of distances between the measured sampling points and the corresponding points of the template is solved iteratively until the change in the transformation matrix is less than the set convergence threshold or the maximum number of iterations is reached. S34. Apply the final obtained optimal rigid transformation matrix to the measured cross-sectional three-dimensional profile data to complete the alignment of the measured cross-sectional three-dimensional profile data to the standard profile coordinate system.
[0010] In one possible implementation of the first aspect, in step S4, the rows of the height data matrix correspond to the positions of the cross-sections along the length of the rail, the columns correspond to the transverse sampling points on the top surface of the rail, and the matrix elements are the height deviation values at the corresponding positions; the linear normalization mapping is to map the height deviation values to a grayscale value range of 0~255 to generate a normalized depth image in single-channel grayscale form.
[0011] In one possible implementation of the first aspect, the object detection model is a YOLOv8 object detection model, which is trained through the following steps: S51. Collect three-dimensional profile data of rail cross sections under different working conditions, and obtain corresponding normalized depth images through registration and reconstruction to construct a training sample set; the working conditions cover different rail models, weld types, track conditions and surface contamination levels; manually annotate the weld areas in each normalized depth image to generate annotation bounding boxes; S52. Using a single-channel normalized depth image as input sample and the corresponding labeled bounding box as label, train a YOLOv8 object detection model; the output of the YOLOv8 object detection model includes the coordinates of the weld area bounding box and the corresponding confidence score. Step S5 further includes the following sub-steps: S53. Input the normalized depth image into the trained YOLOv8 target detection model, set the initial screening confidence threshold, remove candidate bounding boxes with confidence scores lower than the initial screening confidence threshold, and obtain a set of effective candidate bounding boxes; select the effective candidate bounding box with the highest confidence score as the candidate weld area bounding box, and output the candidate detection result containing the candidate weld area bounding box and the corresponding confidence score. S54. Set a verification confidence threshold, which is higher than the initial screening confidence threshold; in the normalized depth image, using the region corresponding to the candidate weld region boundary box as a reference, delineate the weld window, the base material neighborhood window on both sides of the weld, and the roughness evaluation window, respectively, and calculate the result including local height steps. Local roughness The weld geometric signature; when the confidence level of the candidate detection result is lower than the verification confidence threshold, validity verification is triggered; when ≥Preset height threshold and If the roughness threshold is greater than or equal to the preset roughness threshold, the candidate detection result is deemed valid, and the corresponding position is confirmed as a real weld. Otherwise, the area corresponding to the candidate detection result is deemed a fake weld, and a manual verification mark is generated. After the verification is passed, the weld center is determined by the center position of the boundary box of the candidate weld area.
[0012] In one possible implementation of the first aspect, the weld geometric signature further includes a rail top surface height gradient feature, along with local height steps. Local roughness Together they form the signature feature vector; the weld geometric signature is calculated in the standard profile coordinate system and is not affected by the camera installation angle deviation and the rail position deviation; when constructing the training sample set, the weld geometric signature is used as the basis for verifying the geometric consistency of the labeled bounding box.
[0013] In one possible implementation of the first aspect, the method further includes a bimodal confidence fusion step: Simultaneously acquire texture images of the rail surface, input the texture images into a pre-trained second target detection model (texture side), and obtain candidate detection results under the texture mode. The candidate detection results under the texture mode include the bounding boxes of candidate weld areas on the texture side and the corresponding confidence scores. Calculate the intersection-union ratio (IU) of the candidate weld region bounding boxes in the depth modality and the candidate weld region bounding boxes in the texture modality; when the IU is greater than the set overlap threshold, the weld position detection result is deemed reliable; when the IU is less than or equal to the set overlap threshold, the candidate detection result in the depth modality is used as the benchmark recognition result, and a manual verification mark is generated.
[0014] In one possible implementation of the first aspect, step S6 specifically includes the following sub-steps: S61. Using the center of the weld as a reference, take 1m before and after the rail length as the measurement interval; S62. The least squares method is used to fit the center height data of the rail top surface within the measurement interval to obtain the reference baseline; S63. Calculate the absolute deviation between the height of each sampling point within the measurement interval and the height of the corresponding position on the reference baseline, and take the maximum value of all absolute deviations as the straightness value of the corresponding weld. S64. Compare the straightness value with the specified limit value of the corresponding line grade, and output the judgment conclusion of whether the weld straightness is qualified or unqualified.
[0015] In one possible implementation of the first aspect, the method further includes an exception handling step: If, during the location registration process in step S3, there is no corresponding matching point or the iteration does not converge, a registration failure alarm message is generated, and local reregistration is performed on the current section or the corresponding section is skipped and a data anomaly marker is generated. If the three-dimensional profile data of the cross section is missing during the acquisition process, the height data of the missing cross section is supplemented by linear interpolation, or the corresponding interval data is marked as incomplete. If the authenticity of the weld cannot be effectively determined after validity verification, the corresponding position will be marked as an area to be manually reviewed, and the straightness judgment conclusion will not be automatically output.
[0016] Core working principle: There are two independent technological routes currently in use, each with its own insurmountable bottlenecks: Route 1: Pure 3D profile registration scheme, which is only used to improve the accuracy of profile measurement, cannot automatically identify the weld position, and the measurement starting point must be manually specified, so it cannot achieve fully automated detection; Route 2: Pure vision / depth target detection scheme, which is only used to identify the location of welds. However, due to the influence of camera installation posture and rail position offset, the depth map features of the same weld are very different under different working conditions. The model must be retrained and adapted for each installation and each line, resulting in extremely poor generalization.
[0017] The core breakthrough of this invention lies in the organic integration of the two approaches, constructing a collaborative architecture where "registration is the pre-detection step and detection relies on a unified benchmark," thus fundamentally solving two types of problems simultaneously: During the operation of on-rail inspection vehicles or portable equipment, factors such as vehicle vibration, track curves, and uneven track can cause the spatial attitude of the line structured light 3D camera relative to the rail to continuously change, resulting in translational and rotational deviations in the profiles of each section. Direct detection based on raw data will lead to problems such as inconsistent benchmarks and poor model generalization.
[0018] This invention introduces a standard rail profile as a priori benchmark. Through a two-level architecture of "coarse registration of feature points + fine registration of ICP", all measured cross-sections are unified to the standard coordinate system, eliminating the benchmark difference caused by the installation posture and rail position from the root. Then, the registered rail top surface height data is reconstructed into a normalized depth image, and the three-dimensional geometric information is losslessly encoded into a two-dimensional image adapted to the deep learning framework. At this time, the depth map under all working conditions is at the same geometric benchmark, and the height step, roughness and other features of the weld are completely consistent. Therefore, a single detection model can be used directly across installation, line and working conditions without repeated adaptation.
[0019] Meanwhile, this invention defines a weld geometric signature based on physical properties and constructs a two-level positioning mechanism of "deep learning for rapid initial screening + geometric rule-based fallback verification": a low-threshold initial screening quickly filters out the vast majority of invalid interference, ensuring detection efficiency; for candidate results with medium confidence, physical rule verification is performed using the weld geometric signature, balancing detection speed and positioning reliability, and adapting to the dual requirements of computing power and accuracy for real-time onboard detection. Finally, strictly adhering to the measurement definitions in the national railway maintenance regulations, straightness quantification is completed through least-squares fitting of the baseline, and the measurement results directly align with industry standards.
[0020] Its beneficial effects are as follows: 1. Standard profile registration eliminates installation and positional deviations (Type I interference), and depth geometric feature detection eliminates surface contamination interference (Type II interference). Furthermore, registration is not only for the accuracy of a single measurement, but also serves as a pre-processing step for depth map normalization to achieve a unified detection benchmark. This allows a single YOLO model to be directly generalized across camera installations, lines, and operating conditions, unlike existing technologies where registration and detection are independent.
[0021] 2. Define the weld geometric signature composed of local height steps and local roughness. This serves as the basis for verifying the geometric consistency of the model training labels and as a fallback judgment rule when the confidence level is insufficient or the modal conflict occurs. This effectively reduces the false detection rate of the black-box model and improves the localization robustness under extreme working conditions.
[0022] 3. No manual operation or on-site calibration is required, and the detection efficiency is dozens of times higher than that of the manual ruler and feeler gauge method, and it is not affected by differences in human operation; the optional dual-modal fusion scheme further improves the detection reliability in complex scenarios, and the results are traceable.
[0023] 4. Based on a GPU parallel acceleration architecture, the entire process time for a single meter of rail does not exceed 200ms, and it can support online inspection of the rail inspection vehicle at a speed of 160km / h without occupying track maintenance windows.
[0024] 5. Strictly follow the national railway maintenance regulations to quantify the straightness within ±1m before and after the weld. The measurement results can be directly compared with the standard limits. The intermediate data of each step in the whole process can be verified and traced. The measurement accuracy is better than 0.05mm, which meets the industry verification requirements. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0026] Figure 1 This is a schematic diagram of a weld straightness detection method based on a high-precision 3D camera provided in an embodiment of this application; Figure 2 This is a schematic diagram of the module structure corresponding to the weld straightness detection method based on a high-precision 3D camera provided in the embodiments of this application; Figure 3 This is a schematic diagram of the key sub-processes and dependencies of "registration → normalized depth map → geometric signature localization" provided in the embodiments of this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0029] Example 1 This embodiment takes the on-board dynamic detection of 60kg / m rail welds as an example, combined with... Figure 1 The overall process shown provides a complete explanation of the implementation process and parameter details of the detection method.
[0030] S1. Data Acquisition A high-precision line structured light 3D camera is mounted on the bottom of the rail inspection vehicle. The camera works based on the principle of laser triangulation, with a height measurement accuracy of 0.03mm and a cross-section acquisition frequency of 2000Hz. The line laser covers the entire width (approximately 70mm) of the top surface of the rail laterally. The rail inspection vehicle travels at a constant speed of 80km / h, and the camera continuously acquires the three-dimensional profile data of the cross-section along the length of the rail at spatial intervals of 0.5mm. Each cross-section contains approximately 500 three-dimensional coordinate points.
[0031] S2. Data Preprocessing Two levels of filtering are performed sequentially on the three-dimensional profile data of each cross-section: The first stage is k-nearest neighbor statistical filtering for noise reduction, with k set to 10. The criteria for outlier sampling points are: the average distance of the k-nearest neighbors of the sampling point is greater than the sum of the average distance of all sampling points and twice the standard deviation, thus eliminating discrete noise points caused by laser reflection and dust. The second stage is a moving average filter smoothing. The filter window contains 7 sampling points and slides along the extension direction of the top profile of the rail to suppress high-frequency random noise and obtain smoothed three-dimensional profile data of the cross section.
[0032] S3. Position Registration Combination Figure 3 The sub-process shown completes the registration in four steps: S31. Pre-set standard rail profile template with a specification of 60kg / m, the template includes complete standard profile data of the top surface of the rail head, the side surface of the rail head, the web of the rail and the bottom of the rail; S32. Extract key feature points from the smoothed measured profile, including the center point of the top surface of the rail head, the starting point of the arcs on both sides of the rail head, and the center point of the rail web; match the measured feature points with the corresponding feature points of the standard template, calculate the initial rigid transformation matrix (in-plane translation + rotation), and complete the coarse registration; S33. Using the coarse registration result as the initial value, the Iterative Closest Point (ICP) algorithm is used to perform fine registration. The optimal rigid transformation matrix that minimizes the sum of the distances between the measured sampling points and the corresponding points of the template is iteratively solved. The convergence threshold is set to... The maximum number of iterations is set to 50. S34. Apply the final obtained optimal rigid transformation matrix to the measured cross-section three-dimensional profile data to complete the alignment of the measured cross-section with the standard profile coordinate system and eliminate camera pitch and roll angle deviations and rail lateral and vertical position deviations.
[0033] S4. Depth Image Reconstruction Height data within a 30mm width range on the top surface of the rail is extracted from each registered cross-sectional profile. The data is then arranged along the rail length in the order of acquisition to form an N×60 height data matrix (N is the number of cross-sections, and 60 is the number of transverse sampling points). The rows of the matrix correspond to the longitudinal mileage positions, the columns correspond to the transverse sampling points, and the elements are the height deviation values at the corresponding positions. The height deviation values are linearly mapped to the grayscale value range of 0~255 to generate a normalized depth image in single-channel grayscale form, thus completing the encoding conversion of three-dimensional geometric information into two-dimensional detection input.
[0034] S5. Weld positioning The normalized depth image is input into a pre-trained YOLOv8 object detection model. An initial screening confidence threshold of 0.3 is set to remove low-quality interference boxes with confidence scores below 0.3, resulting in a set of valid candidate bounding boxes. The valid candidate bounding box with the highest confidence score is selected as the candidate weld region bounding box, and the candidate detection result, including the bounding box coordinates and confidence score, is output. The validation confidence threshold is set to 0.6, which is higher than the initial screening confidence threshold. When the confidence of a candidate detection result is ≥0.6, the candidate result is directly determined to be valid, confirming that the corresponding location is a real weld. When the confidence of a candidate detection result is between 0.3 and 0.6, a validity check is triggered: using the area corresponding to the boundary box of the candidate weld area as a reference, the weld window, the base material neighborhood windows on both sides of the weld, and the roughness evaluation window are defined respectively, and the calculation of the local height steps is performed. Local roughness The geometric signature of the weld; when ≥0.15mm and When the thickness is ≥0.03mm, the candidate detection result is deemed valid, and the corresponding position is confirmed as a real weld; otherwise, it is deemed a false weld, and a manual verification mark is generated; after the verification is passed, the longitudinal coordinate corresponding to the center position of the candidate weld area boundary box is taken as the weld center.
[0035] S6. Straightness Measurement Using the weld center as a reference, 1m sections were taken before and after the rail along its length as measurement intervals (approximately 2000 sections in total). The height data of the center column of the rail top surface within the interval were extracted. The least squares method was used to fit the sequence to obtain the reference baseline. The absolute deviation between the height of each sampling point within the interval and the height of the corresponding position on the baseline was calculated, and the maximum value of all absolute deviations was taken as the straightness value of the weld.
[0036] In this embodiment, the weld straightness was measured to be 0.18 mm. Compared with the national railway maintenance regulation limit of 0.2 mm / m for high-speed railways, the weld straightness was deemed to be qualified.
[0037] S7. Output Results Outputs weld mileage location, measurement range, straightness value and pass / fail judgment conclusion, generates standardized inspection report and stores it in historical database, supports trend analysis and retrospective query.
[0038] This embodiment runs on an onboard GPU computing platform. ICP registration and YOLO inference are both accelerated in parallel by the GPU. The entire process time for a single meter of rail is about 150ms, which meets the real-time detection requirements of 160km / h. The weld positioning accuracy can reach within ±5mm, and the straightness measurement accuracy is better than 0.05mm.
[0039] This embodiment combines Figure 3 This paper elaborates on the working principle of the core link of registration → normalized depth map → weld positioning.
[0040] 1. Registration-Generalization Dependency Principle Without S3 registration, differences in camera installation pitch and roll angles, as well as lateral and vertical positional offsets of the rails, will result in varying baseline heights and tilt angles in the depth maps of the same weld under different acquisition conditions. Detection models trained directly on the original depth maps will experience a significant drop in accuracy and a marked increase in false negatives when changing installation locations or inspecting different lines, and will be unable to generalize across different operating conditions.
[0041] After S3 standard profile registration, all cross sections are aligned to a unified standard coordinate system. The height reference and lateral position reference of the depth map are completely consistent, and the geometric features of the weld are not affected by the installation posture and the position of the rail. Therefore, the detection model trained on a single set of standardized depth maps can be directly applied to detection scenarios under different installation conditions and on different lines without the need for re-annotation and training. This is the core mechanism of this invention to achieve cross-condition generalization.
[0042] 2. Encoding Logic for Depth Image Reconstruction The essence of depth image reconstruction is "vertical sequence stacking + height grayscale encoding": each cross section outputs a set of lateral height values of the rail top surface, which is equivalent to a row of pixels in the depth image; the camera moves longitudinally along the rail, and the continuously acquired cross sections are stacked in sequence to form a two-dimensional image composed of multiple rows of pixels; the pixel grayscale values correspond one-to-one with the height deviation, which not only preserves the quantitative accuracy of geometric measurement, but also has the structural features of two-dimensional images, perfectly adapting to the input requirements of convolutional neural networks such as YOLO.
[0043] Compared to directly detecting objects in point clouds, this method improves inference speed by 5 to 10 times, and has lower model training difficulty and simpler data annotation, making it easier to implement in engineering and vehicle deployment.
[0044] 3. Weld Geometric Signature Calculation and Verification Logic Let the normalized depth map matrix be H, with elements Indicates the first Section 1, the first The height deviation value of each horizontal sampling point.
[0045] Local height steps Using the center of the candidate weld area boundary box as a reference, a weld window with a width of 21 sampling points is defined. And the base material neighborhood window of 15 sampling points on each side of the weld. . This represents the difference between the average height within the weld window and the average height within the base metal window, reflecting the abrupt change in height between the weld and the base metal. Local roughness Define a roughness evaluation window within the weld seam window. (15 sampling points) Calculate the standard deviation of the height values within the window to reflect the surface roughness of the weld area: Longitudinal height gradient feature: The mean of the absolute values of the first-order differences of the height sequence within the weld window is calculated along the length of the rail. This reflects the steepness of the height change at the weld edge, further distinguishing genuine welds from pseudo-features such as local scratches and indentations. in The sampling point number corresponding to the center column of the rail top surface. This refers to the number of cross sections within the weld window.
[0046] The complete feature vector of the weld geometric signature is All features are calculated in the standard profile coordinate system, and are invariant to camera installation angle deviation and rail position deviation.
[0047] The verification execution logic is as follows: 1. The model outputs all candidate bounding boxes, which are then filtered by an initial confidence threshold to remove noisy boxes with too low confidence, resulting in a valid candidate set. 2. Select the bounding box with the highest confidence from the valid candidate set as the target candidate, and determine the relationship between its confidence and the verification confidence threshold; 3. If the confidence level of the candidate detection result is greater than or equal to the verification confidence level threshold, the weld is directly confirmed as valid, and the center of the bounding box is retained as the weld center; 4. If the confidence level of a candidate detection result is less than the validation confidence threshold (and greater than or equal to the initial screening confidence threshold), proceed to geometric validity validation. Delineate the corresponding window based on the candidate bounding box and calculate... , and ; 5. If all geometric threshold conditions are met, the weld is confirmed to be valid; if the threshold conditions are not met, it is judged as a false weld and a manual verification mark is generated.
[0048] In this embodiment, the actual weld seam Typically 0.3~1.2mm, Typically 0.05~0.2mm; geometric threshold set to , Meanwhile, when constructing the training sample set, this geometric signature is also used as the basis for verifying the geometric consistency of manually labeled bounding boxes, eliminating samples with excessive labeling deviations, and improving the quality of training data.
[0049] This embodiment also explains the working principle of the dual-modal fusion and anomaly handling mechanism.
[0050] 1. Principles and Implementation of Dual-Modal Belief Fusion Simultaneously acquire RGB texture images of the rail surface, input them into a pre-trained second target detection model (texture side), and obtain candidate detection results in the texture mode, including the bounding boxes of candidate weld seam regions on the texture side and their corresponding confidence scores.
[0051] Calculate the interaction ratio (IoU) between depth modality and texture modality candidate bounding boxes: When the crossover ratio is greater than the set overlap threshold (0.5), the detection results of the two modes are determined to be consistent, and the weld position detection result is reliable. When the crossover ratio is less than or equal to the set overlap threshold, it is determined that there is a conflict in the modality results. The candidate detection results of the deep modality are used as the benchmark identification results, and a manual verification mark is generated.
[0052] Depth modality has a natural advantage in resisting dirt and is the main detection path; texture modality can supplement surface visual features and provide cross-validation under clean rail surface conditions; when the two conflict, the depth result takes precedence, which utilizes texture information to improve reliability and avoids detection errors caused by texture failure under dirty conditions.
[0053] 2. Full-process exception handling mechanism and principle Registration anomaly: If the ICP iteration in step S3 fails to converge after exceeding the maximum number of iterations, or if it is impossible to match enough feature points, a registration failure alarm message is generated, and local re-registration is performed on the current section; if the re-registration fails, the section is skipped and a data anomaly marker is generated.
[0054] Design principle: In vehicle dynamic detection, there are occasional situations where severe surface corrosion or foreign objects block the view, resulting in the loss of feature points. By using a local reregistration and skipping mechanism, we can avoid the interruption of the entire line detection due to a single registration failure, thereby improving the robustness of the system.
[0055] Data missing anomaly: If the three-dimensional profile data of the cross section is missing during the acquisition process, the height data of the missing cross section will be supplemented by linear interpolation of adjacent cross sections; if more than 5 consecutive cross sections are missing, the corresponding interval data will be marked as incomplete and no formal detection conclusion will be output.
[0056] Design principle: A small number of missing sections can be approximately filled in by interpolation to ensure the continuity of detection; when there are a large number of missing sections, the incomplete sections are actively marked to avoid outputting unreliable measurement results.
[0057] Verification anomaly: If the authenticity of the weld cannot be effectively determined after verifying the validity of the weld geometric signature, the corresponding position will be marked as an area to be manually reviewed, and the straightness judgment conclusion will not be automatically output to avoid misjudgment.
[0058] Example 2 This embodiment corresponds to Figure 2 The system module structure shown illustrates the system composition and data interaction logic for implementing the above detection method.
[0059] The detection system comprises eight modules connected in sequence. The functions and corresponding methods of each module are as follows: Data acquisition module (M1): includes a high-precision line structured light 3D camera and a speed encoder. The encoder triggers the camera to acquire data synchronously and outputs the three-dimensional profile data of the rail cross section, corresponding to method step S1. Preprocessing module (M2): Receives the three-dimensional profile data of the cross section, performs k-nearest neighbor statistical filtering for noise reduction and moving average smoothing in sequence, and outputs the smoothed three-dimensional profile data of the cross section, corresponding to method step S2; Registration module (M3): It has a built-in standard profile template library, receives smoothed profile data, performs feature point extraction, coarse registration and ICP fine registration in sequence, and outputs registered profile data aligned to the standard coordinate system, corresponding to method step S3; The output of this module provides a unified coordinate system benchmark for subsequent depth map reconstruction and is the core module for achieving cross-condition generalization.
[0060] Depth map reconstruction module (M4): Receives the registered profile data, extracts the track top surface height sequence, stacks it along the longitudinal direction and performs grayscale normalization, and outputs a normalized depth image, corresponding to method step S4; Weld seam positioning module (M5): It has a built-in YOLOv8 inference engine and geometric signature calculation unit. It receives the normalized depth image, first outputs the candidate detection results through the target detection model, then calculates the weld seam geometric signature in parallel and performs validity verification, and finally outputs the confirmed weld seam center position, corresponding to method step S5. Dual-modal fusion module (M6, optional): synchronously receives rail surface images acquired by texture camera, outputs texture detection results through texture side detection model, calculates cross-union ratio with depth detection results and completes confidence fusion, outputs fused weld position and verification mark, corresponding to dual-modal confidence fusion steps; Straightness Calculation Module (M7): Receives the weld center position and registered height data, extracts the rail top surface center height sequence within ±1m interval before and after the weld, fits the baseline using the least squares method and calculates the maximum absolute deviation, outputs the straightness value and the qualification judgment conclusion, corresponding to method step S6. Result Output Module (M8): Receives all test data and judgment conclusions, generates standardized test reports, completes data storage and historical trend analysis, and outputs corresponding results.
[0061] Each module is connected through a standardized data structure (cross-sectional profile structure, depth map matrix, detection box structure, geometric signature vector, and straightness record) to form an end-to-end detection closed loop. The system is mounted on an on-board GPU computing platform. The ICP operation of the registration module and the YOLO inference of the weld positioning module are both accelerated in parallel by the GPU to ensure real-time detection performance at 160km / h.
[0062] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computing software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0063] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0064] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for detecting weld straightness based on a high-precision 3D camera, characterized in that, Includes the following steps: S1. A line structured light 3D camera is used to continuously scan along the length of the rail to collect three-dimensional profile data of the rail cross section; S2. Perform noise reduction and smoothing processing on the three-dimensional profile data of each section in sequence to obtain smoothed three-dimensional profile data of the section; S3. Based on the pre-set standard rail profile template, rigid registration is performed on the smoothed measured cross-sectional three-dimensional profile data to eliminate camera installation angle deviation and rail position deviation, and all measured cross-sectional three-dimensional profile data are unified under the standard profile coordinate system. S4. Extract the rail top surface area height data from the 3D profile data of each cross section after registration, arrange them along the rail length direction in the order of acquisition to form a height data matrix, and perform linear normalization mapping on the height values to generate a normalized depth image under a unified coordinate system. S5. Input the normalized depth image into the pre-trained target detection model and output candidate detection results. The candidate detection results include candidate weld region bounding boxes and corresponding confidence scores. Calculate the weld geometric signature using the depth image region corresponding to the candidate weld region bounding boxes as the calculation range. The validity of the candidate detection results is verified by the weld geometric signature. If the verification is successful, the weld center is determined by the center position of the candidate weld area boundary box. S6. Using the determined weld center as a reference, select a measurement interval of a set length in the longitudinal direction of the rail, fit the reference baseline, calculate the maximum absolute deviation of the rail top surface height relative to the reference baseline within the measurement interval, and obtain the weld straightness value.
2. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, In step S1, the cross-sectional acquisition frequency of the line structured light 3D camera is not less than 1000Hz, the spatial distance between adjacent acquisition cross-sections along the length of the rail is not greater than 1mm, the measurement accuracy in the height direction is better than 0.05mm, and the lateral range of a single cross-sectional scan covers the complete width of the top surface of the rail.
3. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, In step S2, the noise reduction process uses k-nearest neighbor statistical filtering, where the value of k ranges from 8 to 12. The criteria for determining outlier sampling points are: the average distance of the k-nearest neighbors of the sampling point is greater than the sum of the average distance of all sampling points and twice the standard deviation. The smoothing process uses moving average filtering, where the filtering window contains 5 to 10 sampling points and slides along the extension direction of the top profile of the track.
4. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, Step S3 specifically includes the following sub-steps: S31. A standard rail profile template of corresponding specifications is pre-set according to the target rail model. The standard rail profile template includes complete outline data of the top surface of the rail head, the side surface of the rail head, the web of the rail, and the bottom of the rail. S32. Extract key feature points from the smoothed measured cross-sectional three-dimensional profile data. The key feature points include the center point of the top surface of the rail head, the starting point of the arc on both sides of the rail head, and the center point of the rail web. Match the measured key feature points with the corresponding feature points of the standard rail profile template, calculate the initial rigid transformation matrix, and complete the coarse registration. S33. Using the coarse registration result as the initial value, the iterative nearest point algorithm is used to perform fine registration. The optimal rigid transformation matrix that minimizes the sum of distances between the measured sampling points and the corresponding points of the template is solved iteratively until the change in the transformation matrix is less than the set convergence threshold or the maximum number of iterations is reached. S34. Apply the final obtained optimal rigid transformation matrix to the measured cross-sectional three-dimensional profile data to complete the alignment of the measured cross-sectional three-dimensional profile data to the standard profile coordinate system.
5. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, In step S4, the rows of the height data matrix correspond to the positions of the cross-sections along the length of the rail, the columns correspond to the transverse sampling points on the top surface of the rail, and the matrix elements are the height deviation values at the corresponding positions; the linear normalization mapping maps the height deviation values to a grayscale value range of 0~255, generating a normalized depth image in single-channel grayscale form.
6. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, The object detection model is a YOLOv8 object detection model, which is trained through the following steps: S51. Collect three-dimensional profile data of rail cross sections under different working conditions, and obtain corresponding normalized depth images through registration and reconstruction to construct a training sample set; the working conditions cover different rail models, weld types, track conditions and surface contamination levels; manually annotate the weld areas in each normalized depth image to generate annotation bounding boxes; S52. Using a single-channel normalized depth image as input sample and the corresponding labeled bounding box as label, train a YOLOv8 object detection model; the output of the YOLOv8 object detection model includes the coordinates of the weld area bounding box and the corresponding confidence score. Step S5 further includes the following sub-steps: S53. Input the normalized depth image into the trained YOLOv8 target detection model, set the initial screening confidence threshold, remove candidate bounding boxes with confidence scores lower than the initial screening confidence threshold, and obtain a set of effective candidate bounding boxes; select the effective candidate bounding box with the highest confidence score as the candidate weld area bounding box, and output the candidate detection result containing the candidate weld area bounding box and the corresponding confidence score. S54. Set a verification confidence threshold, which is higher than the initial screening confidence threshold; in the normalized depth image, using the region corresponding to the candidate weld region boundary box as a reference, delineate the weld window, the base material neighborhood window on both sides of the weld, and the roughness evaluation window, respectively, and calculate the result including local height steps. Local roughness The weld geometric signature; when the confidence level of the candidate detection result is lower than the verification confidence threshold, validity verification is triggered; when ≥Preset height threshold and When the roughness threshold is greater than or equal to the preset roughness threshold, the candidate detection result is deemed valid, and the corresponding position is confirmed to be a real weld. Otherwise, the area corresponding to the candidate detection result is determined to be a fake weld, and a manual verification mark is generated; After the verification is passed, the weld center is determined by the center position of the candidate weld area boundary box.
7. The weld straightness detection method based on a high-precision 3D camera according to claim 6, characterized in that, The weld geometric signature also includes the rail top surface height gradient feature, and local height steps. Local roughness Together they constitute the signature feature vector; The weld geometric signature is calculated in a standard profile coordinate system and is not affected by camera installation angle deviation or rail position deviation. When constructing the training sample set, the weld geometric signature is used as the basis for verifying the geometric consistency of the bounding box.
8. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, The method further includes a dual-modal confidence fusion step: Simultaneously acquire texture images of the rail surface, input the texture images into a pre-trained second target detection model (texture side), and obtain candidate detection results under the texture mode. The candidate detection results under the texture mode include the bounding boxes of candidate weld areas on the texture side and the corresponding confidence scores. Calculate the intersection-union ratio (IURR) of the candidate weld region bounding boxes in the depth mode and the candidate weld region bounding boxes in the texture mode; when the IURR is greater than the set coincidence threshold, the weld position detection result is deemed reliable. When the crossover ratio is less than or equal to the set overlap threshold, the candidate detection results of the deep modality are used as the benchmark identification results, and manual verification marks are generated.
9. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, Step S6 specifically includes the following sub-steps: S61. Using the center of the weld as a reference, take 1m before and after the rail length as the measurement interval; S62. The least squares method is used to fit the center height data of the rail top surface within the measurement interval to obtain the reference baseline; S63. Calculate the absolute deviation between the height of each sampling point within the measurement interval and the height of the corresponding position on the reference baseline, and take the maximum value of all absolute deviations as the straightness value of the corresponding weld. S64. Compare the straightness value with the specified limit value of the corresponding line grade, and output the judgment conclusion of whether the weld straightness is qualified or unqualified.
10. The weld straightness detection method based on a high-precision 3D camera according to claim 1, characterized in that, The method also includes an exception handling step: If, during the location registration process in step S3, there is no corresponding matching point or the iteration does not converge, a registration failure alarm message is generated, and local reregistration is performed on the current section or the corresponding section is skipped and a data anomaly marker is generated. If the three-dimensional profile data of the cross section is missing during the acquisition process, the height data of the missing cross section is supplemented by linear interpolation, or the corresponding interval data is marked as incomplete. If the authenticity of the weld cannot be effectively determined after validity verification, the corresponding position will be marked as an area to be manually reviewed, and the straightness judgment conclusion will not be automatically output.