Dynamic range compression method and device for magnetic flux leakage signal visualization
By employing an S-shaped nonlinear compression function and a dynamic threshold group, the problems of slight defect loss and non-robust parameter tuning caused by the large dynamic range in magnetic flux leakage signal visualization are solved, achieving efficient and robust defect visualization.
Patent Information
- Application Number
- CN202511743737.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-03-13
AI Technical Summary
Existing methods for visualizing magnetic flux leakage signals suffer from the loss of minor defect features, poor parameter tuning robustness, low efficiency, and high computational costs when dealing with extremely large dynamic ranges, making it difficult to meet the industrial application requirements for high-efficiency, high-precision, and automated visualization.
By employing a method based on an S-shaped nonlinear compression function and a dynamic threshold group, the gradient signal matrix is obtained, and a nonlinear compression transformation is performed using a controllable percentile parameter p. Combined with a color mapping table, a pseudo-color image is output, achieving high-fidelity and flexible defect visualization.
It significantly improves the ability to present minor defect features and the flexibility of adjustment, increases processing efficiency and parameter robustness, reduces manual interpretation time and computational cost, and adapts to mean and gain variations in different datasets.
Smart Images

Figure CN121661180A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial defect detection technology, specifically relating to a dynamic range compression method and apparatus for visualizing magnetic flux leakage signals. Background Technology
[0002] In industries such as oil and gas, the safe operation of pipelines is crucial. Magnetic flux leakage (MFL) testing is currently the most widely used non-destructive testing technology for pipelines (especially those made of ferromagnetic materials). Interpreters need to convert the abstract signal matrix collected by MFL sensors into intuitive visual images (such as pseudo-color images) to identify and assess defects. Therefore, a visualization technology capable of presenting defect signals with high fidelity and high contrast is a key preliminary step in ensuring pipeline safety.
[0003] However, converting raw magnetic flux leakage signals into visualized images presents several technical challenges in real-world engineering scenarios. First, magnetic flux leakage signals exhibit a wide dynamic range: severe defects generate extremely strong leakage magnetic fields with potentially very high signal amplitudes, while minor defects produce very weak ones, with amplitude differences reaching several orders of magnitude. Second, minor defect signals are weak and have low signal-to-noise ratios, making their characteristics easily masked by background noise. Furthermore, magnetic flux leakage signals inevitably contain various background noises and interferences, such as the signal response of pipe welds, the non-uniformity of the pipe material's magnetic permeability, and noise introduced by sensor probe jitter. These challenges lead to severe visualization distortion in existing visualization methods: if a global linear mapping is used, its range is inevitably dominated by the extreme amplitudes of severe defects, causing the background signal and minor defect signal, which constitute the vast majority of the total signal, to be compressed into an extremely narrow display range, completely eliminating the visual distinguishability of crucial minor defect features.
[0004] To address the aforementioned challenges, particularly the issues of enhancing signals with extremely large dynamic ranges and minor defects, various signal processing and visualization solutions have been proposed by academic and industrial communities both domestically and internationally. The most basic solution is global linear mapping and manual adjustment, which involves linearly normalizing the signal using global maximum and minimum values, or relying on interpreters to manually and repeatedly adjust the "window width" and "window level" of the display window in visualization software to magnify local signals for observation.
[0005] Although the above methods have made some progress in the processing and visualization of magnetic flux leakage signals, they still have problems such as poor parameter tuning, low efficiency, high computational cost, and inability to balance the preservation of details of minor defects and the inclusion of signals of serious defects when dealing with complex industrial scenarios with large dynamic range, significant noise interference and weak signals of minor defects. They are difficult to meet the needs of practical industrial applications for high-efficiency, high-precision and automated visualization. Summary of the Invention
[0006] To address the aforementioned problems in the prior art, this invention provides a dynamic range compression method, apparatus, electronic device, and computer-readable storage medium for visualizing magnetic flux leakage signals. The technical problem to be solved by this invention is achieved through the following technical solution: In a first aspect, embodiments of the present invention provide a dynamic range compression method for visualizing magnetic flux leakage signals, the method comprising: S1, acquire the raw leakage magnetic signal data matrix obtained from part of the collected data, perform preprocessing and gradient enhancement to obtain the gradient signal matrix; S2, obtain the preset initial value of the parameter p that represents the controllable percentile; S3, based on the current parameter p and the statistical distribution of the gradient signal matrix, calculate the dynamic threshold group, including positive dynamic threshold and negative dynamic threshold; S4 uses an S-shaped nonlinear compression function and a dynamic threshold group as a scaling factor to perform a nonlinear compression transformation on the gradient signal matrix to obtain a normalized feature matrix. S5 performs visualization mapping based on the normalized feature matrix and dynamic threshold group, and outputs a pseudo-color image. S6. If the numerical fluctuation in the pseudo-color image does not meet the preset requirements, adjust the parameter p and return to step S3 until the preset requirements are met. Apply the determined parameter p to the original leakage magnetic signal data matrix obtained from all the collected data for further processing to obtain the final pseudo-color image.
[0007] In one embodiment of the present invention, S1, the process of preprocessing and gradient enhancement of the original leakage magnetic signal data matrix to obtain a gradient signal matrix includes: The original magnetic flux leakage signal data matrix is preprocessed using a medium-range filter to obtain a preprocessed signal matrix. The preprocessed signal matrix is subjected to first-order difference calculation along the sampling point direction to perform gradient enhancement, thereby obtaining the gradient signal matrix.
[0008] In one embodiment of the present invention, the parameter p represents the statistical tolerance to extreme outliers; the preset initial value is 0.5.
[0009] In one embodiment of the present invention, in step S3, a dynamic threshold group is calculated based on the current parameter p and the statistical distribution of the gradient signal matrix, including: S31, Based on the current value of parameter p, calculate the first gradient signal matrix. Percentiles, and defined as a positive dynamic threshold, to express; S32, based on the current value of parameter p, calculate the first step of the current gradient signal matrix. The absolute value of the percentile is defined as the negative dynamic threshold. express.
[0010] In one embodiment of the present invention, in step S4, an sigmoid nonlinear compression function is used, and a dynamic threshold group is used as a scaling factor to perform a nonlinear compression transformation on the gradient signal matrix to obtain a normalized feature matrix. The formula used is as follows: ; in, This indicates the position in the normalized characteristic matrix. The element value; Indicates a positive dynamic threshold; Indicates a negative dynamic threshold; The position in the gradient signal matrix is 1 The element value; This represents the hyperbolic tangent function. In one embodiment of the present invention, in step S5, a visualization mapping is performed based on the normalized feature matrix and dynamic threshold group to output a pseudo-color image, including: S51, cut the current normalized feature matrix into at least one image block of a preset width along the sampling point direction; S52, apply a color mapping table to the obtained image patch to map it into a pseudo-color image; S53, the opposites of the current positive dynamic threshold and negative dynamic threshold are used as the upper and lower limits of the color mapping table, respectively, to obtain the corrected pseudo-color image as the visualization result.
[0011] In one embodiment of the present invention, in step S6, when the numerical fluctuation in the pseudo-color image does not meet the preset requirements, adjusting the parameter p includes: When the numerical fluctuation in the pseudo-color image exceeds a preset upper limit threshold, increase the parameter p; When the numerical fluctuation in the pseudo-color image is less than the preset lower threshold, the parameter p is reduced.
[0012] Secondly, embodiments of the present invention provide a dynamic range compression device for visualizing magnetic flux leakage signals, the device comprising: The gradient signal matrix acquisition module is used to acquire the raw leakage magnetic signal data matrix obtained from part of the collected data, perform preprocessing and gradient enhancement, and obtain the gradient signal matrix. The module for obtaining the initial value of the controllable percentile parameter p is used to obtain the preset initial value of the parameter p that represents the controllable percentile. The dynamic threshold group calculation module is used to calculate the dynamic threshold group, including positive dynamic threshold and negative dynamic threshold, based on the current parameter p and the statistical distribution of the gradient signal matrix. The normalized feature matrix calculation module is used to perform nonlinear compression transformation on the gradient signal matrix using an S-shaped nonlinear compression function and a dynamic threshold group as a scaling factor to obtain the normalized feature matrix. The pseudo-color image acquisition module is used to perform visualization mapping based on the normalized feature matrix and dynamic threshold group, and output a pseudo-color image. The parameter p adjustment processing module is used to adjust parameter p when the numerical fluctuation in the pseudo-color image does not meet the preset requirements, and to reprocess it using the dynamic threshold group calculation module until the preset requirements are met. Furthermore, the gradient signal matrix acquisition module and the pseudo-color image acquisition module are also used to apply the determined parameter p to the original leakage magnetic signal data matrix obtained from all the acquired data for further processing, thereby obtaining the final pseudo-color image.
[0013] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes the program stored in the memory, it implements the steps of the dynamic range compression method for visualizing leakage magnetic signals provided in the embodiments of the present invention.
[0014] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the dynamic range compression method for visualizing magnetic leakage signals provided in embodiments of the present invention.
[0015] The beneficial effects of this invention are: The dynamic range compression method and apparatus for visualizing magnetic flux leakage signals provided in this invention have the following advantages compared with the prior art: First, the present invention significantly improves the ability to present minor defect features and the flexibility of adjustment. Existing technologies, when processing signals with extremely large dynamic ranges, either mask low-amplitude signals in pseudo-color images to accommodate high-amplitude signals, or they solidify the compression curve, lacking controllability. The nonlinear compression and adjustment linkage mechanism proposed in this invention utilizes the approximately linear region characteristics of the sigmoid function to faithfully preserve the original shape and contrast of low-amplitude signals; simultaneously, it uses its "saturation region" characteristics to suppress high-amplitude signals.
[0016] Secondly, the processing efficiency and parameter robustness of this invention are significantly improved. Existing technologies rely on setting absolute amplitude parameters, which lack robustness. When faced with datasets with different gains or means, the original parameters become completely ineffective, forcing interpreters to spend a significant amount of time on repetitive, subjective manual adjustments. Meanwhile, other advanced algorithms have high computational complexity and long processing times. The controllable percentile threshold calculation method proposed in this invention innovatively uses a statistically significant relative parameter p to replace the absolute amplitude parameter. Interpreters only need to set the statistical tolerance once, and this method can automatically calculate a robust dynamic threshold from the data distribution. This threshold naturally adapts to changes in the mean and gain of different datasets. This mechanism greatly improves the robustness and efficiency of parameter tuning, enabling batch processing with a single setting, significantly reducing the time and labor costs of manual interpretation. Furthermore, the overall pipeline computation cost of this invention is extremely low, demonstrating a significant efficiency advantage when processing massive amounts of magnetic flux leakage data. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating a dynamic range compression method for visualizing magnetic flux leakage signals provided in an embodiment of the present invention. Figure 2 To visualize the leakage magnetic gradient signal using existing technology; Figure 3 This is a pseudo-color image visualization effect output after processing the same MFL gradient signal using the method of the embodiments of the present invention; Figure 4 This is a schematic diagram of a dynamic range compression device for visualizing magnetic flux leakage signals, provided in an embodiment of the present invention. Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0018] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.
[0019] To address the challenges in existing technologies, particularly the problems of loss of minor defect features, non-robust parameter tuning, low efficiency, high computational cost, and fixed compression effect in existing magnetic flux leakage signal visualization methods when processing data with a very large dynamic range, this invention proposes a dynamic range compression method, apparatus, electronic device, and computer-readable storage medium for magnetic flux leakage signal visualization. The aim is to effectively solve the above problems and achieve robust, efficient, controllable, and high-fidelity defect visualization.
[0020] It should be noted that the execution entity of the dynamic range compression method for visualizing magnetic flux leakage signals provided in this embodiment of the invention can be a dynamic range compression device for visualizing magnetic flux leakage signals, and the device can run in an electronic device. This electronic device can be a server or a terminal device, but is not limited to these.
[0021] In a first aspect, embodiments of the present invention provide a dynamic range compression method for visualizing magnetic flux leakage signals, such as... Figure 1 As shown, the method may include the following steps: S1, acquire the raw leakage magnetic signal data matrix obtained from part of the collected data, perform preprocessing and gradient enhancement to obtain the gradient signal matrix; This invention allows for the pre-installation of MFL sensors on pipelines such as oil and gas pipelines. For example, an MFL sensor can be installed at predetermined intervals along the pipeline length to construct an MFL sensor array. This array can collect the raw time-series signal of the magnetic flux leakage (MFL) signal, thereby obtaining a MFL signal data matrix. To reduce the amount of data processing, this invention employs the following approach: after obtaining all the collected data for the pipeline under test, a portion of the data is used to begin executing step S1 until a controllable percentile parameter p that meets the requirements is obtained. This parameter p is then used to further process the MFL signal data matrix of all collected data to obtain the final pseudo-color image. This design ensures that only a portion of the collected data is used during the parameter p adjustment process, thus avoiding excessive computation. Applying the obtained parameter p to all collected data improves accuracy while maintaining computational efficiency.
[0022] Specifically, the raw timing signals collected by the MFL sensor array for the pipeline under test can be read from a storage medium (such as a .bin file) through the data reading interface, and the raw timing signals can be reshaped into a raw leakage magnetic signal data matrix.
[0023] For ease of understanding, the original leakage magnetic signal data matrix in embodiment S1 of the present invention can be used as... Representation. Let the dimension of this matrix be . ,in Number of sensor channels This represents the number of sampling points along the pipeline's direction of travel. In S1, the process of preprocessing and gradient enhancement of the original leakage magnetic signal data matrix to obtain the gradient signal matrix includes: 1) Apply a medium-range filter to the original magnetic flux leakage signal data matrix for signal preprocessing to obtain a preprocessed signal matrix; In this embodiment of the invention, a preferred method is to use one The median filter is a non-linear filter that replaces the value of a pixel with its corresponding value. Neighborhood The median of all signal values within the matrix. In this embodiment of the invention, the purpose of applying a medium filter to the original magnetic flux leakage signal data matrix is to suppress isolated impulse noise.
[0024] For the original leakage magnetic signal data matrix any point in Its corresponding preprocessed signal matrix The value can be represented as: ; in, This represents the median function.
[0025] 2) Perform first-order difference calculation on the preprocessed signal matrix along the sampling point direction to perform gradient enhancement and obtain the gradient signal matrix.
[0026] The direction of the sampling point is the same as the direction of pipeline travel.
[0027] The specific formula can be expressed as: ; in, Represents any point in the gradient signal matrix The value of . In this embodiment of the invention, the physical characteristics of the MFL defect manifest as a localized, drastic change in the magnetic field, i.e., a high signal gradient. The principle of using first-order differential processing is to shift the focus from signal level to the rate of signal change. This gradient calculation is preferably a backward differential along the sampling point direction to characterize the rate of change of magnetic flux. The gradient signal matrix enhances the defect edge features, thereby highlighting the defect characteristics.
[0028] S2, obtain the preset initial value of the parameter p that represents the controllable percentile; In this embodiment of the invention, the parameter p is the only external adjustment parameter, which represents the statistical tolerance to extreme outliers; the preset initial value can be 0.5.
[0029] S3, based on the current parameter p and the statistical distribution of the gradient signal matrix, calculate the dynamic threshold group, including positive dynamic threshold and negative dynamic threshold; S3 includes the following steps: S31, Based on the current value of parameter p, calculate the first gradient signal matrix. Percentiles, and defined as a positive dynamic threshold, to express; make Gradient signal matrix The set of all elements in, then The calculation can be expressed as: ; in, It is a statistical function used to calculate the "pth percentile". S32, based on the current value of parameter p, calculate the first step of the current gradient signal matrix. The absolute value of the percentile is defined as the negative dynamic threshold. express.
[0030] The calculation can be expressed as: ; As you can understand, percentiles are a statistical concept that indicates what percentage of data points in a set are less than or equal to a given value. For example, the 50th percentile (denoted as P50) is commonly referred to as the median, meaning that 50% of the data points are less than or equal to it.
[0031] In this embodiment of the invention, the Xth percentile of the gradient signal matrix is a statistic describing the distribution of signal values in the matrix. It indicates that X% of the elements in the matrix have values less than or equal to this number.
[0032] The lower percentile focuses on the weaker parts of the signal.
[0033] High percentiles focus on the strongest parts of the signal, which often contain the most critical information in an image (such as edges).
[0034] One of the core innovations of this invention lies in its parameter adjustment mechanism. Existing technologies (such as manual window width and window level) rely on setting absolute amplitude as a threshold, which lacks data robustness. The principle of this invention is to innovatively use a percentile parameter p with clear statistical significance as the only controllable parameter, providing a parameter adjustment mechanism based on relative percentages to replace parameter adjustment based on absolute amplitude. Interpreters do not need to concern themselves with the absolute amplitude of the signal, but only need to set its statistical tolerance to extreme values, thereby achieving robustness to data with different gains or means.
[0035] S4 uses an S-shaped nonlinear compression function and a dynamic threshold group as a scaling factor to perform a nonlinear compression transformation on the gradient signal matrix to obtain a normalized feature matrix. The preferred sigmoid nonlinear compression function is the hyperbolic tangent (tanh) function. The sigmoid nonlinear compression function is employed, along with a positive dynamic threshold. and negative dynamic threshold As a scaling factor, it dynamically controls the width of the "approximately linear region" of the nonlinear compression function.
[0036] The specific formula used is as follows: ; in, This indicates the position in the normalized characteristic matrix. The element value; Indicates a positive dynamic threshold; Indicates a negative dynamic threshold; The position in the gradient signal matrix is 1 The element value; This represents the hyperbolic tangent function. As can be understood from the above formula, the embodiments of the present invention are based on the gradient signal matrix. values greater than zero , this value Divide by the positive dynamic threshold hyperbolic tangent function and positive dynamic threshold Multiplication performs a forward compression transformation; for the gradient signal matrix Less than or equal to zero Divide this value by the negative dynamic threshold. hyperbolic tangent function and negative dynamic threshold Multiply to perform a negative compression transformation.
[0037] Another core innovation of this invention lies in utilizing the dual properties of the hyperbolic tangent (tanh) function: firstly, in the approximately linear region near the zero point, when the input signal... The amplitude is much smaller than the threshold. Sometimes: ; At this point, the transformation result is approximately equal to the input signal. This characteristic ensures that the original form and relative amplitude relationship of low-amplitude signals are preserved with high fidelity. Secondly, in the saturation region far from zero, when the input signal... The amplitude is much greater than the threshold. hour, It converges asymptotically to 1 (or -1). This property ensures that high-amplitude signals are nonlinearly suppressed, and that the result converges asymptotically to this threshold. This prevents it from dominating the visualized range.
[0038] Therefore, the embodiments of the present invention utilize the "approximately linear region" of the hyperbolic tangent function near zero to retain details of low-amplitude defects, and utilize its "saturation region" to suppress high-amplitude defect signals, thereby achieving nonlinear compression of the dynamic range.
[0039] S5 performs visualization mapping based on the normalized feature matrix and dynamic threshold group, and outputs a pseudo-color image. S5 may include the following steps: S51, cut the current normalized feature matrix into at least one image block of a preset width along the sampling point direction; The current normalized feature matrix Cutting the image into at least one preset width along the sampling point direction is to facilitate the block processing and display of massive amounts of data.
[0040] S52, apply a color mapping table to the obtained image patch to map it into a pseudo-color image; The color map table is a pre-designed color lookup table that strictly defines a one-to-one mapping relationship from numerical intensity to a specific color space.
[0041] The specific execution process of this step is as follows: the system traverses each pixel in the normalized feature matrix, uses its value as an index, and searches for and replaces it with the corresponding color in the color mapping table. Its core purpose is to utilize the visual physiological characteristic that the human eye's ability to distinguish color changes is far greater than its ability to distinguish grayscale changes. Through this mapping, minute numerical differences in the original magnetic leakage signal that are imperceptible to the naked eye can be transformed into significant color contrasts (for example, mapping low-amplitude background noise to deep cool tones, while mapping high-amplitude defect signals to striking warm tones). This processing method makes the originally abstract data differences intuitively "visualized," greatly enhancing the image's sense of depth and enabling interpreters to more clearly and quickly identify subtle defect features in complex backgrounds, facilitating subsequent analysis and interpretation.
[0042] Pseudo-color mapping is one method of visualization mapping. The output pseudo-color image serves as the visualization result.
[0043] S53, the opposites of the current positive dynamic threshold and negative dynamic threshold are used as the upper and lower limits of the color mapping table, respectively, to obtain the corrected pseudo-color image as the visualization result.
[0044] This step is one of the key steps in this invention. Its principle lies in ensuring that the range of the visualization mapping is completely consistent with the range used for calculation and compression in the dynamic threshold and the obtained normalized feature matrix, thereby achieving standardized visualization. This results in the output of a high-contrast defect image (i.e., the obtained pseudo-color image).
[0045] The final output pseudo-color image can be represented as: ; in, This indicates the position in the final output pseudo-color image. The element value, This represents the color mapping function. and These represent the upper and lower limits of the color mapping table, respectively. Those skilled in the art will understand that the function of the color mapping is to find the corresponding color value in a preset color table based on the input value, thereby generating the final pseudo-color image. This invention uses a statistically significant percentile parameter p to replace the traditional absolute amplitude parameter, and combines the nonlinear compression characteristics of the sigmoid function to solve the problem of visual range imbalance caused by the large dynamic range of the MFL signal. While greatly improving the robustness and efficiency of parameter adjustment, it also takes into account the preservation of details of minor defects and the signal containment of serious defects.
[0046] S6. If the numerical fluctuation in the pseudo-color image does not meet the preset requirements, adjust the parameter p and return to step S3 until the preset requirements are met. Apply the determined parameter p to the original leakage magnetic signal data matrix obtained from all the collected data for further processing to obtain the final pseudo-color image.
[0047] When the numerical fluctuations in the pseudo-color image do not meet the preset requirements, the parameter p is adjusted, including: When the numerical fluctuation in the pseudo-color image exceeds a preset upper limit threshold, increase the parameter p; When the numerical fluctuation in the pseudo-color image is less than the preset lower threshold, the parameter p is reduced.
[0048] Specifically, when the numerical fluctuations in the pseudo-color image exceed a preset upper threshold (e.g., excessive background noise or significant clutter interference in non-defect areas), it indicates that there are still excessive differences in numerical amplitude in the pseudo-color image. In this embodiment of the invention, the parameter p is increased. Increasing the value of parameter p will improve the calculated positive dynamic threshold. and negative dynamic threshold The absolute value of the reduction narrows the width of the "approximately linear region" of the nonlinear compression function, pushing high-amplitude background noise or interference signals into the saturation region for suppression, highlighting the details of the main signal. This will enhance the suppression effect on high-amplitude clutter and make the visual focus more on the distribution range of the main signal.
[0049] When the numerical fluctuation in a pseudo-color image is less than a preset lower threshold (e.g., insufficient overall image contrast, or loss of morphological details due to oversaturation), this embodiment of the invention reduces the parameter p. Reducing the value of parameter p will improve the positive dynamic threshold. and negative dynamic threshold Increasing the absolute value of this threshold allows for a wider range of signal amplitudes to be linearly mapped, enabling more signals that were originally in the saturation region to fall into the linear mapping range. This widens the "approximately linear region," thereby recovering high-amplitude defect details lost due to over-compression or preventing signals from entering the saturation region prematurely. The preset upper threshold is greater than the preset lower threshold; both can be set based on empirical values.
[0050] It can be seen that by adjusting the parameter p, the change and The value of can be dynamically controlled to determine the width of the approximate linear region of the nonlinear compression function, thus enabling flexible and controllable nonlinear compression.
[0051] The dynamic range compression method for visualizing magnetic flux leakage signals provided in this invention can be used for nonlinear compression and enhancement of magnetic flux leakage signals with a large dynamic range to clearly present slight defect characteristics. Compared with the prior art, this invention has the following advantages: First, the present invention significantly improves the ability to present minor defect features and the flexibility of adjustment. Existing technologies, when processing signals with extremely large dynamic ranges, either mask low-amplitude signals in pseudo-color images to accommodate high-amplitude signals, or they solidify the compression curve, lacking controllability. The nonlinear compression and adjustment linkage mechanism proposed in this invention utilizes the approximately linear region characteristics of the sigmoid function to faithfully preserve the original shape and contrast of low-amplitude signals; simultaneously, it uses its "saturation region" characteristics to suppress high-amplitude signals.
[0052] Secondly, the processing efficiency and parameter robustness of this invention are significantly improved. Existing technologies rely on setting absolute amplitude parameters, which lack robustness. When faced with datasets with different gains or means, the original parameters become completely ineffective, forcing interpreters to spend a significant amount of time on repetitive, subjective manual adjustments. Meanwhile, other advanced algorithms have high computational complexity and long processing times. The controllable percentile threshold calculation method proposed in this invention innovatively uses a statistically significant relative parameter p to replace the absolute amplitude parameter. Interpreters only need to set the statistical tolerance once, and this method can automatically calculate a robust dynamic threshold from the data distribution. This threshold naturally adapts to changes in the mean and gain of different datasets. This mechanism greatly improves the robustness and efficiency of parameter tuning, enabling batch processing with a single setting, significantly reducing the time and labor costs of manual interpretation. Furthermore, the overall pipeline computation cost of this invention is extremely low, demonstrating a significant efficiency advantage when processing massive amounts of magnetic flux leakage data.
[0053] The effects of the method of the present invention will be further explained below with reference to the visualization diagrams in the experiments of the present invention: Figure 2 This demonstrates the effectiveness of visualizing leakage magnetic gradient signals using existing techniques (i.e., traditional line graphing). Due to a severe defect in the original signal with extremely high amplitude (corresponding to a sharply protruding peak in the graph), the Y-axis range of the entire line graph must be set to an extremely large value to accommodate this extreme peak. The adverse consequence is that all signals with lower amplitude (including background noise and minor defects) are severely flattened, and their waveform details are visually indistinct, appearing as near-horizontal straight lines in the graph. Interpreters cannot effectively identify these lines, easily leading to missed detections. Figure 3 This demonstrates the pseudo-color image visualization effect output after processing the same MFL gradient signal using the method of this embodiment of the invention. For example... Figure 3 As shown, in step S4, the present invention first employs nonlinear compression based on the sigmoid function (tanh), which effectively suppresses the high-amplitude signal with severe defects, preventing it from dominating the entire visualization range. At the same time, in step S5, the robust dynamic threshold calculated in step S3 is used as the boundary of the color mapping, which greatly stretches the contrast of the low-amplitude signal in the approximately linear region.
[0054] Secondly, corresponding to the above method embodiments, this invention also provides a dynamic range compression device for visualizing magnetic flux leakage signals, such as... Figure 4 As shown, the device includes: The gradient signal matrix acquisition module is used to acquire the raw leakage magnetic signal data matrix obtained from part of the collected data, perform preprocessing and gradient enhancement, and obtain the gradient signal matrix. The module for obtaining the initial value of the controllable percentile parameter p is used to obtain the preset initial value of the parameter p that represents the controllable percentile. The dynamic threshold group calculation module is used to calculate the dynamic threshold group, including positive dynamic threshold and negative dynamic threshold, based on the current parameter p and the statistical distribution of the gradient signal matrix. The normalized feature matrix calculation module is used to perform nonlinear compression transformation on the gradient signal matrix using an S-shaped nonlinear compression function and a dynamic threshold group as a scaling factor to obtain the normalized feature matrix. The pseudo-color image acquisition module is used to perform visualization mapping based on the normalized feature matrix and dynamic threshold group, and output a pseudo-color image. The parameter p adjustment processing module is used to adjust parameter p when the numerical fluctuation in the pseudo-color image does not meet the preset requirements, and to reprocess it using the dynamic threshold group calculation module until the preset requirements are met. Furthermore, the gradient signal matrix acquisition module and the pseudo-color image acquisition module are also used to apply the determined parameter p to the original leakage magnetic signal data matrix obtained from all the acquired data for further processing, thereby obtaining the final pseudo-color image.
[0055] For details on the specific processing procedures of each module of the device, please refer to the relevant content in the first section, which will not be repeated here.
[0056] The present invention can solve the problem of visual range imbalance caused by the large dynamic range of MFL signals. While greatly improving the robustness and efficiency of parameter adjustment, it also takes into account the preservation of details of minor defects and the signal inclusion of serious defects.
[0057] Thirdly, embodiments of the present invention also provide an electronic device, such as... Figure 5 As shown, it includes a processor 001, a communication interface 002, a memory 003, and a communication bus 004, wherein the processor 001, the communication interface 002, and the memory 003 communicate with each other through the communication bus 004. The memory is used to store computer programs; When the processor executes the program stored in the memory, it implements the steps of any of the dynamic range compression methods for visualizing leakage magnetic signals provided in the first aspect of the present invention.
[0058] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0059] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0060] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0061] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0062] The method provided in this invention can be applied to electronic devices. Specifically, the electronic device can be a desktop computer, a portable computer, a smart mobile terminal, a server, etc. No limitation is made herein; any electronic device that can implement this invention falls within the protection scope of this invention.
[0063] Fourthly, corresponding to the dynamic range compression method for visualizing leakage magnetic signals provided in the first aspect, this embodiment of the invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the dynamic range compression methods for visualizing leakage magnetic signals provided in the first aspect of this invention.
[0064] For the embodiments of the device / electronic device / storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and relevant parts can be referred to in the description of the method embodiments.
[0065] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0066] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A dynamic range compression method for visualizing magnetic leakage signals, characterized in that, include: S1, acquire the raw leakage magnetic signal data matrix obtained from part of the collected data, perform preprocessing and gradient enhancement to obtain the gradient signal matrix; S2, obtain the preset initial value of the parameter p that represents the controllable percentile; S3, based on the current parameter p and the statistical distribution of the gradient signal matrix, calculate the dynamic threshold group, including positive dynamic threshold and negative dynamic threshold; S4 uses an S-shaped nonlinear compression function and a dynamic threshold group as a scaling factor to perform a nonlinear compression transformation on the gradient signal matrix to obtain a normalized feature matrix. S5 performs visualization mapping based on the normalized feature matrix and dynamic threshold group, and outputs a pseudo-color image. S6. If the numerical fluctuation in the pseudo-color image does not meet the preset requirements, adjust the parameter p and return to step S3 until the preset requirements are met. Apply the determined parameter p to the original leakage magnetic signal data matrix obtained from all the collected data for further processing to obtain the final pseudo-color image.
2. The method according to claim 1, characterized in that, In S1, the process of preprocessing and gradient enhancement of the original leakage magnetic signal data matrix to obtain the gradient signal matrix includes: The original magnetic flux leakage signal data matrix is preprocessed using a medium-range filter to obtain a preprocessed signal matrix. The preprocessed signal matrix is subjected to first-order difference calculation along the sampling point direction to perform gradient enhancement, thereby obtaining the gradient signal matrix.
3. The method according to claim 1, characterized in that, The parameter p represents the statistical tolerance to extreme outliers; the preset initial value is 0.
5.
4. The method according to claim 1, characterized in that, In S3, based on the statistical distribution of the current parameter p and the gradient signal matrix, a dynamic threshold set is calculated, including: S31, Based on the current value of parameter p, calculate the first gradient signal matrix. Percentiles, and defined as a positive dynamic threshold, to express; S32, based on the current value of parameter p, calculate the first step of the current gradient signal matrix. The absolute value of the percentile is defined as the negative dynamic threshold. express.
5. The method according to claim 1, characterized in that, In S4, an sigmoid nonlinear compression function is used, and a dynamic threshold set is used as a scaling factor to perform a nonlinear compression transformation on the gradient signal matrix to obtain the normalized feature matrix. The formula used is as follows: ; in, This indicates the position in the normalized characteristic matrix. The element value; Indicates a positive dynamic threshold; Indicates a negative dynamic threshold; The position in the gradient signal matrix is 1 The element value; This represents the hyperbolic tangent function.
6. The method according to claim 1, characterized in that, In S5, visualization mapping is performed based on the normalized feature matrix and dynamic threshold group, outputting pseudo-color images, including: S51, cut the current normalized feature matrix into at least one image block of a preset width along the sampling point direction; S52, apply a color mapping table to the obtained image patch to map it into a pseudo-color image; S53, the opposites of the current positive dynamic threshold and negative dynamic threshold are used as the upper and lower limits of the color mapping table, respectively, to obtain the corrected pseudo-color image as the visualization result.
7. The method according to claim 1, characterized in that, In S6, when the numerical fluctuation in the pseudo-color image does not meet the preset requirements, the parameter p is adjusted, including: When the numerical fluctuation in the pseudo-color image exceeds a preset upper limit threshold, increase the parameter p; When the numerical fluctuation in the pseudo-color image is less than the preset lower threshold, the parameter p is reduced.
8. A dynamic range compression device for visualizing leakage magnetic signals, characterized in that, include: The gradient signal matrix acquisition module is used to acquire the raw leakage magnetic signal data matrix obtained from part of the collected data, perform preprocessing and gradient enhancement, and obtain the gradient signal matrix. The module for obtaining the initial value of the controllable percentile parameter p is used to obtain the preset initial value of the parameter p that represents the controllable percentile. The dynamic threshold group calculation module is used to calculate the dynamic threshold group, including positive dynamic threshold and negative dynamic threshold, based on the current parameter p and the statistical distribution of the gradient signal matrix. The normalized feature matrix calculation module is used to perform nonlinear compression transformation on the gradient signal matrix using an S-shaped nonlinear compression function and a dynamic threshold group as a scaling factor to obtain the normalized feature matrix. The pseudo-color image acquisition module is used to perform visualization mapping based on the normalized feature matrix and dynamic threshold group, and output a pseudo-color image. The parameter p adjustment processing module is used to adjust parameter p when the numerical fluctuation in the pseudo-color image does not meet the preset requirements, and to reprocess it using the dynamic threshold group calculation module until the preset requirements are met. Furthermore, the gradient signal matrix acquisition module and the pseudo-color image acquisition module are also used to apply the determined parameter p to the original leakage magnetic signal data matrix obtained from all the acquired data for further processing, thereby obtaining the final pseudo-color image.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes the program stored in the memory, it implements the steps of the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-7.
Citation Information
Cited By
Nonlinear filtering method for pulsed eddy current detection signal
CN121899247A