A method for identifying defects in oil and gas pipeline magnetic flux leakage images based on a deep attention mechanism
By processing the image frames and attitude data of the magnetic flux leakage detection device, a sequence of magnetic flux leakage image frames with attitude annotations is generated and non-rigid geometric normalization and signal distortion compensation are performed to construct a structure-aware embedding map. This solves the problem of inaccurate defect identification in complex areas such as bends in oil and gas pipelines, and achieves accurate image positioning and stable identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2026-03-27
AI Technical Summary
Existing magnetic flux leakage detection methods struggle to accurately identify defects in complex structural areas such as bends in oil and gas pipelines, and image distortion and signal distortion lead to unstable identification results.
By collecting image frames and sensor attitude data from the magnetic flux leakage detection device, performing format conversion and spatial coordinate mapping, a sequence of magnetic flux leakage image frames with attitude annotations is generated. The elbow section, transition section and straight pipe section are divided by structural region marking map, non-rigid geometric normalization and signal distortion compensation are performed, a structural perception embedding map is constructed, attention guidance and hierarchical feature reconstruction are implemented, and a defect saliency map is generated to improve recognition accuracy.
It achieves accurate positioning and stable identification of magnetic flux leakage images of oil and gas pipelines under complex postures, improving the accuracy and stability of defect identification.
Smart Images

Figure CN121259407B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of oil and gas pipeline detection, and more particularly to an oil and gas pipeline magnetic flux leakage image defect recognition method based on a deep attention mechanism. BACKGROUND
[0002] Currently, the non-destructive testing of oil and gas pipelines widely adopts the magnetic flux leakage (MFL) method, which uses the principle of magnetic induction to identify defects such as corrosion and cracks on the inner and outer walls of the pipeline, and has become one of the key means to ensure the safe operation of long-distance transportation pipelines. With the increasing integration of detection equipment and the complexity of the on-site operating environment, the detection device is often deployed in a towing robot or a detection vehicle, and during operation, it is accompanied by complex attitude changes and non-constant fitting states. In particular, in the structure area of the elbow section and the variable diameter section, the image signal is often affected by factors such as dramatic changes in sensor attitude, uneven spacing with the pipe wall, and unstable fitting pressure, resulting in image distortion, positioning errors, and fuzzy defect features, which seriously affect the recognition effect and interpretation stability of the magnetic flux leakage image.
[0003] The existing technology has the following disadvantages: the existing magnetic flux leakage image recognition method relies on image cleaning and template matching means in a static scene, and is difficult to adapt to the scene requirements of dynamic attitude changes and structural area diversity. On the one hand, the image processing process does not establish a spatial coordinate mapping combined with the sensor attitude information, making it difficult to accurately locate the spatial position of the defect in the image, affecting the traceability of defect positioning; on the other hand, in the face of elbow sections and other areas with severe geometric deformation, the existing method generally lacks effective compensation for image non-rigid distortion and signal intensity degradation, resulting in distortion of feature information and a significant increase in misjudgment rate. SUMMARY
[0004] In order to overcome the above-mentioned defects of the prior art, the following scheme is provided to solve the problem of inaccurate recognition of the magnetic flux leakage image of the pipeline elbow section in the background art.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical scheme:
[0006] An oil and gas pipeline magnetic flux leakage image defect recognition method based on a deep attention mechanism, comprising the following steps:
[0007] Collecting image frames output by a magnetic flux leakage detection device and attitude data of a sensor, and performing format conversion and spatial coordinate mapping to obtain a magnetic flux leakage image frame sequence with attitude annotations;
[0008] According to the pose data and the image signal density gradient, a structure region label map is generated, a bend section, a transition section and a straight pipe section are divided, non-rigid geometric normalization is performed on the bend section, signal distortion and geometric distortion caused by the distance change between the probe and the pipe wall are compensated through boundary sliding mapping and density leveling mapping, and a distortion compensation image is obtained;
[0009] A structure perception embedding graph is constructed on the distortion compensation image, a fixed size image block is taken as a node, a relative position code, a gradient direction change rate and a texture continuity are labeled, edges are connected according to structure consistency and feature propagation is performed, attention guidance is implemented, an attention focus is determined according to response differences, and a feature saliency map is generated;
[0010] The feature saliency map is subjected to hierarchical feature reconstruction, a disturbance index and a boundary jump distance are extracted, and a defect saliency map and a boundary prior are generated according to a preset fusion rule;
[0011] According to the defect saliency map and the structure region label map, a candidate region is located, a defect type, an axial position, a circumferential angle and a pixel-level boundary are output by combining a disturbance direction retention rate and a structure cooperation index, and the recognition stability is monitored and identified in continuous frames; when the recognition of the bend section is unstable, the structure region label map and the geometric normalization parameters are adaptively updated, and the corrected recognition result is output.
[0012] Further, the pose data includes an angle change rate, a distance estimation from the pipe wall and a contact pressure indication; the spatial coordinate mapping process refers to the correspondence of the sensor array coordinates to the pipe surface reference coordinates, and the establishment of a bidirectional index with the image pixel coordinates.
[0013] Further, the magnetism leakage image frame sequence with pose annotation refers to the addition of pose and position information associated with the pipe reference coordinate system to each frame of magnetism leakage image under a unified time reference, including the pitch angle, roll angle and azimuth angle of the sensor array relative to the pipe axis, the distance estimation from the probe to the pipe wall and its distribution on the array channel, the scanning position and scanning speed along the pipe axis, and the bidirectional index relationship between the pixel coordinates and the pipe surface coordinates, while recording the frame-level quality marks and distortion parameters necessary for distortion compensation; the image frames are sequentially arranged according to the time stamp in ascending order, and the continuity constraint of the pose and mapping relationship between adjacent frames is satisfied.
[0014] Further, according to the pose data and the image signal density gradient, a structure region label map is generated, a bend section, a transition section and a straight pipe section are divided, non-rigid geometric normalization is performed on the bend section, and the specific steps include:
[0015] The pose change rate is calculated based on the pose data, and a pose continuous change band is formed on the image; the main direction field is calculated based on the image signal density gradient;
[0016] When the posture change rate meets the elbow threshold and the main direction field exists a turning, it is marked as an elbow segment; when the posture change rate and the main direction field meet the transition threshold condition, it is marked as a transition segment; the rest is marked as a straight pipe segment, and a structure region marking map is generated;
[0017] For the elbow segment, non-rigid geometric normalization is performed, boundary slip mapping is applied along the tangential direction, and density leveling mapping is applied based on the straight pipe segment reference patch area, and the normalized elbow segment image is output.
[0018] Further, the signal distortion and geometric distortion caused by the change of the distance between the probe and the pipe wall are compensated by the boundary slip mapping and the density leveling mapping to obtain a distortion compensation image, and the specific steps include:
[0019] Based on the posture data and the distance estimate, a distance field of the elbow segment is generated, and a corresponding relationship is established according to the sensor channel and the pixel coordinate;
[0020] According to the structure region marking map, the elbow segment boundary is determined, the boundary slip mapping is constructed along the tangential direction of the elbow segment, the monotonic displacement field is formed, and the non-rigid geometric normalization is performed on the elbow segment to correct the pixel compression and pixel stretching;
[0021] Based on the signal statistical quantity of the straight pipe segment reference patch area, the intensity correction factor of each pixel of the elbow segment is calculated and the density leveling mapping is implemented to restore the signal contrast;
[0022] The time smoothing constraint is applied to the displacement field and the intensity correction factor of the adjacent frames, and the distortion compensation image is output.
[0023] Further, a structure-aware embedding graph is constructed on the distortion compensation image, with fixed-size image blocks as nodes, relative position encoding, gradient direction change rate and texture continuity being labeled, edges being connected according to structure consistency and feature propagation being performed, attention focus being determined according to response difference, a feature saliency map being generated, and the specific steps include:
[0024] The distortion compensation image is divided into fixed-size image blocks, and a node set composed of the image blocks is established;
[0025] The relative position encoding, gradient direction change rate and texture continuity are calculated and labeled for each node to form a node label;
[0026] According to the structure consistency and the boundary continuity, edges are established between nodes to form a structure-aware embedding graph;
[0027] Feature propagation is performed on the structure-aware embedding graph, and the propagation is terminated when the propagation step reaches the propagation step threshold to obtain an intermediate response map;
[0028] The attention focus is selected as a subgraph that is connected and satisfies a boundary continuity constraint according to response differences based on an intermediate response map;
[0029] A feature saliency map is generated with the attention focus as a constraint.
[0030] Further, a hierarchical feature reconstruction is performed on the feature saliency map, a disturbance index and a boundary jump distance are extracted, and a defect saliency map and a boundary prior are generated according to a preset fusion rule. The specific steps include:
[0031] A hierarchical structure composed of a primary saliency layer and a secondary saliency layer is established, the feature saliency map is generated into a set of scale maps according to a preset scale ratio, and the set of scale maps is pixel-aligned with a structure region label map;
[0032] In each layer, the disturbance index is calculated, the amplitude, direction retention and curvature change rate of the response difference sequence of adjacent nodes of the candidate region are calculated, and a hierarchical disturbance score is formed;
[0033] In each layer, the boundary jump distance is calculated, the minimum continuous length and the maximum gap length of the response transition of adjacent pixels along the boundary continuous path are determined, and a boundary constraint set is formed;
[0034] According to the preset fusion rule, the hierarchical reconstruction is completed, the candidate regions in the same layer are merged from high to low according to the hierarchical disturbance score, and the consistency verification is performed according to the boundary constraint set. The candidate regions that do not pass the verification are rolled back to the upper level set to be re-estimated and then merged;
[0035] The regions that pass the consistency verification are subjected to inter-layer constraint, the merging result of the primary saliency layer is used for mask mapping of the secondary saliency layer, and a defect saliency map and a boundary prior are output, and the pixel alignment relationship between the defect saliency map and the boundary prior is maintained.
[0036] Further, the primary saliency layer is a region in the feature saliency map with a response amplitude higher than a preset saliency threshold and a boundary jump distance greater than a preset boundary threshold, and the secondary saliency layer is a region in the feature saliency map with a response amplitude lower than the preset saliency threshold but having a spatial adjacency relationship with the primary saliency layer.
[0037] Further, the candidate region is located according to the defect saliency map and the structure region label map, the disturbance direction retention rate and the structure synergy index are used for judgment, and a defect type, an axial position, a circumferential angle and a pixel-level boundary are output. The specific steps include:
[0038] The pixel alignment relationship between the defect saliency map and the structure region label map is used for connected domain extraction, and the regions that do not satisfy the minimum continuous length and the maximum gap length are removed as constraints, to obtain a candidate region set.
[0039] Calculate the perturbation direction retention rate in each candidate region, compare the response direction within the candidate region with the main direction field of the corresponding position pixel by pixel, and count the proportion of pixels consistent within the direction tolerance threshold as the perturbation direction retention rate;
[0040] Calculate the structure synergy index between each candidate region and its adjacent segment indicated by the structure region marker map, respectively measure the correlation of response amplitude change and the coverage of boundary continuity, when the correlation and coverage reach the threshold at the same time, it is determined as high synergy, otherwise it is determined as low synergy;
[0041] Adopt two-level judgment rules to complete defect confirmation and result output, first determine stability by perturbation direction retention rate, candidate regions with stable stability enter synergy judgment, high synergy confirms the existence of defects, and generates pixel-level boundary according to boundary priori;
[0042] Obtain the defect type from the preset type mapping table combined with the structure category and boundary jump distance of the candidate region, output the defect type, axial position, ring angle and pixel-level boundary.
[0043] Further, monitor and identify stability in consecutive frames, when the elbow segment identification is unstable, adaptively update the structure region marker map and geometric normalization parameters, and output the corrected identification result, the specific steps include:
[0044] Based on the magnetic flux leakage image frame sequence with pose annotation, the pixel-level boundary and boundary priori of the confirmed defect are frame by frame registered, and the boundary overlap rate and local variance of the defect saliency map between adjacent frames are calculated;
[0045] When the boundary overlap rate is lower than the overlap threshold or the local variance is higher than the variance threshold and the consecutive frame count reaches the consecutive frame count threshold, it is determined that the elbow segment identification is unstable;
[0046] In the neighborhood of the elbow segment determined to be unstable, according to the main direction field of the pose continuous change band and the image signal density gradient, update the elbow segment boundary position and transition segment range in the structure region marker map;
[0047] According to the updated structure region marker map and the interval field, re-estimate the boundary slip mapping and density leveling mapping parameters, and generate a new distortion compensation image for the corresponding frame;
[0048] On the new distortion compensation image, according to the processing rules of feature propagation, attention guidance and hierarchical feature reconstruction, recalculate the feature saliency map and defect saliency map, and output the corrected defect type, axial position, ring angle and pixel-level boundary.
[0049] The technical effects and advantages of the oil and gas pipeline magnetic flux leakage image defect identification method based on deep attention mechanism:
[0050] The application realizes accurate alignment of sensor images and pipe curved surface positions by constructing a magnetic flux leakage image frame sequence with attitude annotation through unified time reference and space coordinate mapping, and improves positioning consistency of image data under complex attitudes; realizes non-rigid geometric normalization and signal intensity compensation by introducing boundary slip mapping and density leveling mapping in the elbow segment, eliminating signal distortion and geometric distortion caused by attitude changes and uneven fitting; constructs a structure perception embedding graph on the distortion compensation image, fuses relative position encoding, gradient direction change rate and texture continuity features, implements multi-step feature propagation and attention guidance, and generates a feature saliency map with structure constraint and response difference;
[0051] On this basis, defect saliency map and boundary prior are generated through hierarchical feature reconstruction and boundary jump measurement, two-level judgment is performed combining disturbance direction retention rate and structure cooperation index, effectively suppressing structure non-associated interference, improving defect recognition accuracy, introducing continuous frame monitoring and recognition stability judgment mechanism, triggering adaptive update of normalization parameters and structure marker map, forming a closed loop of recognition to update to verification, improving the stability and accuracy of oil and gas pipeline magnetic flux leakage image defect recognition under complex working conditions. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 FIG. 1 is a flowchart of a method for recognizing defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to the present application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0054] In order to achieve the above-mentioned purpose, Figure 1 The structure diagram of the method for recognizing defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to the present application is given, which specifically includes the following steps:
[0055] Collect image frames and attitude data of the sensor output by the magnetic flux leakage detection device, and perform format conversion and space coordinate mapping to obtain a magnetic flux leakage image frame sequence with attitude annotation, which is specifically implemented as:
[0056] According to the attitude data and the image signal density gradient, a structure region label map is generated, a bend section, a transition section and a straight pipe section are divided, non-rigid geometric normalization is performed on the bend section, signal distortion and geometric distortion caused by the distance change between the probe and the pipe wall are compensated through boundary slip mapping and density leveling mapping, and a distortion compensation image is obtained;
[0057] A structure perception embedding graph is constructed on the distortion compensation image, a fixed size image block is taken as a node, a relative position code, a gradient direction change rate and a texture continuity are labeled, edges are connected according to structure consistency and feature propagation is performed, attention guidance is implemented, an attention focus is determined according to response difference, and a feature saliency map is generated;
[0058] The feature saliency map is subjected to hierarchical feature reconstruction, a disturbance index and a boundary jump distance are extracted, and a defect saliency map and a boundary prior are generated according to a preset fusion rule;
[0059] According to the defect saliency map and the structure region label map, a candidate region is located, a disturbance direction retention rate and a structure cooperation index are combined for judgment, and a defect type, an axial position, a circumferential angle and a pixel-level boundary are output, and the stability of monitoring and identification in continuous frames is monitored and identified, when the identification of the bend section is unstable, the structure region label map and the geometric normalization parameters are adaptively updated, and the corrected identification result is output.
[0060] Step 1, collect the image frames output by the magnetic flux leakage detection device and the attitude data of the sensor, and perform format conversion and spatial coordinate mapping to obtain a sequence of magnetic flux leakage images with attitude labels, and the specific implementation is as follows:
[0061] In the field deployment stage, the image output of the magnetic flux leakage detection device and the sensor data are connected to the same controller, the controller provides a unified time reference and writes a time stamp for each piece of data.
[0062] The image frame is expressed as a magnetic flux leakage image in a fixed two-dimensional matrix, and the row and column directions are one-to-one corresponding to the physical arrangement of the sensor array; the attitude and position information are given in real time by independent sensors, in which the pitch angle, the roll angle and the azimuth angle are output by a three-axis inertial measurement unit, and the distance estimation from the pipe wall is directly measured by a distance measuring device installed on the probe support and distributed to the array channels according to the sensor channel position; when there is an included angle or arc distance between the channels, interpolation is performed according to the spatial position of the channel center line to make the distance estimation continuously distributed on the channel index; the contact pressure indication is output by the pressure sensor arranged on the contact surface between the probe and the pipe wall.
[0063] The angle change rate is obtained by: under a unified time reference, subtracting the previous frame value from the pitch angle, roll angle and azimuth angle of the adjacent two frames, and then dividing by the difference between the two frame timestamps to obtain the change amount per unit time of each attitude angle; the scanning position along the axial direction of the pipeline is obtained by accumulating the displacement encoder installed on the detection vehicle or the trailing mechanism, and the scanning speed is the difference between the scanning positions of the adjacent two frames divided by the difference between the two frame timestamps. The above image frames, pitch angle, roll angle, azimuth angle, distance estimation from the pipe wall, contact pressure indication, scanning position and scanning speed are aligned on the same time axis to complete the format conversion and time synchronization.
[0064] When establishing the spatial coordinate mapping, first define the pipeline reference coordinate system:
[0065] The axial position is the coordinate along the central axis of the pipeline, and the circumferential angle is the angle around the circumferential direction of the pipeline. The pipeline curved surface reference coordinate is composed of the axial position and the circumferential angle. The sensor array coordinate is defined as the channel coordinate indexed by rows and columns and its fixed geometric position on the device body. The pitch angle, roll angle and azimuth angle are used as attitude inputs to determine the projection position of each channel on the pipeline outer surface curved surface in combination with the array geometric position, so as to correspond the sensor array coordinate to the pipeline curved surface reference coordinate. Then, according to the pixel row and column of the image frame and the corresponding relationship of the channel, a bidirectional index between the pixel coordinate and the pipeline curved surface reference coordinate is established: one is the pixel-to-surface index used to find the corresponding axial position and circumferential angle at any pixel position; the other is the surface-to-pixel index used to find the pixel row and column in the image corresponding to any axial position and circumferential angle. The generation process of the bidirectional index is performed once per frame, using the pitch angle, roll angle and azimuth angle of the frame and the distance estimation from the pipe wall to ensure that the index is consistent with the actual attitude. When the index is invalid due to out-of-bounds or occlusion during calculation, the pixel is marked as an invalid pixel and the invalid proportion and reason are recorded in the frame-level quality identification.
[0066] When constructing the magnetic flux leakage image frame sequence with attitude annotation, the image pixel matrix of each frame and the attitude and position information of the frame are bound, which specifically includes: pitch angle, roll angle, azimuth angle, distance estimation from the pipe wall distributed according to the array channel, scanning position and scanning speed along the axial direction of the pipeline, bidirectional index relationship between the pixel coordinate and the pipeline curved surface reference coordinate, and frame-level quality identification and distortion parameters for subsequent distortion compensation.
[0067] Frame-level quality flag is used to indicate the availability and continuity of the current frame data, including at least whether the contact pressure indicator is below the preset normal contact threshold, whether the invalid pixel ratio exceeds the preset upper limit, and whether the attitude sensor is saturated or lost.
[0068] The sequence is arranged in ascending order of timestamp, and continuity constraints of attitude and mapping relationship are applied:
[0069] The constraints include that the differences of pitch angle, roll angle and azimuth angle between adjacent two frames should be less than the attitude continuity threshold, and the corresponding differences of pixel to surface index and surface to pixel index between adjacent two frames should be less than the index continuity threshold. If any of the above exceeds the threshold, it is recorded as a continuity anomaly in the frame-level quality flag and the anomaly type is marked.
[0070] In the data persistence and calling stage, the image pixel matrix and complete attitude and position information field are saved in frame units to ensure consistent reference of the same term in subsequent processing links. Before calling any frame for identification or compensation, the frame-level quality flag and distortion parameters of the frame are read first. If the contact pressure indicator indicates no contact or the invalid pixel ratio exceeds the upper limit, the frame is marked as a frame that needs to be reviewed and does not enter the identification process. If the continuity constraints are met and the attitude and position information are complete, the pitch angle, roll angle, azimuth angle, distance estimate from the probe to the pipe wall, scanning position and scanning speed, and bidirectional index of the frame are directly used as inputs for subsequent steps.
[0071] Step 2, generate a structure region marker map according to the attitude data and image signal density gradient, divide the elbow section, transition section and straight pipe section, perform non-rigid geometric normalization on the elbow section, compensate for signal distortion and geometric distortion caused by changes in the distance between the probe and the pipe wall through boundary slip mapping and density leveling mapping, and obtain a distortion compensation image. The specific implementation is as follows:
[0072] Read the pitch angle, roll angle, azimuth angle, distance estimate from the probe to the pipe wall, scanning position, scanning speed, and bidirectional index relationship between the pixel coordinates and the pipe surface reference coordinates from the magnetic flux leakage image frame sequence with attitude annotation, and verify that the frame-level quality flag meets the following conditions: the contact pressure indicator is not lower than the normal contact threshold, the invalid pixel ratio does not exceed the upper limit, and the continuity constraints of attitude and mapping relationship are met. To generate a structure region marker map, first calculate the angle change rate: with a unified time reference as a reference, subtract the previous frame value from the current frame value of the pitch angle, roll angle and azimuth angle of adjacent two frames, and then divide by the difference between the two frame timestamps to obtain the unit time change quantity of the three attitude angles, and form an attitude continuous change band on the image accordingly.
[0073] The main direction field is obtained by calculating the gradient direction of the image signal density on the current frame leakage magnetic image using a fixed size neighborhood center difference method, and the direction mode of each pixel in the neighborhood is taken as the main direction of the pixel. The main direction is mapped to the pipe surface reference coordinate by pixel to surface index.
[0074] The elbow threshold condition is set by pre-calibration method: select the calibration data set containing the known elbow segment and the known straight pipe segment, respectively, to count the lower limit value of the angle change rate in the elbow segment and the upper limit value of the angle change rate in the straight pipe segment, and take the fixed threshold value between the two as the elbow threshold condition; the transition threshold condition is that the angle change rate is between the elbow threshold condition and the upper limit of the angle change rate in the straight pipe segment, and the main direction field exists direction gradual change but not sudden change.
[0075] According to the above two types of threshold conditions and the turning features of the main direction field, the structure region marker map is generated by marking pixel by pixel on the surface reference coordinate: when the angle change rate meets the elbow threshold condition and the main direction field has a turning point, it is marked as an elbow segment; when the angle change rate and the main direction field meet the transition threshold condition, it is marked as a transition segment; the rest is marked as a straight pipe segment.
[0076] For the elbow segment in the structure region marker map, non-rigid geometric normalization is performed, and first the distance field is obtained by interpolating the distance estimate between the pipe wall on the channel.
[0077] The distance field is generated by linearly interpolating the distance estimate between the pipe wall along the ring direction and time interpolating the scanning position along the axial direction, so that each pixel obtains the corresponding distance value on the surface reference coordinate through the pixel to surface index, forming a pixel-defined distance field. Then, the boundary position of the elbow segment is determined according to the structure region marker map, and the boundary sliding mapping is constructed along the tangential direction of the elbow segment with the boundary as the constraint.
[0078] The boundary sliding mapping is realized by a monotonic displacement field: the reference boundary near the straight pipe segment is specified as the fixed boundary, and the other side is the slidable boundary. A displacement sequence gradually increasing from zero displacement is generated according to the deviation of the distance field and the reference distance in the tangential direction, which ensures that the displacement is monotonically changed along the tangential direction and topologically connected without overlapping in the normal direction. This way, the non-rigid geometric normalization is performed on the elbow segment pixels, so that the pixel compression and pixel stretching caused by uneven bending and fitting are corrected, and the geometric normalized elbow segment intermediate image is output; wherein, the reference distance is the median (or mean) of the distance estimate between the pipe wall in the straight pipe segment reference area, which is used to measure the deviation of the elbow segment and the straight pipe segment in distance.
[0079] The density leveling mapping is implemented on the geometric normalized intermediate image of the elbow segment to compensate for the signal contrast attenuation, and the selection of the reference patch area of the straight pipe segment is as follows:
[0080] In the structure region marking map, two continuous regions along the axial direction of the elbow segment are marked as straight pipe segment regions. After removing the frames with abnormal continuity, the pixel intensity statistics (including mean and quantile) of the two straight pipe segment regions are taken as the signal statistics of the straight pipe segment reference patch area. The intensity correction factor of each pixel in the elbow segment is calculated: the intensity statistics of the small neighborhood where the pixel is located are compared with the intensity statistics of the straight pipe segment reference patch area. If attenuation occurs, an intensity correction factor greater than one is generated. If enhancement occurs, an intensity correction factor less than one is generated. At the same time, the intensity correction factor is limited within a safe range to avoid excessive correction. The intensity correction factor is applied to the geometric normalized intermediate image of the elbow segment pixel by pixel to obtain an intensity leveled image.
[0081] To ensure temporal consistency, the monotonic displacement field and the intensity correction factor of adjacent frames are simultaneously subjected to temporal smoothing constraints: a fixed temporal smoothing coefficient is used to perform first-order recursion on the last frame estimate and the current frame estimate, so that the displacement field and the intensity correction factor are smoothly transitioned in the time dimension. The temporal smoothing constraints are recorded in the frame-level quality identification, including whether the temporal smoothing constraints are triggered and the reason for the triggering.
[0082] Finally, the geometric normalization and the density leveling mapping are jointly applied to the elbow segment region, and the pixels in the straight pipe segment and the transition segment are not subjected to geometric distortion processing according to the marking of the structure region marking map. Only when necessary, global brightness consistency is performed to make the full-frame image maintain boundary continuity and region connectivity in the curved reference coordinate, and the distortion compensation image is output.
[0083] The distortion compensation image is archived together with the structure region marking map, the pitch field, the monotonic displacement field, the intensity correction factor and the temporal smoothing constraint identification of the current frame, serving as the input basis for subsequent construction of structure-aware embedding map, feature propagation and hierarchical feature reconstruction on the distortion compensation image.
[0084] It should be noted that the elbow threshold condition, the transition threshold condition, the normal contact threshold, the upper limit of the invalid pixel ratio, the posture continuity threshold and the index continuity threshold are determined through a calibration process when the device is delivered and are fixed in the parameter table; the temporal smoothing coefficient is selected and fixed according to the stability of the scanning speed during on-site deployment, so as to ensure that the same parameter name can be repeatedly referenced and verified in subsequent steps.
[0085] Step 3: Constructing a structure-aware embedding map on the distortion compensation image, taking a fixed-size image block as a node, labeling relative position encoding, gradient direction change rate and texture continuity, connecting edges according to structure consistency and performing feature propagation, and implementing attention guidance to determine the focus of attention according to the response difference, generating a feature saliency map, which is implemented as follows:
[0086] Image block division is performed on the distortion-compensated image, and the entire frame is cut into a plurality of fixed-size image blocks according to a fixed row-column size, to establish a node set composed of the image blocks.
[0087] Three types of node labels are calculated and labeled for each node: 1. Relative position encoding, which uses pixel-to-surface indexing to obtain the axial position and ring angle of the image block centroid in the pipe surface reference coordinate, and respectively normalizes the axial range and ring range relative to the axial range and ring range of the frame (with the endpoints as the reference, expressed in proportion to the distance from the endpoints), and calculates the surface distance of the centroid to the nearest structure boundary (from the bend segment boundary or transition segment boundary of the structure region marking map) and normalizes it according to the axial range, which together constitute the relative position encoding;
[0088] 2. Gradient direction change rate, which first obtains the gradient direction of each pixel in the image block using central difference in a fixed pixel neighborhood, then takes the main direction of the image block as the highest frequency value of the pixel-level gradient direction, and finally counts as consistent within the direction tolerance threshold and as changed outside the direction tolerance threshold according to the absolute value of the direction difference between the main direction and the main direction of the four adjacent image blocks, and takes the proportion of the change count in the total count of the four adjacent image blocks as the gradient direction change rate;
[0089] 3. Texture continuity, which counts the proportion of "gray level difference falling within the small difference band" in the gray level co-occurrence pair along the main direction of the image block, and the higher the proportion, the more continuous the texture in the main direction, which is taken as the texture continuity. When establishing a connection edge, first calculate the structure consistency for each pair of adjacent nodes:
[0090] When the main direction difference between the two nodes is less than the direction tolerance threshold and the difference in texture continuity between the two nodes is less than the continuity threshold, it is judged as structure consistent; then test the boundary continuity, i.e. extract an edge pixel chain near the common edge of the two nodes, if there is a continuous edge path across the two nodes and the path interruption length does not exceed the maximum gap length threshold, it is judged as satisfying the boundary continuity, only when both structure consistency and boundary continuity are satisfied, a connection edge is established between the two nodes to form a structure-aware embedding graph.
[0091] Thereafter, feature propagation is performed on the structure-aware embedding graph and an intermediate response map is generated. The feature propagation updates the orientation and texture representations in the node labels in a step-by-step iterative manner: in each propagation step, the structural consistency score of each node with all its adjacent nodes connected by edges is calculated, the score is based on the combined determination of the orientation consistency and the texture continuity closeness; the adjacent node with the highest score is selected as the alignment reference of the current node, and the main orientation of the current node is replaced by the main orientation of the reference, and the texture continuity of the current node is replaced by the texture continuity of the reference; when there are same-score situations, the adjacent node with stronger boundary continuity (longer continuous edge path across nodes) is preferred; when the current node has shown a significant gradient direction change rate in the last propagation step and the change rate exceeds a preset significant change rate threshold, the main orientation of the last propagation step is retained to avoid over-smoothing.
[0092] After each propagation step, the variation amplitude of the main orientation and the texture continuity between the current step and the last step of each node is recorded, and the larger one of the two is recorded as the response strength of the node, and the projection of the node position on the image forms a response strength map; when the number of propagation steps reaches the propagation step threshold, the propagation is terminated, and the current response strength map is the intermediate response map, and the node orientation and texture label at this time are retained for subsequent attention selection.
[0093] Finally, attention guidance is implemented based on the intermediate response map and a feature saliency map is generated, that is, by attention guidance, the nodes with response strength exceeding a preset response strength threshold are selected from the intermediate response map as a candidate set, then a connectivity search is performed on the candidate set on the structure-aware embedding graph, and a connected subgraph that satisfies connectivity and boundary continuity is retained, the connectivity is based on the graph edges, the boundary continuity is based on the existence of a continuous edge path across nodes and the path gap length does not exceed a maximum gap length threshold, each connected subgraph that satisfies the condition is determined as an attention focus, and the corresponding node set is mapped back to the distortion compensation image according to the image block coverage range to obtain an initial salient region; at the same time, to suppress discrete noise, a rank order normalization mapping is performed on the response strength of the nodes within the attention focus, that is, the response strength is sorted from small to large and mapped to a fixed interval of saliency level values according to the sorting position, the mapping result is written into the saliency level map corresponding to the pixel position, and the pixel saliency level in the non-attention focus region is set to the lowest level, to obtain the feature saliency map.
[0094] Step 4, hierarchical feature reconstruction is performed on the feature saliency map, disturbance indicators and boundary jump distances are extracted, and a defect saliency map and a boundary prior are generated according to a preset fusion rule, and the specific implementation is as follows:
[0095] Firstly, a hierarchical structure consisting of a primary saliency layer and a secondary saliency layer is established based on a feature saliency map. The feature saliency map is divided into a plurality of scale sets according to a preset scale ratio, and each scale set is aligned with a structure region label map pixel by pixel using a pixel-to-surface index. A response amplitude is derived from a saliency level value in the feature saliency map, and after interval normalization, the response amplitude is used as a pixel-level response amplitude.
[0096] The primary saliency layer is defined as a region with a response amplitude higher than a preset saliency threshold and a boundary jump distance greater than a preset boundary threshold. The secondary saliency layer is defined as a region with a response amplitude lower than the preset saliency threshold but having a spatial adjacency relationship with the primary saliency layer in the surface reference coordinate.
[0097] Then, a disturbance index is calculated on each scale set to form a hierarchical disturbance score. With reference to the main direction of the node embedded in the structure perception saliency map, a response difference sequence of adjacent nodes is extracted along the main direction and the normal direction of each candidate region, respectively.
[0098] The amplitude of the response difference is represented by the absolute quantization result of the difference between the response amplitudes of the adjacent nodes. The direction retention degree is represented by the proportion of pixels in the candidate region whose main direction is consistent with the main direction of the adjacent node within a direction tolerance threshold. The curvature change rate is represented by the frequency of change of the turning angle of adjacent skeleton points on the center connected skeleton of the candidate region per unit length. To obtain the hierarchical disturbance score, the response difference amplitudes are first sorted from high to low. When there is a tie, the direction retention degree is sorted from high to low. When there is still a tie, the curvature change rate is sorted from low to high. This order determination rule is used to distinguish the priority of the saliency of the candidate region without numerical weighting. The sorting result is the hierarchical disturbance score.
[0099] Next, the boundary jump distance is calculated on each scale set to form a boundary constraint set. For each candidate region, a continuous edge path across the boundary of the candidate region is searched pixel by pixel along the boundary normal direction orthogonal to the main direction. The transition of the response amplitude of adjacent pixels from the inside to the outside of the region is regarded as a jump, and the length of the continuous path that satisfies the boundary continuity is recorded as the minimum continuous length. The maximum gap length in the path is recorded. The minimum continuous length and the maximum gap length are compared with the preset boundary threshold, the minimum continuous length threshold, and the maximum gap length threshold to obtain the boundary constraint entry of the candidate region. The boundary constraint entries of all candidate regions form the boundary constraint set. The boundary constraint set is used to check whether the merged region maintains a continuous boundary and a traceable edge in the subsequent hierarchical reconstruction.
[0100] Finally, the hierarchical feature reconstruction is completed according to a preset fusion rule, and a defect saliency map and a boundary prior are output.
[0101] The fusion rule is: in the same scale, the candidate regions are combined in order of hierarchical disturbance score, before each combination, the combined region is checked by the boundary constraint set to see if it meets the minimum continuous length threshold and the maximum gap length threshold, if it meets, it is retained, if not, it is not combined and the rollback process is triggered; the rollback process is to re-estimate the boundary path and connected skeleton of the candidate region on the upper level atlas (higher resolution scale) and then return to the current scale for review; the same layer result after combination and verification is used as the significant region set of the scale.
[0102] The cross-scale constraint is realized by using a mask mapping method:
[0103] The significant region of the main significant layer on the high resolution scale is used as a mask, which is mapped to the corresponding position of the secondary significant layer. The region overlapping with the mask in the secondary significant layer is covered, and the conflict is resolved by the principle of giving priority to the main significant layer, ensuring that the main significant layer has a spatial constraint on the secondary significant layer. After the fusion of all scales, the significant regions retained in each scale are uniformly mapped back to the original resolution on the surface reference coordinate to obtain the defect saliency map. At the same time, the boundary path that passes the boundary constraint set check is expanded to a thin strip region as the boundary prior, and is aligned with the defect saliency map pixel by pixel.
[0104] The defect saliency map and the boundary prior are archived together with the preset significant threshold, the preset boundary threshold, the minimum continuous length threshold, the maximum gap length threshold, and the sorting rule of the hierarchical disturbance score used in this phase.
[0105] Step 5: According to the defect saliency map and the structure region marker map, the candidate region is located, the disturbance direction retention rate and the structure coordination index are combined for judgment, and the defect type, axial position, ring angle and pixel-level boundary are output. The stability of continuous frames is monitored and identified. When the elbow segment identification is unstable, the structure region marker map and the geometric normalization parameter are updated adaptively, and the corrected identification result is output. The specific implementation is:
[0106] First, the candidate region positioning is performed: based on the boundary prior, the connected domain is extracted under the premise that the defect saliency map and the structure region marker map are pixel-aligned. The specific method is:
[0107] The defect saliency map is scanned by rows and columns, pixels with saliency level reaching a preset saliency threshold are added to a candidate set, and the candidate set must fall within an effective detection area indicated by the structure area label map; a connected domain is formed inside the candidate set according to the four-neighbor or eight-neighbor rule, and the coincidence length of each connected domain with the boundary prior and the boundary path continuity are calculated respectively, if the boundary continuous path length of a connected domain is less than a minimum continuous length threshold, or the maximum length of the discontinuous segment in the boundary path is greater than a maximum gap length threshold, the connected domain is removed; the remaining connected domain set is the candidate region set, and for each candidate region, the axial position range and the ring angle range of the region are read in the curved reference coordinate and cached, which can be used for output position coordinates.
[0108] Then, the disturbance direction retention rate and the structure coordination index are calculated and two-level judgment is performed. The calculation steps of the disturbance direction retention rate are:
[0109] For each candidate region, the main direction of the pixel in the structure perception embedding graph corresponding node is read pixel by pixel, and the direction value of the pixel in the main direction field is read, the direction difference between the two is expressed in angle, and when the absolute value of the direction difference is less than the direction tolerance threshold, it is recorded as a consistent pixel; the ratio of the number of consistent pixels to the total number of pixels in the candidate region is calculated, which is the disturbance direction retention rate.
[0110] The calculation steps of the structure coordination index are:
[0111] First, an intensity sampling sequence is taken from inside to outside along the boundary normal in the boundary band of the candidate region, and then an intensity sampling sequence is taken in the same way in the boundary band of the adjacent segment indicated by the structure area label map; the consistency of the two sampling sequences in the response amplitude increasing or decreasing direction is compared by taking time sequence or spatial sequence as the sequence index, the consistency is expressed by the proportion of the number of same direction changes to the total number of steps, and then the overlap coverage of the candidate region boundary and the adjacent segment boundary in the boundary prior is calculated, the coverage is expressed by the ratio of the overlap length to the union length, when the change direction consistency proportion and the coverage reach their respective thresholds at the same time, the structure coordination index of the candidate region is determined as high coordination, otherwise it is determined as low coordination.
[0112] The two-level judgment process is: first, the stability is judged by the disturbance direction retention rate, if the disturbance direction retention rate reaches the threshold, the coordination is determined; in the coordination determination, when the structure coordination index is high, it is confirmed that the candidate region has defects, and the outermost continuous path of the boundary prior in the range of the candidate region is taken as the pixel-level boundary.
[0113] After the defect is confirmed, the output field is generated and the type determination is completed. The pixel-level boundary is obtained by extracting the outermost continuous path through the boundary prior of the thin strip region. The axial position is calculated by projecting the pixel-level boundary to the pipe surface reference coordinate through the pixel-to-surface index, and the minimum and maximum values of the axial position are taken as the center value. The minimum and maximum values of the ring angle are obtained by the same projection, and the central angle is taken as the representation. The defect type is obtained according to the preset type mapping table. The preset type mapping table takes the combination relationship of the structure category (elbow segment, transition segment or straight pipe segment), boundary jump distance, disturbance direction retention rate and structure synergy index as the index item. The defect type label is returned according to the completely matched item. If multiple items satisfy at the same time, the item with larger boundary jump distance is returned preferentially.
[0114] Finally, the defect type, axial position, ring angle and pixel-level boundary are outputted, and the corresponding disturbance direction retention rate, structure synergy index and determination threshold are archived together, which is convenient for review in the continuous frame monitoring stage.
[0115] In the continuous frame monitoring stage, the adjacent frames in the magnetic leakage image frame sequence with attitude annotation are identified and the stability is evaluated. The specific method is as follows:
[0116] The pixel-level boundary of the confirmed defect is frame-by-frame registered between the adjacent two frames. During the registration, the boundary is projected from the image coordinate to the pipe surface reference coordinate through the pixel-to-surface index, and the boundary overlap rate is calculated in the coordinate system. The boundary overlap rate is represented by the ratio of the overlap length to the union length of the pixel-level boundaries of the two frames. At the same time, the local variance of the significant level inside the defect region is calculated in the defect saliency map with pixels as the unit. The local variance is represented by the dispersion degree of the significant level in the fixed window. When the boundary overlap rate is lower than the overlap threshold, or the local variance of the significant level is higher than the variance threshold, and the number of such abnormalities in the continuous frames reaches the continuous frame count threshold, it is determined that the elbow segment is not stable.
[0117] After it is determined that the identification is not stable, the structure region marker map is re-adjusted in the elbow segment neighborhood of the determination frame according to the attitude continuous change band and the main direction field. Specifically, the elbow segment boundary position and the transition segment range are fine-tuned to make the boundary continuity and the region connectivity meet the threshold constraint again. Then, the boundary slip mapping and the density leveling mapping parameters are re-estimated according to the updated structure region marker map and the interval field, and a new distortion compensation image is generated for the corresponding frame.
[0118] In the new distortion compensation image, the feature propagation, attention guidance and hierarchical feature reconstruction are sequentially performed according to the established process, and the feature saliency map and the defect saliency map are obtained again. The candidate region positioning and two-level determination are repeated, and the corrected defect type, axial position, ring angle and pixel-level boundary are outputted.
[0119] It should be noted that the threshold information related in this embodiment is set by professionals in advance, and will not be explained too much here. In the embodiment, there are same letters in some parameters, but different meanings are explained in use, which will not be explained one by one here.
[0120] The application realizes accurate alignment of sensor images and pipe curved surface positions by constructing a magnetic flux leakage image frame sequence with attitude annotation through unified time reference and space coordinate mapping, and improves the positioning consistency of image data under complex attitudes; realizes non-rigid geometric normalization and signal intensity compensation by introducing boundary slip mapping and density leveling mapping in the elbow segment, eliminating signal distortion and geometric distortion caused by attitude change and uneven fitting; constructs a structure perception embedding graph on the distortion compensation image, fuses relative position encoding, gradient direction change rate and texture continuity features, implements multi-step feature propagation and attention guidance, and generates a feature saliency map with structure constraint and response difference;
[0121] On this basis, through hierarchical feature reconstruction and boundary jump measurement, a defect saliency map and boundary prior are generated, two-level judgment is performed combined with disturbance direction retention rate and structure cooperation index, structure non-associated interference is effectively suppressed, defect recognition accuracy is improved, continuous frame monitoring and recognition stability judgment mechanism is introduced, adaptive update of normalization parameters and structure marker graph is triggered, forming a closed loop of recognition to update to verification, and the stability and accuracy of oil and gas pipeline magnetic flux leakage image defect recognition under complex working conditions are improved.
[0122] The above embodiments can be realized wholly or partially by software, hardware, firmware or any combination thereof. When realized by software, the above embodiments can be realized in the form of a computer program product wholly or partially.
[0123] Those skilled in the art can realize that the modules and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0124] In addition, each functional module in each embodiment of the present application can be integrated in one processing module, or each module can exist physically alone, or two or more modules can be integrated in one module.
[0125] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0126] Finally, the above merely provides the preferred embodiments of the present application, but is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism, characterized in that: The specific steps include: The image frames output by the magnetic flux leakage detection device and the attitude data of the sensor are acquired, and format conversion and spatial coordinate mapping are performed to obtain a sequence of magnetic flux leakage image frames with attitude annotations. Based on the attitude data and image signal density gradient, a structural region marking map is generated, dividing the section into bends, transition sections and straight pipe sections. Non-rigid geometric normalization is performed on the bends. By using boundary slip mapping and density leveling mapping, signal distortion and geometric distortion caused by the change in the distance between the probe and the pipe wall are compensated to obtain a distortion-compensated image. A structure-aware embedding map is constructed on the distortion-compensated image. Fixed-size image blocks are used as nodes, and relative position encoding, gradient direction change rate and texture continuity are labeled. Edges are connected according to structural consistency and feature propagation is performed. Attention guidance is implemented at the same time, and attention focus is determined according to response differences to generate a feature saliency map. Hierarchical feature reconstruction is performed on the feature saliency map to extract perturbation indicators and boundary jump distances, and defect saliency maps and boundary priors are generated according to preset fusion rules; Candidate regions are located based on the defect saliency map and the structural region marking map. The defect type, axial position, circumferential angle and pixel-level boundary are determined by combining the disturbance direction retention rate and the structural coordination index. The recognition stability is monitored in continuous frames. When the recognition of the bend section is determined to be unstable, the structural region marking map and geometric normalization parameters are adaptively updated, and the corrected recognition result is output.
2. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 1, characterized in that: Attitude data includes the rate of change of angle, the estimated distance from the pipe wall, and the contact pressure indication; the spatial coordinate mapping process refers to mapping the sensor array coordinates to the reference coordinates of the pipe surface and establishing a bidirectional index with the image pixel coordinates.
3. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 2, characterized in that: A magnetic flux leakage image frame sequence with attitude annotation refers to attaching attitude and position information associated with the pipeline reference coordinate system to each frame of magnetic flux leakage image under a unified time reference. This includes the pitch, roll, and azimuth angles of the sensor array relative to the pipeline axis, the estimated distance between the probe and the pipeline wall and its distribution on the array channel, the scanning position and scanning speed along the pipeline axis, and the bidirectional indexing relationship between pixel coordinates and pipeline surface coordinates. At the same time, the frame-level quality label and distortion parameters necessary for distortion compensation are recorded. The image frames are arranged into a sequence by increasing the timestamp, and the continuity constraints of attitude and mapping relationship are satisfied between adjacent frames.
4. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 3, characterized in that: Based on attitude data and image signal density gradient, a structural region marker map is generated, dividing the pipe into bend sections, transition sections, and straight pipe sections. Non-rigid geometric normalization is performed on the bend sections. The specific steps include: The attitude change rate is calculated based on the attitude data and a continuous attitude change band is formed on the image. The principal direction field is calculated based on the image signal density gradient. When the attitude change rate meets the bend threshold and there is a turning point in the main direction field, it is marked as a bend segment; when the attitude change rate and the main direction field meet the transition threshold condition, it is marked as a transition segment; the rest are marked as straight pipe segments, and a structural region marking map is generated. For the elbow section, non-rigid geometric normalization is performed, boundary slip mapping is applied along the tangential direction, and density leveling mapping is applied based on the straight pipe section reference area, outputting the normalized elbow section image.
5. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 4, characterized in that: By compensating for signal and geometric distortions caused by changes in the distance between the probe and the tube wall through boundary slip mapping and density leveling mapping, a distortion-compensated image is obtained. The specific steps include: The spacing field of the bend segment is generated based on the attitude data and spacing estimate, and a correspondence is established between the sensor channel and the pixel coordinate. The boundary of the bend segment is determined based on the structural region marking map. A boundary slip mapping is constructed along the tangential direction of the bend segment to form a monotonic displacement field. Non-rigid geometric normalization is performed on the bend segment to correct pixel compression and pixel stretching. Based on the signal statistics of the reference area of the straight pipe section, the intensity correction factor of each pixel in the bend section is calculated and density leveling mapping is implemented to restore the signal contrast. Temporal smoothing constraints are applied to the displacement field and intensity correction factor of adjacent frames to output a distortion-compensated image.
6. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 5, characterized in that: A structure-aware embedding map is constructed on the distortion-compensated image. Fixed-size image patches are used as nodes, and their relative position encoding, gradient direction change rate, and texture continuity are labeled. Edges are connected according to structural consistency, and feature propagation is performed. Simultaneously, attention guidance is implemented, and the focus of attention is determined based on response differences to generate a feature saliency map. Specific steps include: The distortion-compensated image is divided into image blocks of fixed size, and a node set composed of each image block is established; For each node, calculate and label its relative position code, gradient direction change rate, and texture continuity to form a node label; Based on structural consistency and boundary continuity, connections are established between nodes to form a structure-aware embedding graph; Feature propagation is performed on the structure-aware embedding graph, and the propagation is terminated when the number of propagation steps reaches the propagation step threshold, resulting in an intermediate response graph; Attention guidance is implemented based on intermediate response graphs, and subgraphs that are connected and satisfy boundary continuity constraints are selected as attention focus according to response differences. Generate a feature saliency map by using the focus of attention as a constraint.
7. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 6, characterized in that: The feature saliency map is subjected to hierarchical feature reconstruction, perturbation indices and boundary jump distances are extracted, and defect saliency maps and boundary priors are generated according to preset fusion rules. The specific steps include: A hierarchical structure consisting of a primary salient layer and a secondary salient layer is established. Feature salient maps are generated into map sets of various scales according to a preset scale ratio and then pixel-aligned with the structural region label map. In each layer, the perturbation index is calculated, and the amplitude, orientation preservation degree and curvature change rate of the response difference sequence of adjacent nodes in the candidate region are obtained to form a hierarchical perturbation score. In each layer, the boundary jump distance is calculated, and the minimum continuous length and maximum gap length of the response jump between adjacent pixels are determined along the continuous path of the boundary to form a boundary constraint set. The hierarchical reconstruction is completed according to the preset fusion rules. Candidate regions are merged in the same layer from high to low according to the hierarchical perturbation score. Then, consistency verification is performed according to the boundary constraint set. Candidate regions that fail the verification are backed to the next level atlas for re-estimation and then merged. Apply interlayer constraints to regions that pass the consistency check, perform mask mapping on the secondary salient layers using the merged results of the primary salient layers, output the defect saliency map and boundary prior, and maintain the pixel alignment relationship between the two.
8. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 7, characterized in that: The primary saliency layer is the region in the feature saliency map whose response amplitude is higher than the preset saliency threshold and whose boundary transition distance is greater than the preset boundary threshold. The secondary saliency layer is the region in the feature saliency map whose response amplitude is lower than the preset saliency threshold but has a spatial adjacency relationship with the primary saliency layer.
9. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 8, characterized in that: Candidate regions are located based on the defect saliency map and structural region marking map. The determination is then made by combining the disturbance direction retention rate and structural synergy index, and the defect type, axial position, circumferential angle, and pixel-level boundary are output. Specific steps include: Connected region extraction is performed using the pixel alignment relationship between the defect saliency map and the structural region labeling map. Regions that do not meet the minimum continuous length and maximum gap length conditions are eliminated with boundary priors as constraints, resulting in a candidate region set. The perturbation orientation retention rate is calculated in each candidate region. The response orientation within the candidate region is compared pixel by pixel with the main orientation field at the corresponding position. The proportion of pixels that are consistent within the orientation tolerance threshold is used as the perturbation orientation retention rate. The structural coordination index is calculated between each candidate region and its adjacent segments indicated by the structural region labeling map. The correlation of response amplitude changes and the coverage of boundary continuity are measured respectively. When both correlation and coverage reach the threshold, it is judged as high coordination; otherwise, it is judged as low coordination. A two-level judgment rule is adopted to complete the defect confirmation and result output. First, the stability is judged by the perturbation direction retention rate. Candidate regions with the stability standard enter the cooperation judgment. When the cooperation is high, the existence of the defect is confirmed, and pixel-level boundaries are generated based on the boundary prior. The defect type is obtained from the preset type mapping table by combining the structural category of the candidate region and the boundary jump distance, and the defect type, axial position, circumferential angle and pixel-level boundary are output.
10. The method for identifying defects in magnetic flux leakage images of oil and gas pipelines based on a deep attention mechanism according to claim 9, characterized in that: The system monitors recognition stability across consecutive frames. When the recognition of the bend segment is deemed unstable, it adaptively updates the structural region marker map and geometric normalization parameters, outputting the corrected recognition result. The specific steps include: Based on the magnetic flux leakage image frame sequence with attitude annotation, the pixel-level boundaries of confirmed defects are registered with the boundary prior frame by frame, and the boundary overlap rate between adjacent frames and the local variance of the defect saliency map are calculated. When the boundary overlap rate is lower than the overlap threshold or the local variance is higher than the variance threshold and the consecutive frame count reaches the consecutive frame count threshold, the elbow segment identification is deemed unstable. Within the neighborhood of the bend segment identified as unstable, the boundary position of the bend segment and the range of the transition segment in the structural region labeling map are updated according to the main direction field of the attitude continuous change zone and the image signal density gradient. Based on the updated structural region labeling map and spacing field, the boundary slip mapping and density leveling mapping parameters are re-estimated, and a new distortion compensation image is generated for the corresponding frame. On the new distortion-compensated image, following the processing rules of feature propagation, attention guidance, and hierarchical feature reconstruction, the feature saliency map and defect saliency map are recalculated, and the corrected defect type, axial position, circumferential angle, and pixel-level boundary are output.
Citation Information
Patent Citations
Machine vision dynamic defect detection method and device for precise structural part
CN119887745A
ERCP image intelligent identification system based on multi-modal fusion
CN120318207A