Pipeline inner wall detection method and system based on variable-diameter pipeline robot
By combining data fusion methods from cameras and magnetic flux leakage sensors, and using image gradient information to adaptively filter the magnetic flux leakage signal, the problem of insufficient accuracy and reliability in pipeline inner wall detection in existing technologies is solved, and efficient identification of small defects is achieved.
Patent Information
- Application Number
- CN202610031175.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-12
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2046-01-12
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, which combines data acquisition with cameras and magnetic flux leakage sensors. By fusing magnetic flux leakage signals and inner wall images, the magnetic flux leakage signals are adaptively filtered using image gradient information, and edge detection parameters are iteratively optimized to improve the accuracy and robustness of defect identification.
It effectively overcomes the limitations of single-sensor detection, significantly improves the accuracy and robustness of small defect contour recognition, and achieves efficient and accurate results for pipeline inner wall detection.
Smart Images

Figure CN121499644A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of pipeline electromagnetic detection, 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, 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] The existing pipeline inner wall detection method based on a robot still faces 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 running vibration, resulting in low signal-to-noise ratio and difficulty in directly presenting the geometric morphology of defects; methods relying only on visual sensors (such as cameras) are easily affected by uneven lighting inside the pipeline, camera noise and other factors, and have low recognition rate for small or surface defects without obvious changes.
[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: One embodiment of the present application provides a pipeline inner wall detection method based on a variable-diameter pipeline robot, which comprises the following steps: Using a camera to collect the inner wall image of the pipeline and using a magnetic flux leakage sensor to collect the magnetic flux leakage signal of the inner wall of the pipeline; the magnetic flux leakage signal represents an axial magnetic flux leakage sequence composed of the magnetic flux leakage intensity of different axial positions under each circumferential position of the inner wall of the pipeline; Determining the first profile of all defect regions according to the magnetic flux leakage signal; Using each set of parameters to perform edge detection on the collected inner wall image, marking the profile with the maximum correlation with all first profiles among all profiles obtained by edge detection as a target profile, recording the maximum correlation as a, and filtering the magnetic flux leakage signal using the gradient of the pixel points in the target profile; determining the second profile of all defect regions according to the filtered magnetic flux leakage signal, and recording the maximum correlation in the profile with the maximum correlation with all second profiles among all profiles obtained by edge detection as b; When the difference between b and a is maximum and b is maximum, the parameters are recorded as optimal parameters, and all defects in the image are detected using the optimal parameters.
[0007] Preferably, the first contour of each defect region is determined according to the magnetic flux leakage signal, and the specific steps include the following: 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 circumferential positions and all axial 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.
[0008] Preferably, the edge detection is performed on the collected inner wall image using each set of parameters, and the contour with the maximum correlation with all the first contours among all the contours obtained by the edge detection is marked as a target contour, and the maximum correlation is denoted as a, and the specific steps include the following: 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; The inner wall image is processed using the Canny edge detection algorithm under each set of parameters to obtain all the contours; the similarity of each contour to the first contour of each defect region is calculated; and among all the contours, the contour with the maximum similarity to the first contour of each defect region is marked as the target contour of each defect region under each set of parameters. The average value of the maximum similarities corresponding to all the defect regions is calculated, and the average value is denoted as the maximum correlation and denoted as a.
[0009] Preferably, the similarity of each contour to the first contour of each defect region is calculated, and the specific steps include the following: Each contour is subjected to a scaling transformation so that the rectangular bounding box of each contour after the 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 the scaling transformation to the Hu moment of the first contour is calculated as the similarity of each contour to the first contour.
[0010] Preferably, the magnetic flux leakage signal is filtered using the gradients of the pixel points in the target contour, and the specific steps include the following: D1: The gradient amplitudes of all pixel points in the target contour are calculated using a Sobel operator, and the pixel point corresponding to the maximum gradient amplitude is marked as a reference pixel point; D2: A set proportion of reference pixel points is randomly sampled from all the reference pixel points; each reference pixel point sampled is projected to a circumferential position p1 and an axial position p2 of the inner wall of the pipeline; for each axial magnetic flux leakage sequence corresponding to the circumferential position p1, a Fourier transform is performed to obtain the frequency spectrum of the axial magnetic flux leakage 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.
[0011] Preferably, the parameter when the difference between b and a is greatest and b is at its maximum is recorded as the optimal parameter, and the specific steps include the following: 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.
[0012] Preferably, the specific steps for determining the target noise frequency that has the most significant impact on the leakage magnetic signal by performing several random sampling and inverse transformation experiments within the spectrum of the axial leakage magnetic sequence corresponding to each circumferential position p1 are as follows: 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.
[0013] Preferably, the specific steps for obtaining the rate of change of leakage magnetic field intensity at each axial position based on the axial leakage magnetic field 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.
[0014] Preferably, each set of parameters includes the filter type, filter kernel size, and dual threshold in the Canny edge detection algorithm.
[0015] Another embodiment of the present invention provides a pipe inner wall inspection system based on a variable diameter pipe robot. The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor runs the computer program, it implements all the steps of the above-described pipe inner wall inspection method based on a variable diameter pipe robot.
[0016] The beneficial effects of the technical solution of the present invention are: This invention takes into account the different characteristics of noise or error faced by magnetic flux leakage sensors and cameras. Based on this, this invention fuses the inner wall image acquired by the camera with the magnetic flux leakage signal acquired by the magnetic flux leakage sensor. The magnetic flux leakage signal is used to initially determine the first contour of the defect region, and based on this, the best-matching target contour is found in the image domain. Then, the image gradient information within the target contour is used to adaptively filter the magnetic flux leakage signal. Through iterative optimization, the optimal edge detection parameters are found that maximize the improvement in the correlation (b) between the second contour determined by the filtered magnetic flux leakage signal and the image contour compared to the initial correlation (a), and also achieve the highest b value. This method effectively overcomes the limitations of single-sensor detection, using two modal data—magnetic flux leakage signal and inner wall image—to mutually correct and complement each other, ultimately achieving mutual fusion. This reduces the problem of inaccurate defect detection results caused by errors or noise, and significantly improves the accuracy and robustness of small defect contour recognition. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the steps of a pipe inner wall inspection method based on a variable diameter pipe robot according to an embodiment of the present invention. Figure 2 A flowchart illustrating the steps involved in obtaining the optimal parameters. Detailed Implementation
[0019] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of the pipe inner wall inspection method and system based on a variable-diameter pipe robot proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0020] 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 invention pertains.
[0021] The following description, in conjunction with the accompanying drawings, details the specific scheme of the pipe inner wall inspection method and system based on a variable diameter pipe robot provided by this invention.
[0022] Example 1: Please see Figure 1 The diagram illustrates a flowchart of a pipe inner wall inspection method based on a variable diameter pipe robot according to an embodiment of the present invention. The method includes the following steps: Step S1: Use the camera and magnetic flux leakage sensor mounted on the variable diameter pipe robot to collect images of the inner wall of the pipe and the magnetic flux leakage signal of the inner wall of the pipe.
[0023] The variable-diameter pipeline robot employs an active diameter-changing mechanism, using a lead screw and nut to drive a parallelogram linkage mechanism to achieve radial dimension adjustment. Variable-diameter pipeline robots are existing technology, and this embodiment will not elaborate further on them. In this embodiment, the pipeline refers to a natural gas pipeline with a metal inner wall.
[0024] A magnetic flux leakage sensor is mounted on the rear end of the variable diameter pipe robot to collect magnetic flux leakage signals at different locations on the inner wall of the pipe.
[0025] A number of cameras (e.g., 6) are evenly distributed circumferentially at the front end of a variable-diameter pipe robot. Each camera has a radial viewing angle, meaning each camera directly faces the inner wall of the pipe to capture images (the camera's optical axis is parallel to the pipe's radial direction). A ring-shaped LED light source is installed around the camera lens. The images captured by the cameras are recorded as the inner wall images. In this embodiment, the inner wall image is a 1024×2048 grayscale image; in other embodiments, when a color image is captured, it is converted to grayscale.
[0026] The variable-diameter pipe robot moves at a constant speed inside the pipe (in this embodiment, it moves at a constant speed of 0.1 meters per second). In order to save power and reduce data volume, the camera and magnetic flux leakage sensor operate at a low sampling frequency during the 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.
[0027] The purpose of using a magnetic flux leakage sensor in this embodiment is that it can detect minute internal wall defects. The purpose of using a magnetic flux leakage camera is that the camera can cover the pipe with a large field of view, capture the full picture and outline shape of pipe defects, and facilitate visualization.
[0028] Step S2: Filter the magnetic flux leakage signal using the gradient in the inner wall image, and obtain the optimal parameters for edge detection of the inner wall image using the filtered magnetic flux leakage signal.
[0029] The magnetic flux leakage signal collected by the magnetic flux leakage sensor contains noise, which comes from the noise inherent in the magnetic flux leakage sensor itself. On the other hand, the robot will vibrate when it moves, which will cause the distance between the magnetic flux leakage sensor and the inner wall of the pipe to change. This change will significantly change the strength of the magnetic flux leakage signal, thus causing the magnetic flux leakage signal to contain noise.
[0030] This embodiment uses an edge detection algorithm to process the inner wall image, thereby obtaining the contour of the connected domain of the inner wall defect. However, the contour acquisition result of the connected domain of the inner wall defect also contains noise or errors (especially the contour acquisition error of the contour of small defects is relatively large). This noise and error comes from the noise distribution in the inner wall image on the one hand, and on the other hand, due to unreasonable lighting distribution, the defect features inside the pipe (such as the edge contour of the defect area) cannot be clearly captured by the camera. When an edge detection algorithm with unsuitable parameters is used for processing, the obtained contour is inaccurate and contains errors.
[0031] In summary, the presence of errors or noise means that accurate defect detection results cannot be obtained by using a magnetic flux leakage sensor or camera alone.
[0032] It should be noted that this embodiment employs an offline defect detection method to inspect the inside of the pipe. That is, while the robot moves within the pipe, it only collects and stores images of the inner wall and magnetic flux leakage signals, but does not perform defect detection. After the robot exits the pipe (or after the robot has moved 100 meters within the pipe), the stored images of the inner wall and magnetic flux leakage signals are transmitted to the processor via data cable or fiber optic cable for defect detection. Its advantage lies in sacrificing computational efficiency (i.e., computation time) to obtain accurate defect detection results.
[0033] Therefore, in this embodiment, the subsequent defect detection process utilizes the stored inner wall image and magnetic leakage signal.
[0034] In this step, considering that the characteristics of noise or error faced by the magnetic flux leakage sensor and the camera are different, 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 by using the filtered magnetic flux leakage signal.
[0035] Step S3: Use the optimal parameters to perform an edge detection algorithm on the inner wall image to obtain the detection results of the inner wall of the pipe.
[0036] In steps S1 to S3 above, considering that the characteristics of noise or error faced by the magnetic flux leakage sensor and the camera are different, based on this, the two modal data of magnetic flux leakage signal and inner wall image are used to correct and complement each other, and finally achieve mutual fusion, thereby reducing the problem of inaccurate defect detection results caused by error or noise.
[0037] Furthermore, this embodiment will further describe step S2, as follows: Figure 2 As shown, the specific steps included are as follows: Step S201: Determine the first contour of the defect region based on the magnetic flux leakage signal.
[0038] (1) It should be noted that the magnetic flux leakage sensor is composed of a Hall sensor array distributed circumferentially (distributed along the circumference). Each Hall sensor serves as a circumferential position of the pipe. When the robot moves the magnetic flux leakage sensor along the pipe, each Hall sensor will scan the magnetic flux leakage intensity at each axial position inside the pipe along the axial direction (i.e., the direction of robot movement). During the axial scanning process, the magnetic flux leakage intensity at all axial positions obtained by each Hall sensor at all times constitutes the time sequence collected by each Hall sensor.
[0039] The time corresponding to the first element in the time sequence is denoted as the initial time. The time corresponding to any element in the time sequence is subtracted from the initial time and then multiplied by the robot's movement speed to obtain the axial position corresponding to any element in the time sequence. At this time, the above time sequence represents the leakage magnetic field intensity of all axial positions under each circumferential position. Based on this, the time sequence is also denoted as the axial leakage magnetic field sequence of each circumferential position.
[0040] In summary, the leakage magnetic signal refers to the axial leakage magnetic sequence obtained by all Hall sensors in the Hall sensor array at all circumferential positions.
[0041] It should be noted that the above decomposes each position inside the pipe into two components: circumferential position and axial position.
[0042] (2) Furthermore, each element in the axial leakage magnetic flux sequence (i.e., each leakage magnetic flux intensity) is a three-dimensional vector with three components: radial component, axial component, and circumferential component. In this embodiment, all three-dimensional vectors in the axial leakage magnetic flux sequence at all circumferential positions are reduced to scalars using PCA.
[0043] Thus far, each element in the axial leakage magnetic field sequence is a scalar. For ease of description, this scalar will still be referred to as leakage magnetic field strength. The axial leakage magnetic field sequences described later are all scalarized axial leakage magnetic field sequences after dimensionality reduction.
[0044] (3) Obtain the first contour of the defect region based on the rate of change of the axial leakage magnetic flux sequence at different circumferential positions.
[0045] The rate of change of the axial leakage magnetic flux sequence refers to the slope of the change of leakage magnetic flux intensity at different axial positions, which is used to describe how fast the leakage magnetic flux intensity changes.
[0046] As an example, the method for obtaining the first contour of the defect region based on the rate of change of the axial leakage magnetic flux sequence at different circumferential positions includes: For the axial flux leakage sequences obtained at all circumferential positions, a Gaussian filter kernel of length 7 is used to perform Gaussian filtering on the flux leakage intensity in any axial flux leakage sequence. For any axial position in the filtered axial flux leakage sequence, the n0 nearest axial positions (including the axial position) are obtained. These n0 axial positions and the filtered flux leakage intensity constitute a curve of flux leakage intensity versus axial position. The curve is fitted using the least squares method, and the absolute value of the slope of the fitted straight line is denoted as the rate of change of flux leakage intensity at that axial position. This embodiment uses n0=9 as an example for description.
[0047] Setting a change rate less than 0.1 to 0 aims to ignore minute changes in leakage flux and focus only on significant changes in leakage flux.
[0048] Thus, for each circumferential position of the axial leakage magnetic field sequence, each axial position in the axial leakage magnetic field sequence corresponds to a change slope.
[0049] The slope of the axial flux leakage sequence at all circumferential positions constitutes a flux leakage rate distribution image. The contours of all defect regions are extracted from the flux leakage rate distribution image and denoted as the first contour.
[0050] The first profile indicates that the magnetic flux leakage sensor detected a significant change in the magnetic flux leakage intensity of the inner wall of the pipe at the first profile, indicating that the first profile is the edge profile of the defect.
[0051] Step S202: Using each set of parameters, the inner wall image is extracted to obtain the target image. The contour with the highest correlation to the first contour among all contours in the target image is denoted as the target contour of each image processing parameter, and the correlation is denoted as a.
[0052] (1) For any defective region obtained above, find the inner wall image that contains the defective region among all the inner wall images captured by the camera, that is, the inner wall image that contains the image information of the defective region. The inner wall images mentioned in this step refer to the inner wall images that contain the image information of the defective region.
[0053] (2) Further, edge detection is performed on the inner wall image to obtain all contours in the inner wall image, which contain the first contour of the defect area.
[0054] Considering that image noise and lighting conditions can limit edge detection accuracy, inappropriate or constant edge detection parameters may fail to accurately capture the contour of the defect region within the inner wall image. Therefore, it is necessary to obtain suitable edge detection parameters based on the initial contour of the defect region.
[0055] This embodiment uses the Canny algorithm for edge detection. The Canny algorithm achieves edge detection through filtering, gradient calculation, and edge extraction. This algorithm is a well-known technology and will not be described in detail in this embodiment.
[0056] The parameters include the filters used in the Canny edge detection algorithm (including filter type and filter kernel size) and the set dual thresholds (including high threshold and low threshold).
[0057] Specifically, a set of parameters (including filter type, filter kernel size, high threshold, and low threshold) are randomly initialized, and these parameters are used to perform edge detection on the inner wall image to obtain all edges.
[0058] For closed edges, treat them as contours; for unclosed edges, if the Euclidean distance between the two ends of the edge is greater than one-quarter of the edge length, then connect the two ends of the edge with a straight line to treat it as a closed contour. If the distance is not greater than one-quarter of the edge length, then the edge is considered non-existent and is not treated as a contour.
[0059] (3) Calculate the similarity between each contour and the first contour. The similarity is used to describe whether the contour detected in the inner wall image has a large degree of similarity to the first contour detected in the magnetic flux leakage signal. The greater the similarity, the more obvious the similarity.
[0060] As an example, the similarity between each contour and the first contour is calculated using the following methods: In this embodiment, each contour and the first contour are two-dimensional geometric figures of polygons. For any geometric figure in each contour and the first contour, several Hu moments of the geometric figure are obtained, such as the fifth Hu moment including the central moment and the normalized central moment. All Hu moments constitute a contour vector.
[0061] The cosine similarity between the contour vectors corresponding to each contour and the first contour is denoted as the similarity between each contour and the first contour. For all contours in the inner wall image, the contour with the maximum similarity to the first contour is obtained, denoted as contour L.
[0062] (4) The above (1) to (3) give the method of obtaining contour L based on the first contour of each defect region. For the first contour of all defect regions obtained based on the leakage magnetic signal, a contour L is obtained for each first contour according to the above (1) to (3). All contours L are marked as target contours. The average value of the maximum similarity corresponding to all first contours is calculated and denoted as correlation a.
[0063] In summary, the target contour is the contour in the image mode that has the greatest correlation with the first contour of the defect region in the magnetic flux leakage signal. The greatest correlation is the obtained a (that is, the correlation refers to the mean of the similarity corresponding to all first contours).
[0064] Step S203: Filter the magnetic leakage signal using the gradient of the pixels within the target contour in the target image.
[0065] It should be noted that the magnetic flux leakage signal contains noise, such as noise caused by vibration during robot movement. In order to eliminate the influence of this noise in the above process, the magnetic flux leakage signal was Gaussian filtered before obtaining the first contour. 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, although the first contour can roughly describe the shape of the defect from obvious features, it cannot further describe the details of the defect.
[0066] To further describe the defect, this embodiment uses the gradient of pixels within the target contour to filter the magnetic flux leakage signal. As an example, this process specifically includes: (1) For all target contours obtained in step S202, the gradient magnitude of each pixel in all target contours is obtained by using the Sobel operator, and the maximum value of the gradient magnitude of all pixels in all target contours is obtained. The pixel corresponding to the maximum value is recorded as the reference pixel (including the pixel on the target contour).
[0067] It should be noted that each of the above target contours is based on a certain inner wall image, that is, the inner wall image obtained in step S202 (1), which is further obtained by the Canny algorithm (see step S202 for details). In some embodiments, before obtaining the gradient magnitude of the pixel in this step, the inner wall image is first filtered by the filter in the Canny algorithm, and then the gradient magnitude of each pixel in the target contour in the inner wall image is obtained by the Sobel operator.
[0068] (2) Randomly sample n1 reference pixels from all reference pixels, and project the n1 reference pixels to the circumferential position p1 and axial position p2 of the inner wall of the pipe. In this embodiment, n1 is 25% (rounded down) of the total number of reference pixels, and its preferred range is 20% to 40% of the total number of reference pixels.
[0069] (3) For each circumferential position p1, the axial leakage magnetic field sequence is transformed using the Fourier transform algorithm to obtain the spectrum, which represents the response amplitude of the leakage magnetic field intensity at different frequencies for all axial positions in the axial leakage magnetic field sequence. All frequencies in the spectrum are divided into five equal intervals, and a quarter frequency is randomly selected in each interval (rounded down).
[0070] For all the spectra obtained from the axial leakage magnetic flux sequences at all circumferential positions p1, firstly, the response amplitude of the selected frequencies is set to 0 in all spectra, and then the inverse Fourier transform algorithm is used to transform each spectrum to obtain the axial leakage magnetic flux filtering sequence for each circumferential position p1.
[0071] (4) For any axial leakage magnetic filtering sequence at a circumferential position p1, obtain the axial position corresponding to the maximum value in the axial leakage magnetic filtering sequence, and denote it as the target axial position. Among all axial positions in the axial leakage magnetic filtering sequence at the circumferential position p1, for each axial position p2, obtain the shortest distance between all target axial positions and each axial position p2, and denote it as the correction distance of each axial position p2. The average of the correction distances of all axial positions p2 at the circumferential position p1 is denoteed as the filtering index of the circumferential position p1.
[0072] The average filtering index is obtained by averaging the filtering indices at all circumferential positions p1.
[0073] (5) Repeat (3) to (4) several times (e.g., 10 times) to obtain each frequency selected when the average filtering index is minimized, and mark them as noise frequencies respectively.
[0074] (6) Repeat (2) to (5) several times (e.g., 20 times), obtain all noise frequencies, and count the frequency of each noise frequency (i.e., the number of times each noise frequency appears is divided by 20). Use the Otsu threshold segmentation algorithm to divide the frequency of all noise frequencies into two parts. For the part of noise frequencies with the largest average frequency, record it as the target noise frequency.
[0075] The target noise frequency refers to the noise frequency caused by the noise inherent in the magnetic flux leakage sensor itself and the vibration generated by the robot during movement. It has the most significant impact on the magnetic flux leakage signal, causing the magnetic flux leakage signal to be unable to further describe the details of the inner wall defects.
[0076] (7) For the spectrum obtained from the axial leakage magnetic field sequence of all circumferential positions (including all circumferential positions p1), the response amplitude of the target noise frequency in the spectrum is set to 0, and then the inverse Fourier transform algorithm is used to transform each spectrum again to remove the target noise frequency. The resulting axial leakage magnetic field filtering sequence of all circumferential positions is the filtered leakage magnetic field signal.
[0077] Step S204: Determine the second contour of the defect area based on the filtered magnetic leakage signal. The maximum correlation between all contours of the target image and the second contour is denoted as b. The image processing parameters when the difference between b and a is the largest are used to process the inner wall image.
[0078] Following the method in step S201, the contour of the defect region is determined based on the filtered magnetic leakage signal and denoted as the second contour. Following the method in step S202, the contour with the greatest correlation to the second contour is obtained, and the greatest correlation here is denoted as b.
[0079] Thus, given a set of parameters (including filter type, filter kernel size, high threshold, and low threshold), we obtain a maximum correlation a and b. The parameter that maximizes the difference between b and a and maximizes b is denoted as the optimal parameter.
[0080] The largest difference between b and a indicates that filtering the magnetic flux leakage signal using the target contour and pixel gradient obtained under optimal parameters significantly removes noise from the signal. The largest b indicates that the target contour obtained under optimal parameters closely matches or conforms to the defect region determined by the magnetic flux leakage signal. The fact that b has the largest difference from a and is also the largest b suggests that a reasonable combination of data from both the magnetic flux leakage signal and the inner wall image helps obtain more accurate defect detection results.
[0081] Furthermore, step S3 involves using the optimal parameters to perform an edge detection algorithm on the inner wall image to obtain the pipe inner wall detection result. The specific steps of this process are as follows: The optimal parameters include the filter type, filter kernel size, high threshold, and low threshold in the Canny edge detection algorithm. Based on these optimal parameters, edge detection is performed on each inner wall image captured by the camera to obtain all edges. In this embodiment, the connected components formed by all closed edges are recorded as the defect detection results, i.e., the pipe inner wall detection results. All defect detection results are displayed on the screen for pipe inspection personnel to view.
[0082] This concludes the implementation process.
[0083] Example 2: Step S201 of Embodiment 1 includes: the slope changes contained in the axial flux leakage sequence at all circumferential positions constitute a flux leakage rate distribution image. The contours of all defect regions are extracted from the flux leakage rate distribution image and denoted as the first contour. As an example, this process includes: For each circumferential position of the axial leakage magnetic flux sequence, each element in the axial leakage magnetic flux sequence represents the leakage magnetic flux intensity at each axial position, and a corresponding rate of change is obtained.
[0084] An image is constructed from all axial positions of all circumferential positions, denoted as the leakage magnetic flux change rate distribution image. The width of the leakage magnetic flux change rate distribution image (i.e., the number of pixels per row) is equal to the number of axial positions corresponding to each circumferential position (i.e., the length of the axial leakage magnetic flux sequence), and the height of the leakage magnetic flux change rate distribution image is equal to the total number of all circumferential positions (i.e., the number of Hall sensors in the Hall sensor array described in Embodiment 1). Each pixel in the leakage magnetic flux change rate distribution image corresponds to each axial position of each circumferential position.
[0085] The gray value of each pixel in the leakage magnetic flux change rate distribution image is set as the rate of change of each axial position at each circumferential position. The gray values of all pixels in the leakage magnetic flux change rate distribution image are linearly normalized. The Canny edge detection algorithm is used to perform edge detection on the normalized leakage magnetic flux change rate distribution image to obtain all edges. All closed edges are retained. The connected region enclosed by the closed edges is taken as the defect region, and the closed edges are taken as the first contour.
[0086] It should be noted that noise or error interference (such as camera noise and illumination interference) present in the inner wall image does not exist in the leakage magnetic flux change rate distribution image. In other words, the general and obvious features of the pipe inner wall defects can be clearly and indirectly captured by the leakage magnetic flux change rate distribution image. Therefore, the parameters of the Canny edge detection algorithm will not significantly affect the acquisition result of the first contour. In this embodiment, no filtering is performed in the Canny edge detection algorithm. 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 uses high threshold of 0.85 and low threshold of 0.23 as examples.
[0087] Furthermore, 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 1, resulting in inaccurate similarity as described in Embodiment 1. Therefore, for each contour and the corresponding geometry of the first contour, the bounding box algorithm is used to obtain the rectangular bounding boxes of these two geometry shapes, denoted as F1 (the bounding box of each contour) and F2 (the bounding box of the first contour), respectively. F2 is translated so that the lower left vertex of F1 and F2 coincides. A two-dimensional coordinate system is constructed with this vertex as the origin, with the horizontal axis parallel to the bottom edge of F1 and the vertical axis parallel to the side edge of F1. The unit length on the horizontal axis is equal to the width of a unit pixel (i.e., equal to 1), and the unit length on the vertical axis is equal to the height of a unit pixel (i.e., equal to 1).
[0088] At this point, each contour, the geometric figure corresponding to the first contour, and F1 and F2 are represented in a two-dimensional coordinate system. Next, a scaling matrix is solved, such that rectangle F1 is scaled using this matrix to obtain rectangle F2. Solving for the scaling matrix and performing the scaling transformation are well-known geometric principles, and will not be elaborated upon in this embodiment. Furthermore, the solved scaling matrix is used to scale the geometric figure corresponding to each contour. Then, the similarity between the scaled geometric figure and the geometric figure corresponding to the first contour is obtained using the method in Embodiment 1, and this similarity is used as the similarity between each contour and the first contour.
[0089] In summary, this embodiment only focuses on the edge features (such as the curvature or turning point of the edge) of each contour and the first contour. Since it uses scaling transformation and Hu moment techniques, it does not focus on the stretching, scaling, rotation and translation features of the contour shape.
[0090] Step S203 of Embodiment 1 includes: projecting n1 reference pixels into circumferential positions p1 and axial positions p2 of the inner wall of the pipe. As an example, the method includes: For any one of the n1 reference pixels, the target contour containing that reference pixel corresponds to a first contour with the highest similarity. Using the method described above, the target contour and the first contour are represented in a two-dimensional coordinate system, and a scaling matrix is obtained. Simultaneously, the reference pixel is also represented in a two-dimensional coordinate system, and its coordinates are: the pixel coordinates of the reference pixel in the inner wall image minus the pixel coordinates of the lower left corner of F1 in the inner wall image. The scaling matrix is used to transform the coordinates of the reference pixel in the coordinate system, resulting in transformed coordinates v1 (v1 is rounded to the nearest integer in each dimension). The vertex at the bottom left corner of F2 (before translation) also corresponds to a pixel in the leakage magnetic flux change rate distribution image. The coordinates of this pixel in the leakage magnetic flux change rate distribution image are denoted as v2. The pixel at v1+v2-v3 in the leakage magnetic flux change rate distribution image is obtained. The circumferential position and axial position corresponding to this pixel are denoted as p1 and p2, respectively. Here, v3 represents the displacement vector of F2 in the leakage magnetic flux change rate distribution image when the bottom left corner vertices of F1 and F2 coincide after the above translation of F2.
[0091] The above are all well-known geometric transformations, and will not be elaborated further in this embodiment.
[0092] Specifically, in some embodiments, if the area of the connected region enclosed 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 pipe is a curved surface, it may be deformed on the inner wall image. Furthermore, this embodiment does not focus on the error of defects with a large area. Based on this, the target contour is regarded as non-existent and does not participate in the process of filtering the leakage magnetic signal.
[0093] Step S202 of Embodiment 1 includes: identifying the inner wall image containing the defective region from all inner wall images acquired by the camera. As an example, this process specifically includes: For any defect region, the first contour of the defect region is composed of several circumferential and axial positions. As can be seen from step S201 (1), each axial position corresponds to a time. The average time corresponding to all axial positions of the first contour is calculated, and the average time is used as the time T when the defect region is observed.
[0094] The axial distance L from the optical center of the camera to the magnetic flux leakage sensor is measured. L is divided by the robot's movement speed to obtain time t. The inner wall image captured by the camera at time Tt is obtained, and this inner wall image contains the defect area.
[0095] Step S202 of Example 1 includes: randomly initializing a set of parameters. Specifically: Each set of parameters includes the filter type, filter kernel size, high threshold, and low threshold. As an example, the filter type ranges from {Gaussian filter, mean filter, minimum filter}; the filter kernel size ranges from {3, 5, 7, 9}; the high threshold ranges from {100, 130, 160, 190}; and the low threshold ranges from {20, 40, 60, 90}.
[0096] A set of parameters is randomly selected from the above range of values and used as the initial parameters.
[0097] In other embodiments, a gamma transform is performed on the inner wall image before Canny edge detection. In this case, each set of parameters also includes gamma coefficients of the gamma transform, with values ranging from {0.8, 1, 1.2}.
[0098] Step S204 of Example 1 includes: obtaining the parameter when the difference between b and a is maximized and b is maximized, denoted as the optimal parameter. As an example, it specifically includes: Using b×(ba) as the evaluation index for each set of parameters, the set of parameters with the largest evaluation index among all parameters combined within the above value range is selected as the optimal parameter. In other embodiments, the particle swarm optimization algorithm can also be used to obtain the parameter with the largest evaluation index and select it as the optimal parameter.
[0099] Example 3: In this embodiment, the variable diameter pipeline robot employs an active diameter-changing mechanism, enabling it to be used in natural gas pipelines of different diameters.
[0100] In one example, the magnetic flux leakage sensor also employs an active diameter-changing mechanism (or electric actuator) to alter the distance between the sensor and the inside of the pipe. For instance, in this embodiment, multiple sets of magnetic flux leakage sensors (the number of sensor sets and cameras is the same, both being 6) are used. Each set of sensors uses a diameter-changing mechanism (or electric actuator) to control the distance between it and the inner wall of the pipe. Each set includes a circumferentially distributed (along a circle) Hall sensor array. Furthermore, each set of sensors is aligned with the center of each camera, meaning the Hall sensor in the center of the array and the optical axis of each camera are in the same axial plane of the pipe. In this embodiment, the distance between the Hall sensor in the center of the array and the inner wall of the pipe is set to 6 mm. Any set of magnetic flux leakage sensors and its corresponding camera together implement all the methods described in Embodiment 1. Different magnetic flux leakage sensors and their corresponding cameras independently implement all the methods described in Embodiment 1, thereby achieving 360° defect detection within the pipe.
[0101] Since the magnetic flux leakage sensors of variable-diameter pipeline robots and variable-diameter mechanisms are existing technologies, they will not be described in detail in this embodiment. For example, CN219675907U discloses a magnetic flux leakage detection device for defects in long-distance pipelines, which incorporates a combination of magnetic flux leakage sensors of variable-diameter pipeline robots and variable-diameter mechanisms.
[0102] In other embodiments, for straight pipes with a constant inner diameter, each set of magnetic flux leakage sensors does not employ a diameter-changing mechanism. Instead, a fixed bracket is used to fix each set of magnetic flux leakage sensors to the robot, ensuring that the distance between the Hall sensor array of each set of sensors and the inner wall of the pipe is maintained at 6 mm. When inspecting pipes of other diameters, only the fixed bracket for each set of magnetic flux leakage sensors needs to be replaced. Its advantages are simple structure and low inspection cost.
[0103] Example 4: This embodiment provides a pipe internal wall inspection system based on a variable-diameter pipe robot. The system includes a camera and a magnetic flux leakage sensor, as well as a solid-state drive (SSD) for storing internal wall images and magnetic flux leakage signals acquired by the camera and sensor. The system also includes a memory storing a computer program and a processor for running the computer program. When the computer program runs, it reads the internal wall images and magnetic flux leakage signals stored on the SSD via a data cable or optical fiber and executes all the steps described in the above embodiments. The system also includes a display screen connected to the processor via a data cable. The defect detection results obtained after the processor runs the computer program are displayed on the display screen.
[0104] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the principles of the present invention should be included within the protection scope of the present invention.
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 greatest and b is at its maximum is denoted as the optimal parameter. The optimal parameter is used to detect all defects in the image.
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 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.
4. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 3, 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.
5. 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 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.
6. 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.
7. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 5, 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.
8. 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.
9. The pipe inner wall inspection method based on a variable diameter pipe robot according to claim 8, characterized in that, Each set of parameters includes the filter type, filter kernel size, and dual thresholds in the Canny edge detection algorithm.
10. 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 9.
Citation Information
Patent Citations
Method and device of inspecting a steel strip
CN108226173A
Three-dimensional magnetic flux leakage detection defect reconstruction method based on generative adversarial network
CN110992363A
Detection system of variable diameter travelling type natural gas pipeline detection robot and detection method
CN111219564A
Quantitative detection method and system for magnetic flux leakage defect of pipeline and electronic equipment
CN114972973A
Elevator steel wire rope defect detection device and method combining AR coding and magnetic flux leakage
CN120589564A