Pipeline inner wall detection method and system based on variable-diameter pipeline robot
By combining data from a magnetic flux leakage sensor and a camera, and using image gradient information to adaptively filter the magnetic flux leakage signal, the problem of low detection accuracy and reliability in existing pipeline inner wall detection methods is solved, and efficient identification of minute defects is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-12
- Publication Date
- 2026-03-27
AI Technical Summary
Existing robot-based pipe inner wall inspection methods suffer from low signal-to-noise ratio, unstable imaging quality, and difficulty in accurately identifying minute defects or defects with no obvious surface changes, resulting in low detection accuracy and reliability.
A variable-diameter pipe robot is used, combined with a magnetic flux leakage sensor and a camera. By fusing the magnetic flux leakage signal and the inner wall image, the first contour of the defect area is initially determined using the magnetic flux leakage signal. The best matching target contour is then found in the image domain. The magnetic flux leakage signal is adaptively filtered using the image gradient information within the target contour, and the optimal edge detection parameters are iteratively optimized.
It effectively overcomes the limitations of single-sensor detection, improves the accuracy and robustness of small defect contour recognition, and significantly enhances the accuracy and reliability of detection results.
Smart Images

Figure CN121499644B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of pipeline electromagnetic detection, and in particular to a pipeline inner wall detection method and system based on a variable-diameter pipeline robot. BACKGROUND
[0002] Corrosion, cracks and other defects in the inner wall of a natural gas pipeline are the main hidden dangers threatening the safety of the pipeline, and therefore, regular and efficient pipeline inner wall detection technology is a core link for ensuring the safety of energy transportation, preventing environmental pollution and major accidents.
[0003] Existing pipeline inner wall detection methods based on robots still face significant technical bottlenecks. First, the limitations of a single sensing mode are prominent. Methods relying on magnetic flux leakage sensors are sensitive to metal defects, but their signals are easily disturbed by sensor noise and robot operation vibrations, resulting in low signal-to-noise ratios and difficulty in directly presenting the geometric morphology of defects. Methods relying only on visual sensors (such as cameras) are susceptible to uneven lighting in the pipeline, camera noise and other factors, and have low recognition rates for small or surface-unchanged defects.
[0004] In summary, the accuracy and reliability of pipeline inner wall detection using a single sensor are low. SUMMARY
[0005] To solve the above problems, the present application provides a pipeline inner wall detection method and system based on a variable-diameter pipeline robot.
[0006] The pipeline inner wall detection method and system based on a variable-diameter pipeline robot of the present application adopts the following technical solutions:
[0007] One embodiment of the present application provides a pipeline inner wall detection method based on a variable-diameter pipeline robot, which includes the following steps:
[0008] An inner wall image of the pipeline is captured using a camera, and a magnetic flux leakage signal of the inner wall of the pipeline is captured using a magnetic flux leakage sensor; the magnetic flux leakage signal represents an axial magnetic flux leakage sequence composed of magnetic flux leakage intensities at different axial positions under each circumferential position of the inner wall of the pipeline;
[0009] A first contour of all defect regions is determined according to the magnetic flux leakage signal;
[0010] An edge detection is performed on the captured inner wall image using each set of parameters, a contour with the maximum correlation to all first contours among all contours obtained by the edge detection is marked as a target contour, the maximum correlation is recorded as a, and the magnetic flux leakage signal is filtered using the gradient of the pixel points in the target contour; a second contour of all defect regions is determined according to the filtered magnetic flux leakage signal, and a contour with the maximum correlation to all second contours among all contours obtained by the edge detection is recorded as b;
[0011] The parameters when the difference between b and a is maximum and b is maximum are recorded as optimal parameters, and the optimal parameters are used to detect all defects in the image.
[0012] Preferably, the specific steps of determining the first contour of all defect regions according to the magnetic flux leakage signal include the following:
[0013] According to the axial magnetic flux leakage sequence at each circumferential position, the rate of change of the magnetic flux leakage intensity at each axial position is obtained, and the rates of change obtained at all axial positions at all circumferential positions constitute a magnetic flux leakage rate of change distribution image; a connected domain surrounded by a closed edge in the magnetic flux leakage rate of change distribution image is determined as a defect region, and the closed edge is taken as the first contour.
[0014] Preferably, the specific steps of using each group of parameters to perform edge detection on the collected inner wall image include the following:
[0015] For the first contour of each defect region, according to the robot motion speed and the axial distance between the camera and the magnetic flux leakage sensor, an inner wall image containing image information of each defect region is collected;
[0016] The inner wall image is processed by using the Canny edge detection algorithm under each group of parameters to obtain all contours; the similarity of each contour to the first contour of each defect region is calculated; and the contour with the maximum similarity to the first contour of each defect region among all contours is marked as the target contour of each defect region under each group of parameters.
[0017] The average value of the maximum similarities corresponding to all defect regions is calculated, and the average value is recorded as the maximum correlation and as a.
[0018] Preferably, the specific steps of calculating the similarity of each contour to the first contour of each defect region include the following:
[0019] Each contour is subjected to scaling transformation so that the rectangular bounding box of each contour after scaling transformation is aligned with the rectangular bounding box of the first contour, and then the cosine similarity of the Hu moment of each contour after scaling transformation to the Hu moment of the first contour is calculated as the similarity of each contour to the first contour.
[0020] Preferably, the specific steps of filtering the magnetic flux leakage signal by using the gradient of the pixel points in the target contour include the following:
[0021] D1: Calculate the gradient amplitude of all pixel points in the target contour by using the Sobel operator, and mark the pixel point corresponding to the maximum gradient amplitude as a reference pixel point.
[0022] D2: randomly sampling a set proportion of reference pixel points from all reference pixel points; projecting each of the sampled reference pixel points to a circumferential position p1 and an axial position p2 on the inner wall of the pipeline; performing Fourier transform on an axial leakage magnetic sequence corresponding to each circumferential position p1 to obtain a frequency spectrum of the axial leakage magnetic sequence;
[0023] D3: determining a target noise frequency that has the most significant influence on the leakage magnetic signal by random sampling and inverse transform experiments in the frequency spectrum of the axial leakage magnetic sequence corresponding to each circumferential position p1;
[0024] In the frequency spectrum of the axial leakage magnetic sequence at all circumferential positions, the response amplitude of the target noise frequency is first set to zero, and then Fourier inverse transform is performed on the frequency spectrum of the axial leakage magnetic sequence at all circumferential positions to obtain a filtered leakage magnetic signal.
[0025] Preferably, the parameter when the difference between b and a is the largest and b is the largest is recorded as the optimal parameter, and the specific steps include the following:
[0026] An evaluation index of each group of parameters is obtained, and the parameter when the evaluation index is the largest is recorded as the optimal parameter, and the evaluation index is positively correlated with b-a and b.
[0027] Preferably, the target noise frequency that has the most significant influence on the leakage magnetic signal is determined by random sampling and inverse transform experiments in the frequency spectrum of the axial leakage magnetic sequence corresponding to each circumferential position p1, and the specific steps include the following:
[0028] After each execution of D2, a plurality of frequencies are randomly sampled in the frequency spectrum of the axial leakage magnetic sequence corresponding to each circumferential position p1, and after setting the response amplitudes of the sampled frequencies to 0 in the frequency spectrum, inverse transform is performed to obtain an axial leakage magnetic filtering sequence corresponding to each circumferential position p1; when the axial position corresponding to the maximum value in all axial leakage magnetic filtering sequences corresponding to the circumferential positions p1 has the smallest distance from all axial positions p2, the sampled frequency is marked as a noise frequency.
[0029] After performing D2 for a plurality of times, the frequency at which each noise frequency appears is obtained; all noise frequencies appearing frequencies are divided into two parts by using the Otsu threshold segmentation algorithm, and the noise frequency with the largest average value of the appearing frequencies is recorded as the target noise frequency.
[0030] Preferably, the change rate of the leakage magnetic intensity at each axial position is obtained according to the axial leakage magnetic sequence at each circumferential position, and the specific steps include the following:
[0031] The axial leakage magnetic sequence of each circumferential position is Gauss filtered, and for any one axial position in the filtered axial leakage magnetic sequence, a plurality of axial positions closest to the axial position are obtained, and the plurality of axial positions are fitted by using a least square method, and the absolute value of the slope of the straight line obtained by fitting is recorded as the change rate of leakage magnetic intensity at any one axial position.
[0032] Preferably, the parameters of each group include filter type, filter kernel size and double threshold in the Canny edge detection algorithm.
[0033] Another embodiment of the present application provides a pipeline inner wall detection system based on a variable-diameter pipeline robot, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements all steps of the pipeline inner wall detection method based on the variable-diameter pipeline robot when executing the computer program.
[0034] The technical scheme of the present application has the following beneficial effects:
[0035] The present application takes into account that the characteristics of noise or error faced by the magnetic flux leakage sensor and the camera are different, and based on this, the present application fuses the inner wall image collected by the camera and the leakage magnetic signal collected by the magnetic flux leakage sensor, preliminarily determines the first contour of the defect region by using the leakage magnetic signal, and finds the target contour that best matches the first contour in the image domain, and then uses the image gradient information in the target contour to perform adaptive filtering on the leakage magnetic signal; through iterative optimization, the optimal edge detection parameter that can make the correlation (b) between the second contour determined by the filtered leakage magnetic signal and the image contour be improved the most compared with the initial correlation (a) and the value of b be the highest is found. This method effectively overcomes the limitations of single sensor detection, uses the leakage magnetic signal and the inner wall image of two modal data to correct and supplement each other, and finally realizes mutual fusion, thereby reducing the problem of inaccurate defect detection results caused by error or noise, and significantly improving the accuracy and robustness of small defect contour identification. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, brief descriptions will be given below to the drawings needed to be used in the embodiments or prior art descriptions. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative effort.
[0037] Figure 1 The step flow chart of the pipeline inner wall detection method based on the variable-diameter pipeline robot provided by an embodiment of the present application;
[0038] Figure 2A step flow chart of an optimal parameter acquisition process. DETAILED DESCRIPTION
[0039] In order to further clarify the technical means and effects taken by the present application to achieve the predetermined object of the application, the following describes in detail the pipeline inner wall detection method and system based on the variable-diameter pipeline robot according to the present application, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0041] The specific scheme of the pipeline inner wall detection method and system based on the variable-diameter pipeline robot provided by the present application is described in detail below in combination with the accompanying drawings.
[0042] Embodiment one:
[0043] Please refer to Figure 1 which shows a step flow chart of the pipeline inner wall detection method based on the variable-diameter pipeline robot provided by one embodiment of the present application, which includes the following steps:
[0044] Step S1, using the camera and the magnetic flux leakage sensor carried by the variable-diameter pipeline robot to collect the inner wall image of the pipeline and the magnetic flux leakage signal of the pipeline inner wall.
[0045] The variable-diameter pipeline robot adopts an active variable-diameter mechanism, and the radial size adjustment is achieved by driving the parallelogram linkage mechanism through the screw nut. The variable-diameter pipeline robot is a prior art, and this embodiment will not be described in detail. The pipeline in this embodiment refers to a metal inner wall natural gas pipeline.
[0046] A magnetic flux leakage sensor is carried on the rear end of the variable-diameter pipeline robot for collecting magnetic flux leakage signals at different positions of the pipeline inner wall.
[0047] A plurality of (for example, 6) circumferentially uniformly distributed cameras are carried on the front end of the variable-diameter pipeline robot, and the angle of view of each camera is radially oriented, that is, each camera directly faces the pipeline inner wall to collect images (the camera optical axis is parallel to the radial direction of the pipeline), and a ring-shaped LED light source is installed around the camera lens. The image collected by the camera is referred to as an inner wall image. In this embodiment, the inner wall image is a 1024x2048 grayscale image, and when a color image is collected in other embodiments, it is grayed.
[0048] The variable-diameter pipeline robot moves at a constant speed in the pipeline (in this embodiment, at a constant speed of 0.1 meters per second). In this embodiment, in order to save power and reduce data volume, the camera and the magnetic flux leakage sensor work at a small sampling frequency during movement. In this embodiment, the camera collects images at a sampling frequency of 10 Hz, and the magnetic flux leakage sensor collects magnetic flux leakage signals at a sampling frequency of 200 Hz.
[0049] In this embodiment, the purpose of using the magnetic flux leakage sensor is that the magnetic flux leakage sensor can detect small inner wall defects. The purpose of using the camera is that the camera can cover the pipeline with a large field of view, and can capture the overall appearance and contour shape of the pipeline defects, facilitating visualization.
[0050] In step S2, the magnetic flux leakage signals are filtered using the gradient in the inner wall image, and the optimal parameters for edge detection of the inner wall image are obtained using the filtered magnetic flux leakage signals.
[0051] The magnetic flux leakage signals collected by the magnetic flux leakage sensor have noise, which comes from the noise existing in the magnetic flux leakage sensor itself. On the other hand, the robot will vibrate when moving, causing the distance between the magnetic flux leakage sensor and the inner wall of the pipeline to change. This change will significantly change the strength of the magnetic flux leakage signals, and further cause the magnetic flux leakage signals to have noise.
[0052] In this embodiment, the inner wall image is processed using an edge detection algorithm to obtain the contour of the inner wall defect connected domain. The contour acquisition result of the inner wall defect connected domain also has noise or error (especially the contour acquisition error of small defects is larger). This noise and error comes from the noise distribution in the inner wall image, and on the other hand, due to the unreasonable distribution of light, the defect features (such as the edge contour of the defect area) inside the pipeline cannot be captured by the camera. When using an edge detection algorithm with inappropriate parameters for processing, the obtained contour is inaccurate and has errors.
[0053] In summary, due to the existence of errors or noise, the magnetic flux leakage sensor or the camera alone cannot obtain accurate defect detection results.
[0054] It should be noted that this embodiment uses an offline defect detection method to detect the inside of the pipeline, that is, the robot only collects and stores the inner wall image and the magnetic flux leakage signal during movement in the pipeline, but does not perform defect detection. When the robot exits the pipeline (or when the robot moves 100 meters in the pipeline), the stored inner wall image and magnetic flux leakage signal are transmitted to the processor using a data line or an optical fiber for defect detection. The advantage is that subsequent accurate defect detection results are obtained by sacrificing computing efficiency (i.e., computing time).
[0055] Therefore, the subsequent defect detection process in this embodiment uses the stored inner wall image and magnetic flux leakage signal.
[0056] The characteristics of the noise or error faced by the magnetic flux leakage sensor and the camera are different in this step, so the gradient in the inner wall image is used to filter the magnetic flux leakage signal, and the optimal parameters for edge detection of the inner wall image are obtained using the filtered magnetic flux leakage signal.
[0057] Step S3, using the optimal parameters to perform edge detection algorithm on the inner wall image to obtain the pipeline inner wall detection result.
[0058] The characteristics of the noise or error faced by the magnetic flux leakage sensor and the camera are different in the above steps S1-S3, based on which the magnetic flux leakage signal and the inner wall image are used to correct and supplement each other, and finally realize mutual fusion, so as to reduce the problem of inaccurate defect detection result caused by error or noise.
[0059] Further, the embodiment further describes step S2, as shown in Figure 2 The specific steps include:
[0060] Step S201, determining the first contour of the defect area according to the magnetic flux leakage signal.
[0061] (1) It should be noted that the magnetic flux leakage sensor is composed of a circumferentially distributed (along the circumferential direction) Hall sensor array, and each Hall sensor serves as a circumferential position of the pipeline. When the robot drives the magnetic flux leakage sensor to move along the pipeline, each Hall sensor will scan the magnetic flux intensity of each axial position inside the pipeline along the axial direction (i.e. the direction of robot movement); all the magnetic flux intensities of all axial positions obtained by each Hall sensor at all times during the axial scanning process constitute the time sequence collected by each Hall sensor.
[0062] For the time corresponding to the first element in the time sequence, it is recorded as the initial time, and the time corresponding to any element in the time sequence is subtracted from the initial time, and then multiplied by the speed of the robot to obtain the axial position corresponding to any element in the time sequence. At this time, the above time sequence represents the magnetic flux intensity of all axial positions at each circumferential position, and based on this, the time sequence is also recorded as the axial magnetic flux sequence of each circumferential position.
[0063] In summary, the magnetic flux leakage signal refers to the axial magnetic flux sequence obtained by all Hall sensors in the Hall sensor array at all circumferential positions.
[0064] It should be noted that the above decomposes each position inside the pipeline into two components, the circumferential position and the axial position.
[0065] (2) Further, each element (i.e. each leakage magnetic intensity) in the axial leakage magnetic sequence is a three-dimensional vector, having three components: a radial component, an axial component and a circumferential component. This embodiment performs PCA dimension reduction on all three-dimensional vectors in the axial leakage magnetic sequence of all circumferential positions, and reduces the three-dimensional vectors into scalars.
[0066] Up to now, each element in the axial leakage magnetic sequence is a scalar, which is still recorded as leakage magnetic intensity for the convenience of description. The axial leakage magnetic sequence described later is the scalarized axial leakage magnetic sequence after dimension reduction.
[0067] (3) Obtain the first profile of the defect region according to the change rate of the axial leakage magnetic sequence at different circumferential positions.
[0068] The change rate of the axial leakage magnetic sequence refers to the change slope of the leakage magnetic intensity at different axial positions, which is used to describe the fast or slow situation of the change of the leakage magnetic intensity.
[0069] As an example, the method for obtaining the first profile of the defect region according to the change rate of the axial leakage magnetic sequence at different circumferential positions includes:
[0070] For the axial leakage magnetic sequence obtained at each circumferential position; Gaussian filtering is performed on the leakage magnetic intensity in any one axial leakage magnetic sequence using a Gaussian filter kernel with a length of 7. For any axial position in the filtered axial leakage magnetic sequence, the n0 nearest axial positions (including the axial position) to the axial position are obtained, and the n0 axial positions and the filtered leakage magnetic intensity constitute a leakage magnetic intensity change curve with respect to the axial position. The absolute value of the slope of the straight line fitted by the least square method is recorded as the change rate of the leakage magnetic intensity at the axial position. This embodiment takes n0=9 as an example for description.
[0071] The change rate less than 0.1 is set to 0, which aims to ignore the small leakage magnetic change and only focus on the obvious leakage magnetic change.
[0072] Up to now, for the axial leakage magnetic sequence of each circumferential position, a change slope is obtained for each axial position in the axial leakage magnetic sequence.
[0073] The change slopes contained in the axial leakage magnetic sequences of all circumferential positions constitute a leakage magnetic change rate distribution image. The profiles of all defect regions are extracted from the leakage magnetic change rate distribution image, which are recorded as the first profiles.
[0074] The first profile indicates that the leakage magnetic sensor detects a significant state mutation of the leakage magnetic intensity of the inner wall of the pipeline at the first profile, which indicates that the first profile is the edge profile of the defect.
[0075] Step S202, using each set of parameters, the inner wall image is profiled to obtain the target image, all contours of the target image are related to the first contour, and the correlation is denoted as a.
[0076] (1) For any one of the above obtained defect regions, find the inner wall image containing the defect region in all the inner wall images collected by the camera, that is, the image information of the defect region is contained in the inner wall image. The inner wall image described in the subsequent steps refers to the image information of the inner wall image containing the defect region.
[0077] (2) Further, edge detection is performed on the inner wall image to obtain all contours in the inner wall image, and the first contour of the defect region is contained in these contours.
[0078] Considering that during edge detection, due to the influence and limitation of image noise and lighting conditions, inappropriate or constant edge detection parameters cannot further accurately obtain the contour of the defect region in the inner wall image. Therefore, the next step is to obtain suitable edge detection parameters based on the first contour of the defect region.
[0079] In this embodiment, Canny algorithm is used for edge detection. Canny algorithm realizes edge detection through filtering, gradient calculation and edge extraction, and this algorithm is a known technology, and this embodiment will not be described in detail.
[0080] The parameters include the filter used in the Canny edge detection algorithm (including the filter type and the filter kernel size) and the set double threshold (including the high threshold and the low threshold).
[0081] Specifically, a set of parameters (including the filter type, the filter kernel size, the high threshold and the low threshold) is randomly initialized, and the inner wall image is edge detected using the parameters to obtain all edges.
[0082] For a closed edge, it is regarded as a contour. For an unclosed edge, if the Euclidean distance between the two ends of the edge is greater than one fourth of the length of the edge, then the straight line connecting the two ends of the edge is also regarded as a closed contour. If it is not greater than one fourth of the length of the edge, then the edge is regarded as non-existent and is not processed as a contour.
[0083] (3) Calculate the similarity of each contour and the first contour. The similarity is used to describe whether the detected contour in the inner wall image and the first contour detected in the magnetic flux leakage signal have a greater same or similar situation, and the greater the similarity, the more obvious the same or similar situation.
[0084] As an example, the similarity of each contour and the first contour is calculated, including the following methods:
[0085] Each contour in the embodiment and the first contour are two-dimensional geometric figures of a polygonal line. For each geometric figure in each contour and the first contour, a plurality of Hu moments of the geometric figure are obtained, such as 5-order Hu moments including central moments and normalized central moments. All the Hu moments constitute a contour vector.
[0086] The cosine similarity of the contour vector corresponding to each contour and the first contour is denoted as the similarity of each contour and the first contour. For all contours in the inner wall image, the contour with the maximum similarity with the first contour is obtained and denoted as contour L.
[0087] (4) The above (1)-(3) gives a method of obtaining contour L based on the first contour of each defect region. For all first contours of defect regions obtained based on the magnetic flux leakage signal, a contour L is obtained for each first contour according to the method of (1)-(3). All contours L are denoted as target contours, and the maximum similarity corresponding to all first contours is averaged and denoted as correlation a.
[0088] In summary, the target contour is a contour in the image modality with the maximum correlation with the first contour of the defect region in the magnetic flux leakage signal, and the maximum correlation is the obtained a (i.e., the correlation refers to the average of the similarities corresponding to all first contours).
[0089] Step S203, filtering the magnetic flux leakage signal using the gradient of the pixel points in the target contour in the target image.
[0090] It should be noted that the magnetic flux leakage signal contains noise, such as noise caused by robot movement process vibration. In order to eliminate the influence of the noise, the magnetic flux leakage signal is subjected to Gaussian filtering before the first contour is obtained in the above process. The filtered magnetic flux leakage signal loses the details of the defect, but retains the general contour of the defect (i.e., the first contour). Therefore, the above first contour can generally describe the defect shape from the obvious features, but cannot further describe the details of the defect.
[0091] In order to further describe the defect, the embodiment filters the magnetic flux leakage signal using the gradient of the pixel points in the target contour. As an example, the process specifically includes:
[0092] (1) For all target contours obtained in step S202, the gradient amplitude of each pixel point in all target contours is obtained using a Sobel operator, and the maximum value of the gradient amplitude of all pixel points in all target contours is obtained. The pixel point corresponding to the maximum value is denoted as a reference pixel point (including the pixel point on the target contour).
[0093] It should be noted that each of the above target contours is based on a certain inner wall image, i.e., the inner wall image obtained in (1) in step S202, and is further obtained by the Canny algorithm (see step S202 for details). In some embodiments, before obtaining the gradient amplitude of the pixel points, the inner wall image is filtered using the filter in the Canny algorithm, and then the gradient amplitude of each pixel point in the target contour of the inner wall image is obtained using the Sobel operator.
[0094] (2) Randomly sample n1 reference pixel points from all reference pixel points, and project the n1 reference pixel points into the circumferential position p1 and the axial position p2 of the pipeline inner wall. In this embodiment, n1 is 25% (rounded down) of the number of all reference pixel points, and its preferred range is 20% to 40% of the number of all reference pixel points.
[0095] (3) For each circumferential position p1 corresponding to an axial leakage magnetic sequence, the Fourier transform algorithm is used to transform the axial leakage magnetic sequence to obtain a frequency spectrum, wherein the frequency spectrum represents the response amplitude of the leakage magnetic intensity of all axial positions in the axial leakage magnetic sequence at different frequencies. All frequencies in the frequency spectrum are divided into five intervals, and one fourth of the frequencies in each interval are randomly selected (rounded down).
[0096] For all frequency spectra obtained from the axial leakage magnetic sequences of all circumferential positions p1, first set the response amplitudes of the selected frequencies to 0 in all frequency spectra, and then use the inverse Fourier transform algorithm to transform each frequency spectrum to obtain an axial leakage magnetic filtering sequence for each circumferential position p1.
[0097] (4) For the axial leakage magnetic filtering sequence of any circumferential position p1, obtain the axial position corresponding to the maximum value in the axial leakage magnetic filtering sequence, denoted as the target axial position. Among all the axial positions in the axial leakage magnetic sequence of this circumferential position p1, for each axial position p2, obtain the closest distance between all target axial positions and each axial position p2, denoted as the corrected distance of each axial position p2. The average of the corrected distances of all axial positions p2 of this circumferential position p1 is denoted as the filtering index of this circumferential position p1.
[0098] The filtering indices of all circumferential positions p1 are averaged to obtain the average filtering index.
[0099] (5) After repeating (3) to (4) several times (e.g., 10 times), the selected frequency when the average filtering index is the smallest is obtained, and is respectively marked as a noise frequency.
[0100] (6) After repeating (2)~(5) for several times (for example, 20 times), all noise frequencies are obtained, and the frequency of occurrence of each noise frequency (i.e., the number of occurrences of each noise frequency divided by 20) is counted. Using the Otsu threshold segmentation algorithm, the frequency of occurrence of all noise frequencies is divided into two parts. For the part of noise frequencies with the maximum average value of the frequency of occurrence, it is recorded as the target noise frequency.
[0101] The target noise frequency refers to the noise frequency due to the noise existing in the magnetic flux leakage sensor itself and the vibration existing when the robot is moving, which has the most significant impact on the magnetic flux leakage signal, resulting in the magnetic flux leakage signal being unable to further describe the details of the inner wall defect.
[0102] (7) For the frequency spectrum obtained from the axial magnetic flux leakage sequence of all circumferential positions (including all circumferential positions p1), the response amplitude of the target noise frequency in the frequency spectrum is set to 0, and then the Fourier inverse transform algorithm is used to transform each frequency spectrum again to remove the target noise frequency. The axial magnetic flux leakage filtering sequence obtained for all circumferential positions is the filtered magnetic flux leakage signal.
[0103] Step S204, determining a second contour of the defect region according to the filtered magnetic flux leakage signal, and recording the maximum correlation between all contours of the target image and the second contour as b. The image processing parameters with the maximum difference between b and a are used for image processing of the inner wall image.
[0104] According to the method of step S201, the contour of the defect region is determined according to the filtered magnetic flux leakage signal, which is recorded as the second contour. According to the method of step S202, the contour with the maximum correlation with the second contour is obtained, and the maximum correlation here is recorded as b.
[0105] At this point, given a set of parameters (including filter type, filter kernel size, high threshold value, and low threshold value), a maximum correlation a and b are obtained. The parameters with the maximum difference between b and a and the maximum b are recorded as the optimal parameters.
[0106] The maximum difference between b and a indicates that the noise of the magnetic flux leakage signal is obviously removed after filtering the magnetic flux leakage signal using the target contour obtained under the optimal parameters and the pixel point gradient. The maximum b indicates that the target contour obtained under the optimal parameters is close to or consistent with the defect region determined by the magnetic flux leakage signal. The maximum difference between b and a and the maximum b indicate that the combination of the data of the magnetic flux leakage signal and the inner wall image is helpful to obtain more accurate defect detection results.
[0107] Further, the optimal parameters are used to perform edge detection algorithm on the inner wall image to obtain the pipe inner wall detection result according to step S3. The specific steps of the process are as follows:
[0108] The optimal parameters include filter type, filter kernel size, high threshold value and low threshold value in the Canny edge detection algorithm; based on the optimal parameters, edge detection is performed on each inner wall image collected by the camera to obtain all edges, and all connected domains formed by the closed edges are recorded as defect detection results, i.e., the pipeline inner wall detection results, and all defect detection results are displayed on the display screen for the pipeline detection personnel to view.
[0109] Thus far, the implementation ends.
[0110] Embodiment Two
[0111] Step S201 of Embodiment One includes that the change slopes contained in the axial magnetic flux leakage sequences of all circumferential positions constitute a magnetic flux leakage change rate distribution image. The contours of all defect regions are extracted from the magnetic flux leakage change rate distribution image and recorded as first contours. As an example, the process includes:
[0112] For the axial magnetic flux leakage sequence of each circumferential position, each element in the axial magnetic flux leakage sequence represents the magnetic flux leakage intensity of each axial position and corresponds to obtain a change rate.
[0113] All axial positions of all circumferential positions are constructed into an image, recorded as a magnetic flux leakage change rate distribution image. The width (i.e., the number of pixel points in each row) of the magnetic flux leakage change rate distribution image is equal to the number of axial positions corresponding to each circumferential position (i.e., the length of the axial magnetic flux leakage sequence), and the height of the magnetic flux leakage change rate distribution image is equal to the number of all circumferential positions (i.e., the number of Hall sensors in the Hall sensor array described in Embodiment One). Each pixel point in the magnetic flux leakage change rate distribution image corresponds to each axial position of each circumferential position.
[0114] The gray value of each pixel point in the magnetic flux leakage change rate distribution image is set as the change rate of each axial position of each circumferential position, the gray values of all pixel points in the magnetic flux leakage change rate distribution image are linearly normalized, the normalized magnetic flux leakage change rate distribution image is subjected to edge detection by using the Canny edge detection algorithm to obtain all edges, all closed edges are retained, the connected domain surrounded by the closed edges is taken as a defect region, and the closed edges are taken as first contours.
[0115] It should be noted that the noise or error interference (such as camera noise and light interference) existing in the inner wall image does not exist in the magnetic flux leakage rate distribution image, or the approximate obvious features of the pipe inner wall defects can be captured indirectly by the magnetic flux leakage rate distribution image, so the parameters of the Canny edge detection algorithm here will not affect the acquisition result of the first contour. In this embodiment, no filtering is performed in the Canny edge detection algorithm, and the preferred value range of the high threshold is [0.8, 1], and the preferred value range of the low threshold is [0, 0.3]. This embodiment takes 0.85 and 0.23 as the high threshold and the low threshold, respectively, as an example for description.
[0116] Further, it should be noted that the first contour obtained in this embodiment is stretched compared to each contour obtained from the inner wall image in Embodiment One, resulting in inaccurate similarity as described in Embodiment One. At this time, for each contour and the corresponding geometric figure of the first contour, a bounding box algorithm is used to obtain the rectangular bounding box of the two geometric figures, which are represented as F1 (the bounding box of each contour) and F2 (the bounding box of the first contour). F2 is translated so that the top left corner of F1 and F2 coincides. A two-dimensional coordinate system is constructed with the top left corner as the coordinate origin, the horizontal coordinate axis parallel to the bottom edge of F1, and the vertical coordinate axis parallel to the side edge of F1. The unit length of the horizontal coordinate axis is equal to the width of the unit pixel (i.e., equal to 1), and the unit length of the vertical coordinate axis is equal to the height of the unit pixel (i.e., equal to 1).
[0117] At this point, the geometric figures corresponding to each contour and the first contour, as well as F1 and F2, are represented in the two-dimensional coordinate system. Then a scaling matrix is solved to obtain rectangular F2 by scaling and transforming rectangular F1 using the scaling matrix. Solving the scaling matrix and performing scaling transformation are known geometric knowledge, and this embodiment will not be described in detail. Further, the geometric figure corresponding to each contour is scaled and transformed using the solved scaling matrix, and then the similarity between the scaled and transformed geometric figure and the geometric figure corresponding to the first contour is obtained using the method in Embodiment One, as the similarity between each contour and the first contour.
[0118] In summary, this embodiment only focuses on the edge features (such as edge curvature or turning features) in each contour and the first contour. Due to the use of scaling transformation and Hu matrix techniques, the stretching, scaling, and rotation translation of the contour shape are not considered.
[0119] Step S203 of Embodiment One includes projecting the n1 reference pixel points to the circumferential position p1 and the axial position p2 of the pipe inner wall. As an example, the method includes:
[0120] For any one of the n1 reference pixel points, for the target contour where the reference pixel point is located, the target contour corresponds to a first contour with the maximum similarity, the target contour and the first contour are represented in the two-dimensional coordinate system by using the above method, and a scaling matrix is obtained, and the reference pixel point is also represented in the two-dimensional coordinate system, and the corresponding coordinates of the reference pixel point in the coordinate system are: the pixel coordinates of the reference pixel point in the inner wall image minus the pixel coordinates of the vertex at the lower left corner of F1 in the inner wall image. The coordinates of the reference pixel point in the coordinate system are transformed by using the scaling matrix to obtain transformed coordinates v1 (v1 is rounded to an integer in each dimension). The vertex at the lower left corner of F2 (before translation) also corresponds to a pixel point in the magnetic flux leakage rate distribution image, and the coordinates of the pixel point in the magnetic flux leakage rate distribution image are v2, and the pixel point at v1+v2-v3 in the magnetic flux leakage rate distribution image is obtained, and the circumferential position and the axial position corresponding to the pixel point are p1 and p2 respectively, wherein v3 represents the displacement vector of F2 in the magnetic flux leakage rate distribution image when the vertex at the lower left corner of F1 and F2 is coincided by translating F2.
[0121] The above are all known knowledge of geometric transformation, and the embodiment will not be described in detail.
[0122] In particular, in some embodiments, if the area of the connected domain surrounded by a certain target contour is greater than 15% of the total area of the inner wall image, it indicates that the area of the target contour is large. Since the inner wall of the pipeline is a curved surface, there may be deformation on the inner wall image, and the embodiment does not focus on the error of the large-area defect. Based on this, the target contour is considered to be non-existent and does not participate in the process of magnetic flux leakage signal filtering.
[0123] Step S202 of the first embodiment includes: finding an inner wall image containing the defect region from all inner wall images collected by the camera. As an example, the process specifically includes:
[0124] For any one defect region, the first contour of the defect region is composed of a plurality of circumferential positions and axial positions. As known from (1) of step S201, each axial position corresponds to a time, and the average time of all axial positions of the first contour is taken as the time T when the defect region is observed.
[0125] The axial distance L from the camera optical center position to the magnetic flux leakage sensor is measured, L is divided by the robot motion speed to obtain the time t, and the inner wall image collected by the camera at time T-t is obtained, which contains the defect region.
[0126] Step S202 of the first embodiment includes: randomly initializing a set of parameters. Specifically:
[0127] Each group of parameters includes filter type, filter kernel size, high threshold value and low threshold value. As an example, the filter type has a value range of {Gaussian filter, mean filter, minimum filter}; the filter kernel size has a value range of {3, 5, 7, 9}; the high threshold value has a value range of {100, 130, 160, 190}; and the low threshold value has a value range of {20, 40, 60, 90}.
[0128] A group of parameters is randomly combined from the above value range as initial parameters.
[0129] In other embodiments, gamma transformation is performed on the inner wall image before Canny edge detection, and at this time, each group of parameters further includes a gamma coefficient of gamma transformation, which has a value range of {0.8, 1, 1.2}.
[0130] Step S204 of Embodiment One includes obtaining parameters when b is maximum and the difference between b and a is maximum, denoted as optimal parameters. As an example, it specifically includes:
[0131] b×(b-a) is used as an evaluation index of each group of parameters, and a group of parameters with the maximum evaluation index is obtained from all parameters combined from the above value range, which is used as the optimal parameters. In other embodiments, the particle swarm optimization algorithm can also be used to obtain parameters with the maximum evaluation index, which is used as the optimal parameters.
[0132] Embodiment Three:
[0133] In this embodiment, the variable-diameter pipeline robot adopts an active variable-diameter mechanism to adapt to different diameters of natural gas pipelines.
[0134] In an example, the magnetic flux leakage sensor also adopts an active variable-diameter mechanism (or an electric push rod) to change the distance between the magnetic flux leakage sensor and the inside of the pipeline. For example, in this embodiment, there are multiple groups of magnetic flux leakage sensors (the number of groups of magnetic flux leakage sensors is the same as the number of cameras, both of which are 6), each group of magnetic flux leakage sensors controls the distance between each group of magnetic flux leakage sensors and the inner wall of the pipeline through a variable-diameter mechanism (or an electric push rod), each group of magnetic flux leakage sensors includes a circumferentially distributed (distributed along the circumference) Hall sensor array, and in addition, each group of magnetic flux leakage sensors is aligned with the center of each camera, that is, the Hall sensor in the middle of the Hall sensor array is in the same pipeline axial plane as the optical axis of each camera; in this embodiment, the distance between the Hall sensor in the middle of the Hall sensor array and the inner wall of the pipeline is set to 6 mm. Any group of magnetic flux leakage sensors and its corresponding camera together implement all the methods of Embodiment One described above; for different magnetic flux leakage sensors and their corresponding cameras, all the methods of Embodiment One described above are implemented independently, thereby realizing 360° defect detection inside the pipeline.
[0135] Since the variable-diameter pipeline robot and the variable-diameter mechanism of the magnetic flux leakage sensor are prior art, the embodiments will not be described in detail. For example, the long-distance pipeline defect magnetic flux leakage detection device disclosed in CN219675907U includes the technical means of combining the variable-diameter pipeline robot and the variable-diameter mechanism of the magnetic flux leakage sensor.
[0136] In other embodiments, for straight pipelines with a constant inner wall diameter, each group of magnetic flux leakage sensors does not use a variable-diameter mechanism, but uses a fixed bracket to fix each group of magnetic flux leakage sensors on the robot, so that the distance between the Hall sensor array of each group of magnetic flux leakage sensors and the inner wall of the pipeline is kept at 6 mm. When detecting pipelines with other diameters, only the fixed bracket of each group of magnetic flux leakage sensors needs to be replaced. The advantage is that the structure is simple and the detection cost is low.
[0137] Embodiment four:
[0138] The present embodiment provides a pipeline inner wall detection system based on a variable-diameter pipeline robot, which includes a camera and a magnetic flux leakage sensor, and a solid state disk for storing the inner wall images and magnetic flux leakage signals collected by the camera and the magnetic flux leakage sensor; the system also includes a computer program storage and a processor for running the computer program, when the computer program is running, the inner wall images and magnetic flux leakage signals stored in the solid state disk are read through a data line or an optical fiber, and all the steps of all the above embodiments are run. The system also includes a display screen connected to the processor through a data line, and the defect detection results obtained after the processor runs the computer program are displayed on the display screen.
[0139] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for detecting the inner wall of a pipe based on a variable-diameter pipe robot, characterized in that, The method includes the following steps: The system uses a camera to capture images of the inner wall of the pipe and a magnetic flux leakage sensor to collect magnetic flux leakage signals from the inner wall of the pipe. The magnetic flux leakage signals represent the axial magnetic flux leakage sequence composed of magnetic flux leakage intensities at different axial positions under each circumferential position in the inner wall of the pipe. The first contour of all defect regions is determined based on the magnetic flux leakage signal; Edge detection is performed on the acquired inner wall image using each set of parameters. The contour with the highest correlation to all first contours among all contours obtained by edge detection is marked as the target contour, and the highest correlation is denoted as a. The magnetic flux leakage signal is filtered using the gradient of the pixels within the target contour. The second contour of all defect areas is determined based on the filtered magnetic flux leakage signal. For the contour with the highest correlation to all second contours among all contours obtained by edge detection, the highest correlation is denoted as b. The parameter at which the difference between b and a is the largest and b is the largest is recorded as the optimal parameter. The optimal parameter is used to detect all defects in the image. The process of performing edge detection on the acquired inner wall image using each set of parameters, and marking the contour with the highest correlation to all first contours among all edge detection contours as the target contour, denoted as 'a', includes the following specific steps: For the first contour of each defect area, the inner wall image containing image information of each defect area is determined based on the robot's movement speed and the axial distance between the camera and the magnetic flux leakage sensor. The inner wall image is processed using the Canny edge detection algorithm under each set of parameters to obtain all contours; the similarity between each contour and the first contour of each defect region is calculated; the contour with the greatest similarity to the first contour of each defect region is marked as the target contour of each defect region under each set of parameters. Calculate the average of the maximum similarity corresponding to all defective regions, and denote this average as the maximum correlation, denoted as a; The specific steps involved in filtering the magnetic leakage signal using the gradient of pixels within the target contour are as follows: D1: Use the Sobel operator to calculate the gradient magnitude of all pixels within the target contour, and mark the pixel corresponding to the maximum gradient magnitude as the reference pixel. D2: Randomly sample a set proportion of reference pixels from all reference pixels; project each sampled reference pixel onto the circumferential position p1 and axial position p2 of the inner wall of the pipe; perform a Fourier transform on the axial leakage magnetic field sequence corresponding to each circumferential position p1 to obtain the spectrum of the axial leakage magnetic field sequence. D3: For the spectrum of the axial leakage magnetic field sequence corresponding to each circumferential position p1, the target noise frequency that has the most significant impact on the leakage magnetic field signal is determined by several random sampling and inverse transformation experiments within the spectrum. In the spectrum of the axial leakage magnetic field sequence at all circumferential positions, the response amplitude of the target noise frequency is first set to zero, and then an inverse Fourier transform is performed on the spectrum of the axial leakage magnetic field sequence at all circumferential positions to obtain the filtered leakage magnetic field signal.
2. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 1, characterized in that, The specific steps involved in determining the first contour of all defect regions based on the magnetic flux leakage signal are as follows: The rate of change of leakage magnetic intensity at each axial position is obtained based on the axial leakage magnetic flux sequence at each circumferential position; the rate of change obtained at all axial positions at all circumferential positions constitutes a leakage magnetic flux change rate distribution image; the connected region enclosed by the closed edges in the leakage magnetic flux change rate distribution image is determined as the defect region, and the closed edges are taken as the first contour.
3. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 1, characterized in that, The specific steps involved in calculating the similarity between each contour and the first contour of each defect region are as follows: For each contour, a scaling transformation is performed such that the bounding box of each scaled contour is aligned with the bounding box of the first contour. Then, the cosine similarity between the Hu moment of each scaled contour and the Hu moment of the first contour is calculated as the similarity between each contour and the first contour.
4. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 1, characterized in that, The parameter that maximizes the difference between b and a, and when b is at its maximum, is denoted as the optimal parameter. The specific steps involved are as follows: The evaluation index for each set of parameters is obtained, and the parameter with the maximum evaluation index is recorded as the optimal parameter. The evaluation index is positively correlated with ba and also positively correlated with b.
5. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 1, characterized in that, For the spectrum of the axial leakage magnetic field sequence corresponding to each circumferential position p1, the target noise frequency that has the most significant impact on the leakage magnetic field signal is determined through several random sampling and inverse transformation experiments within the spectrum. The specific steps include the following: After each execution of D2, several frequencies are randomly sampled from the spectrum of the axial leakage magnetic flux sequence corresponding to each circumferential position p1. The response amplitude of the sampled frequencies in the spectrum is set to 0 and then inversely transformed to obtain the axial leakage magnetic flux filtering sequence corresponding to each circumferential position p1. When the axial position corresponding to the maximum value in all the axial leakage magnetic flux filtering sequences corresponding to all the circumferential positions p1 has the minimum distance from all the axial positions p2, the sampled frequency is marked as the noise frequency. After executing D2 several times, the frequency of each noise frequency is obtained; using the Otsu threshold segmentation algorithm, the frequencies of all noise frequencies are divided into two parts, and the noise frequency with the largest average value is recorded as the target noise frequency.
6. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 2, characterized in that, The specific steps for obtaining the rate of change of leakage magnetic intensity at each axial position based on the axial leakage magnetic sequence at each circumferential position are as follows: Gaussian filtering is applied to the axial leakage magnetic field sequence at each circumferential position. For any axial position in the filtered axial leakage magnetic field sequence, several axial positions closest to that axial position are obtained. The least squares method is used to fit the several axial positions. The absolute value of the slope of the fitted line is recorded as the rate of change of leakage magnetic field intensity at any axial position.
7. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 6, characterized in that, Each set of parameters includes the filter type, filter kernel size, and dual thresholds in the Canny edge detection algorithm.
8. A pipe inner wall inspection system based on a variable-diameter pipe robot, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor runs the computer program, it implements all the steps of the pipe inner wall inspection method based on a variable diameter pipe robot as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Elevator steel wire rope defect detection device and method combining AR coding and magnetic flux leakage
CN120589564A
Defect magnetic flux leakage detection device for long-distance pipeline
CN219675907U