Method and system for detecting defects of curved welds of pipelines by photoelasticity

CN122989574APending Publication Date: 2026-10-27WUHAN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611068916.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-17
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0004]然而传统光弹检测方法中,对光弹图像中的缺陷识别多依赖人工完成,不仅效率偏低,而且主观性较强

Benefits of technology

本发明提供的管道曲面焊缝缺陷光弹检测方法通过采集管道曲面焊缝区域的原始光弹图像并对其进行曲面几何畸变校正,有效消除了管道曲率造成的图像几何失真,为后续检测提供了高质量的输入数据;在此基础上,利用包含依次连接的编码器、多尺度减法特征提纯模块、曲率注意力CGA模块和解码器的CGA-M2SNet网络模型,由编码器提取多层级特征,由多尺度减法特征提纯模块通过差分运算提取层级间互补差异特征以凸显缺陷边缘与结构信息,并由CGA模块根据曲率信息生成逐像素注意力权重对差异特征进行曲率加权增强,从而在对多尺度缺陷特征进行精准捕捉的同时有效压制曲面曲率带来的背景干扰,实现了对管道曲面焊缝缺陷的端到端自动化精准检测,显著提高了检测精度与检测效率,并具有良好的曲面适配性和泛化能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989574A_ABST
    Figure CN122989574A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of pipeline curved surface weld defect photoelastic detection method and system.The method includes collecting the original photoelastic image of pipeline curved surface weld area;The original photoelastic image is carried out curved surface geometry distortion correction preprocessing, and standard photoelastic image is obtained;Standard photoelastic image is input into trained defect detection model, the model includes encoder, multiscale subtraction feature purification module, curvature attention CGA module and decoder connected in turn;Encoder extracts multi-level feature;Multiscale subtraction feature purification module extracts complementary difference features between levels by difference operation;CGA module generates pixel-by-pixel attention weight according to the curvature information of difference feature, and difference feature is output to decoder after curvature weighted enhancement, decoder decoding, and finally output defect detection result.The method is combined by curved surface distortion correction and curvature attention enhancement, effectively suppresses curved surface background interference, realizes the accurate, efficient detection of pipeline curved surface weld defect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of weld defect detection technology, and in particular to a photoelastic detection method and system for weld defects on curved pipe surfaces. Background Technology

[0002] Currently, the main methods for weld defect detection include ultrasonic testing, radiographic testing, magnetic particle testing, and photoelastic testing. Ultrasonic testing and radiographic testing are easily affected by the curvature of the surface when inspecting welds on curved pipe surfaces, resulting in lower detection accuracy and radiation hazards; magnetic particle testing is only applicable to ferromagnetic materials, limiting its scope of application.

[0003] Photoelastic testing, based on the polarization characteristics of light, uses interference fringes generated by stress birefringence to reflect the stress distribution within a material, thus revealing weld defect information. The photoelastic patch method is a full-field observation analysis method that can detect unpredictable high-stress areas, such as stress concentration zones caused by welding. Photoelastic testing offers advantages such as being non-destructive, radiation-free, and providing intuitive detection, making it suitable for weld inspection of various materials.

[0004] However, in traditional photoelastic inspection methods, defect identification in photoelastic images largely relies on manual work, which is not only inefficient but also highly subjective. For curved weld seams in pipelines, the curvature variations themselves complicate the background of the photoelastic image, blurring defect features and further reducing detection accuracy. Most existing photoelastic inspection methods do not specifically address the curvature characteristics of curved weld seams in pipelines, making it difficult to effectively distinguish defect areas from background interference. Consequently, the rates of missed and false detections remain high, failing to meet the requirements for accurate defect detection in curved weld seams of pipelines. Summary of the Invention

[0005] This invention provides a photoelastic detection method and system for defects in curved weld seams of pipelines, in order to overcome at least one of the above-mentioned technical problems existing in the prior art.

[0006] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions: In a first aspect, the present invention provides a photoelastic detection method for defects in curved weld seams of pipelines, comprising: Acquire raw photoelastic images of the weld area on the curved surface of the pipeline; The original photoelastic image is preprocessed to obtain a standard photoelastic image. The preprocessing includes at least surface geometric distortion correction of the original photoelastic image. The standard photoelastic image is input into the trained defect detection model, and the defect detection result is output. The defect detection model is CGA-M. 2The SNet network model includes an encoder, a multi-scale subtraction feature extraction module, a curvature attention CGA module, and a decoder connected in sequence. The encoder is used to extract multi-level features from the standard photoelastic image. The multi-scale subtraction feature extraction module is used to perform differential operations on the multi-level features to extract complementary difference features between levels. The CGA module is used to generate pixel-wise attention weights based on the curvature information of the difference features, and then perform curvature-weighted enhancement on the difference features before outputting them to the decoder.

[0007] In one possible implementation of the first aspect, the surface geometric distortion correction of the original photoelastic image includes: The original photoelastic image is subjected to coordinate transformation using a cylindrical inverse distortion model. The transformation formula is as follows: ; In the formula, The radius of curvature of the pipe; These are the original pixel coordinates of the distorted image; These are the coordinates of the pixels without distortion after correction.

[0008] In one possible implementation of the first aspect, the step of performing a difference operation on the multi-level features to extract complementary difference features between levels includes: The adjacent feature maps in the multi-level features are subtracted element by element and the absolute value is taken. The result is then convolved through multiple fixed-weight filters of different scales. The convolution results of each scale are aggregated and then convolved again to output multi-scale difference features.

[0009] In one possible implementation of the first aspect, the CGA module performs curvature-weighted enhancement on the difference features, including: Perform a two-dimensional Laplacian operation on the difference feature map to obtain the curvature matrix; The curvature matrix is ​​Softmax normalized to generate attention weights; The attention weights are multiplied element-wise by the differential features to output the weighted enhanced features.

[0010] In one possible implementation of the first aspect, the training process of the defect detection model includes: A dataset of photoelastic defects in curved weld seams of pipes is constructed, which contains photoelastic images of various defect types. The model parameters are optimized using a composite loss function, which is a weighted sum of the cross-entropy loss function and the Dice loss function. The defect detection model is trained using the AdamW optimizer until a preset training termination condition is met.

[0011] In one possible implementation of the first aspect, the defect detection result includes a defect region; The pixel coordinates of the defect area are mapped to the actual coordinates of the workpiece using a pixel-physical space calibration coefficient. The mapping formula is as follows: ; The size of the defective region is determined based on the number of pixels in the defective region and the calibration coefficient; Where (x, y) are the pixel coordinates of the defect region in the standard photoelastic image, (X, Y) are the actual coordinates of the defect region on the workpiece surface, and ρ is the calibration coefficient.

[0012] In one possible implementation of the first aspect, the calibration method for the calibration coefficient ρ includes: Place a ruler of known length at the same imaging distance as the workpiece to be measured; The pixel coordinates at both ends of the standard scale on the ruler are extracted by subpixel edge detection, and the pixel length corresponding to the scale segment is calculated. Calculate the pixel equivalent for a single group, where the pixel equivalent is the ratio of the actual length of the scale segment to the pixel length; Select scale segments at different positions in the image of the scale, calculate the pixel equivalent of each group, remove outliers and take the arithmetic mean to obtain the calibration coefficient ρ.

[0013] In one possible implementation of the first aspect, when the defect detection result indicates the presence of a defect region, it further includes: The photoelastic image of the defect area is acquired, and after the preprocessing of the photoelastic image of the defect area, it is input into the defect detection model to obtain the secondary detection result; Calculate the overlap between the defect area in the defect detection result and the defect area in the secondary detection result. When the overlap reaches a preset threshold, determine that the detection is consistent and output the final detection result.

[0014] In one possible implementation of the first aspect, calculating the overlap between the defect region in the defect detection result and the defect region in the secondary detection result includes: The overlap between the defect area in the defect detection result and the defect area in the secondary detection result is calculated using the following formula: ; In the formula, The defect area is defined in the defect detection results. For the defective areas in the secondary detection results, when the overlap rate (Consistency) is ≥ 0.8, the detection is considered consistent.

[0015] Compared with the prior art, the present invention has at least the following beneficial effects: The photoelastic detection method for defects in curved weld seams of pipelines provided by this invention effectively eliminates image geometric distortion caused by pipeline curvature by acquiring the original photoelastic image of the weld seam area on the curved surface of the pipeline and correcting its surface geometric distortion, thus providing high-quality input data for subsequent detection. Based on this, a CGA-M module, comprising an encoder, a multi-scale subtraction feature purification module, a curvature attention CGA module, and a decoder connected in sequence, is utilized. 2 The SNet network model extracts multi-level features through an encoder, and a multi-scale subtraction feature purification module extracts complementary difference features between levels through differential operations to highlight defect edges and structural information. The CGA module generates pixel-by-pixel attention weights based on curvature information to enhance the difference features with curvature weighting. This allows for accurate capture of multi-scale defect features while effectively suppressing background interference caused by surface curvature. It achieves end-to-end automated and accurate detection of weld defects on curved pipe surfaces, significantly improving detection accuracy and efficiency, and exhibiting good surface adaptability and generalization ability.

[0016] Secondly, the present invention provides a photoelastic inspection system for defects in curved weld seams of pipelines, comprising: The image acquisition module is used to acquire raw photoelastic images of the weld area on the curved surface of the pipeline; The image preprocessing module is used to preprocess the original photoelastic image to obtain a standard photoelastic image. The preprocessing includes at least surface geometric distortion correction of the original photoelastic image. The defect detection module is used to input the standard photoelastic image into the trained defect detection model and output the defect detection result. The defect detection model is CGA-M. 2 The SNet network model includes an encoder, a multi-scale subtraction feature extraction module, a curvature attention CGA module, and a decoder connected in sequence. The encoder is used to extract multi-level features from the standard photoelastic image. The multi-scale subtraction feature extraction module is used to perform differential operations on the multi-level features to extract complementary difference features between levels. The CGA module is used to generate pixel-wise attention weights based on the curvature information of the difference features, and then perform curvature-weighted enhancement on the difference features before outputting them to the decoder.

[0017] Thirdly, the present invention provides an electronic device comprising: at least one processor and at least one memory, wherein the memory stores computer-readable instructions; the computer-readable instructions are executed by one or more of the processors, causing the electronic device to implement the photoelastic detection method for defects in curved weld seams of pipes as described in any implementation of the first aspect.

[0018] Fourthly, the present invention provides a storage medium having a computer-executable program stored thereon, the computer-executable program being used to cause a computer to execute the photoelastic detection method for defects in curved weld seams of pipes as described in any implementation of the first aspect.

[0019] Understandably, the beneficial effects achieved by the system of the second aspect, the electronic device of the third aspect, and the storage medium of the fourth aspect provided above can be referred to in light of the beneficial effects of the first aspect and any of its possible design embodiments, which will not be repeated here. Attached Figure Description

[0020] 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 some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a photoelastic detection method for defects in curved weld seams of pipelines, provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the curved surface reflective photoelastic testing experimental platform used in an embodiment of the present invention; Figure 4 This is a structural block diagram of a photoelastic detection system for defects in curved weld seams of pipelines, provided in an embodiment of the present invention. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be described below with reference to the accompanying drawings. In the description of the present invention, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can represent A or B. The "or" in the present invention is merely a description of the relationship between the related objects, indicating that three relationships can exist. For example, A or B can represent: A alone, A and B simultaneously, and B alone. A and B can be singular or plural. Furthermore, in the description of the present invention, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items.

[0023] Furthermore, to facilitate a clear description of the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.

[0024] In this embodiment of the invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this embodiment of the invention should not be construed as superior or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner for ease of understanding.

[0025] Currently, the main methods for weld defect detection include ultrasonic testing, radiographic testing, magnetic particle testing, and photoelastic testing. Ultrasonic testing and radiographic testing are easily affected by the curvature of the surface when inspecting welds on curved pipe surfaces, resulting in lower detection accuracy and radiation hazards; magnetic particle testing is only applicable to ferromagnetic materials, limiting its scope of application.

[0026] Photoelastic testing, based on the polarization characteristics of light, uses interference fringes generated by stress birefringence to reflect the stress distribution within a material, thus revealing weld defect information. The photoelastic patch method is a full-field observation analysis method that can detect unpredictable high-stress areas, such as stress concentration zones caused by welding. Photoelastic testing offers advantages such as being non-destructive, radiation-free, and providing intuitive detection, making it suitable for weld inspection of various materials.

[0027] However, in traditional photoelastic inspection methods, defect identification in photoelastic images largely relies on manual work, which is not only inefficient but also highly subjective. For curved weld seams in pipelines, the curvature variations themselves complicate the background of the photoelastic image, blurring defect features and further reducing detection accuracy. Most existing photoelastic inspection methods do not specifically address the curvature characteristics of curved weld seams in pipelines, making it difficult to effectively distinguish defect areas from background interference. Consequently, the rates of missed and false detections remain high, failing to meet the requirements for accurate defect detection in curved weld seams of pipelines.

[0028] In view of this, on the one hand, embodiments of the present invention provide a photoelastic detection method for defects in curved weld seams of pipelines, comprising: acquiring an original photoelastic image of the weld seam region of the curved surface of the pipeline; preprocessing the original photoelastic image to obtain a standard photoelastic image, wherein the preprocessing includes at least correcting the surface geometric distortion of the original photoelastic image; inputting the standard photoelastic image into a trained defect detection model, and outputting a defect detection result; wherein the defect detection model is CGA-M. 2The SNet network model includes an encoder, a multi-scale subtraction feature extraction module, a curvature attention CGA module, and a decoder connected in sequence. The encoder is used to extract multi-level features from the standard photoelastic image. The multi-scale subtraction feature extraction module is used to perform differential operations on the multi-level features to extract complementary difference features between levels. The CGA module is used to generate pixel-wise attention weights based on the curvature information of the difference features, and then perform curvature-weighted enhancement on the difference features before outputting them to the decoder.

[0029] The photoelastic detection method for defects in curved weld seams of pipelines provided in this embodiment of the invention effectively eliminates image geometric distortion caused by pipeline curvature by acquiring the original photoelastic image of the weld seam area of ​​the pipeline and correcting its surface geometric distortion, thus providing high-quality input data for subsequent detection. Based on this, a CGA-M module, comprising an encoder, a multi-scale subtraction feature purification module, a curvature attention CGA module, and a decoder connected in sequence, is utilized. 2 The SNet network model extracts multi-level features through an encoder, and a multi-scale subtraction feature purification module extracts complementary difference features between levels through differential operations to highlight defect edges and structural information. The CGA module generates pixel-by-pixel attention weights based on curvature information to enhance the difference features with curvature weighting. This allows for accurate capture of multi-scale defect features while effectively suppressing background interference caused by surface curvature. It achieves end-to-end automated and accurate detection of weld defects on curved pipe surfaces, significantly improving detection accuracy and efficiency, and exhibiting good surface adaptability and generalization ability.

[0030] In some embodiments, the photoelastic detection method for defects in curved weld seams of pipelines provided in this invention can be executed by any electronic device 20 with data processing capabilities, such as a general-purpose computer, personal computer, laptop computer, switch, or tablet computer. The specific implementation of the electronic device 20 is not limited here.

[0031] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown. The electronic device 20 includes a processor 210, a memory 220, and a communication interface 230.

[0032] Processor 210 may include one or more processing cores. Processor 210 connects to various parts within electronic device 20 using various interfaces and lines, and performs various functions and processes data of electronic device 20 by running or executing instructions, programs, code sets, or instruction sets stored in memory 220, and by calling data stored in memory 220. Optionally, processor 210 may be implemented using at least one of the following hardware forms: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).

[0033] The memory 220 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 220 may include a non-transitory computer-readable storage medium. The memory 220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 220 may include a program storage area. This program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc.

[0034] Communication interface 230 is used to communicate with other devices, equipment or communication networks, such as data storage devices, image processing devices or Ethernet, wireless access network (RAN), wireless local area network (WLAN), etc.

[0035] In terms of physical implementation, the aforementioned devices (such as processor 210, memory 220, and communication interface 230) can each be devices within the same device (such as a laptop computer). Alternatively, at least two of these devices can be located within the same device, i.e., as different devices within the same device, similar to the deployment of devices or components in a distributed system.

[0036] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 20. In other embodiments of the present invention, the electronic device 20 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0037] The following description, in conjunction with the accompanying drawings, illustrates a photoelastic detection method for defects in curved weld seams of pipelines provided by an embodiment of the present invention.

[0038] like Figure 2 As shown in the embodiment of the present invention, a photoelastic detection method for defects in curved weld seams of pipelines is provided. This method may include, but is not limited to, the following: S1: Acquire the original photoelastic image of the weld area on the curved surface of the pipeline.

[0039] In embodiments of the present invention, the original photoelastic image of the weld seam area on the curved surface of a pipe can be acquired using a reflective photoelastic instrument. Specifically, as shown... Figure 3 As shown, a curved surface reflective photoelastic testing experimental platform was constructed. The experimental equipment can be an LF / Z-2 reflective photoelastic instrument, paired with a clamping fixture suitable for curved workpieces. The photoelastic patch is adhered to the surface of the curved weld seam of the pipe using adhesive. The curved workpiece to be tested, with the weld seam, is then stably clamped onto the fixture of the universal testing machine. The angle of the fixture is manually fine-tuned to align the weld seam testing area with the instrument's optical path, ensuring that the incident light rays are perpendicularly incident on the surface of the photoelastic patch and then reflect back along the same path. Simultaneously, the entire weld seam to be tested is placed within the instrument's actual imaging and testing range.

[0040] The fixture is equipped with an adjustable curvature structure, capable of accommodating weld seams on pipe surfaces with varying curvatures. The fixture adjustment angle θ and the pipe curvature radius R satisfy the following relationship: .

[0041] In the formula, r is the chord length corresponding to the radius of curvature, and R is the radius of curvature of the pipe.

[0042] Turn on the light source of the reflective photoelastic instrument, and adjust the optical path so that the incident light rays can be perpendicularly incident on the surface of the photoelastic patch and then return along the original path. Turn on the universal testing machine and apply a preset loading force to the specimen (for example, apply 1000N, 2000N, 3000N, 4000N, and 5000N respectively) to cause stress concentration in the weld defect area.

[0043] The light emitted from the light source of the reflective photoelastic instrument passes sequentially through a polarizer and a quarter-wave plate, forming circularly polarized light that is incident on a photoelastic patch attached to the surface of the curved weld of the pipe. The circularly polarized light penetrates the photoelastic patch, reaches the reflective layer at the bottom of the patch, and is reflected. The reflected light then passes through the photoelastic patch again. During this penetration-reflection-repeating process, the photoelastic patch exhibits stress birefringence under the residual stress of the weld, causing the incident light to accumulate an optical path difference corresponding to the stress distribution of the weld during its two passes through the patch. The reflected light carrying stress information passes sequentially through a quarter-wave plate and an analyzer, and is then captured by a digital camera to obtain a photoelastic interference fringe pattern containing information about the weld stress distribution. After photoelectric conversion, the original photoelastic image is generated.

[0044] The phase compensation amount of the quarter-wave plate is: .

[0045] In the formula, λ is the wavelength of the incident light.

[0046] S2: Preprocess the original photoelastic image to obtain a standard photoelastic image. The preprocessing includes at least surface geometric distortion correction of the original photoelastic image.

[0047] Due to the geometric characteristics of the curved surface of the pipe, the original photoelastic image exhibits geometric distortion caused by the projection of the curved surface, requiring surface geometric distortion correction. In one feasible implementation, this embodiment of the invention performs inverse cylindrical distortion coordinate transformation pixel by pixel based on the pipe's radius of curvature R, and uses bilinear interpolation to complete the pixels, outputting the corrected image.

[0048] The coordinate transformation formula for the cylindrical inverse distortion model is: ; In the formula, The radius of curvature of the pipe; These are the original pixel coordinates of the distorted image; These are the coordinates of the pixels without distortion after correction.

[0049] The coordinate transformation formula maps the pixels on the curved surface to the planar position after the cylinder is unfolded, thereby effectively eliminating the geometric distortion of the image caused by the curvature of the pipe.

[0050] In addition to correcting the surface geometric distortion of the original photoelastic image, the embodiments of the present invention may include, but are not limited to, preprocessing steps such as denoising, grayscale normalization, and size standardization.

[0051] Specifically, this embodiment of the invention employs a combination of bilateral filtering and median filtering to denoise the corrected image. First, a bilateral filter is used to remove global Gaussian noise while preserving the edges of photoelastic fringes and defect boundaries. The weights of the bilateral filter consider both pixel spatial distance and grayscale similarity, and its expression is: .

[0052] In the formula, Ω is the neighborhood window (5×5 in this embodiment); w s The spatial weight kernel is calculated based on the Euclidean distance between pixels, with spatial variance σ. s =4;w r The grayscale weight kernel is calculated based on the pixel grayscale difference, with grayscale variance σ. r =20; I roi (i,j) represents the gray value of the input image at pixel (i,j); This represents the grayscale value at pixel (x, y) after bilateral filtering.

[0053] Spatial weight kernel w s and grayscale weight kernel w r The specific calculation formula is as follows: ; .

[0054] By using bilateral filtering, Gaussian noise is removed while effectively preserving the detailed information of photoelastic fringes and the edge features of defects.

[0055] Then, median filtering (kernel size 3×3) is used to eliminate residual impulse noise points after bilateral filtering. The formula for median filtering is: .

[0056] In the formula, f(x,y) is the gray value of the input image at pixel (x,y); f'(x,y) is the filtered output value; and median{} is the median operation.

[0057] This invention employs a percentile grayscale normalization method to eliminate the influence of illumination intensity on photoelastic images, normalizing the image grayscale values ​​to the [0, 1] interval. The formula is: .

[0058] In the formula, I enhance (x,y) represents the gray value of the image to be normalized at pixel (x,y) (the original gray value range is 0~255); I norm (x,y) represents the normalized grayscale value; P5 is the 5th percentile of all pixel grayscale values ​​in the entire image, used to remove low grayscale abnormal extreme values ​​such as dark noise and dark spots; P 95It is the 95th percentile of all pixel grayscale values ​​in the entire image, used to remove high grayscale abnormal extreme values ​​such as bright spots from curved surfaces and strong light noise.

[0059] To prevent pixel values ​​from going out of bounds, a range truncation constraint is applied to the normalization result: if I norm If (x,y)<0, then the value is 0; if I norm If (x,y)>1, then the value is 1.

[0060] In this embodiment of the invention, bilinear interpolation is used to adjust the normalized image to a preset size (512×512 pixels in this embodiment) so that the input image size matches the input layer of the network model, thus avoiding image distortion.

[0061] The pixel mapping relationship is as follows: .

[0062] In the formula, (W source H source (W) represents the original image size; target H target The target size is 512×512 pixels.

[0063] The standard photoelastic image is obtained through the above preprocessing steps.

[0064] S3: Input the standard photoelastic image into the trained defect detection model and output the defect detection result.

[0065] The defect detection model in this embodiment of the invention is CGA-M. 2 The SNet network model includes an encoder, a multi-scale subtraction feature purification module, a curvature attention CGA module, and a decoder connected in sequence.

[0066] The encoder uses Res2Net-50 as its backbone network to extract multi-level features from the standard photoelastic image. The encoder outputs five feature maps E1~E5 with different receptive fields, covering multi-scale information from pixel-level details to global semantics. 3×3 convolutions are used to reduce the number of feature channels in each layer to 64, thereby reducing model computation and parameter redundancy.

[0067] The basic convolution operation formula is: .

[0068] In the formula, W represents the convolution kernel weights; b represents the bias term; * represents the convolution operation; σ represents the ReLU activation function; and F represents the revolution kernel weights. in For the input feature map; F conv This is for outputting feature maps.

[0069] The multi-scale subtraction feature purification module is used to perform difference operations on the multi-level features to extract complementary difference features between levels. The multi-scale subtraction feature purification module is based on the basic subtraction unit (SU) and extended to an intra-layer multi-scale subtraction unit (MSU).

[0070] The basic subtraction unit (SU) is used to extract single-scale bidirectional difference information of features from adjacent layers of the encoder. It removes redundant information from the common background through element-wise differencing and absolute value operations, retaining specific defect difference features. The calculation formula for the basic subtraction unit SU is: .

[0071] In the formula, F A F B represents the feature maps of two adjacent layers of the encoder; |.| represents the element-wise absolute value operation; Conv is a 3×3 convolutional layer.

[0072] The intralayer multi-scale subtraction unit (MSU) further extends the SU (Suspended Subtraction Unit) by employing three sets of convolutional filters with fixed weights of 1 (1×1, 3×3, and 5×5) to capture pixel-level subtle defect differences (1×1) and region-level structural defect differences (3×3 and 5×5), respectively. This achieves differential feature enhancement from single-scale to multi-scale without additional parameter increments. The MSU calculation formula is as follows: .

[0073] In the formula, Filter n×n It is a multi-scale convolutional filter with fixed weights of 1, requiring no parameter training; This is a multi-scale difference feature aggregation operation.

[0074] After processing by the multi-scale subtraction feature purification module, five sets of multi-scale complementary enhancement features CE1~CE5 are generated, realizing full-scale feature capture from local texture defects to global stress defects.

[0075] The CGA module is located between the multi-scale subtraction feature purification module and the decoder. It is used to generate pixel-by-pixel attention weights based on the curvature information of the difference features, and to output the curvature-weighted enhancement of the difference features to the decoder.

[0076] The specific process of the CGA module performing curvature-weighted enhancement on the differential features is as follows: First, a two-dimensional Laplacian operation is performed on the aforementioned difference features to obtain the curvature matrix. The formula for the two-dimensional Laplacian operation is: .

[0077] The formula for calculating the curvature matrix is: .

[0078] In the formula, K is the curvature matrix; F mmsm The difference features output by the multi-scale subtraction feature purification module.

[0079] Then, the curvature matrix is ​​Softmax normalized to generate attention weights. The normalization formula for the attention weights is: .

[0080] In the formula, W i,j Let be the attention weight at position (i,j) of the feature map, with a normalized value range of [0,1]. This indicates summing all positions in the feature map.

[0081] Finally, the attention weights are multiplied element-wise by the differential features to output the weighted enhanced features. The feature weighting enhancement formula is as follows: .

[0082] In the formula, For element-wise multiplication (Hadamard product); F weighted The multi-scale feature map after attention enhancement; W cga The attention weight matrix generated by the Softmax normalization.

[0083] The decoder upsamples and decodes the weighted and enhanced features to restore the spatial resolution of the input image, and finally the output module outputs the defect detection results.

[0084] Specifically, in this embodiment of the invention, the output module uses the Sigmoid activation function to map the enhanced features into a defect probability map, achieving pixel-level defect segmentation. The formula is as follows: .

[0085] In the formula, P defect The threshold value is 0.5 to determine the defect area.

[0086] In this embodiment of the invention, the defect detection model is pre-trained. The training process can be understood as follows: (1) Construct a dataset of photoelastic defects in weld seams on curved pipe surfaces.

[0087] In this embodiment of the invention, the dataset contains photoelastic images of four defect types: cracks, porosity, incomplete penetration, and slag inclusions. There are 100 images for each defect type, and the ratio of the training set, validation set, and test set is 7:2:1.

[0088] During the data annotation phase, two senior inspectors independently performed pixel-level annotations, using the stripe distortion area as the defect boundary, and only marked valid defects with an actual size ≥ 0.1 mm.

[0089] Online data augmentation strategies were employed on the training set, including ±10° random rotation, random horizontal and vertical flipping, scaling by 0.9 to 1.1, brightness adjustment by 0.8 to 1.2, small contrast perturbation, and low-intensity Gaussian noise superposition, in order to expand the sample size and improve the model's anti-interference ability.

[0090] (2) Optimize model parameters using a composite loss function In this embodiment of the invention, the composite loss function is a weighted sum of the cross-entropy loss function and the Dice loss function, as shown in the formula: .

[0091] In the formula, α is a weighting coefficient, with a value ranging from 0.2 to 0.7 (α = 0.4 in this embodiment of the invention); L ce For cross-entropy loss, L dice This is a loss for Dice.

[0092] The formula for the cross-entropy loss function is: .

[0093] In the formula, N is the total number of pixels; y i p is the true label for the i-th pixel (1 for defect, 0 for background); i This represents the defect probability predicted by the model.

[0094] The Dice loss function formula is: .

[0095] In the formula, To prevent smooth terms with a denominator of 0.

[0096] The defect detection model is trained using the AdamW optimizer until a preset training termination condition is met.

[0097] In this embodiment of the invention, the preset training termination condition is reaching a preset number of training epochs (epochs=100). Specifically, the initial learning rate η=1×10 -4 A cosine annealing learning rate scheduling strategy is adopted: the first 10 rounds of training are a warm-up phase, with the learning rate starting from 1×10. -5 linearly up to 1×10 -4 After 10 rounds, cosine decay is applied until the minimum learning rate η at the end of training. min =1×10 -6The first-order momentum coefficient β1 = 0.9, the second-order momentum coefficient β2 = 0.999, and the numerical stability constant of the optimizer is taken as 1 × 10⁻⁶. -6 Weight decay coefficient λ wd =5×10 -4 Batch size=8.

[0098] After training is complete, the preprocessed standard photoelastic image is input into the defect detection model, and the defect detection result is output.

[0099] In one feasible implementation, the defect detection result in this embodiment of the invention includes the defect region.

[0100] Specifically, the defect detection model outputs a defect probability map, where the value of each pixel represents the probability that the pixel belongs to a defect region. Pixels with a probability value greater than a preset threshold (0.5 in this embodiment) are identified as defective pixels, and the connected regions of all defective pixels constitute a defect region. The defect region is output in the form of a binary mask, where defective pixels are marked as 1 and background pixels are marked as 0.

[0101] Since the defect area output by the model is located in the pixel coordinate system of the standard photoelastic image, it needs to be mapped to the actual physical coordinate system of the workpiece surface through pixel-physical space calibration coefficients.

[0102] Specifically, let the pixel coordinates of the defect region in the standard photoelastic image be (x, y), and its actual physical coordinates on the workpiece surface be (X, Y). The mapping formula is as follows: .

[0103] In the formula, ρ is the calibration coefficient, which represents the actual physical size corresponding to a single pixel, with the dimension of length / pixel (ρ=0.05mm / pixel in this embodiment of the invention).

[0104] The actual spatial location of the defect area on the workpiece surface can be obtained through the above mapping.

[0105] After obtaining the actual spatial location of the defect region on the workpiece surface, it is necessary to further determine the size of the defect region. The size of the defect region is determined based on the number of pixels in the defect region and the calibration coefficient. The formula for calculating the actual physical size d of the defect region is as follows: .

[0106] In the formula, n is the number of pixels contained in the defect area; ρ is the calibration coefficient; and s is the image scaling ratio, defined as the ratio of the original image size to the standard photoelastic image size.

[0107] In this embodiment of the invention, the standard photoelastic image size is 512×512 pixels. The original image is scaled to the standard size using bilinear interpolation, with a scaling ratio of s=1. Substituting the calibration coefficient ρ=0.05mm / pixel, the actual size of the defect can be obtained with an accuracy of not less than 0.1mm.

[0108] In one feasible implementation, the calibration method for the calibration coefficient ρ in this embodiment of the invention includes the following steps: Place a ruler of known length (preferably a micrometer with an accuracy of not less than 0.01 mm) at the same imaging distance as the workpiece to be measured, ensuring that the ruler plane is parallel to the image acquisition plane.

[0109] The pixel coordinates at both ends of the standard scale on the ruler are extracted using a sub-pixel edge detection algorithm, and the pixel length corresponding to the scale segment is calculated. Sub-pixel edge detection employs gray-scale moment method or interpolation method to improve edge positioning accuracy to the sub-pixel level, thereby enhancing calibration accuracy.

[0110] Calculate the pixel equivalent for a single group, where the pixel equivalent is the ratio of the actual length of the scale segment to the pixel length, i.e.: .

[0111] In the formula, ρ k L is the pixel equivalent measured in the k-th group; actual L represents the actual length of the scale segment. pixel (k) represents the pixel length corresponding to the scale segment in the k-th measurement group.

[0112] Select scale segments at different positions in the image of the scale, calculate the pixel equivalent of each group, remove outliers, and take the arithmetic mean to obtain the calibration coefficient ρ: .

[0113] In the formula, M represents the number of effective measurement groups. In this embodiment of the invention, 15 sets of scale data are collected in different areas of the image. After removing one set each of the maximum and minimum values, the arithmetic mean of the remaining 13 sets of data is taken to obtain ρ = 0.05 mm / pixel.

[0114] In this embodiment of the invention, the accuracy of the defect detection is evaluated using pixel-level classification accuracy, calculated as follows: .

[0115] In the formula, TP (True Positive) is the number of correctly detected defect pixels; TN (True Negative) is the number of correctly detected background pixels; FP (False Positive) is the number of background pixels that are misclassified as defects; and FN (False Negative) is the number of missed defect pixels.

[0116] It should be noted that the defect detection model described in this embodiment of the invention has a detection accuracy of no less than 95% on the test set.

[0117] Finally, the defect detection results in this embodiment of the invention can be displayed, but are not limited to, through a visualization module. The visualization module uses a heatmap to mark the defect area, overlays the defect probability distribution on the original photoelastic image in pseudo-color, and outputs specific values ​​for the defect type and size, making it easy for staff to intuitively identify the defect location and severity.

[0118] In one feasible implementation, the present invention also provides a secondary re-inspection and verification mechanism to verify the reliability of the output results of the defect detection model, so as to reduce the risk of missed detection or false detection that may be introduced by a single detection.

[0119] Specifically, when the defect detection result indicates the presence of a defective area, the system automatically triggers a secondary re-inspection and verification process. If the defect detection result does not indicate any defective area, the system directly outputs a detection report and terminates the detection process.

[0120] In this embodiment of the invention, the secondary re-inspection and verification process may include, but is not limited to: Using a reflective photoelastic detection system, a new local photoelastic image of the defect area is acquired. Specifically, based on the actual coordinates (X, Y) of the defect area on the workpiece surface as output from the initial detection, the curved surface fixture is moved to realign the defect area with the instrument's optical path, and the original photoelastic image of the local area is acquired under the same imaging parameters.

[0121] Perform the same preprocessing steps (including surface geometric distortion correction, noise reduction, grayscale normalization, and size standardization) on the newly acquired photoelastic image to obtain the re-inspection standard photoelastic image.

[0122] The re-inspection standard photoelastic image is input into the trained defect detection model, and a complete inference process is performed to obtain a secondary detection result, which includes the defect area detected in the secondary detection.

[0123] Calculate the intersection over union (IoU) between the defect region in the defect detection result and the defect region in the secondary detection result. The formula for calculating the intersection over union is: .

[0124] In the formula, The defect area is defined in the defect detection results. Let Area be the defect region in the secondary detection result, Area() is the function to calculate the area of ​​the region, ∩ represents the region intersection operation; ∪ represents the region union operation.

[0125] The value of Consistency ranges from [0,1]. A larger value indicates a higher consistency between the two detection results. When Consistency=1, the defect areas detected by the two tests completely overlap; when Consistency=0, the defect areas detected by the two tests do not overlap at all.

[0126] When the overlap reaches a preset threshold, the detection is determined to be consistent and the final detection result is output. In this embodiment of the invention, the preset threshold is 0.8, that is, when Consistency ≥ 0.8, the two detection results are determined to be consistent, which indicates that the reliability of the defect detection result is high.

[0127] When Consistency < 0.8, the two detection results are considered inconsistent. This may be due to the following situations: (a) a false positive in the initial detection, misclassifying the background area as a defect; (b) a missed detection in the initial detection, where the defect area was not fully detected; or (c) a momentary interference to the detection system, resulting in a large deviation between the two detection results. In this case, the system re-acquires the photoelastic image of the local area and performs the detection again, repeating the above re-inspection process until the consistency determination is passed or the preset maximum number of re-inspections is reached (in this embodiment, the maximum number of re-inspections is 3). If the consistency determination is still not passed after reaching the maximum number of re-inspections, the system outputs an alarm prompt, and a final determination is made manually.

[0128] Once the second verification is passed, the system automatically generates a test report. The test report may include, but is not limited to, the following information: Basic workpiece information: workpiece number, material, pipe curvature radius, weld number, etc. Experimental testing parameters: applied force value, imaging distance, calibration coefficient ρ, detection time, etc. Defect detection results: heat map of defect area, defect type, actual coordinates (X,Y) of defect on workpiece surface, and defect size value d; Re-inspection and verification information: Consistency value of the two tests, number of re-inspections, and consistency judgment conclusion; Final test results: Pass / Fail determination and recommendations.

[0129] This invention, through a secondary re-inspection and verification mechanism, effectively reduces the probability of false positives and false negatives caused by accidental interference (such as surface oil stains, vibration, and light intensity fluctuations) in workpiece defect detection. The consistency threshold of ≥0.8 ensures rigorous verification while allowing for tolerance of normal minor detection fluctuations, avoiding frequent resampling due to excessive stringency. The closed-loop verification method of secondary re-inspection enables adaptive verification of test results within the automated testing process, eliminating the need for manual review. Manual intervention is only required for cases where consistency judgment fails, ensuring both reliability and efficiency. The final generated test report includes complete basic workpiece information, experimental test parameters, defect detection results, and re-inspection and verification information, providing ample evidence for subsequent experimental traceability, data processing, and archiving.

[0130] Based on the photoelastic detection method for defects in curved weld seams of pipelines provided in the first aspect, embodiments of the present invention provide a photoelastic detection system for defects in curved weld seams of pipelines, such as... Figure 4 As shown, the photoelastic inspection system for defects in curved weld seams of pipelines includes: Image acquisition module 110 is used to acquire the original photoelastic image of the weld area on the curved surface of the pipe; Image preprocessing module 120 is used to preprocess the original photoelastic image to obtain a standard photoelastic image. The preprocessing includes at least surface geometric distortion correction of the original photoelastic image. The defect detection module 130 is used to input the standard photoelastic image into the trained defect detection model and output the defect detection result. The defect detection model is CGA-M. 2 The SNet network model includes an encoder, a multi-scale subtraction feature extraction module, a curvature attention CGA module, and a decoder connected in sequence. The encoder is used to extract multi-level features from the standard photoelastic image. The multi-scale subtraction feature extraction module is used to perform differential operations on the multi-level features to extract complementary difference features between levels. The CGA module is used to generate pixel-wise attention weights based on the curvature information of the difference features, and then perform curvature-weighted enhancement on the difference features before outputting them to the decoder.

[0131] Based on the photoelastic detection method for defects in curved weld seams of pipelines provided in the first aspect, this embodiment of the invention also provides a storage medium storing a computer-executable program. The computer-executable program is used to cause a computer to execute the photoelastic detection method for defects in curved weld seams of pipelines as described in any implementation of the first aspect. Explanations of the relevant content and descriptions of the beneficial effects of any of the computer-readable storage media provided above can be found in the corresponding embodiments described above, and will not be repeated here.

[0132] Those skilled in the art will understand that the program for implementing all or part of the steps of the above embodiments, which can be executed by a program instructing related hardware, can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The processing unit or processor mentioned above can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.

[0133] This invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.

[0134] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of the present invention, such as, but not limited to, the aforementioned memory, computer-readable storage medium, and communication chip, are all non-transitory. Those skilled in the art should recognize that the functions described in the embodiments of the present invention in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0135] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A photoelastic detection method for defects in curved weld seams of pipelines, characterized in that, include: Acquire raw photoelastic images of the weld area on the curved surface of the pipeline; The original photoelastic image is preprocessed to obtain a standard photoelastic image. The preprocessing includes at least surface geometric distortion correction of the original photoelastic image. The standard photoelastic image is input into the trained defect detection model, and the defect detection result is output. The defect detection model is CGA-M. 2 The SNet network model includes an encoder, a multi-scale subtraction feature extraction module, a curvature attention CGA module, and a decoder connected in sequence. The encoder is used to extract multi-level features from the standard photoelastic image. The multi-scale subtraction feature extraction module is used to perform differential operations on the multi-level features to extract complementary difference features between levels. The CGA module is used to generate pixel-wise attention weights based on the curvature information of the difference features, and then perform curvature-weighted enhancement on the difference features before outputting them to the decoder.

2. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 1, characterized in that, The surface geometric distortion correction of the original photoelastic image includes: The original photoelastic image is subjected to coordinate transformation using a cylindrical inverse distortion model. The transformation formula is as follows: ; In the formula, The radius of curvature of the pipe; These are the original pixel coordinates of the distorted image; These are the coordinates of the pixels without distortion after correction.

3. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 1, characterized in that, The step of performing a difference operation on the multi-level features to extract complementary difference features between levels includes: The adjacent feature maps in the multi-level features are subtracted element by element and the absolute value is taken. The result is then convolved through multiple fixed-weight filters of different scales. The convolution results of each scale are aggregated and then convolved again to output multi-scale difference features.

4. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 1, characterized in that, The CGA module performs curvature-weighted enhancement on the differential features, including: Perform a two-dimensional Laplacian operation on the difference feature map to obtain the curvature matrix; The curvature matrix is ​​Softmax normalized to generate attention weights; The attention weights are multiplied element-wise by the differential features to output the weighted enhanced features.

5. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 1, characterized in that, The training process of the defect detection model includes: A dataset of photoelastic defects in curved weld seams of pipes is constructed, which contains photoelastic images of various defect types. The model parameters are optimized using a composite loss function, which is a weighted sum of the cross-entropy loss function and the Dice loss function. The defect detection model is trained using the AdamW optimizer until a preset training termination condition is met.

6. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 1, characterized in that, The defect detection results include the defect area; The pixel coordinates of the defect area are mapped to the actual coordinates of the workpiece using a pixel-physical space calibration coefficient. The mapping formula is as follows: ; The size of the defective region is determined based on the number of pixels in the defective region and the calibration coefficient; Where (x, y) are the pixel coordinates of the defect region in the standard photoelastic image, (X, Y) are the actual coordinates of the defect region on the workpiece surface, and ρ is the calibration coefficient.

7. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 6, characterized in that, The calibration method for the calibration coefficient ρ includes: Place a ruler of known length at the same imaging distance as the workpiece to be measured; The pixel coordinates at both ends of the standard scale on the ruler are extracted by subpixel edge detection, and the pixel length corresponding to the scale segment is calculated. Calculate the pixel equivalent for a single group, where the pixel equivalent is the ratio of the actual length of the scale segment to the pixel length; Select scale segments at different positions in the image of the scale, calculate the pixel equivalent of each group, remove outliers and take the arithmetic mean to obtain the calibration coefficient ρ.

8. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 1, characterized in that, When the defect detection result indicates the presence of a defective region, it further includes: The photoelastic image of the defect area is acquired, and after the preprocessing of the photoelastic image of the defect area, it is input into the defect detection model to obtain the secondary detection result; Calculate the overlap between the defect area in the defect detection result and the defect area in the secondary detection result. When the overlap reaches a preset threshold, determine that the detection is consistent and output the final detection result.

9. The photoelastic detection method for defects in curved weld seams of pipelines according to claim 8, characterized in that, The calculation of the overlap between the defect region in the defect detection result and the defect region in the secondary detection result includes: The overlap between the defect area in the defect detection result and the defect area in the secondary detection result is calculated using the following formula: ; In the formula, The defect area is defined in the defect detection results. For the defective areas in the secondary detection results, when the overlap rate (Consistency) is ≥ 0.8, the detection is considered consistent.

10. A photoelastic inspection system for defects in curved weld seams of pipelines, characterized in that, include: The image acquisition module is used to acquire raw photoelastic images of the weld area on the curved surface of the pipeline; The image preprocessing module is used to preprocess the original photoelastic image to obtain a standard photoelastic image. The preprocessing includes at least surface geometric distortion correction of the original photoelastic image. The defect detection module is used to input the standard photoelastic image into the trained defect detection model and output the defect detection result. The defect detection model is CGA-M. 2 The SNet network model includes an encoder, a multi-scale subtraction feature extraction module, a curvature attention CGA module, and a decoder connected in sequence. The encoder is used to extract multi-level features from the standard photoelastic image. The multi-scale subtraction feature extraction module is used to perform differential operations on the multi-level features to extract complementary difference features between levels. The CGA module is used to generate pixel-wise attention weights based on the curvature information of the difference features, and then perform curvature-weighted enhancement on the difference features before outputting them to the decoder.