Oil and gas pipeline defect three-dimensional contour determination method and device

By constructing multi-channel input data and utilizing a pre-trained defect contour inversion model, the accuracy problem of three-dimensional contour reconstruction of oil and gas pipeline defects in magnetic flux leakage detection methods was solved, and high-precision three-dimensional contour determination of oil and gas pipeline defects was achieved.

CN121741002APending Publication Date: 2026-03-27CHINA UNIV OF PETROLEUM (BEIJING)
View PDF 0 Cites 6 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing magnetic flux leakage detection methods cannot achieve high-precision three-dimensional contour reconstruction of defects in oil and gas pipelines, making it difficult to meet the engineering requirements for refined assessment.

Method used

By constructing multi-channel input data and utilizing a pre-trained defect contour inversion model, combined with a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module, the three-dimensional contour of oil and gas pipeline defects can be determined.

Benefits of technology

It improves the accuracy and detail reproduction of defect contour prediction, and can intuitively reflect the distribution characteristics and edge structure of defects in three-dimensional space in image-level form. It supports the determination of whether there are defects in the target area and finely depicts the depth changes and boundary gradients of defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121741002A_ABST
    Figure CN121741002A_ABST
Patent Text Reader

Abstract

The invention provides an oil and gas pipeline defect three-dimensional contour determination method and device. Acquiring a three-axis magnetic flux leakage detection signal of a to-be-detected target oil and gas pipeline and corresponding space coordinate information of the three-axis magnetic flux leakage detection signal; constructing multi-channel input data according to the three-axis magnetic flux leakage detection signal and the space coordinate information; determining a defect contour prediction result of the target oil and gas pipeline according to the multi-channel input data by using a pre-trained defect contour inversion model; wherein the pre-trained defect contour inversion model comprises a multi-axis feature extraction and fusion module, a feature coding module and a multi-task decoding module; the defect contour prediction result is used for indicating whether the target oil and gas pipeline has defects or not, and the defect contour prediction result is further used for indicating the three-dimensional contour shape of the defects under the condition that the target oil and gas pipeline has the defects. Therefore, high-precision visual reconstruction of the defect position and the three-dimensional form of the oil and gas pipeline is realized, and the accuracy of defect identification and the reliability of evaluation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification belongs to the field of oil and gas field development technology, and in particular relates to a method and device for determining the three-dimensional profile of oil and gas pipeline defects. Background Technology

[0002] Magnetic flux leakage (MFL) testing is a commonly used non-destructive testing method for pipelines. It identifies and assesses defects by analyzing the magnetic flux leakage signal generated at the defect location. However, existing methods mainly rely on traditional physical models or rule-driven fitting algorithms, which can only provide a rough estimate of the defect point or area. They cannot achieve high-precision image-level visualization and reconstruction, making it difficult to meet the practical engineering needs for refined assessment of pipeline defects.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This specification provides a method and apparatus for determining the three-dimensional contour of defects in oil and gas pipelines, which solves the problem that traditional magnetic flux leakage detection methods cannot achieve accurate reconstruction of the three-dimensional contour of pipeline defects.

[0005] This specification provides a method for determining the three-dimensional profile of defects in oil and gas pipelines, including:

[0006] Acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be inspected and its corresponding spatial coordinate information;

[0007] Based on the triaxial magnetic flux leakage detection signal and spatial coordinate information, multi-channel input data is constructed;

[0008] Using a pre-trained defect contour inversion model, the defect contour prediction result of the target oil and gas pipeline is determined based on the multi-channel input data; wherein, the pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module; the defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and when there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

[0009] In one embodiment, before determining the defect profile prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect profile inversion model, the method further includes:

[0010] Acquire historical multi-channel input data of the target oil and gas pipeline;

[0011] An initial defect contour inversion model and its corresponding joint loss function are constructed; wherein, the joint loss function is used to simultaneously constrain the depth prediction error and edge structure error of the defect contour.

[0012] Based on the joint loss function, the initial defect contour inversion model is trained multiple times using the historical multi-channel input data to obtain a defect contour inversion model that has converged and meets the preset requirements.

[0013] In one embodiment, the step of training the initial defect contour inversion model multiple times using the historical multi-channel input data based on the joint loss function to obtain a defect contour inversion model that has converged and meets preset requirements includes:

[0014] Perform the current round of training as follows:

[0015] Using the multi-axis feature extraction and fusion module from the model trained in the previous round, feature extraction is performed on the leakage magnetic field signals of each axis in the historical multi-channel input data of the current round to obtain the corresponding axial features. Based on a preset spatial attention mechanism, corresponding spatial attention weights are generated according to the response intensity at different spatial positions in each axial feature. The spatial attention weights are used to dynamically weight each axial feature, and the weighted axial features are fused to obtain the fused features. The fused features are used to characterize the abnormal magnetic field distribution in the target region.

[0016] Using the feature encoding module in the model obtained from the previous training round, multi-scale deep features are obtained based on the fused features;

[0017] Using the multi-task decoding module in the model obtained from the previous training, the defect depth map and defect gradient map corresponding to the target oil and gas pipeline are output according to the multi-scale deep features.

[0018] Based on the joint loss function and the defect depth map and defect gradient map corresponding to the target oil and gas pipeline, the loss function value corresponding to the current training round is calculated; wherein, the joint loss function includes a first loss term and a second loss term; wherein, the first loss term is used to constrain the depth prediction error, and the second loss term is used to constrain the edge structure error;

[0019] Based on the loss function value corresponding to the current training round, determine whether the model obtained from the previous training round meets the requirements;

[0020] When the model obtained from the previous training round meets the preset convergence condition based on the loss function value corresponding to the current training round, the model obtained from the previous training round is determined as the defect contour inversion model that meets the requirements.

[0021] The multi-axis feature extraction and fusion module is constructed based on a preset multi-channel convolutional neural network and spatial attention mechanism; the feature encoding module is constructed based on a preset residual connection network and channel attention mechanism; and the multi-task decoding module is constructed based on a preset U-Net decoder structure.

[0022] In one embodiment, after determining whether the model obtained in the previous training round meets the requirements based on the loss function value corresponding to the current training round, the method further includes:

[0023] When it is determined, based on the loss function value corresponding to the current training round, that the model obtained in the previous training round does not meet the preset convergence condition, the model training parameters and optimization strategy are adjusted to construct the training model for the current round.

[0024] Training continues based on the joint loss function to obtain the model after the current round of training.

[0025] In one embodiment, the step of using the feature encoding module in the model obtained from the previous training round to obtain multi-scale deep features based on the fused features includes:

[0026] Using the residual connection module in the feature encoding module, residual path superposition operation is performed according to the fused features to obtain a residual enhanced feature map; wherein, the residual enhanced feature map is used to enhance local detail information and global structure perception capabilities;

[0027] Using the attention mechanism module in the feature encoding module, an attention weight map is generated based on the spatial distribution structure of the residual enhanced feature map and the dependency relationship between the feature responses of each channel. The residual enhanced feature map is then weighted and adjusted based on the attention weight map to determine multi-scale deep features.

[0028] In one embodiment, the step of using the multi-task decoding module in the model obtained from the previous training round to output the defect depth map and defect gradient map corresponding to the target oil and gas pipeline based on the multi-scale deep features includes:

[0029] Based on the multi-scale deep features, a first decoding feature and a second decoding feature are determined respectively; wherein, the first decoding feature is used for depth prediction and the second decoding feature is used for gradient prediction.

[0030] The first decoding feature is input into the first decoding branch of the multi-task decoding module to reconstruct the spatial depth distribution of the defect contour and output the defect depth map corresponding to the target oil and gas pipeline.

[0031] The second decoding feature is input into the second decoding branch of the multi-task decoding module, and the defect gradient map corresponding to the target oil and gas pipeline is output through the decoding path containing the edge response enhancement structure.

[0032] In one embodiment, constructing multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information includes:

[0033] Based on the spatial coordinate information, the spatial position corresponding to each signal point in the triaxial magnetic flux leakage detection signal is determined, and the spatial position is normalized to obtain a normalized spatial coordinate channel.

[0034] The signal values ​​in each direction of the triaxial magnetic flux leakage detection signal are concatenated with the corresponding normalized spatial coordinate channels to obtain multi-channel input data; wherein, the multi-channel input data includes the triaxial magnetic flux leakage signal channel and the normalized spatial coordinate channel.

[0035] This specification provides a device for determining the three-dimensional profile of defects in oil and gas pipelines, including:

[0036] The data acquisition module is used to acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information;

[0037] The data determination module is used to construct multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information;

[0038] The result determination module is used to determine the defect contour prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect contour inversion model. The pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module. The defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and if there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

[0039] This specification also provides a computer-readable storage medium storing computer instructions that, when executed, implement a method for determining the three-dimensional profile of defects in oil and gas pipelines.

[0040] Based on the method for determining the three-dimensional contour of oil and gas pipeline defects provided in this specification, the following steps are taken: First, a triaxial magnetic flux leakage (MFL) detection signal and its corresponding spatial coordinate information of the target oil and gas pipeline are acquired. Second, multi-channel input data is constructed based on the MFL detection signal and spatial coordinate information. Third, a pre-trained defect contour inversion model is used to determine the predicted defect contour of the target oil and gas pipeline based on the multi-channel input data. The pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module. The predicted defect contour is used to indicate whether a defect exists in the target oil and gas pipeline, and if a defect exists, the predicted defect contour is also used to indicate the three-dimensional contour shape of the defect. In this way, by constructing triaxial magnetic flux leakage detection signals and spatial coordinate information into unified multi-channel input data, the spatial localization and joint characterization of magnetic field features of defects in target oil and gas pipelines are realized. By using a pre-trained defect contour inversion model to fuse and analyze multi-source input information, deep features related to defect morphology can be extracted while maintaining spatial consistency, thereby improving the accuracy and detail reproduction of defect contour prediction. The resulting defect contour prediction results can intuitively reflect the distribution characteristics and edge structure of defects in three-dimensional space in image-level form. This not only supports the determination of whether defects exist in the target area, but can also be used to finely characterize the depth changes and boundary gradients of defects, which helps to improve the accuracy of qualitative and quantitative assessment of defects. Attached Figure Description

[0041] To more clearly illustrate the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 This is a flowchart illustrating a method for determining the three-dimensional profile of defects in oil and gas pipelines, provided in one embodiment of this specification.

[0043] Figure 2 This is a schematic diagram of the electronic device structure provided in one embodiment of this specification;

[0044] Figure 3 This is a schematic diagram of the structural composition of a three-dimensional contour determination device for oil and gas pipeline defects provided in one embodiment of this specification;

[0045] Figure 4 This is a schematic diagram of a three-dimensional contour model of an oil and gas pipeline defect provided in one embodiment of this specification;

[0046] Figure 5This is a schematic diagram of the training and verification process RMSE provided in one embodiment of this specification;

[0047] Figure 6 This is a schematic diagram of the training and verification process MAE provided in one embodiment of this specification;

[0048] Figure 7 This is a schematic diagram of the training and verification process loss provided in one embodiment of this specification;

[0049] Figure 8 This is a comparative diagram of the inversion results of a rule-based defect model provided in one embodiment of this specification;

[0050] Figure 9 This is a schematic diagram comparing the inversion results of an irregular defect model provided in one embodiment of this specification. Detailed Implementation

[0051] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0052] See Figure 1 As shown in the embodiments of this specification, a method for determining the three-dimensional contour of defects in oil and gas pipelines is provided, wherein the method is specifically applied to the server side. In specific implementation, the method may include the following:

[0053] S101: Acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information;

[0054] S102: Construct multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information;

[0055] S103: Using a pre-trained defect contour inversion model, the defect contour prediction result of the target oil and gas pipeline is determined based on the multi-channel input data; wherein, the pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module; the defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and when there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

[0056] Among them, the above-mentioned triaxial magnetic flux leakage detection signal can be used to reflect the magnetic field response data of the target oil and gas pipeline in different spatial directions. Specifically, it includes the magnetic flux leakage signal sequence collected by the magnetic flux leakage sensors arranged along the axial, radial and tangential directions, which is used to comprehensively characterize the magnetic field anomaly characteristics of the target oil and gas pipeline in multiple axes.

[0057] The aforementioned spatial coordinate information can be used to calibrate the acquisition position of each group of triaxial magnetic flux leakage detection signals. Specifically, it includes three-dimensional spatial positioning coordinates that correspond one-to-one with the triaxial magnetic flux leakage detection signals. The three-dimensional spatial positioning coordinates include the position elevation in the direction of the pipeline centerline, circumferential angle information, and radial displacement, which are used to construct a spatial distribution map of the magnetic flux leakage signals.

[0058] The aforementioned multi-channel input data can be a data structure constructed by fusing the triaxial magnetic flux leakage detection signal and the corresponding spatial coordinate information at the channel level. Specifically, it includes: based on each sampling point, encoding the corresponding triaxial magnetic flux leakage detection signal and its spatial coordinates into feature vectors of different channels, and arranging them sequentially according to the sampling sequence to form a tensor-type data input, which is used to provide the multi-source input information required by the defect contour inversion model.

[0059] The aforementioned defect contour prediction results can be spatial image results output by a pre-trained defect contour inversion model after receiving the multi-channel input data. Specifically, these include: a discrimination map indicating whether a target oil and gas pipeline has defects, and, in the case of defects, image-based prediction results of the depth variation and edge structure distribution of the corresponding defects in three-dimensional space, used to characterize the three-dimensional contour shape of the defects.

[0060] In some embodiments, acquiring the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information may specifically include:

[0061] A sensor array is deployed in the detection area of ​​the target oil and gas pipeline, with multiple triaxial magnetic flux leakage sensor nodes evenly arranged along the pipeline axis. Each sensor node is used to collect magnetic flux leakage signals in the X, Y, and Z axes at corresponding positions on the outer wall of the pipeline. Simultaneously, based on the sensor installation positions and the odometer or inertial navigation system of the moving detection device, corresponding spatial coordinate information is obtained. The spatial coordinate information includes the three-dimensional spatial position coordinates (x, y, z) corresponding to each set of triaxial magnetic flux leakage signals, and is synchronized with the magnetic flux leakage signals of each axis to form structured raw detection data. This raw detection data is then used as the basic data source for the subsequent multi-channel input data construction process.

[0062] In some embodiments, the construction of multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information may specifically include:

[0063] The triaxial magnetic flux leakage detection signal corresponding to each sampling point is recorded as a magnetic flux leakage component along the X-axis, Y-axis, and Z-axis, forming three physical channel data. The triaxial signal is aligned with its corresponding spatial coordinate information to construct a three-dimensional magnetic flux leakage data matrix with spatial position index. Furthermore, for cases with uneven sampling intervals or missing sampling points, spatial completion processing of the magnetic flux leakage signal can be performed based on interpolation algorithms (such as linear interpolation or cubic spline interpolation). In addition, to enhance the model's ability to perceive defects of different scales, the triaxial signal can be normalized and pre-encoded with multi-scale convolutional kernels. Finally, the pre-processed X-axis, Y-axis, and Z-axis signal data are used as different channels of the multi-channel input tensor to construct multi-channel input data in a unified format, which is then input into the defect contour inversion model for training or prediction.

[0064] By uniformly encoding the triaxial leakage magnetic field signal and spatial coordinate information to construct multi-channel input data, not only are the response characteristics of the defect magnetic field distribution in different directions preserved, but the geometric structural information of the defect spatial location is also integrated, thereby improving the model's ability to spatially perceive and express complex defect morphologies.

[0065] Based on the above embodiments, by constructing triaxial magnetic flux leakage detection signals and spatial coordinate information into unified multi-channel input data, the spatial localization and joint characterization of magnetic field features of target oil and gas pipeline defects are realized. By using a pre-trained defect contour inversion model to fuse and analyze multi-source input information, deep features related to defect morphology can be extracted while maintaining spatial consistency, thereby improving the accuracy and detail reproduction of defect contour prediction. The resulting defect contour prediction results can intuitively reflect the distribution characteristics and edge structure of defects in three-dimensional space in image-level form. This not only supports the determination of whether defects exist in the target area, but can also be used to finely characterize the depth changes and boundary gradients of defects, which helps to improve the accuracy of qualitative and quantitative defect assessment.

[0066] In some embodiments, before determining the defect profile prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect profile inversion model, the method may further include the following:

[0067] S1: Obtain historical multi-channel input data of the target oil and gas pipeline;

[0068] S2: Construct an initial defect contour inversion model and the corresponding joint loss function; wherein, the joint loss function is used to simultaneously constrain the depth prediction error and edge structure error of the defect contour;

[0069] S3: Based on the joint loss function, the initial defect contour inversion model is trained multiple times using the historical multi-channel input data to obtain a defect contour inversion model that has converged and meets the preset requirements.

[0070] Specifically, the system acquires triaxial magnetic flux leakage detection signals and their corresponding spatial coordinate information collected in previous inspection tasks of the target oil and gas pipeline, and constructs a historical multi-channel input dataset covering multiple typical defect morphologies based on different detection time points and defect status annotations.

[0071] An initial defect contour inversion model is constructed, which includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module. A joint loss function is preset, which includes a first loss term and a second loss term, which are used to constrain the numerical error of the defect depth map and the edge structure error of the defect gradient map, respectively.

[0072] The initial defect contour inversion model is trained in multiple rounds using the historical multi-channel input dataset. In each round of training, the direction response features of the three-axis signals are extracted using the multi-axis feature extraction and fusion module, and weighted fusion is performed through a spatial attention mechanism. The fused features are input into the feature encoding module to extract multi-scale deep semantic features, and then the corresponding defect depth map and defect gradient map are output by the multi-task decoding module.

[0073] After each training round, the corresponding loss value is calculated based on the joint loss function, and the current model is judged to meet the accuracy and stability requirements according to the preset convergence criterion. When the loss function meets the convergence criterion, the defect contour inversion model that has been trained is determined to be a pre-trained model for subsequent defect prediction.

[0074] In some embodiments, the method involves training the initial defect contour inversion model multiple times based on the joint loss function and using the historical multi-channel input data to obtain a defect contour inversion model that has converged and meets preset requirements. In specific implementations, the method may further include the following:

[0075] Perform the current round of training as follows:

[0076] S1: Using the multi-axis feature extraction and fusion module in the model obtained from the previous training round, feature extraction is performed on the leakage magnetic field signal of each axis in the historical multi-channel input data of the current round to obtain the corresponding axial features; based on the preset spatial attention mechanism, corresponding spatial attention weights are generated according to the response intensity of different spatial positions in each axial feature; the spatial attention weights are used to dynamically weight each axial feature, and the weighted axial features are fused to obtain the fused features; wherein, the fused features are used to characterize the magnetic field anomaly distribution in the target area;

[0077] S1: Using the feature encoding module in the model obtained from the previous training round, multi-scale deep features are obtained based on the fused features;

[0078] S2: Using the multi-task decoding module in the model obtained from the previous training, output the defect depth map and defect gradient map corresponding to the target oil and gas pipeline based on the multi-scale deep features;

[0079] S3: Calculate the loss function value corresponding to the current training round based on the joint loss function and the defect depth map and defect gradient map corresponding to the target oil and gas pipeline; wherein, the joint loss function includes a first loss term and a second loss term; wherein, the first loss term is used to constrain the depth prediction error, and the second loss term is used to constrain the edge structure error;

[0080] S4: Based on the loss function value corresponding to the current training round, determine whether the model obtained from the previous training round meets the requirements;

[0081] S5: When the model obtained from the previous training round meets the preset convergence condition based on the loss function value corresponding to the current training round, the model obtained from the previous training round is determined as the defect contour inversion model that meets the requirements.

[0082] The multi-axis feature extraction and fusion module is constructed based on a preset multi-channel convolutional neural network and spatial attention mechanism; the feature encoding module is constructed based on a preset residual connection network and channel attention mechanism; and the multi-task decoding module is constructed based on a preset U-Net decoder structure.

[0083] In some embodiments, the multi-axis feature extraction and fusion module is constructed based on a preset multi-channel convolutional neural network and a spatial attention mechanism. Specifically, it may include:

[0084] Multiple independent channel convolution kernels are used to perform local perceptual feature extraction on the input triaxial magnetic flux leakage detection signal to obtain an initial multi-channel feature map containing features of horizontal, vertical and normal components.

[0085] A spatial attention mechanism is applied to the initial multi-channel feature map to calculate the importance weight of each spatial position in the overall magnetic field response, and the three-axis channels are weighted and fused based on the weight to generate fused features with direction-aware capabilities.

[0086] In some embodiments, the feature encoding module is constructed based on a preset residual connection network and a channel attention mechanism. Specifically, it may include:

[0087] Multiple cascaded residual convolutional blocks are used to perform layer-by-layer feature enhancement on the fused features. Each residual convolutional block includes a skip connection structure to alleviate the gradient vanishing problem in deep networks.

[0088] After the residual channel output, a channel attention mechanism is introduced to adaptively adjust the response intensity of different feature channels, thereby highlighting the channel components related to the geometric features of the defect and improving the model's sensitivity to fine-grained defect representation.

[0089] In some embodiments, the multi-task decoding module is constructed based on a preset U-Net decoder structure, and in specific implementations, it may include:

[0090] The deep semantic feature map is upsampled step by step using a symmetric decoding path, and the image spatial resolution is restored by concatenating the features with the intermediate feature map in the encoding path.

[0091] A dual-branch output structure is set in the decoding path, corresponding to the defect depth map prediction subtask and the defect gradient map prediction subtask respectively, so as to realize the joint modeling of the numerical morphology and edge structure of the defect contour.

[0092] In some embodiments, to address the problem of inter-channel feature confusion caused by differences in the physical properties of triaxial magnetic flux leakage signals, a multi-axis independent feature extraction and fusion method is proposed. This method designs a multi-axis independent feature extraction module to extract feature information along each axis, taking into account the heterogeneity of the triaxial magnetic flux leakage detection signal.

[0093] Specifically, the triaxial magnetic flux leakage detection signals correspond to the magnetic field strength signals in the x, y, and z directions, respectively, and are input to three independent convolutional extraction branches. Each axis feature is extracted using independent convolutional modules. Furthermore, to address the differences in the spatial importance reflected by the signals of each axis, a spatial attention mechanism is introduced to enhance the feature response capability of the defect region.

[0094] After completing triaxial feature extraction and spatial weighting, a dynamic weight generation network is constructed to dynamically output a three-channel weight tensor based on spatial location. This weight tensor reflects the relative contribution of each axis signal in different spatial regions. Finally, the triaxial feature maps are weighted and fused according to the weight tensor, and the fused features are output as input to subsequent encoding modules.

[0095] Through the above structural design, the preservation of triaxial physical properties and dynamic adjustment of signal contribution are achieved, effectively enhancing the coordinated fusion capability among multiaxial features. This method can adapt to complex defect morphological changes and, combined with a spatial attention mechanism, further highlight the salient features of the defect region, thereby improving the performance of subsequent defect recognition and segmentation.

[0096] The triaxial leakage flux signals are defined as follows:

[0097]

[0098] in, Indicates along the first Images of leakage magnetic field signals acquired along the axes (i.e., the x, y, and z directions). The magnetic flux leakage image is represented by a two-dimensional tensor belonging to one channel, where H represents the height of the image and W represents the width of the image.

[0099] The axial feature extraction function is expressed as:

[0100]

[0101] in, This is the axial feature extraction function. It is a feature extraction subnetwork consisting of convolutional layers, batch normalization, and spatial attention. This indicates the number of channels allocated.

[0102] The three-axis features of the spliced ​​structure are represented as follows:

[0103]

[0104] Where F represents the fused three-axis feature tensor, These represent the feature maps along the x, y, and z axes after convolution or feature extraction operations, respectively.

[0105] The generated dynamic weights are represented as follows:

[0106]

[0107] Where W represents the dynamic weight, This represents a weight prediction network that includes convolutional layers and activation functions.

[0108] Furthermore, Softmax guarantees the normalization and sparse selection of weights across the three-axis channel dimensions, satisfying:

[0109]

[0110] The dynamically weighted fusion output is represented as:

[0111]

[0112] in, This represents the fused feature value at spatial location (h, w). Let (h, w) be the axial eigenvector of the spatial position (h, w). For the corresponding fusion weights.

[0113] By using branch-independent modeling to ensure that the individual characteristics of leakage magnetic signals on each axis are not confused, and by using dynamic weights to capture the contribution of heterogeneous signals in the input space, we can achieve flexible perception of the directional features of complex defects, which helps to improve the spatial resolution and directional accuracy of defect contour reconstruction.

[0114] In some embodiments, to enhance the trainability of deep networks and alleviate gradient vanishing and degradation problems, this paper introduces a standard two-dimensional residual block (ResBlock2D) in the feature extraction module. Each residual block contains two layers. Convolution, batch normalization (BatchNorm), and ReLU activation, along with a shortcut, are used to ensure shape matching of residual connections when the number of channels changes.

[0115] This structure ensures that gradients can propagate across layers without restriction, without significantly increasing computational complexity and the number of parameters.

[0116] In some embodiments, traditional 3D defect contour reconstruction only focuses on the representation of the defect contour, ignoring the important role of gradient information in edge sharpness. This specification designs a joint decoder that predicts both a depth map and a corresponding gradient map on top of shared convolutional features. The introduction of the gradient map allows the network to focus on local rates of change through gradient branches, thus enhancing defect edges. During training, gradient information constrains the predicted boundary recovery, compensating for the edge blurring shortcomings of traditional methods.

[0117] Gradient branching helps the model learn the rate of change of depth map edges, enhancing boundary clarity and alleviating edge blurring. Multi-task learning shares low-level features, balancing training efficiency and prediction accuracy, which can improve the reliability of local structural details in the depth map and enhance the ability to reconstruct geometric information of defects.

[0118] In some embodiments, the depth loss is an L1 loss term that measures the absolute difference between the depth prediction and the true label. The gradient loss is calculated using the Sobel operator to compute the gradient maps of the predicted and true depth maps, and then applying the L1 loss to enhance edge similarity. A dynamic weight α is used to adjust the ratio of depth to gradient loss as training progresses, emphasizing overall deep learning in the early stages and strengthening edge detail preservation in the later stages, thus promoting stable model convergence and maintaining high-precision reconstruction.

[0119] To address the need for high-precision inversion of the 3D contours of pipeline defects, and considering the physical characteristics and spatial complexity of triaxial signals in magnetic flux leakage detection, this paper designs a direction-aware multi-axis dynamic fusion module and a depth-gradient joint decoder to achieve high-quality defect reconstruction. The overall model uses spatial coordinate encoding as the input prior, extracts multi-scale features with the help of a residual attention encoder, and jointly optimizes the depth and edge gradients to achieve a clear and physically consistent 3D inversion of the defect contours.

[0120] The loss function and training strategy directly affect the prediction quality. The joint loss is designed as follows:

[0121]

[0122] Where L is the joint loss, Ld is the depth L1 loss, and Lg is the gradient L1 loss. These are weights that are dynamically adjusted during training to balance the emphasis on overall depth accuracy in the early stages of training, thereby improving the model's convergence stability and final performance.

[0123] The depth loss L1 (Ld) measures the overall error of the depth map and is expressed as:

[0124]

[0125] Where Ld is a measure of the overall error of the depth map. This represents the true depth value at the i-th pixel position. This represents the predicted depth value at the i-th pixel position. This represents the total number of pixels in the image.

[0126] The gradient L1 loss Lg is based on the Sobel operator to strengthen edge constraints, and is expressed as:

[0127]

[0128] Among them, Lg is based on the Sobel operator to strengthen edge constraints. , representing the first The actual and predicted depth values ​​at each pixel location. These are the gradient calculation operators for the horizontal and vertical directions corresponding to the Sobel operator, respectively. N is the total number of pixels.

[0129] In some embodiments, image quality assessment methods from the graphics domain are used, and indicators such as root mean square error Em, mean positive error Ep, mean negative error En, and structural similarity SSIM are defined to evaluate the results of defect contour inversion.

[0130] For the 3D profile inversion results of the defect, measurement points with values ​​m and n are uniformly selected along the axial and circumferential directions within the defect region, respectively. For a profile matrix of size m x n, the predicted defect profile (DP) is:

[0131]

[0132] The actual defect profile (DP) is as follows:

[0133]

[0134] The root mean square error Em reflects the overall deviation between the inverted predicted defect profile and the actual defect profile, that is:

[0135]

[0136] Em reflects the overall deviation between the predicted defect profile and the actual defect profile. and These are the ratios of the remaining pipe wall thickness and the original pipe wall thickness at the i-th axial and j-th circumferential measurement points, respectively, of the inverted defect profile and the actual defect profile.

[0137] The mean positive error Ep reflects the average percentage by which the predicted defect profile exceeds the depth of the actual defect profile, i.e.:

[0138]

[0139] Ep reflects the average percentage by which the predicted defect profile exceeds the depth of the actual defect profile. The unit step function; Npos is Greater than The number of measurement points.

[0140] The average negative error En reflects the average percentage by which the predicted defect profile is less than the depth of the actual defect profile, i.e.:

[0141]

[0142] Where En reflects the average percentage of the predicted defect contour that is less than the depth of the actual defect contour, and Nneg is... Less than The number of measurement points.

[0143] The inverted 3D contour and the true defect contour are treated as two grayscale images. The SSIM (structural similarity index) is introduced to evaluate the similarity between the inverted 3D contour and the true defect contour. The calculation formula is as follows:

[0144]

[0145] Among them, SSIM(x,y) is the structural similarity index. , Let x and y be the average values, respectively. , The variances of x and y, for and The covariance. These are constants used to maintain stability. L is the dynamic range of the pixel. K1 and k2 are constants, 0.01 and 0.03 respectively.

[0146] A smaller Em is better, indicating that the inverted contour is closer to the true contour. The relative magnitudes of Ep and Em reflect whether the error distribution between the inverted contour and the true contour is uniform. The SSIM result ranges from 0 to 1. The closer the inverted contour image is to the true contour, the closer SSIM is to 1. When the inverted contour is the same as the true contour, SSIM=1.

[0147] In some embodiments, after determining whether the model obtained from the previous training round meets the requirements based on the loss function value corresponding to the current training round, the specific implementation may include:

[0148] S1: When it is determined, based on the loss function value corresponding to the current training round, that the model obtained in the previous training round does not meet the preset convergence condition, the model training parameters and optimization strategy are adjusted to construct the training model for the current round.

[0149] S2: Continue training based on the joint loss function to obtain the model after the current round of training.

[0150] Specifically, when it is determined that the model obtained from the previous training round does not meet the preset convergence conditions, the system dynamically adjusts the parameter configuration of the current training model according to the preset training parameter tuning strategy, which may include:

[0151] Lowering the learning rate slows down the parameter update step size and improves the stability of the model training process; increasing the batch size of training batches improves the global representativeness of feature statistics; introducing a regularization coefficient adjustment mechanism to constrain the weight parameters in the model structure to prevent overfitting; dynamically adjusting the optimizer type or hyperparameter configuration, such as switching from the Adam optimizer to the SGD optimizer, or modifying the momentum factor and weight decay parameters.

[0152] After adjusting the training parameters and optimization strategies, the system constructs the training model for the current round and continues to perform training operations based on the preset joint loss function until the model reaches the convergence criterion or meets the termination condition of the maximum number of training rounds in the current round of training.

[0153] In some embodiments, the method utilizes the feature encoding module in the model obtained from the previous training round to obtain multi-scale deep features based on the fused features. In specific implementations, the method may further include the following:

[0154] S1: Using the residual connection module in the feature encoding module, a residual path superposition operation is performed according to the fused features to obtain a residual enhanced feature map; wherein, the residual enhanced feature map is used to enhance local detail information and global structure perception capabilities;

[0155] S2: Using the attention mechanism module in the feature encoding module, an attention weight map is generated based on the spatial distribution structure of the residual enhanced feature map and the dependency relationship between the feature responses of each channel. The residual enhanced feature map is then weighted and adjusted based on the attention weight map to determine multi-scale deep features.

[0156] Specifically, the fused features are first input into the residual connection module in the feature encoding module, and multi-level convolution transformation is performed to extract the initial deep features. Then, by constructing short connection paths, the input fused features and the convolution output are added pixel by pixel to form a residual path superposition structure, thereby obtaining a residual enhanced feature map that retains low-level spatial details.

[0157] Subsequently, the system inputs the residual enhancement feature map into the attention mechanism module, calculates the saliency response distribution in the spatial dimension and the feature dependency in the channel dimension, generates the corresponding spatial attention map and channel attention map, and modulates the residual enhancement feature map through a dual attention weighting operation, so that the response of the local defect edge region is enhanced, while the response of the background or invalid region is suppressed.

[0158] After the residual connection and attention mechanism work together, the system outputs multi-scale deep features containing multi-layer semantics and fine edge features, which are used for subsequent fine prediction of defect contours and structural reconstruction.

[0159] In some embodiments, the multi-task decoding module in the model obtained from the previous training round outputs the defect depth map and defect gradient map corresponding to the target oil and gas pipeline based on the multi-scale deep features. In specific implementations, the method may further include the following:

[0160] S1: Based on the multi-scale deep features, determine the first decoding feature and the second decoding feature respectively; wherein, the first decoding feature is used for depth prediction and the second decoding feature is used for gradient prediction.

[0161] S2: Input the first decoding feature into the first decoding branch of the multi-task decoding module to reconstruct the spatial depth distribution of the defect contour and output the defect depth map corresponding to the target oil and gas pipeline.

[0162] S3: Input the second decoding feature into the second decoding branch of the multi-task decoding module, and output the defect gradient map corresponding to the target oil and gas pipeline through the decoding path containing the edge response enhancement structure.

[0163] Specifically, based on the multi-scale deep features, the first decoding feature and the second decoding feature are extracted through feature channel separation and aggregation operations. The first decoding feature retains contextual information related to the depth of the defect space, while the second decoding feature highlights response features related to the defect edge structure.

[0164] The first decoded feature is input to the first decoding branch of the multi-task decoding module. After passing through multiple levels of upsampling operations and feature fusion modules, the feature map is restored layer by layer in terms of spatial resolution and the corresponding spatial depth distribution is reconstructed. Finally, the defect depth map of the target oil and gas pipeline is output to characterize the depth distribution and spatial range of the defect.

[0165] Simultaneously, the second decoding feature is input to the second decoding branch of the multi-task decoding module. The second decoding branch integrates an edge response enhancement structure. By introducing an edge guidance channel and a high-frequency texture enhancement module into the decoding path, the structural perception capability of the defect edge is enhanced, and the defect gradient map corresponding to the target oil and gas pipeline is output to reflect the boundary change trend and directional gradient characteristics of the defect contour.

[0166] The collaborative output of the two decoding branches enables the final defect contour prediction result to have both accurate spatial depth representation and edge structure restoration capabilities, thereby improving the overall accuracy and interpretability of defect detection.

[0167] Based on the above embodiments, by constructing a defect contour inversion model that integrates multi-axis feature extraction, residual enhancement coding, and multi-task decoding, multi-scale deep analysis of triaxial magnetic flux leakage detection data of oil and gas pipelines is realized. It can simultaneously output spatial depth maps and edge gradient maps of defects, thereby significantly improving the accuracy and completeness of three-dimensional contour recognition of defects, enhancing the ability to represent complex defect morphologies, and providing efficient and intelligent data support for pipeline integrity assessment and precise maintenance.

[0168] In some embodiments, the method for constructing multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information may further include the following:

[0169] S1: Based on the spatial coordinate information, determine the spatial position corresponding to each signal point in the triaxial magnetic flux leakage detection signal, and normalize the spatial position to obtain a normalized spatial coordinate channel.

[0170] S2: The signal values ​​in each direction of the triaxial magnetic flux leakage detection signal are concatenated with the corresponding normalized spatial coordinate channels to obtain multi-channel input data; wherein, the multi-channel input data includes the triaxial magnetic flux leakage signal channel and the normalized spatial coordinate channel.

[0171] Specifically, firstly, the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline is acquired, including the magnetic flux leakage intensity values ​​collected along the X, Y, and Z axes. Simultaneously, the spatial coordinate information of each signal sampling point in the oil and gas pipeline coordinate system is acquired, including longitudinal distance, circumferential angle, and radial depth. For each sampling point, its spatial coordinates are subjected to minimum-maximum normalization, mapped to the [0,1] interval to obtain a normalized spatial position channel. During the normalization process, a uniform scaling based on the minimum and maximum coordinate range of the entire detection segment can be performed to ensure consistency in spatial feature scale.

[0172] Next, the processed magnetic flux leakage signal channels along the X, Y, and Z axes are concatenated with the normalized spatial coordinate channels (such as normalized longitudinal distance, normalized circumferential angle, and normalized radial depth channels) of the corresponding locations along the channel dimension to form a unified format of multi-channel tensor input data. This tensor can be used for subsequent defect contour inversion model training and inference to achieve the fusion expression of spatial perception and multi-axis signal features. This method ensures that the spatial structural information of the defect location is fully injected during the model input stage, which helps to improve the model's ability to accurately identify the defect morphological boundaries and spatial distribution.

[0173] In some embodiments, the data preprocessing stage has a significant impact on model performance in magnetic flux leakage detection data processing. This paper uses triaxial signals as three-channel inputs to the network. To enhance the model's spatial awareness, a two-dimensional normalized coordinate grid encoding is designed and concatenated with the original signal as two additional channels, forming a five-channel network input. This coordinate encoding allows the model to explicitly receive physical spatial location information, avoiding the problem of the network struggling to learn global spatial location information, greatly enhancing the expressive power of spatial structures, and facilitating the accurate reconstruction of defect locations and shapes. The model input includes the original triaxial magnetic flux leakage signal and its corresponding normalized coordinate information, explicitly injecting spatial priors to assist the network in capturing the spatial distribution of defects.

[0174] The triaxial leakage magnetic input signal is represented as follows:

[0175]

[0176] Where X represents the triaxial leakage magnetic input signal, Hx, Hy, and Hz represent the magnetic field strength on the pipe surface in the x, y, and z directions, respectively, and H and W are the image space width and height. Two-dimensional coordinate encoding:

[0177]

[0178] Where G is the normalized two-dimensional spatial coordinate encoding tensor, This is the encoding channel for the normalized horizontal coordinates. This is the encoding channel for the normalized vertical coordinates. This indicates two channels, each with a size of [value missing]. .

[0179] Using two-dimensional normalized coordinate grid encoding, the coordinate elements are represented as follows:

[0180]

[0181] in, These are the normalized horizontal coordinate values. These are the normalized vertical coordinate values.

[0182] The input signal after concatenation of all spatial pixel positions (i,j) is represented as follows:

[0183]

[0184] Where I represents the concatenated input feature tensor, and Concat(X, G) represents the concatenation of the three-axis leakage magnetic signal tensor X and the two-dimensional coordinate encoding tensor G in the channel dimension.

[0185] By using coordinate encoding, the model can perceive absolute spatial coordinates, which helps the network learn the coupling relationship between local magnetic field signals and spatial location information. Simultaneously, it assists the network in understanding the spatial semantic structure of each location, better representing the joint features of the three-axis signals and spatial distribution, and improving defect localization accuracy.

[0186] As can be seen from the above, the embodiment of this specification provides a method for determining the three-dimensional contour of oil and gas pipeline defects, which acquires the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information; constructs multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information; and determines the defect contour prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect contour inversion model. The pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module. The defect contour prediction result is used to indicate whether the target oil and gas pipeline has defects, and when defects exist in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defects. In this way, by constructing triaxial magnetic flux leakage detection signals and spatial coordinate information into unified multi-channel input data, the spatial localization and joint characterization of magnetic field features of defects in target oil and gas pipelines are realized. By using a pre-trained defect contour inversion model to fuse and analyze multi-source input information, deep features related to defect morphology can be extracted while maintaining spatial consistency, thereby improving the accuracy and detail reproduction of defect contour prediction. The resulting defect contour prediction results can intuitively reflect the distribution characteristics and edge structure of defects in three-dimensional space in image-level form. This not only supports the determination of whether defects exist in the target area, but can also be used to finely characterize the depth changes and boundary gradients of defects, which helps to improve the accuracy of qualitative and quantitative assessment of defects.

[0187] See Figure 2 As shown in the embodiments of this specification, a specific electronic device is also provided, wherein the electronic device includes a network communication port 201, a processor 202 and a memory 203, and the above structures are connected by internal cables so that the various structures can perform specific data interaction.

[0188] Specifically, the network communication port 201 can be used to acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information.

[0189] The processor 202 can be specifically used to construct multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information; and to determine the defect contour prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect contour inversion model; wherein the pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module; the defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and in the case that there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

[0190] The memory 203 can be used to store the corresponding instruction program.

[0191] Based on the above method, the relevant structural performance of electronic equipment can be effectively utilized to improve the data processing speed of electronic equipment and efficiently realize a method for determining the three-dimensional contour of oil and gas pipeline defects.

[0192] In this embodiment, the network communication port 201 can be a virtual port bound to different communication protocols, thereby enabling the sending or receiving of different data. For example, the network communication port can be a port responsible for web data communication, a port responsible for FTP data communication, or a port responsible for email data communication. Furthermore, the network communication port can also be a physical communication interface or communication chip. For example, it can be a wireless mobile network communication chip, such as GSM or CDMA; it can also be a Wi-Fi chip; or it can be a Bluetooth chip.

[0193] In this embodiment, the processor 202 can be implemented in any suitable manner. For example, the processor can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers, etc. This specification is not limiting.

[0194] In this embodiment, the memory 203 may include a hierarchy. In a digital system, anything that can store binary data can be a memory. In an integrated circuit, a circuit with storage function but no physical form is also called a memory, such as RAM, FIFO, etc. In a system, a storage device with a physical form is also called a memory, such as a memory stick, TF card, etc.

[0195] This specification also provides a computer-readable storage medium based on the above-described method for determining the three-dimensional contour of oil and gas pipeline defects. The method acquires the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline and its corresponding spatial coordinate information; constructs multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information; and determines the defect contour prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect contour inversion model. The pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module. The defect contour prediction result is used to indicate whether the target oil and gas pipeline has a defect, and if the target oil and gas pipeline has a defect, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

[0196] In this embodiment, the storage medium includes, but is not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), Cache, Hard Disk Drive (HDD), or Memory Card. The memory can be used to store computer program instructions. The network communication unit can be an interface configured according to standards specified in the communication protocol for network connection communication.

[0197] In this embodiment, the specific functions and effects implemented by the program instructions stored in the computer-readable storage medium can be explained in comparison with other embodiments, and will not be repeated here.

[0198] See Figure 3 At the software level, embodiments of this specification also provide a device for determining the three-dimensional contour of defects in oil and gas pipelines. This device may specifically include the following structural modules:

[0199] Data acquisition module 301 is used to acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information;

[0200] The data determination module 302 is used to construct multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information;

[0201] The result determination module 303 is used to determine the defect contour prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect contour inversion model; wherein, the pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module; the defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and when there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

[0202] In some embodiments, before the above-mentioned result determination module 303 is executed, specifically in the following steps: acquiring historical multi-channel input data of the target oil and gas pipeline; constructing an initial defect contour inversion model and a corresponding joint loss function; wherein, the joint loss function is used to simultaneously constrain the depth prediction error and edge structure error of the defect contour; and a model training module is used to perform multiple rounds of training on the initial defect contour inversion model based on the joint loss function and using the historical multi-channel input data to obtain a defect contour inversion model that has converged and meets preset requirements.

[0203] In some embodiments, the above-mentioned model training module, in specific implementation, performs the current round of training in the following manner: using the multi-axis feature extraction and fusion module in the model obtained from the previous round of training, features are extracted from the leakage magnetic field signals of each axis in the historical multi-channel input data of the current round to obtain the corresponding axial features; based on a preset spatial attention mechanism, corresponding spatial attention weights are generated according to the response intensity of different spatial positions in each axial feature; the spatial attention weights are used to dynamically weight each axial feature, and the weighted axial features are fused to obtain fused features; wherein, the fused features are used to characterize the magnetic field anomaly distribution in the target area; the feature encoding module is used to obtain multi-scale deep features based on the fused features using the feature encoding module in the model obtained from the previous round of training; the multi-task decoding module is used to output the defect depth map corresponding to the target oil and gas pipeline based on the multi-scale deep features using the multi-task decoding module in the model obtained from the previous round of training. The model is trained using a combination of a loss function and a defect gradient map. Based on the joint loss function and the defect depth map and gradient map corresponding to the target oil and gas pipeline, the loss function value for the current training round is calculated. The joint loss function includes a first loss term and a second loss term. The first loss term constrains the depth prediction error, and the second loss term constrains the edge structure error. A "meets requirements" module is used to determine whether the model obtained from the previous training round meets the requirements based on the loss function value for the current training round. When the loss function value for the current training round determines that the model obtained from the previous training round meets the preset convergence condition, the model obtained from the previous training round is determined as a qualified defect contour inversion model. The multi-axis feature extraction and fusion module is constructed based on a preset multi-channel convolutional neural network and spatial attention mechanism. The feature encoding module is constructed based on a preset residual connection network and channel attention mechanism. The multi-task decoding module is constructed based on a preset U-Net decoder structure.

[0204] In some embodiments, after the above-mentioned requirement-compliance module performs the steps, specifically, when it is determined, based on the loss function value corresponding to the current training round, that the model obtained from the previous training round does not meet the preset convergence condition, the model training parameters and optimization strategy are adjusted to construct the training model for the current round; training is then continued based on the joint loss function to obtain the model after the current training round.

[0205] In some embodiments, the feature encoding module, in its specific implementation, utilizes the residual connection module within the feature encoding module to perform residual path superposition operations based on the fused features to obtain a residual enhanced feature map; wherein, the residual enhanced feature map is used to enhance local detail information and global structure perception capabilities; utilizing the attention mechanism module within the feature encoding module, an attention weight map is generated based on the spatial distribution structure of the residual enhanced feature map and the dependency relationship between the feature responses of each channel, and a weighted adjustment is performed on the residual enhanced feature map based on the attention weight map to determine multi-scale deep features.

[0206] In some embodiments, the multi-task decoding module, in its specific implementation, determines a first decoding feature and a second decoding feature based on the multi-scale deep features; wherein the first decoding feature is used for depth prediction and the second decoding feature is used for gradient prediction; the first decoding feature is input to the first decoding branch of the multi-task decoding module to reconstruct the spatial depth distribution of the defect contour and output a defect depth map corresponding to the target oil and gas pipeline; the second decoding feature is input to the second decoding branch of the multi-task decoding module, and through a decoding path including an edge response enhancement structure, outputs a defect gradient map corresponding to the target oil and gas pipeline.

[0207] In some embodiments, the data determination module 302, in specific implementation, determines the spatial position corresponding to each signal point in the triaxial magnetic flux leakage detection signal based on the spatial coordinate information, and performs normalization processing on the spatial position to obtain a normalized spatial coordinate channel; the signal values ​​in each direction of the triaxial magnetic flux leakage detection signal are concatenated with the corresponding normalized spatial coordinate channel by channel dimension to obtain multi-channel input data; wherein, the multi-channel input data includes the triaxial magnetic flux leakage signal channel and the normalized spatial coordinate channel.

[0208] It should be noted that the units, devices, or modules described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. For ease of description, the above devices are described by dividing them into various modules according to their functions. Of course, in implementing this specification, the functions of each module can be implemented in the same software and / or hardware, or modules that implement the same function can be implemented by a combination of sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection between the devices or units shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0209] As can be seen from the above, based on the three-dimensional contour determination device for oil and gas pipeline defects provided in the embodiments of this specification, the device acquires logging data of the target well in the target area and standard well data of a reference standard well; determines the logging characteristics of the target well based on the logging data; wherein the logging characteristics include: the ratio of natural gamma value to deep lateral resistivity value, and curve morphology characteristics, the curve morphology characteristics being used to reflect the inflection point position and curvature change of the natural gamma curve and the deep lateral resistivity curve; determines the geological characteristics corresponding to the target well based on the standard well data; wherein the geological characteristics include: the average layer thickness characteristics of the main layer, and the layer thickness consistency characteristics between the target well and the reference standard well; and determines the layer data of the target well based on the logging characteristics and the geological characteristics using a preset marker layer prediction model; wherein the layer data is used to guide the reservoir layer division of the target well.

[0210] In a specific scenario example, the method and apparatus for determining the three-dimensional contour of oil and gas pipeline defects provided in this specification can be applied, solving the problem that traditional magnetic flux leakage detection methods cannot achieve accurate reconstruction of the three-dimensional contour of pipeline defects. The specific implementation process may include the following.

[0211] In some embodiments, to quantitatively evaluate the impact of multi-axis independent branches, spatial attention mechanisms, residual structures, bi-branch output structures, and joint loss function design on the overall performance of the model, four sets of control variable comparison experiments are designed in some embodiments and compared with the complete model MFL-RARN. Specifically, this includes:

[0212] (1) MFL-RFN (NoAttn): This is a multi-axis residual fusion network without attention. Based on the complete model, all spatial attention modules and multi-axis dynamic weighted fusion structures are removed, and only the fusion method of directly splicing the three-axis magnetic flux leakage signals after processing them with convolution and residual modules (ResBlock) is retained. This experiment is used to verify the role of spatial attention mechanism and adaptive multi-axis weight allocation strategy in the feature extraction and fusion accuracy of multi-source signals;

[0213] (2) MFL-SFN: namely, single-branch feature fusion network, which adopts a simple splicing strategy to directly use the three-channel leakage magnetic field signal as the whole input and input it into the shared convolutional layer and residual structure, without setting up independent branches for the three axes. By comparing with the complete model, the effectiveness of the axis-by-axis feature extraction structure compared with the traditional channel splicing method in modeling complex defect features can be evaluated;

[0214] (3) MFL-RAN(L1): This is a residual attention network with only L1 loss, which retains the complete network structure and dual-branch output settings, but only uses the L1 reconstruction error based on the predicted depth map as the training objective in the loss function design, and removes the explicit gradient map loss term. This experiment is used to analyze the performance improvement of jointly introducing gradient supervision in enhancing edge detail representation and defect contour fidelity;

[0215] (4) MFL-RASN (SingleOut): This is a residual attention dual-output network with gradient branches removed, retaining the multi-axis branch structure, spatial attention mechanism, and residual coding module. However, in the decoding stage, only the depth branch is retained for outputting the defect depth map, and the gradient branch used for edge prediction is removed. The loss function also accordingly only calculates the L1 reconstruction error of the depth map and the optional gradient regularization term. This experiment is used to verify the synergistic gain effect of the explicit gradient prediction head in guiding the depth map to learn spatial geometric features.

[0216] Through the above multi-dimensional comparative experiments, the effectiveness of the proposed structural components and supervision strategies in the three-dimensional inversion task of oil and gas pipeline defects was verified, providing theoretical support and engineering basis for model structure optimization and design.

[0217] In some embodiments, see Figure 4 As shown, an encoder-decoder structure is adopted, and a multi-axis magnetic leakage feature fusion module, spatial attention mechanism and depth perception decoder are introduced to improve the recognition accuracy of defect areas and the ability to restore geometric contours.

[0218] like Figure 4 As shown in (a), the overall system structure includes: an input module, a multi-axis feature fusion module, an encoder module, a decoder module, and a depth-sensing decoder module. The input module receives triaxial magnetic leakage signals, represented as magnetic field disturbance data in the x, y, and z directions; the multi-axis feature fusion module... Figure 4 As shown in (c), three independent convolutional branches are used to extract features from the three-axis magnetic flux leakage data, the defect response region is enhanced through a spatial attention mechanism, and a unified fusion feature map is output based on a dynamic fusion structure.

[0219] The encoder module adopts a multi-level residual structure (such as...). Figure 4 As shown in (b), this is used to extract multi-scale deep semantic information and set skip connections between each level to preserve shallow spatial features. The decoder module restores the spatial resolution of the defect image through step-by-step upsampling operations and fuses the skip features of the corresponding levels to enhance the expression of details.

[0220] Furthermore, such as Figure 4As shown in (d), the depth-sensing decoder module includes a two-branch structure: a depth head and a gradient head, which are used to predict the spatial depth distribution and edge gradient changes of the defect region, respectively. The module incorporates a shared convolutional structure and residual path, and employs different nonlinear activation functions to adapt to the characteristics of depth prediction (S-shaped function) and gradient prediction (Tanh function), thereby achieving a joint representation of complex defect geometric features.

[0221] With the above structural setup, the system can accurately invert the defect area of ​​oil and gas pipeline in three-dimensional space, improve the accuracy of identifying multi-morphological defects (such as corrosion, cracks, perforation, etc.), and is suitable for scenarios such as high-precision defect modeling, quantitative assessment and maintenance decision support.

[0222] In some embodiments, see Figure 5 As shown in the figure, the root mean squared error (RMSE) of the MFL-MAARN model and four variant models on the training set (left) and validation set (right) varies with the number of training epochs. The figure reveals that all models exhibit a rapid decrease in RMSE during the initial training phase (the first 10 epochs), subsequently converging. In contrast, the MFL-MAARN model maintains consistently lower training and validation errors throughout the training process, with a smoother RMSE curve and less fluctuation, indicating superior fitting ability and generalization performance. Especially with the introduction of multi-axis feature fusion and spatial attention mechanisms, the model's ability to represent magnetic flux leakage defects is significantly enhanced, effectively improving reconstruction accuracy.

[0223] In some embodiments, see Figure 6 As shown in the figure, the mean absolute error (MAE) curves of MFL-MAARN and its variants on the training and validation sets are presented. The figure shows that the error of each model decreases rapidly in the early training stages (0–10 epochs), and then enters a slow decline phase after 10 epochs. Compared with other variant models, MFL-MAARN exhibits the lowest MAE values ​​in both the training and validation stages, and its validation curve shows less fluctuation, demonstrating strong stability and robustness. This indicates that by employing a network structure with independent multi-axis branches, enhanced spatial attention, and joint gradient supervision, the spatial features and physical changes in triaxial magnetic flux leakage signals can be captured more precisely, contributing to improved practical application performance.

[0224] In some embodiments, see Figure 7As shown in the figure, the changes in the overall loss value of each model during training and validation are compared. The training loss curve shows that the MFL-MAARN model maintains the lowest training error and converges faster throughout the training process. Regarding validation loss, MFL-MAARN also exhibits a lower final loss value and a smoother descent curve. In contrast, removing spatial attention (MFL-RFN NoAttn), canceling multi-axis modeling (MFL-SFN), removing gradient supervision (MFL-RASN SingleOut), or using only L1 loss (MFL-RAN L1) all lead to a decrease in model performance, larger fluctuations in validation loss, and a higher likelihood of overfitting or underfitting. Figure 7 The results further validate that the collaborative design of the modules in the MFL-MAARN network structure effectively improves the convergence efficiency and generalization ability of the model in the defect depth reconstruction task.

[0225] In some embodiments, see Figure 8 As shown in the figure, the actual contour of the defect and the 3D contour reconstruction results of different models in a regular defect scene are displayed. Figure 8 In the middle (a), the actual defect morphology is shown. Figure 8 (b) shows the reconstruction results based on the MFL-MAARN model. Figure 8 (c) shows the reconstruction results of the MFL-RFN (NoAttn) model. Figure 8 (d) shows the reconstruction results of the MFL-SFN model. Figure 8 In the middle (e), the reconstruction results of the MFL-RAN(L1) model are shown. Figure 8 In the middle (f), the reconstruction result of the MFL-RASN (SingleOut) model is shown.

[0226] As can be seen from the figure, for regular defect samples, the MFL-MAARN model exhibits higher consistency and accuracy in reconstructing defect depth, opening contour, and overall geometry, with its reconstruction results being closest to the true morphology. In comparison, the MFL-SFN model is second best; although it can basically restore the defect location and shape, it has some deviations in boundary smoothness and depth accuracy. The reconstruction results of the MFL-RFN (NoAttn), MFL-RAN (L1), and MFL-RASN (SingleOut) models show obvious contour distortion or local shallow depth problems, making it difficult to accurately fit the spatial distribution characteristics of the true defects.

[0227] It is evident that the proposed MFL-MAARN model, through the synergistic effect of multi-axis feature fusion and spatial attention enhancement mechanism, can achieve higher accuracy in defect morphology reconstruction in regular defect scenarios, significantly improving defect boundary resolution and overall structure restoration capability.

[0228] In some embodiments, see Figure 9 As shown in the figure, the true morphology of irregular defects and the 3D reconstruction results of each model are illustrated. Figure 9 In the middle (a), the actual defect morphology is shown. Figure 9 (b) shows the reconstruction results based on the MFL-MAARN model. Figure 9 (c) shows the reconstruction results of the MFL-RFN (NoAttn) model. Figure 9 (d) shows the reconstruction results of the MFL-SFN model. Figure 9 In the middle (e), the reconstruction results of the MFL-RAN(L1) model are shown. Figure 9 In the middle (f), the reconstruction result of the MFL-RASN (SingleOut) model is shown.

[0229] For more complex irregular defects, the MFL-MAARN model still demonstrates significant advantages in overall defect morphology reconstruction, detailed concavity characterization, and boundary coherence. The reconstructed 3D defect contour maintains a high degree of consistency with the real shape and can accurately reproduce depth variations and local abrupt changes. While the MFL-SFN model can roughly reconstruct the defect morphology, it still exhibits some deviations in edge continuity and depth reconstruction. Other models, such as MFL-RFN (NoAttn), MFL-RAN (L1), and MFL-RASN (SingleOut), all show varying degrees of distortion and degradation in the reconstruction of defect depth, contour distribution, and detailed structure.

[0230] Comprehensive comparisons show that the proposed MFL-MAARN model has stronger generalization ability and reconstruction robustness, and can effectively adapt to different defect types. In particular, when dealing with irregular and complex defects, the strategy of integrating multi-axis spatial features and attention mechanism significantly improves reconstruction accuracy and defect representation integrity.

[0231] While this specification provides the steps of operation for the methods described in the embodiments or flowcharts, more or fewer steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or client product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in a process, method, product, or apparatus that includes said elements is not excluded. The terms "first," "second," etc., are used to denote names and do not indicate any particular order.

[0232] Those skilled in the art will also know that, besides implementing the controller using purely computer-readable program code, the same functions can be achieved by logically programming the method steps, making the controller function as logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers (PLCs), and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the devices within it used to implement various functions can also be considered structures within that hardware component. Alternatively, the devices used to implement various functions can be considered as both software modules implementing the method and structures within a hardware component.

[0233] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this specification can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions of this specification can essentially be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, mobile terminal, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments of this specification.

[0234] Although this specification has been described by way of examples, those skilled in the art will recognize that many variations and modifications are possible without departing from the spirit of this specification, and it is intended that the appended claims cover such variations and modifications without departing from the spirit of this specification.

Claims

1. A method for determining the three-dimensional profile of defects in oil and gas pipelines, characterized in that, include: Acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be inspected and its corresponding spatial coordinate information; Based on the triaxial magnetic flux leakage detection signal and spatial coordinate information, multi-channel input data is constructed; Using a pre-trained defect contour inversion model, the defect contour prediction result of the target oil and gas pipeline is determined based on the multi-channel input data; wherein, the pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module; the defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and when there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

2. The method according to claim 1, characterized in that, Before determining the defect profile prediction result of the target oil and gas pipeline based on the multi-channel input data using the pre-trained defect profile inversion model, the method further includes: Acquire historical multi-channel input data of the target oil and gas pipeline; An initial defect contour inversion model and its corresponding joint loss function are constructed; wherein, the joint loss function is used to simultaneously constrain the depth prediction error and edge structure error of the defect contour. Based on the joint loss function, the initial defect contour inversion model is trained multiple times using the historical multi-channel input data to obtain a defect contour inversion model that has converged and meets the preset requirements.

3. The method according to claim 2, characterized in that, The process of training the initial defect contour inversion model multiple times using the historical multi-channel input data based on the joint loss function to obtain a defect contour inversion model that has converged and meets preset requirements includes: Perform the current round of training as follows: Using the multi-axis feature extraction and fusion module from the model trained in the previous round, feature extraction is performed on the leakage magnetic field signals of each axis in the historical multi-channel input data of the current round to obtain the corresponding axial features. Based on a preset spatial attention mechanism, corresponding spatial attention weights are generated according to the response intensity at different spatial positions in each axial feature. The spatial attention weights are used to dynamically weight each axial feature, and the weighted axial features are fused to obtain the fused features. The fused features are used to characterize the abnormal magnetic field distribution in the target region. Using the feature encoding module in the model obtained from the previous training round, multi-scale deep features are obtained based on the fused features; Using the multi-task decoding module in the model obtained from the previous training, the defect depth map and defect gradient map corresponding to the target oil and gas pipeline are output according to the multi-scale deep features. Based on the joint loss function and the defect depth map and defect gradient map corresponding to the target oil and gas pipeline, the loss function value corresponding to the current training round is calculated; wherein, the joint loss function includes a first loss term and a second loss term; wherein, the first loss term is used to constrain the depth prediction error, and the second loss term is used to constrain the edge structure error; Based on the loss function value corresponding to the current training round, determine whether the model obtained from the previous training round meets the requirements; When the model obtained from the previous training round meets the preset convergence condition based on the loss function value corresponding to the current training round, the model obtained from the previous training round is determined as the defect contour inversion model that meets the requirements. The multi-axis feature extraction and fusion module is constructed based on a preset multi-channel convolutional neural network and spatial attention mechanism; the feature encoding module is constructed based on a preset residual connection network and channel attention mechanism; and the multi-task decoding module is constructed based on a preset U-Net decoder structure.

4. The method according to claim 3, characterized in that, After determining whether the model obtained from the previous training round meets the requirements based on the loss function value corresponding to the current training round, the method further includes: When it is determined, based on the loss function value corresponding to the current training round, that the model obtained in the previous training round does not meet the preset convergence condition, the model training parameters and optimization strategy are adjusted to construct the training model for the current round. Training continues based on the joint loss function to obtain the model after the current round of training.

5. The method according to claim 4, characterized in that, The process of utilizing the feature encoding module in the model obtained from the previous training round, and based on the fused features, to obtain multi-scale deep features includes: Using the residual connection module in the feature encoding module, residual path superposition operation is performed according to the fused features to obtain a residual enhanced feature map; wherein, the residual enhanced feature map is used to enhance local detail information and global structure perception capabilities; Using the attention mechanism module in the feature encoding module, an attention weight map is generated based on the spatial distribution structure of the residual enhanced feature map and the dependency relationship between the feature responses of each channel. The residual enhanced feature map is then weighted and adjusted based on the attention weight map to determine multi-scale deep features.

6. The method according to claim 5, characterized in that, The process of utilizing the multi-task decoding module in the model obtained from the previous training round, and outputting the defect depth map and defect gradient map corresponding to the target oil and gas pipeline based on the multi-scale deep features, includes: Based on the multi-scale deep features, a first decoding feature and a second decoding feature are determined respectively; wherein, the first decoding feature is used for depth prediction and the second decoding feature is used for gradient prediction. The first decoding feature is input into the first decoding branch of the multi-task decoding module to reconstruct the spatial depth distribution of the defect contour and output the defect depth map corresponding to the target oil and gas pipeline. The second decoding feature is input into the second decoding branch of the multi-task decoding module, and the defect gradient map corresponding to the target oil and gas pipeline is output through the decoding path containing the edge response enhancement structure.

7. The method according to claim 1, characterized in that, The process of constructing multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information includes: Based on the spatial coordinate information, the spatial position corresponding to each signal point in the triaxial magnetic flux leakage detection signal is determined, and the spatial position is normalized to obtain a normalized spatial coordinate channel. The signal values ​​in each direction of the triaxial magnetic flux leakage detection signal are concatenated with the corresponding normalized spatial coordinate channels to obtain multi-channel input data; wherein, the multi-channel input data includes the triaxial magnetic flux leakage signal channel and the normalized spatial coordinate channel.

8. A device for determining the three-dimensional profile of defects in oil and gas pipelines, characterized in that, include: The data acquisition module is used to acquire the triaxial magnetic flux leakage detection signal of the target oil and gas pipeline to be detected and its corresponding spatial coordinate information; The data determination module is used to construct multi-channel input data based on the triaxial magnetic flux leakage detection signal and spatial coordinate information; The result determination module is used to determine the defect contour prediction result of the target oil and gas pipeline based on the multi-channel input data using a pre-trained defect contour inversion model. The pre-trained defect contour inversion model includes a multi-axis feature extraction and fusion module, a feature encoding module, and a multi-task decoding module. The defect contour prediction result is used to indicate whether there is a defect in the target oil and gas pipeline, and if there is a defect in the target oil and gas pipeline, the defect contour prediction result is also used to indicate the three-dimensional contour shape of the defect.

9. An electronic device, characterized in that, The method includes a processor and a memory for storing processor-executable instructions, wherein the processor, when executing the instructions, implements the steps of the method for determining the three-dimensional profile of an oil and gas pipeline defect as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores computer instructions, which, when executed by a processor, implement the steps of the method for determining the three-dimensional profile of an oil and gas pipeline defect as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Rotating electromagnetic field surface corrosion defect inversion system, method and medium

    CN121955166A

  • Rotating electromagnetic field surface corrosion defect inversion system, method and medium

    CN121955166B

  • Pipeline magnetic flux leakage defect detection method and system

    CN122109290A

  • Pipeline magnetic flux leakage defect detection method and system

    CN122109290B

  • Pipeline magnetic flux leakage defect detection method and device, storage medium and computer equipment

    CN122218080A