A pipeline corrosion defect magnetic leakage signal inversion method based on physical constraint deep learning

By combining deep learning with physical constraints, the accuracy and reliability issues of complex corrosion defect morphology inversion in magnetic flux leakage detection were solved, enabling high-precision quantitative assessment and morphology reconstruction of corrosion defects and improving the automation level of pipeline inspection.

CN122451269APending Publication Date: 2026-07-24INST OF METAL RESEARCH - CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF METAL RESEARCH - CHINESE ACAD OF SCI
Filing Date
2026-03-24
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing magnetic flux leakage detection technology is difficult to accurately invert the morphology of complex corrosion defects. Traditional methods are computationally time-consuming and rely on assumptions, while pure deep learning models lack physical constraints, resulting in large prediction errors and insufficient generalization ability.

Method used

A corrosion defect inversion method combining deep learning and physical constraints is proposed. By introducing magnetic field divergence, attenuation law and gradient continuity constraints, data is generated using finite element simulation, and an encoder-decoder model is constructed for signal inversion.

Benefits of technology

It achieves high-precision quantitative inversion of complex corrosion defects, improves the generalization ability of the model and the reliability of the inversion results, and outputs corrosion depth, width, volume and morphology, providing accurate parameters for pipeline inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122451269A_ABST
    Figure CN122451269A_ABST
Patent Text Reader

Abstract

The application provides a pipeline corrosion defect magnetic leakage signal inversion method based on physical constraint deep learning, first, a standard magnetic leakage detection equipment is used to scan a pipeline sample containing a corrosion defect or an actual pipeline to obtain a multi-component magnetic leakage signal of a corrosion area, the repeatability of the signal is ensured, after the original magnetic leakage signal is obtained, preprocessing is required to improve the signal quality.The preprocessing includes noise filtering, signal smoothing, signal normalization and signal alignment.The signal frequency domain features are extracted by Fourier transform of the signal to extract the frequency spectrum energy distribution, main frequency and other features.Next, an inversion model of the corrosion defect is constructed, and the decoder part is a deep regression network.The application has the following advantages: the inversion precision is significantly improved, the reliability and interpretability of the model output are improved, the application range of the model is expanded, the generalization ability of the model is improved, the quantitative evaluation precision of the corrosion defect is improved, and the pipeline integrity management level is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of pipeline corrosion nondestructive testing technology and artificial intelligence technology. Specifically, it relates to a method for inverting the morphology of metal corrosion defects by using magnetic flux leakage detection signals and combining them with deep learning models. It is particularly suitable for quantitative assessment of corrosion defects in infrastructure such as oil and gas pipelines and urban underground pipe networks. Background Technology

[0002] Magnetic Flux Leakage (MFL) is one of the most widely used technologies for corrosion detection in oil and gas pipelines and pressure pipelines. Its basic principle is to magnetize the pipeline wall to saturation using permanent magnets or electromagnets. When corrosion defects exist in the pipe wall, the change in magnetic permeability at the defect causes some magnetic lines of force to leak out of the pipe wall. The distribution of the leaked magnetic field is detected by a magnetic sensor placed on a probe, thereby determining the location and characteristics of the defect. MFL has advantages such as fast detection speed, relatively low cost, and sensitivity to defects, and has become the mainstream technology for pipeline inspection.

[0003] However, a complex nonlinear relationship exists between magnetic flux leakage signals and the geometry of corrosion defects. Factors such as the depth, length, width, shape, and edge sharpness of corrosion defects all affect the amplitude, waveform, and spatial distribution of the magnetic flux leakage signal. The diverse and complex morphologies of actual corrosion pits make accurately retrieving the morphology of corrosion defects from magnetic flux leakage signals a highly challenging task. Traditionally, the inversion of magnetic flux leakage signals relies primarily on empirical formulas or finite element numerical simulations. Empirical formula methods simplify defects into regular shapes (such as rectangular grooves or hemispherical pits) and establish an approximate relationship between signal characteristics and defect size through calibration experiments. However, this method struggles to handle the irregular morphologies of actual corrosion. While the finite element method can simulate the magnetic flux leakage of complex defects, it is computationally time-consuming and requires iterative optimization, making it difficult to meet the needs of real-time detection. Furthermore, the simulation results depend on assumptions about material magnetization characteristics and defect boundary conditions, leading to deviations from actual conditions.

[0004] In recent years, the rapid development of deep learning technology has provided new technical means for complex signal inversion. Models such as Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) can automatically learn the mapping relationship between signals and targets from large amounts of data and have been successfully applied in fields such as image reconstruction and parameter inversion. In the field of magnetic flux leakage detection, some researchers have attempted to use deep neural networks to directly predict defect sizes from magnetic flux leakage signals and have made some progress. However, existing methods still have the following problems: First, the inversion accuracy is insufficient, especially for corrosion pits with large depths and complex shapes, resulting in large prediction errors; second, the adaptability to complex corrosion pits is poor, and the models often perform well within the range of training data coverage, but their generalization ability is insufficient when faced with unseen defect types; third, there is a lack of physical constraints, and purely data-driven models only learn the mapping relationship from statistical correlations without incorporating the physical mechanism of magnetic flux leakage detection, which may lead to prediction results that violate the basic laws of magnetic fields, such as abnormal results that do not conform to the magnetic field divergence constraints.

[0005] Therefore, there is an urgent need to propose a corrosion defect inversion method that combines the physical mechanism of magnetic flux leakage with deep learning. While utilizing the powerful fitting ability of deep learning, physical constraints are introduced to ensure the rationality and reliability of the inversion results, thereby achieving high-precision quantitative prediction of the morphological parameters of pipeline corrosion defects. Summary of the Invention

[0006] The purpose of this invention is to provide a method for inverting magnetic flux leakage signals of pipeline corrosion defects based on physically constrained deep learning. This method aims to solve the problem of difficulty in accurately modeling the complex mapping relationship between magnetic flux leakage signals and corrosion morphology in existing technologies, overcome the lack of physical constraints in pure deep learning models, and improve the accuracy and reliability of corrosion defect parameter inversion. Specifically, this invention addresses the following technical problems: First, establishing a high-precision mapping relationship between magnetic flux leakage signals and corrosion defect morphology; second, introducing the physical mechanism of magnetic flux leakage detection into the deep learning model to ensure that the inversion results conform to the basic laws of magnetic fields; third, improving the generalization ability and practicality of the model by combining finite element simulation and real data; and fourth, achieving quantitative inversion of key parameters of corrosion defects, including depth, width, volume, and overall morphology.

[0007] To achieve the above objectives, this invention provides a method for inverting magnetic flux leakage signals of pipeline corrosion defects based on physically constrained deep learning. First, a pipeline sample or actual pipeline containing corrosion defects is scanned using a standard magnetic flux leakage detection device to acquire multi-component magnetic flux leakage signals of the corroded area. These signals include at least three orthogonal components: an axial magnetic field component Bx, a circumferential magnetic field component By, and a radial magnetic field component Bz. During the acquisition process, detection parameters such as probe lift-off height, scanning speed, and magnetization intensity must be recorded to ensure signal repeatability. For each corrosion defect, a set of two-dimensional or one-dimensional magnetic flux leakage signal sequences is obtained, with the signal length depending on the scanning path length and sampling frequency.

[0008] After obtaining the raw magnetic flux leakage signal, preprocessing is required to improve signal quality. Preprocessing includes noise filtering, signal smoothing, signal normalization, and signal alignment. Noise filtering uses methods such as wavelet denoising, median filtering, or Gaussian filtering to remove high-frequency noise while retaining the main characteristics of the signal. Signal smoothing uses moving average or Savitzky-Golay filters to eliminate local glitches and make the waveform smoother. Signal normalization normalizes the amplitude of each channel signal to a uniform numerical range, such as [-1,1] or [0,1], eliminating amplitude differences between different detection batches. Signal alignment uses the defect center as a reference point to align the magnetic flux leakage signals of different defects in space, ensuring the consistency of the model input.

[0009] To reduce the dimensionality of the model input and highlight key information, physically meaningful feature parameters are extracted from the preprocessed magnetic flux leakage signal, including signal peak value, signal width, signal gradient, signal integral area, and signal frequency domain features. The signal peak value represents the maximum and minimum values ​​of each signal component, reflecting the severity of the defect; the signal width, or the half-width at half-maximum (FWHM) or the spacing between peaks, is related to the lateral size of the defect; the signal gradient, the maximum slope of the rising and falling edges, reflects the steepness of the defect edges; the signal integral area, the area under the signal curve, is related to the defect volume; and the signal frequency domain features are extracted by performing a Fourier transform on the signal to obtain spectral energy distribution, dominant frequency, and other characteristics. These features can serve as auxiliary inputs to the deep learning model and can also be used for subsequent physical constraint verification.

[0010] Next, a corrosion defect inversion model is constructed. This model adopts an encoder-decoder architecture. The encoder is used to extract high-dimensional features from the magnetic leakage signal. It can use a convolutional neural network (CNN) or a Transformer network. CNN is suitable for extracting local waveform features, while Transformer is good at capturing long-distance dependencies. The choice or combination can be made according to actual needs. The decoder is a deep regression network. The output layer is designed according to the prediction target: if the prediction is discrete parameters such as depth, width, and volume, the output layer is a fully connected layer that outputs the corresponding values; if the prediction is a complete morphology, the output layer is a deconvolutional network that outputs a two-dimensional height matrix. The intermediate layers of the model use techniques such as residual connections and batch normalization to accelerate training and improve performance.

[0011] To ensure that the model predictions conform to the physical mechanism of magnetic flux leakage detection, this invention introduces physical constraint mechanisms into the model. These physical constraints include magnetic field divergence constraints, leakage magnetic field attenuation laws, and magnetic field gradient continuity constraints. The magnetic field divergence constraint, based on Maxwell's equations, states that the divergence of magnetic induction intensity is zero in the passive region, i.e. The predicted defect morphology is used to calculate the leakage magnetic field signal through a forward model, and its divergence is checked to see if it is close to zero. The leakage magnetic field attenuation law requires that the amplitude of the leakage magnetic field signal should decrease exponentially with the increase of the lift-off height, and the prediction results should satisfy this relationship. The magnetic field gradient continuity constraint requires that the change of the leakage magnetic field in space should be continuous, and there should be no abrupt change in the signal gradient at adjacent locations. These physical constraints are added to the model training process in the form of regularization terms to ensure that the model output conforms to physical laws.

[0012] The model's total loss function consists of two parts: a data error term and a physical constraint error term, i.e., Loss = L_data + λ·L_physics, where λ is a balancing coefficient used to adjust the weight of the physical constraints. The data error term L_data measures the deviation between the model's predicted corrosion parameters and the actual values. For discrete parameters, mean squared error or mean absolute error is used; for morphology prediction, structural similarity index or pixel-level loss is used. The physical constraint error term L_physics calculates the degree to which the predicted results violate physical laws. For example, it calculates the divergence of the predicted leakage magnetic field signal using finite difference and takes its absolute value as the loss; or it inputs the predicted defect morphology into the finite element forward model and calculates the difference between the simulated signal and the measured signal. By optimizing the total loss function, the model can satisfy the physical constraints while fitting the data.

[0013] Model training requires a large amount of paired data, namely, leakage magnetic field signals and corresponding real morphologies of corrosion defects. This invention uses two types of data sources: first, real corrosion defect data, which is obtained by preparing corrosion samples with different morphologies through accelerated corrosion experiments in the laboratory, acquiring defect morphologies using 3D scanning technology, and simultaneously collecting leakage magnetic field signals to form real paired samples; second, numerical simulation corrosion defect data, which uses the finite element method to simulate the leakage magnetic field of corrosion defects of different shapes and sizes, generating a large amount of simulation data to expand the scale and diversity of the training set. During training, the dataset is divided into training, validation, and test sets, and iterative optimization is performed using optimization algorithms such as Adam, while strategies such as early stopping and learning rate decay are used to prevent overfitting.

[0014] After training, the leakage magnetic field signals collected during actual testing are input into the model. After forward propagation, the model outputs the corresponding corrosion defect parameters. The output results include corrosion depth, corrosion width, corrosion volume, and corrosion morphology. These parameters can comprehensively assess the severity of corrosion defects and provide a basis for pipeline integrity evaluation.

[0015] This invention also includes the following key technological innovations: First, a physical constraint loss function is introduced during the deep learning model training process to ensure that the inversion results satisfy the magnetic flux leakage detection mechanism. Magnetic field divergence constraints, attenuation law constraints, and gradient continuity constraints are expressed mathematically and added as regularization terms to the total loss, guiding the model to learn mapping relationships that conform to physical laws and avoiding non-physical interpretations that may arise from purely data-driven models. Second, a large amount of magnetic flux leakage signal data from corrosion defects is generated through finite element simulation to expand the training dataset, establish a parameterized corrosion defect model, change parameters such as the depth, width, shape, and edge angle of the defects, and use finite element software to calculate the corresponding magnetic flux leakage distribution, generating tens of thousands of simulation samples covering a wide parameter space. This compensates for the limited number of real experimental samples and improves the model's generalization ability. Third, the model is calibrated using real corrosion defect data. Real experimental samples are used as a test set to evaluate the model's performance on real data. Transfer learning or fine-tuning techniques are used to adapt the model to the distribution characteristics of real data, reducing the domain difference between simulated and real data. Fourth, a mapping relationship between corrosion defect parameters and leakage magnetic field signals is established to achieve quantitative inversion of corrosion defect morphology. The model not only outputs scalar parameters such as depth and width, but also outputs complete corrosion pit morphology, providing fine input for subsequent stress analysis and life prediction.

[0016] Advantages of this invention: Leveraging the powerful fitting capabilities of deep learning, this method achieves high-precision inversion from complex magnetic flux leakage signals to corrosion defect morphologies, overcoming the limitations of traditional empirical formulas and finite element fitting methods, and significantly improving inversion accuracy. By introducing physical constraint mechanisms into the deep learning model, including magnetic field divergence constraints, attenuation law constraints, and gradient continuity constraints, it ensures that the inversion results conform to the basic physical mechanism of magnetic flux leakage detection, improving the reliability and interpretability of the model output and avoiding physical contradictions that may arise from purely data-driven models. It can identify complex corrosion defect morphologies, outputting not only scalar parameters such as depth and width but also reconstructing the three-dimensional morphology of corrosion pits, providing richer information for a comprehensive assessment of corrosion severity. By generating a large amount of training data through finite element simulation and calibrating it with real experimental data, it solves the problem of obtaining actual corrosion samples, expands the model's application scope, and improves its generalization ability. It enhances the automation level of pipeline corrosion detection, achieving end-to-end automatic inversion from magnetic flux leakage signals to corrosion parameters, reducing manual intervention and reliance on expert experience. It improves the quantitative assessment accuracy of corrosion defects, providing more accurate input parameters for pipeline residual strength evaluation and residual life prediction, contributing to improved pipeline integrity management. Attached Figure Description

[0017] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments: Figure 1This is an overall flowchart of the method for inverting corrosion defects using leakage magnetic signals according to the present invention, showing the eight main steps from signal acquisition to defect inversion; Figure 2 This is a schematic diagram of the magnetic flux leakage detection principle, showing the distribution relationship between the magnetizer, sensor, defect, and leakage magnetic field; Figure 3 This is a schematic diagram of the leakage magnetic field signal distribution, showing the typical waveform characteristics of the axial, radial, and circumferential components; Figure 4 This is a schematic diagram of feature extraction for magnetic flux leakage signals, with the extraction methods for feature parameters such as peak value, width, and gradient marked. Figure 5 The diagram shows the structure of the deep learning-based corrosion defect inversion model, illustrating the connection relationships between the encoder, decoder, and physical constraint module. Figure 6 The image shows a comparison of corrosion defect inversion results, highlighting the differences between the method of this invention, the traditional method, and the actual corrosion morphology. Detailed Implementation

[0018] The present invention will be further explained below with reference to specific implementation schemes, but it is not limited to the present invention. The structures, proportions, sizes, etc. shown in the accompanying drawings are only used to complement the content disclosed in the specification, so as to enable those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modification of the structure, change of the proportion relationship or adjustment of the size, without affecting the effect and purpose that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0020] This embodiment is for illustrative purposes only and does not constitute a limitation on the present invention.

[0021] Example 1: Inversion of Magnetic Leakage Signal Based on Physically Constrained CNN This embodiment uses a laboratory magnetic flux leakage scanning platform for signal acquisition. The platform consists of an electromagnet magnetizer, a triaxial Hall sensor array, a precision motion control system, and a data acquisition card. The magnetizer uses a U-shaped electromagnet, which can generate a magnetizing field of approximately 1.5 T in the sample. The sensor array contains 16 Hall elements arranged at 1 mm intervals, capable of simultaneously acquiring magnetic flux leakage signals in the axial, radial, and circumferential directions. The sample is X70 pipeline steel, measuring 300 mm × 150 mm × 12 mm, with corrosion defects of different sizes and shapes prepared on its surface through accelerated corrosion experiments. During testing, the sample is fixed on the worktable, and the sensor scans uniformly along the sample length at a lift height of 2 mm, a scanning speed of 20 mm / s, and a sampling frequency of 1000 Hz. Each defect is scanned three times and averaged to obtain a set of three-channel magnetic flux leakage signals, with each channel containing 1000 points.

[0022] The acquired raw signals are first preprocessed. Wavelet denoising is employed, using the db4 wavelet basis and a 5-level decomposition layer. Soft thresholding removes high-frequency noise. Then, a moving average filter with a window length of 5 is used for smoothing to eliminate local glitches. Next, the signal is normalized by subtracting the mean from the amplitude of each channel and dividing by the standard deviation, ensuring the data distribution is near zero mean and unit variance. Finally, the signal for each defect is truncated to a fixed length of 200 points centered on the signal peak position to achieve spatial alignment. The preprocessed signal is saved as a 200×3 matrix and used as the model input.

[0023] The following features are extracted from the preprocessed signal for auxiliary input: peak value of each channel, spacing between positive and negative peaks, full width at half maximum (FWHM), maximum gradient at the rising and falling edges, and area under the curve. Furthermore, a Fast Fourier Transform (FFT) is performed on the signal to extract the amplitudes of the top 10 frequency components as frequency domain features. These features constitute a 36-dimensional feature vector, which is input into the model in parallel with the original signal.

[0024] The deep learning model structure used in this embodiment is as follows: The encoder consists of four convolutional blocks, each containing a convolutional layer, a batch normalization layer, and a ReLU activation function. The kernel size is 3×3, the stride is 2, and the number of channels is 32, 64, 128, and 256 respectively. The encoder output is a 256-dimensional feature vector. This feature vector is simultaneously input to two branches: one branch is a fully connected layer, which outputs three scalar values: depth, width, and volume; the other branch is the decoder, which consists of four deconvolutional blocks, progressively restoring the spatial resolution and finally outputting a 64×64 erosion depth matrix. The total number of model parameters is approximately 5.2 million. A physical constraint module is introduced after the encoder output layer. This module calculates the theoretical magnetic leakage signal based on the predicted depth matrix using finite difference and compares it with the input signal to calculate the physical loss.

[0025] The physical constraint loss function comprises three terms: the first is the divergence constraint loss, calculated by estimating the magnetic flux leakage components in three directions from the predicted depth matrix using a forward model and calculating the mean square value of their divergence; the second is the attenuation law constraint, comparing the signal attenuation rate with the theoretical exponential attenuation rate as the lift-off height changes; and the third is the gradient continuity constraint, calculating the sum of the squares of the second derivatives of the predicted magnetic flux leakage signal in space. The three losses are weighted and summed to obtain L_physics, with weight coefficients of 0.3, 0.2, and 0.1 in this embodiment. The data loss L_data uses mean square error, calculated separately for the depth, width, and volume scalars and then summed, while the mean absolute error is used for the topography matrix. The physical constraint weight λ in the total loss is set to 0.2.

[0026] The training data consists of two parts: first, real corrosion defect data, obtained by preparing 120 corrosion samples in the laboratory, performing 3D scanning on each sample to obtain its morphology, and simultaneously acquiring magnetic flux leakage signals, resulting in 120 sets of paired data; second, finite element simulation data, using COMSOL Multiphysics to establish a parametric corrosion defect model, changing parameters such as defect depth, diameter, shape, and edge inclination angle, generating 5000 sets of simulation data, each set containing defect parameters and the corresponding three-channel magnetic flux leakage signal. The simulation and real data were mixed and randomly divided into a training set of 4500 sets, a validation set of 500 sets, and a test set of 120 sets.

[0027] The model was implemented using the PyTorch framework, with Adam as the optimizer, an initial learning rate of 1e-4, and a batch size of 32. During training, the loss was calculated on the validation set every 10 epochs. If the validation loss did not decrease for 20 consecutive epochs, the learning rate was reduced; if it did not decrease for 40 consecutive epochs, training was stopped. Training lasted for 200 epochs, with early stopping actually triggered at the 156th epoch.

[0028] After training, the leakage magnetic field signals from the test set are input into the model, and the model outputs the corresponding corrosion parameters and morphology matrix during forward propagation. For each test sample, the predicted depth, width, and volume are recorded, and the relative error is calculated by comparing them with the true values. The morphology prediction performance is evaluated using the structural similarity index and peak signal-to-noise ratio (PSNR). In this embodiment, the average relative error for depth prediction on the test set is 8.3%, the width error is 11.2%, the volume error is 14.5%, the average SSIM is 0.87, and the average PSNR is 32.5 dB.

[0029] To verify the effectiveness of the physical constraints, a comparative experiment was conducted: a model with the same structure but without physical constraints was trained and tested on the same dataset. The results showed that the model without physical constraints had a depth error of 12.7%, a width error of 16.8%, a volume error of 21.3%, and a shape SSIM of 0.79. Furthermore, the model without physical constraints exhibited physical anomalies on some test samples; for example, the predicted leakage magnetic field divergence significantly deviated from zero, while the prediction results of the model in this invention all satisfied the divergence constraints. This indicates that the physical constraint mechanism effectively improves the accuracy and physical plausibility of the inversion.

[0030] Example 2: Transformer-based model variant This embodiment uses the Transformer architecture instead of CNN as the encoder to verify the effectiveness of different model structures. The magnetic flux leakage signal sequence is used as input, and global features are extracted through positional encoding and a self-attention mechanism. The model contains six Transformer encoding layers, each with eight attention heads, and a hidden layer dimension of 256. The decoder part is the same as in Embodiment 1. The same training data and physical constraint strategy are used for training. The results show that the Transformer model slightly improves the depth prediction error by 7.6%, but the training time increases by approximately three times. For long sequence signals, the Transformer exhibits better feature extraction capabilities, but the model complexity is higher; the choice should be made based on the actual application requirements.

[0031] Database extensions and applications: The model trained according to this invention is deployed into a pipeline inspection system. During actual inspection, the raw signals collected by the magnetic flux leakage detector are preprocessed and input into the model, which outputs the depth, width, volume, and morphology of corrosion defects in real time. These results are combined with the detection location information to generate a pipeline corrosion defect distribution map, providing a basis for maintenance decisions. Simultaneously, data on new types of defects encountered during field inspections are collected periodically for incremental updates to the model, continuously improving its performance.

[0032] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention. Matters not covered in this invention are common knowledge.

[0033] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for inverting magnetic flux leakage signals of pipeline corrosion defects based on physically constrained deep learning, characterized in that: The aforementioned method for inverting magnetic flux leakage signals of pipeline corrosion defects based on physical constraint deep learning first scans a pipeline sample or actual pipeline containing corrosion defects using a standard magnetic flux leakage detection device to acquire multi-component magnetic flux leakage signals of the corrosion area. The magnetic flux leakage signals include at least three orthogonal components: axial magnetic field component Bx, circumferential magnetic field component By, and radial magnetic field component Bz. During the acquisition process, detection parameters such as probe lift-off height, scanning speed, and magnetization intensity need to be recorded to ensure signal repeatability. For each corrosion defect, a set of two-dimensional or one-dimensional magnetic flux leakage signal sequences is obtained, and the signal length depends on the length of the scanning path and the sampling frequency. After obtaining the raw magnetic flux leakage signal, preprocessing is required to improve signal quality. Preprocessing includes noise filtering, signal smoothing, signal normalization, and signal alignment. Noise filtering uses methods such as wavelet denoising, median filtering, or Gaussian filtering to remove high-frequency noise while retaining the main characteristics of the signal. Signal smoothing uses moving average or Savitzky-Golay filters to eliminate local glitches and make the waveform smoother. Signal normalization normalizes the amplitude of each channel signal to a uniform numerical range, eliminating amplitude differences between different detection batches. Signal alignment uses the defect center as a reference point to align the magnetic flux leakage signals of different defects in space, ensuring the consistency of the model input. To reduce the dimensionality of the model input and highlight key information, physically meaningful feature parameters are extracted from the preprocessed magnetic leakage signal, including signal peak value, signal width, signal gradient, signal integral area, and signal frequency domain features. Signal peak values ​​are the maximum and minimum values ​​of each signal component, reflecting the severity of the defect; signal width is the half-width at half-maximum or the spacing between peak values, related to the lateral dimensions of the defect; signal gradient is the maximum slope of the rising and falling edges of the signal, reflecting the steepness of the defect edges; signal integral area is the area under the signal curve, related to the defect volume; signal frequency domain characteristics are extracted by performing Fourier transform on the signal to obtain spectral energy distribution, dominant frequency, and other features. These features can be used as auxiliary inputs for deep learning models, or for subsequent physical constraint verification. Next, a corrosion defect inversion model is constructed. This model adopts an encoder-decoder architecture. The encoder is used to extract high-dimensional features from the magnetic flux leakage signal. It uses a convolutional neural network or a Transformer network. CNN is suitable for extracting local waveform features, while Transformer is good at capturing long-distance dependencies. The choice or combination of these networks can be made according to actual needs. The decoder is a deep regression network. The output layer is designed according to the prediction target: if the prediction is discrete parameters such as depth, width, and volume, the output layer is a fully connected layer that outputs the corresponding values; if the prediction is a complete morphology, the output layer is a deconvolutional network that outputs a two-dimensional height matrix. The intermediate layers of the model employ techniques such as residual connections and batch normalization to accelerate training and improve performance. To ensure that the model predictions conform to the physical mechanism of magnetic flux leakage detection, a physical constraint mechanism is introduced into the model. These physical constraints include magnetic field divergence constraints, the decay law of the leakage magnetic field, and the continuity constraint of the magnetic field gradient. The magnetic field divergence constraint, based on Maxwell's equations, states that the divergence of the magnetic induction intensity is zero in the passive region. The predicted defect morphology is used to calculate the leakage magnetic field signal through a forward model, and its divergence is checked to see if it is close to zero. The leakage magnetic field attenuation law requires that the amplitude of the leakage magnetic field signal should decrease exponentially with the increase of the lift-off height, and the prediction results should satisfy this relationship. The magnetic field gradient continuity constraint requires that the change of the leakage magnetic field in space should be continuous, and there should be no abrupt change in the signal gradient at adjacent positions. These physical constraints are added to the model training process in the form of regularization terms to constrain the model output to conform to physical laws. The model's total loss function consists of two parts: a data error term and a physical constraint error term, i.e., Loss = L_data + λ·L_physics, where λ is a balance coefficient used to adjust the weight of the physical constraints. The data error term L_data measures the deviation between the model's predicted corrosion parameters and the actual values. For discrete parameters, mean square error or mean absolute error is used, while for morphology prediction, structural similarity index or pixel-level loss is used. The physical constraint error term L_physics calculates the degree to which the prediction results violate physical laws. For example, it calculates the divergence of the predicted leakage magnetic field signal using finite difference and takes its absolute value as the loss; or it inputs the predicted defect morphology into the finite element forward model and calculates the difference between the simulated signal and the measured signal. By optimizing the total loss function, the model can satisfy the physical constraints while fitting the data. Model training requires a large amount of paired data, namely, leakage magnetic field signals and corresponding real morphologies of corrosion defects. This invention uses two types of data sources: one is real corrosion defect data, which is obtained by preparing corrosion samples with different morphologies through laboratory accelerated corrosion experiments, using three-dimensional scanning technology to acquire defect morphologies, and simultaneously collecting leakage magnetic field signals to form real paired samples; the other is numerical simulation corrosion defect data, which is obtained by simulating the leakage magnetic field of corrosion defects of different shapes and sizes through the finite element method, generating a large amount of simulation data to expand the scale and diversity of the training set. During training, the dataset is divided into training set, validation set and test set, and optimization algorithms such as Adam are used for iterative optimization. Overfitting is prevented by strategies such as early stopping and learning rate decay. After training, the leakage magnetic field signals collected in the actual test are input into the model. After forward propagation, the model outputs the corresponding corrosion defect parameters. The output results include corrosion depth, corrosion width, corrosion volume, and corrosion morphology. These parameters can be used to comprehensively assess the severity of corrosion defects and provide a basis for pipeline integrity evaluation.

2. The method for inverting magnetic flux leakage signals of pipeline corrosion defects based on physically constrained deep learning according to claim 1, characterized in that: It also includes the following technical aspects: First, a physical constraint loss function is introduced during the deep learning model training process to ensure that the inversion results satisfy the magnetic flux leakage detection mechanism. Magnetic field divergence constraints, attenuation law constraints, and gradient continuity constraints are expressed mathematically and added as regularization terms to the total loss, guiding the model to learn mapping relationships that conform to physical laws and avoiding non-physical interpretations that might arise from purely data-driven models. Second, a large amount of magnetic flux leakage signal data from corrosion defects is generated through finite element simulation to expand the training dataset, establish a parameterized corrosion defect model, change parameters such as the depth, width, shape, and edge angle of the defects, and use finite element software to calculate the corresponding magnetic flux leakage distribution, generating tens of thousands of simulation sets. The model utilizes a wide range of samples to cover the parameter space, compensating for the limited number of real experimental samples and improving the model's generalization ability. Third, it calibrates the model using real corrosion defect data, employing real experimental samples as a test set to evaluate the model's performance on real data. Through transfer learning or fine-tuning techniques, the model adapts to the distribution characteristics of real data, reducing the domain difference between simulation and real data. Fourth, it establishes a mapping relationship between corrosion defect parameters and leakage magnetic field signals, enabling quantitative inversion of corrosion defect morphology. The model not only outputs scalar parameters such as depth and width but also complete corrosion pit morphology, providing precise input for subsequent stress analysis and lifetime prediction.