Gas pipeline root welding quality detection method and system based on image recognition
By calculating the second derivative and characteristic weights in the gas transmission pipeline, and combining energy compensation and pressure sensitivity, the problems of weld identification accuracy and depth assessment in the gas transmission pipeline were solved, and high-precision welding quality control was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG HAINA ENVIRONMENTAL ENG CO LTD
- Filing Date
- 2026-01-20
- Publication Date
- 2026-05-29
Smart Images

Figure CN122116120A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology. More specifically, this invention relates to a method and system for detecting the welding quality at the root of gas pipelines based on image recognition. Background Technology
[0002] As a hub for modern industrial and civilian energy transmission, the construction quality of gas pipelines directly affects public safety and the stability of system operation. In the entire pipeline construction process, root welding, as the first weld bead, not only bears the core functions of sealing and pressure bearing, but also determines the quality of subsequent filling and cover welding. Due to the physical characteristics of gas pipelines, which are often long-distance, large-diameter, and enclosed spaces, the welding quality inspection of their internal environment has always faced enormous technical challenges.
[0003] Currently, traditional non-destructive testing methods such as ultrasonic testing or radiographic testing have a certain degree of accuracy in identifying weld defects. However, these methods generally have limitations such as long testing cycles, high costs, and difficulty in real-time integration with automated welding equipment. This makes it difficult to achieve real-time feedback and closed-loop control during the welding process, hindering further improvements in pipeline construction efficiency.
[0004] With the advancement of computer vision technology, image recognition-based assisted detection methods have begun to be applied in the field of industrial welding. However, inside complex gas pipelines, the strong reflection and diffuse reflection of the metal walls, as well as the non-uniform background formed by welding fumes, often introduce a large number of irregular noise and isolated points into the acquired images. This makes it difficult for conventional edge detection algorithms to accurately locate the physical contour of the weld in complex backgrounds. In addition, inside the narrow pipeline, the energy of the illumination source will experience significant natural attenuation as the spatial propagation sampling path increases. This inconsistency in optical characteristics means that the pixel grayscale information acquired by the sensor cannot objectively reflect the true physical depth of the weld, easily leading to serious evaluation errors at different detection locations.
[0005] More importantly, pipelines of different pressure levels have significantly different tolerances for welding defects. Existing image detection technologies often only remain at the level of qualitative observation of geometric contours, lacking a quantitative evaluation mechanism that deeply couples the dynamically changing visual features with the mechanical design parameters of the pipeline itself. This makes it difficult for the detection system to provide braking judgment criteria with practical reference value for different engineering safety standards, and it is difficult to meet the intelligent and precise quality control requirements of high-standard pipeline construction. Summary of the Invention
[0006] To address the technical problems of insufficient accuracy in identifying root weld features in complex environments on the inner walls of gas pipelines, interference from optical attenuation in physical depth assessment, and lack of mechanical parameter coupling in quality determination, this invention provides solutions in the following aspects.
[0007] In a first aspect, the present invention provides a method for detecting the quality of root welding of a gas pipeline based on image recognition, comprising: acquiring an image of the root of the gas pipeline and preprocessing it to obtain a preprocessed image of the root of the gas pipeline; acquiring the second derivatives of the pixels in the horizontal and vertical directions of the preprocessed image of the root of the gas pipeline, and obtaining the edge positioning intensity of each pixel by combining the directional feature weights determined by the welding process specification; acquiring the grayscale values of each pixel on the sampling path distributed along the weld in the preprocessed image, and obtaining the root welding degree of the sampling path by combining the physical distance of each pixel from the imaging center, the energy dissipation coefficient, and the edge positioning intensity of each pixel; obtaining a hazard score of the sampling path based on the root welding degree, the hazard sensitivity, and the average edge strength of the path; and sending a braking command to an automatic welding robot in response to the hazard score exceeding a judgment threshold.
[0008] This invention acquires images of the root of the gas pipeline and combines them with parameters such as the second derivatives in the horizontal and vertical directions and the physical distance of the sampling path to comprehensively evaluate the edge positioning strength and root welding degree. This generates a hazard score for controlling an automated welding robot, achieving a direct correlation between visual features and control commands. This reduces quality judgment errors caused by environmental interference in automated operations of the gas pipeline.
[0009] Preferably, obtaining the preprocessed gas pipeline root image includes: performing field normalization processing on the gas pipeline root image using a standard median filtering algorithm with a filter kernel size of 3×3 pixels to obtain the preprocessed gas pipeline root image.
[0010] This invention utilizes a filter kernel to perform field normalization processing on the root image of the gas pipeline. By spatially smoothing isolated noise points generated by metal reflection, it improves the quality of the underlying data for subsequent feature extraction, thereby reducing the interference of complex background light and shadow on the inner wall of the pipeline on the analysis of weld edges.
[0011] Preferably, the edge positioning strength satisfies the expression: In the formula, Indicates time pixels Edge positioning strength; Indicates time pixels grayscale distribution field; Indicates time At pixel The gradient vector field at the location; Indicates time At pixel The local normal vector at that location; Represented by pixels The summation region centered on; Represents the summation region Pixel index within; Indicates the feature weights in the horizontal direction; Indicates the feature weights in the vertical direction; Indicates the horizontal coordinate; Represents the vertical coordinates; This represents the dot product operation.
[0012] This invention obtains horizontal and vertical feature weights based on standard weld width and standard weld height. By introducing geometric constraints from the welding process specifications into the calculation of edge positioning strength, the algorithm improves the matching degree of weld morphology under specific processes, thereby reducing physical boundary positioning deviations caused by the mismatch of anisotropic features in the image.
[0013] Preferably, the horizontal feature weights and the vertical feature weights include: obtaining the standard weld width and standard weld height, wherein the horizontal feature weights are obtained in the following manner: The vertical feature weights are obtained as follows: ,in It is the standard weld bead width; This is the standard weld bead height.
[0014] Preferably, the root weld degree satisfies the expression: In the formula, Indicates time Root weld strength; Indicates time sampling path Upper The pixel energy value of each pixel; Indicates time No. The physical distance of each pixel from the center of the image; Indicates time The global maximum grayscale value; Indicates the energy dissipation coefficient; Indicates time The average edge strength of the path; Represents the natural constant.
[0015] Preferably, the energy dissipation coefficient is obtained by: using a reference light source to illuminate a ceramic calibration block with a reflectivity of 90% at a fixed distance, measuring the reflected light intensity and obtaining the initial intensity, and then... Obtain the energy dissipation coefficient, where It is the intensity of reflected light. It is the initial strength.
[0016] This invention uses a reference light source to illuminate a ceramic calibration block with a known reflectivity of 90% to obtain the energy dissipation coefficient. By compensating in real time for the loss caused by light energy propagating deep into the pipeline, the numerical stability of the root weld degree assessment under different optical paths is ensured, thereby reducing the distortion of weld depth assessment caused by the natural attenuation of background light intensity.
[0017] Preferably, the hazard score satisfies the expression: In the formula, Indicates time Harm score; Indicates time The average edge strength of the path; This represents the mean of the average edge intensity of all paths within the sampling path during the first 100 frames before system startup. Indicates a sliding time window; Represents a constant; Indicates sensitivity to hazards; Indicates time Root weld strength; Indicates time Edge positioning strength; This represents absolute value operations.
[0018] Preferably, the hazard sensitivity is obtained by: obtaining the pipeline design pressure; in response to the pipeline design pressure being less than... MPa, hazard sensitivity set at 0.5; responsive to pipeline design pressure greater than or equal to megapascals and less than Megapascals, hazard sensitivity Set to 1.0; responds to piping design pressure greater than or equal to Megapascals, with a hazard sensitivity setting of 1.5.
[0019] This invention reads the pipeline design pressure and maps it to differentiated hazard sensitivities, enabling the welding quality assessment system to proactively adapt to different gas transmission engineering standards, such as low-pressure or high-pressure systems. This achieves coordinated adjustment of detection sensitivity and safety level, thereby reducing the detection risk of failing to meet the safety requirements of specific pressure levels due to overly simplistic judgment criteria.
[0020] Preferably, the determination threshold is obtained by taking the 95.5th percentile of the hazard scores of the top 1000 qualified welds as the determination threshold.
[0021] Secondly, the present invention provides an image recognition-based gas pipeline root welding quality inspection system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned image recognition-based gas pipeline root welding quality inspection method is implemented.
[0022] By adopting the above technical solution, the above-mentioned image recognition-based gas pipeline root welding quality inspection method is generated into a computer program and stored in a memory so that it can be loaded and executed by a processor. In this way, a terminal device can be made based on the memory and the processor for convenient use.
[0023] The beneficial effects of this invention are as follows: This invention obtains edge positioning intensity by analyzing the second derivative of the image at the root of the gas pipeline and combining it with process weights, enabling the system to accurately capture the weld contour with anisotropic geometric features, thereby reducing the problem of unclear weld identification caused by complex background lighting.
[0024] This invention combines the physical distance of each pixel from the imaging center with the energy dissipation coefficient to obtain the root welding degree, and uses a compensation model to correct the pixel energy loss caused by the increase in optical path, thereby reducing the inconsistency in physical feature extraction caused by uneven illumination during long-distance detection of gas pipelines.
[0025] This invention maps edge positioning strength and root weld degree to a hazard score reflecting the pipeline design pressure and sends a braking command accordingly. By obtaining the quantile of historical qualified data as a dynamic judgment threshold, it strengthens the quality closed-loop control capability in the welding process, thereby reducing pipeline root welding quality defects caused by monitoring negligence. Attached Figure Description
[0026] Figure 1 The flowchart of the image recognition-based gas pipeline root welding quality inspection method of the present invention is shown schematically. Figure 2 A schematic diagram illustrating the variation in edge positioning intensity; Figure 3 A schematic diagram illustrating the effect of root weld degree compensation; Figure 4 The diagram illustrates the hazard score and braking determination. Detailed Implementation
[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0029] This invention discloses a method for inspecting the welding quality at the root of gas pipelines based on image recognition, referring to... Figure 1 This includes steps S1-S4: S1. Obtain the root image of the gas pipeline and perform preprocessing to obtain the preprocessed root image of the gas pipeline.
[0030] It should be noted that the internal environment of gas pipelines is extremely complex. The diffuse reflection effect on the inner wall of the pipeline will result in a large number of irregular isolated noise points in the root image of the gas pipeline. These irregular isolated noise points will seriously interfere with the subsequent accurate extraction of weld contour features. By performing field normalization processing before feature extraction, background interference can be removed and the clarity of weld edges can be enhanced, providing a reliable root image of the gas pipeline for subsequent quality assessment.
[0031] Specifically, an image of the gas pipeline root is acquired and preprocessed; a standard median filter algorithm is used to remove isolated noise points caused by metallic reflections in the gas pipeline root image, wherein the kernel size of the standard median filter algorithm is set to [value missing]. Pixels; edge enhancement is performed on the root image of the gas pipeline after processing with the standard median filtering algorithm using the difference of Gaussian operator.
[0032] S2. Obtain the second derivatives of the pixels in the horizontal and vertical directions of the preprocessed gas pipeline root image, and combine them with the directional feature weights determined by the welding process specifications to obtain the edge positioning intensity of each pixel.
[0033] It should be noted that the weld bead profile is affected by the welding current and the travel speed, and exhibits anisotropic geometric features in a two-dimensional projection. This invention obtains the edge positioning strength including process compensation by introducing weights determined based on the welding process specification, thereby accurately identifying the physical boundary of the weld bead.
[0034] Specifically, the second derivatives of the pixel in the horizontal and vertical directions are analyzed, and the edge positioning strength of the pixel including process compensation is calculated. The edge positioning strength satisfies the expression:
[0035] In the formula, Indicates time pixels Edge positioning strength; Indicates time pixels grayscale distribution field; Indicates time At pixel The gradient vector field at the location; Indicates time At pixel The local normal vector at that location; Represented by pixels The summation region centered on the target pixel is set as a circular window with a radius of 10 pixels. Represents the summation region Pixel index within; Indicates the feature weights in the horizontal direction; Indicates the feature weights in the vertical direction; Indicates the horizontal coordinate; Represents the vertical coordinates; This represents the dot product operation.
[0036] In the formula, as the cumulative contribution of the gradient vector in the local normal vector direction increases, it indicates that the current pixel is closer to the true physical boundary, making... As the value increases, it drives the final edge localization strength. It increases nonlinearly.
[0037] It is necessary to further supplement this information by obtaining the standard weld width defined in the welding procedure specification. With standard weld height The horizontal feature weights satisfy the expression. The vertical feature weights satisfy the expression. .
[0038] After obtaining the edge localization intensity of each pixel, the arithmetic mean of the edge localization intensity of all pixels distributed along the weld seam sampling path is calculated as the average edge intensity of the path at that moment, denoted as . .
[0039] For example, Figure 2 This is a schematic diagram illustrating the changes in edge positioning intensity, showing the distribution of edge positioning intensity at different pixels along the sampling path. Under the analytical mechanism including process compensation, the intensity values at the physical boundary of the weld remain at a high level with minimal fluctuations, demonstrating the invention's ability to capture weld contour features.
[0040] S3. Obtain the grayscale value of each pixel along the sampling path distributed along the weld in the preprocessed image, and combine the physical distance of each pixel from the imaging center, the energy dissipation coefficient, and the edge positioning strength of each pixel to obtain the root welding degree of the sampling path.
[0041] It should be noted that, since the industrial camera is located deep within the pipeline, the energy of the background light inside the pipeline will naturally attenuate as the propagation sampling path increases. This directly causes the grayscale values in the image at the root of the gas pipeline to not directly correspond to the physical depth, resulting in evaluation errors. This invention uses an energy compensation model based on the Beer-Lambert law to obtain the root weld degree and repair the optical path loss in real time, so as to obtain consistent and accurate physical depth features at different locations.
[0042] Specifically, the root weld degree is obtained by integrating the pixel energy of the weld area through sampling path compensation, and the root weld degree satisfies the expression:
[0043] In the formula, Indicates time Root weld strength; Indicates time sampling path Upper The pixel energy value of each pixel; Indicates time No. The physical distance of each pixel from the center of the image; Indicates time The global maximum grayscale value; Indicates the energy dissipation coefficient; Indicates time The average edge strength of the path; Represents the natural constant.
[0044] In the formula, as the physical distance... As the value of the numerator increases, the signal loss increases, which in turn increases the compensation integral value of the numerator term, driving the final root weld strength. Maintain consistency in evaluation values at the same physical depth.
[0045] It should be further added that the energy dissipation coefficient is obtained as follows: during the device initialization phase, a reference light source at the front end of the probe is used at a fixed distance. Irradiate a ceramic calibration block with a known reflectivity of 90% and measure the intensity of the reflected light. And obtain the initial strength The energy dissipation coefficient satisfies the expression. In the formula, Represents the natural logarithm operation; Indicates a fixed distance. Indicates the intensity of reflected light. Indicates the initial intensity.
[0046] For example, Figure 3 This is a schematic diagram illustrating the effect of root weld compensation, showing the trend of root weld degree changing with imaging physical distance. Thanks to the real-time correction of optical path loss by the energy compensation model, the root weld degree remains stable as the physical distance increases, indicating that this invention effectively solves the depth assessment deviation caused by light and shadow attenuation deep within the pipeline.
[0047] S4. Based on the root weld degree, hazard sensitivity, and average edge strength of the path, obtain the hazard score of the sampling path; in response to the hazard score exceeding the judgment threshold, send a braking command to the automatic welding robot.
[0048] It should be noted that the present invention requires weighting adjustment in conjunction with pipeline design pressure to assess the severity of welding defects. The present invention outputs a hazard score by combining geometric fluctuations and depth characteristics, providing a judgment basis with mechanical reference value for automated control systems.
[0049] Specifically, by combining the integral features and depth features of edge fluctuations, a hazard score is obtained, which satisfies the expression:
[0050] In the formula, Indicates time Harm score; Indicates time The average edge strength of the path; This represents the mean of the average edge intensity of all paths within the sampling path during the first 100 frames before system startup. This indicates the sliding time window, set to 20 sampling periods; Represents a constant, set to ; Indicates sensitivity to hazards; Indicates time Root weld strength; Indicates time Edge positioning strength; This represents absolute value operations.
[0051] In the formula, the hazard sensitivity corresponds to the pipeline design pressure. As the value increases, the system's penalty for anomalies per unit physical depth increases, causing the second term in the expression to... The increased weight of the factor drives the final harm score. It grew rapidly.
[0052] The method for obtaining hazard sensitivity is: if the pipeline design pressure... Less than 2.5 MPa, then the hazard sensitivity is... Set to 0.5; if the pipeline design pressure If the hazard sensitivity is greater than or equal to 2.5 MPa and less than 6.4 MPa, then the hazard sensitivity is... Set to 1.0; if the pipeline design pressure A sensitivity level greater than or equal to 6.4 MPa indicates a hazard sensitivity. The design pressure is set to 1.5. This invention sets the pipeline design pressure to 1.5. The segmentation thresholds are set at 2.5 MPa and 6.4 MPa, which are determined in accordance with the safety classification requirements for pressure levels in the gas pipeline engineering design standards; 2.5 MPa and 6.4 MPa correspond to the critical points of low pressure, medium and high pressure and high pressure long-distance transmission environments, respectively.
[0053] Furthermore, by collecting hazard scores from the first 1000 qualified welds... The data was used, and its 95.5th percentile was taken as the judgment threshold. ; Response to hazard score Exceeding the judgment threshold The controller sends braking commands to the automatic welding robot and drives the audible and visual alarm module to perform alarm actions.
[0054] For example, Figure 4 This is a schematic diagram illustrating the hazard score and braking determination. The diagram depicts how the hazard score changes over time and its comparison with the determination threshold. When the system detects abnormal fluctuations in the welding area, the hazard score rises rapidly and exceeds the preset determination threshold. At this point, the system will issue a braking command to control the welding robot to stop the operation.
[0055] This invention also discloses an image recognition-based gas pipeline root welding quality inspection system, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the image recognition-based gas pipeline root welding quality inspection method according to this invention.
[0056] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
Claims
1. A method for inspecting the welding quality at the root of a gas pipeline based on image recognition, characterized in that, include: The root image of the gas pipeline is acquired and preprocessed to obtain the preprocessed root image of the gas pipeline. The second derivatives of the pixels in the horizontal and vertical directions of the preprocessed gas pipeline root image are obtained, and the edge positioning intensity of each pixel is obtained by combining the directional feature weights determined by the welding process specifications. The grayscale value of each pixel along the sampling path distributed along the weld in the preprocessed image is obtained. The root welding degree of the sampling path is obtained by combining the physical distance of each pixel from the imaging center, the energy dissipation coefficient, and the edge positioning strength of each pixel. Based on the root weld strength, hazard sensitivity, and average edge strength of the path, a hazard score is obtained for the sampling path; in response to the hazard score exceeding the judgment threshold, a braking command is sent to the automatic welding robot.
2. The method for detecting the welding quality of the root of a gas pipeline based on image recognition according to claim 1, characterized in that, The obtained preprocessed image of the gas pipeline root includes: The root image of the gas pipeline was normalized by using a standard median filter algorithm with a filter kernel size of 3×3 pixels to obtain the preprocessed root image of the gas pipeline.
3. The method for inspecting the welding quality of the root of a gas pipeline based on image recognition according to claim 1, characterized in that, The edge positioning strength satisfies the expression: ; In the formula, Indicates time pixels Edge positioning strength; Indicates time pixels The grayscale distribution field; Indicates time At pixel The gradient vector field at the location; Indicates time At pixel The local normal vector at that location; Represented by pixels The summation region centered on; Represents the summation region Pixel index within; Indicates the feature weights in the horizontal direction; Indicates the feature weights in the vertical direction; Indicates the horizontal coordinate; Represents the vertical coordinates; This represents the dot product operation.
4. The image recognition-based method for inspecting the welding quality of gas pipeline roots according to claim 3, characterized in that, The horizontal feature weights and the vertical feature weights include: The standard weld width and standard weld height are obtained by acquiring the horizontal feature weights as follows: The vertical feature weights are obtained as follows: ,in It is the standard weld bead width; This is the standard weld bead height.
5. The method for detecting the welding quality of the root of a gas pipeline based on image recognition according to claim 1, characterized in that, The root weld degree satisfies the expression: ; In the formula, Indicates time Root weld strength; Indicates time sampling path Upper The pixel energy value of each pixel; Indicates time No. The physical distance of each pixel from the center of the image; Indicates time The global maximum grayscale value; Indicates the energy dissipation coefficient; Indicates time The average edge strength of the path; Represents the natural constant.
6. The method for detecting the welding quality of the root of a gas pipeline based on image recognition according to claim 5, characterized in that, The energy dissipation coefficient is obtained as follows: A ceramic calibration block with a reflectivity of 90% is illuminated at a fixed distance using a reference light source. The reflected light intensity is measured to obtain the initial intensity, and then... Obtain the energy dissipation coefficient, where It is the intensity of reflected light. It is the initial strength.
7. The method for detecting the welding quality of the root of a gas pipeline based on image recognition according to claim 1, characterized in that, The hazard score satisfies the expression: In the formula, Indicates time Harm score; Indicates time The average edge strength of the path; This represents the mean of the average edge intensity of all paths within the sampling path during the first 100 frames before system startup. Indicates a sliding time window; Represents a constant; Indicates sensitivity to hazards; Indicates time Root weld strength; Indicates time Edge positioning strength; This represents absolute value operations.
8. The method for detecting the welding quality of the root of a gas pipeline based on image recognition according to claim 7, characterized in that, The method for obtaining the hazard sensitivity is as follows: Obtain the pipeline design pressure; respond to the pipeline design pressure being less than MPa, hazard sensitivity set at 0.5; responsive to pipeline design pressure greater than or equal to megapascals and less than Megapascals, hazard sensitivity Set to 1.0; responds to piping design pressure greater than or equal to Megapascals, with a hazard sensitivity setting of 1.
5.
9. The method for detecting the welding quality of the root of a gas pipeline based on image recognition according to claim 7, characterized in that, The determination threshold is obtained as follows: The 95.5th percentile of the hazard scores of the top 1000 qualified welds was used as the judgment threshold.
10. A gas pipeline root welding quality inspection system based on image recognition, characterized in that, include: The processor and memory, wherein the memory stores computer program instructions that, when executed by the processor, implement the image recognition-based gas pipeline root welding quality inspection method according to any one of claims 1-9.