Pipeline defect detection robot and detection method
By designing a pipeline defect detection robot and using visual technology and the YOLO-TD algorithm for automatic detection, the problem of low efficiency and safety hazards in existing sewage pipeline detection methods has been solved, automatic identification and classification of defects in pipelines has been achieved, and detection efficiency has been improved. and accuracy.
Patent Information
- Application Number
- CN202410109184.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-01-25
AI Technical Summary
Existing sewage pipeline inspection methods are inefficient and have safety hazards. It is difficult to detect large-scale fine structural defects, and manual inspection is prone to fatigue and highly subjective.
A pipeline defect detection robot is designed, which uses a mechanical system, a control system and an image recognition system. It uses visual technology and the YOLO-TD algorithm to perform automatic detection. It collects images in the pipeline through the driving device and shooting device of the mechanical system. The image recognition system passes The Lucas-Kanade algorithm and YOLO-TD model perform pseudo-defect filtering and defect detection, and generate inspection reports.
It realizes the automatic identification and classification of defects in pipelines, improves detection efficiency, reduces the risk and subjectivity of manual detection, enhances the detection ability of subtle defects, and improves the accuracy and safety of detection.
Smart Images

Figure CN117969554B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of pipeline detection, and in particular relates to a pipeline defect detection robot and a detection method. Background Art
[0002] Without excavating the sewage pipes, it is urgent to detect the damage to the sewage pipes to eliminate hidden dangers. According to preliminary investigations, 60% of the maintenance of domestic underground pipelines currently relies on manual labor, 30% uses imported equipment, and domestic equipment accounts for only 10%. Due to the harsh environment inside the pipelines, and the long-term use of pipelines may also have dangerous conditions such as miasma, poisoning, and leakage, the manual operation efficiency is low and there are also great risks. Therefore, the urban underground pipeline inspection robot came into being. The pipeline inspection robot has a small and simple structure, can adapt to different pipeline diameters, runs smoothly, has good control performance, and has high detection efficiency. It can replace manual entry into the actual pipeline to work.
[0003] At present, the mainstream method of pipeline inspection is for inspectors to enter the pipeline for inspection. This method is not only inefficient, but also has safety risks. The range of pipeline defects that can be detected is small, making it difficult to conduct large-scale pipeline inspection. In addition, there is a method of using a periscope to achieve pipeline inspection, but due to the limitations of the equipment, the pipeline periscope method mainly detects pipe mouth defects, and the detection effect of minor structural defects and functional defects is poor, and only preliminary inspection and evaluation can be performed; pipeline defect images are currently usually determined by professional inspectors, and a large number of pipeline videos are manually inspected, which has the disadvantages of easy fatigue, strong subjectivity, and low efficiency. Summary of the invention
[0004] In order to overcome the above problems existing in the prior art, the purpose of the present invention is to provide a pipeline defect detection robot and detection method, which utilizes visual technology to identify pipeline defects and perform automatic detection, can capture images of defects inside the pipeline and identify and classify them, and solve the problem that the harsh environment in the pipeline causes many inconveniences to manual operations.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] A pipeline defect detection robot, comprising a mechanical system, a control system, an image recognition system and a pipeline defect detection system;
[0007] The mechanical system is used to provide power, protection, structural support and photography for the robot's movement;
[0008] The control system transmits images in real time, which is convenient for operators to plan routes, and realizes image transmission through cables and remote control of the mechanical system, image recognition system and pipeline defect detection system by the host computer;
[0009] The image recognition system is used to collect images taken by the mechanical system and then import them into the computer for detection through algorithms, so as to determine whether the pipeline has defects;
[0010] The pipeline defect detection system imports the video image in the pipeline recognized by the image recognition system, and then automatically generates a corresponding pipeline defect detection report.
[0011] The mechanical system includes a supporting device, a driving device, and a shooting device; the supporting device is used for the protection and structural support of the robot, is designed to be square, and includes a top plate and a bottom plate, the top plate and the bottom plate are connected by bolts through nails to form a hollow frame, the electric control system device is placed in the middle of the hollow frame, and the bottom of the bottom plate is connected to the control device by means of set screws to ensure the reliability of the robot during movement;
[0012] A driving device is arranged on both sides of the supporting device, and the driving device includes a driving wheel. The driving wheel uses a Mecanum wheel as the driving wheel of the pipeline inspection robot, so as to achieve omnidirectional flexible movement;
[0013] The driving device selects to use motor drive as the driving mode of the pipeline detection robot. During actual operation, the driving device provides the pipeline robot with forward power.
[0014] A shooting device is arranged in front of the bottom plate of the supporting device, and the shooting device is a visual sensor used for detecting pipeline defect information.
[0015] The control system is used to control the working conditions of the pipeline robot in real time, and various control components are placed on the bottom plate; the control system is divided into a motor driver module, an image acquisition module, and a light source module;
[0016] The motor driving module drives the driving device of the robot through the motor;
[0017] The image acquisition module is used to acquire images of the internal information of the pipeline and send the acquired image information to the image recognition system for recognition and classification;
[0018] The light source module analyzes the image information through the host computer, thereby sending a signal to the light source module to generate light.
[0019] The control system is used to transmit the image requirements in real time so that the operator can plan the path. A pipeline robot control interface is developed in the host computer Ubuntu20.04 system to control the working status of the pipeline robot in real time. The STM32F407 microcontroller is used as the lower computer to process the instructions issued by the upper computer to control the drive module to realize the movement of the robot. The image transmission and remote control of the robot by the host computer are realized through cables.
[0020] The image recognition system includes a pipeline defect detection algorithm module of YOLO-TD;
[0021] Abnormal viewing angles may occur due to severe camera shaking caused by changes in pipeline terrain and large manual deflection. This type of viewing angle usually appears briefly in the video segment in a motion transition state and is likely to be identified as an abnormal frame with defects.
[0022] The image recognition system uses the YOLO-TD pipeline defect detection algorithm module to detect the pseudo-abnormal frames caused by non-pipeline defects through pseudo-defect image filtering;
[0023] The pseudo-defect image filtering is to monitor the posture change of the camera of the mechanical system shooting device by using the improved Lucas-Kanade algorithm, and remove the video frames with a yaw amplitude greater than a certain threshold from the prediction sequence, which can effectively reduce the over-detection rate. At the same time, due to the coherence of the video itself, this strategy will not lead to defect omission.
[0024] The steps are: detect feature points of the current video frame, and then use the optical flow principle to track the detected feature points, and use the moving distance and direction of the feature points to monitor the position change of the camera;
[0025] The feature point detection is to select several points on the image in the pipeline transmitted back by the image acquisition module in real time as corner points, select the corner points as the feature points to be tracked, place a small window around the assumed corner points, and observe the average change of the intensity value in a certain direction in the window.
[0026] Furthermore, the corner points are pixel points with relatively high average intensity change values in multiple directions;
[0027] Assuming the displacement vector is (μ, γ), the change in average intensity value is:
[0028]
[0029] Where I(x,y)——the grayscale of the image pixel in the pipeline;
[0030] W(x,y)——the corresponding pixel coordinate position in the window determined by the internal image of the pipeline;
[0031] Taylor expansion of equation (1) yields equation (2), and converting equation (2) into matrix form yields equation (3):
[0032]
[0033]
[0034] The middle matrix is denoted as M, and the two eigenvalues of the matrix represent the maximum average intensity value change and the average intensity value change in the vertical direction respectively;
[0035] If both are large, then it is at the corner point, and the corner point response function S is defined as follows:
[0036] S=λ1λ2-k(λ1+λ2) 2 =det(M)-trace 2 (M)
[0037] Where λ1, λ2 are two eigenvalues of the matrix M;
[0038] det——matrix determinant;
[0039] trace - the trace of the matrix.
[0040] The center of the window whose response function is greater than a certain threshold δ is identified as a corner point. Since the overall grayscale of the pipeline scene tends to be smooth. At the same time, non-maximum suppression is added to the algorithm to filter out the corner points adjacent to the extreme values, so that the detected corner points are more dispersed in the viewing angle.
[0041] The feature point tracking is inter-frame feature point tracking. According to the continuity of the video frames, the Lucas-kanade algorithm is used to track the detected corner points, determine the new position of the corner points of the current frame in the subsequent frames, and determine the degree of camera yaw according to the amplitude of the position change. Assuming that the intensity value of the same feature point in adjacent frames is unchanged, this process is to find the following displacement (μ, γ):
[0042] I t (x,y)=I t+1 (x+μ,y+v)
[0043] Where It and It+1 represent the current frame and the next instant frame of the image in the pipeline acquired by the mechanical device respectively;
[0044] The assumption that the intensity value remains unchanged applies to small displacements on adjacent images. Taylor expansion of the equation yields the following equation. Removing the two terms representing the intensity value yields the following equation:
[0045]
[0046]
[0047] A single equation cannot solve two unknown quantities. The LK algorithm assumes that the optical flow vector remains unchanged in the neighborhood of the pixel point, and then uses the least squares method to solve the optical flow equation for all pixels in the neighborhood. However, in order to improve the accuracy of the tracking result, a smaller neighborhood window should be selected, while a large neighborhood window should be selected to handle fast and long movements. In order to solve this contradiction, the pyramid LK algorithm is introduced.
[0048] The pyramid LK algorithm is an improved Lucas-Kanade algorithm (proposed to solve the problem that feature point tracking cannot simultaneously process the improvement of tracking result resolution accuracy and the processing of long and fast motion). The optical flow is first calculated at the top layer of the image pyramid, and the motion result estimated by the previous layer is used as the initial value of the next layer of the pyramid. The next layer calculates the optical flow vector based on the previous layer, and repeats this estimation until the bottom layer of the pyramid, and the optical flow vector of the bottom layer is used as the final result. The above strategy can make the LK algorithm suitable for fast and large displacement motions, thereby improving the accuracy and robustness of the algorithm in real detection scenes.
[0049] The streamer is calculated using a bidirectional optical flow method;
[0050] The steps of the bidirectional counterflow method are to detect the feature point St of the current frame using the LK algorithm in the current frame It. The feature point St is the corner point mentioned above, and the feature point St+1 corresponding to the next frame It+1 is calculated in reverse at the same time, taking It+1 as the current frame and It as the next frame, and calculating the feature point Str corresponding to St+1 in It. If the deviation between St and Str is less than a certain threshold, it is considered that the tracking is successful. After actual verification, the bidirectional optical flow method effectively improves the tracking effect of the feature points of this scene. After obtaining the feature point position information of the adjacent frames, according to the following formula:
[0051]
[0052] Where n is the number of feature points in the current frame, |S(t+1)i-Sti| is the sum of the x and y coordinate differences of the feature point i before and after the frame, and δ is the set threshold. If the formula is established, the frame is identified as a pseudo-abnormal frame and is removed from the defect detection sequence.
[0053] The YOLO-TD pipeline defect detection algorithm is based on the YOLO v5s model, which introduces the Swin Transformer structure to extract semantic features, the DSPP module, and the loss function; it has evolved.
[0054] The image to be detected after filtering the pseudo-defect image is input into the backbone network of the YOLO v5s model for feature extraction, and then the robustness of the features is enhanced through the neck network. Finally, pipeline defect detection is performed through the detection head composed of convolutional layers.
[0055] The YOLO v5s model includes: an input end, a reference network, a Neck network and a Head output end;
[0056] The input end represents the picture extracted by the input mechanical device; the input image size of the network is 608*608, which includes an image preprocessing stage, that is, scaling the input image to the input size of the network and performing normalization and other operations. In the network training stage, YOLOv5 uses Mosaic data enhancement operation to improve the training speed of the model and the accuracy of the network; and proposes an adaptive anchor frame calculation and adaptive image scaling method.
[0057] The benchmark network is usually a network of some excellent classifiers. This module is used to extract some common feature representations contained in the input image. YOLOv5 not only uses the CSPDarknet53 structure, but also uses the Focus structure as the benchmark network.
[0058] The CSPDarknet53 structure is divided into two types, the CSP1_X structure is applied to the benchmark network, and the other CSP2_X structure is applied to the Neck network.
[0059] The Focus structure slices the image so that the length and width information of the original image are concentrated in the channel space, and a double down-sampling feature map with unchanged image information is obtained, which improves the detection accuracy and also improves the detection efficiency.
[0060] The Neck network is usually located in the middle of the reference network and the head network. It can be used to further improve the diversity and robustness of image features extracted at the input end, and is implemented using the spp module.
[0061] The Head is used to output the target detection result. For different detection algorithms, the number of branches at the output end is different, usually including a classification branch and a regression branch.
[0062] The YOLO-TD proposed in the present invention no longer uses CSPDarknet53 as the backbone network, but selects Swin Transformer with better performance, so that the backbone network can extract more advanced semantic features.
[0063] The Swin Transformer structure uses a moving window to limit the self-attention calculation to non-overlapping local windows while allowing cross-window connections. Specifically, the Swin Transformer replaces the multi-head self-attention (MSA) module in the Transformer with a moving window-based module. At the same time, the LayerNorm layer is applied before each MSA module and each MLP, and a residual connection is applied after each module.
[0064] However, the SPP module only performs pooling operation during the detection process, resulting in irreversible loss of information such as image feature details, resulting in a high missed detection rate during pipeline defect detection. Therefore, the present invention proposes a DSPP module to replace the original SPP module for pooling operation.
[0065] The DSPP module is that after the image features obtained by the Swin Transformer structure are input into DSPP, it passes through four branches to perform maximum pooling operations of different scales like SPP, and the maximum pooling information of each branch will be used as the input of the pooling operation together with the feature information of other branches. At the same time, the amount of supplementary pooling information is also determined by the amount of loss information, thereby effectively solving the information loss problem of SPP and further improving the accuracy of pipeline defect detection.
[0066] When the input feature information is X, the output information Y of the DSPP module is as shown in the formula:
[0067] Y=X+X2+X3+X4
[0068] Where X2, X3, and X4 are shown as follows:
[0069] X2=P5(X)
[0070] X3=P9(X+X2)
[0071] X4=P 13 (X+X2+X3)
[0072] The loss function consists of three types of losses: target loss function Loss_obj, category loss function Loss_cls and detection box loss function Loss_box. Among them, Loss_obj and Loss_cls are both calculated using cross entropy loss Loss_BEC:
[0073]
[0074] Where: N is the total number of images, is the Sigmoid function, Ti and They are the true value of the label and the predicted value respectively. The detection box loss function Loss_box is shown as follows:
[0075] Loss_box = 1-GIoU
[0076] Among them, GIoU is shown as follows:
[0077]
[0078] Where: IoU is the intersection over union ratio, A is the detection box, B is the prediction box, and C is the minimum enclosing box that can contain the detection box and the prediction box. The loss function Loss_ of the detection model of this application is shown as follows:
[0079] Loss=αLoss_obj+βLoss_cls_+γ(1-GIoU)
[0080] In the formula: α=0.45, β=0.5, γ=0.05.
[0081] The pipeline defect detection system uses PyQt5 to design the graphical user interface of end-to-end detection.
[0082] This interface can import the video images of the pipeline captured by the pipeline robot, and then automatically generate the corresponding pipeline defect detection report. This test tested 100 pipeline images, including 80 normal samples and 20 defective samples, including cracks, disconnections, obstacles and branch pipe concealed connections. In this test, the pipeline defect categories were correctly identified.
[0083] A pipeline detection method using a pipeline defect detection robot comprises the following steps;
[0084] Step 1: The camera of the shooting device in the mechanical system collects information and transmits the real-time picture to the PC through the electronic control part. After ensuring that there are no errors, the trolley can be controlled to move forward for defect detection;
[0085] Step 2: Filter the pseudo-defect image. After the image is acquired, the camera transmits it to the image acquisition module. By placing a small window around the assumed corner point and observing the average change of the intensity value in a certain direction within the window, assuming that the displacement vector is (μ, γ), the average intensity value change is:
[0086]
[0087] Where I(x,y)——image pixel grayscale;
[0088] W(x,y)——neighborhood of the point of interest;
[0089] Taylor expansion of equation (1) yields equation (2), and converting equation (2) into matrix form yields equation (3):
[0090]
[0091]
[0092] The middle matrix is denoted as M. The two eigenvalues of the matrix represent the maximum average intensity change and the average intensity change in the vertical direction. If both are large, then it is at the corner point. The corner point response function S is defined as formula 4:
[0093] S=λ1λ2-k(λ1+λ2) 2 =det(M)-trace 2 (M) (4)
[0094] Where λ1, λ2 are two eigenvalues of the matrix M;
[0095] det——matrix determinant;
[0096] trace - the trace of a matrix.
[0097] The center of the window whose response function is greater than a certain threshold δ is identified as a corner point; since the overall grayscale of the pipeline scene tends to be smooth, δ is set to 0.1 and the window size WinSize is set to 15; at the same time, non-maximum suppression is added to the algorithm to filter out the corner points adjacent to the extreme values, so that the detected corner points are more dispersed in the viewing angle;
[0098] Step 3: According to the continuity of the video frames, the Lucas-Kanade algorithm is used to track the detected corner points, determine the new position of the corner points of the current frame in the subsequent frames, and determine the degree of camera swing according to the amplitude of the position change; assuming that the intensity value of the same feature point in adjacent frames is unchanged, this process is to find the following displacement (μ, γ):
[0099] I t (x,y)=I t+1 (x+μ,y+v)(1)
[0100] Where It and It+1 represent the current frame and the next instant frame respectively. The assumption of constant intensity value is applicable to small displacements on adjacent images;
[0101] Taylor expansion of equation (1) yields equation (2), and removing the two terms representing the intensity value yields equation (3):
[0102]
[0103]
[0104] A single equation cannot solve two unknown quantities. The LK algorithm assumes that the optical flow vector remains unchanged in the neighborhood of the pixel point, and then uses the least squares method to solve the optical flow equation for all pixels in the neighborhood. However, in order to improve the accuracy of the tracking results, a smaller neighborhood window should be selected, while a large neighborhood window should be selected to handle fast and long movements. In order to resolve this contradiction, the pyramid LK algorithm was introduced. The optical flow is first calculated at the top layer of the image pyramid, and the motion result estimated by the previous layer is used as the initial value of the next layer of the pyramid. The next layer calculates the optical flow vector based on the previous layer, and repeats this estimation until the bottom layer of the pyramid, and the optical flow vector at the bottom layer is used as the final result. The above strategy can make the LK algorithm suitable for fast and large displacement movements, thereby improving the accuracy and robustness of the algorithm in real detection scenes.
[0105] In the current frame It, the LK algorithm is used to detect the feature point St+1 corresponding to the feature point St of the current frame in the next frame It+1. At the same time, reverse calculation is performed, taking It+1 as the current frame and It as the next frame, and calculating the feature point Str corresponding to St+1 in It. If the deviation between St and Str is less than a certain threshold, the tracking is considered successful.
[0106] As shown below
[0107]
[0108] Where n is the number of feature points in the current frame, |S(t+1)i-Sti| is the sum of the x and y coordinate differences of the feature point i before and after the frame, and δ is the set threshold. If the above formula is established, the frame is considered a pseudo-abnormal frame and is removed from the defect detection sequence;
[0109] Step 4: After filtering the pseudo-defect images, the photos extracted through the mechanical part are then detected using the pipeline defect detection algorithm based on YOLO-TD. First, the image to be detected is input into Swin Transformer for feature extraction. Swin Transformer uses a moving window to limit the self-attention calculation to non-overlapping local windows, while allowing cross-window connections, thereby improving efficiency. In addition, this hierarchical structure also has the flexibility to model at different scales, enhancing the model's ability to capture multi-scale information. Specifically, Swin Transformer solves the problem of slow application of Transformer to the field of computer vision that has long plagued the industry by replacing the multi-head self-attention (MSA) module in Transformer with a moving window-based module. At the same time, the LayerNorm layer is applied before each MSA module and each MLP, and a residual connection is applied after each module.
[0110] Step 5: After the image features are extracted, they are input into DSPP. As with SPP, the maximum pooling operation of different scales is performed through four branches of 1×1, 5×5, 9×9 and 13×13 respectively. The maximum pooling information of each branch will be used as the input of the pooling operation together with the feature information of other branches. At the same time, the amount of supplementary pooling information is also determined by the amount of loss information, which effectively solves the information loss problem of SPP and further improves the accuracy of pipeline defect detection. When the input feature information is X, the output information Y of the DSPP module is shown in formula (6):
[0111] Y=X+X2+X3+X4 (6)
[0112] Where X2, X3, and X4 are as shown in equations (7) to (9) respectively:
[0113] X2=P5(X) (7)
[0114] X3=P9(X+X2) (8)
[0115] X4=P 13 (X+X2+X3) (9)
[0116] Pa is the maximum pooling operation of a×a; “+” is the concat operation.
[0117] Step 6: The robustness of the features is enhanced through the neck network, and finally the pipeline defect detection is performed through the detection head composed of convolutional layers.
[0118] Beneficial effects of the present invention:
[0119] 1. The present invention uses computer vision technology to automatically detect the defect categories existing in the collected pipeline images.
[0120] 2. The present invention uses the Swin Transformer structure that easily captures global information to extract more powerful semantic features and enhance the network's ability to extract defect features.
[0121] 3. The present invention designs a dense spatial pyramid pooling module and introduces it into YOLO-TD to obtain richer detail information in the target.
[0122] 4. In order to solve the problem of pseudo-defect images caused by pipeline terrain changes and artificial yaw control, the improved bidirectional optical flow method is used to monitor the camera's posture changes and filter out pseudo-abnormal images caused by excessive posture changes. BRIEF DESCRIPTION OF THE DRAWINGS
[0123] Figure 1 It is the overall design diagram of the present invention.
[0124] Figure 2 It is the overall structure diagram of the detection system of the present invention.
[0125] Figure 3 This is the basic wheel set layout diagram of the present invention.
[0126] Figure 4 This is a module diagram of the control center of the present invention.
[0127] Figure 5 This is a structural diagram of the servo control system of the present invention.
[0128] Figure 6 This is the structural diagram of the fuzzy adaptive PID controller of the present invention.
[0129] Figure 7 It is the principle diagram of the pyramid Lucas-Kanad optical flow of the present invention.
[0130] Figure 8 This is the YOLO-TD network structure diagram of the present invention.
[0131] Fig. 9 This is the Swin Transformer feature extraction network diagram of the present invention.
[0132] Fig.10 This is the structural diagram of the DSPP of the present invention. DETAILED DESCRIPTION
[0133] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0134] like Figure 1 , Figure 2 As shown, the present invention provides a pipeline inspection robot capable of collecting images of defects inside pipelines and identifying and classifying them, including a mechanical part, an electric control part, an algorithm identification part and a defect inspection report.
[0135] The robot is sent to the place where it needs to work. The robot starts the camera at the initial position and transmits the real-time image to the PC through the communication cable. After ensuring that it is correct, the robot can be operated forward to detect defects. Because the environment inside the pipeline is harsh and complex, the operator needs to perform real-time operation to ensure that the robot can safely and effectively capture and analyze the images for defect classification.
[0136] The mechanical part is composed of a supporting device, a driving device, and a shooting device.
[0137] The support part is composed of a top plate and a bottom plate, which are connected by bolts to form a hollow skeleton. The space in the middle is used to place the electronic control system device. The control device is also fixed to the bottom plate by set screws to ensure the reliability of the robot during movement. There are some uneven roads in underground pipelines. In order to enhance the terrain adaptability of the pipeline robot, a single-axis connection is designed in the fuselage chassis of the pipeline robot. The design divides the fuselage chassis into two parts, which are connected in a multi-bearing coaxial manner, so that there is relative freedom of movement between the front and rear chassis and between the front and rear wheels. This design allows the robot to have better terrain adaptability, ensures that the four wheels can grip the ground at the same time, and also reduces motion errors.
[0138] The drive device is responsible for the movement of the robot, which is mainly composed of a DC motor, a coupling and a driving wheel. The motor drives the driving wheel through the coupling to complete the movement of the pipeline robot. In order to achieve flexible control of the robot, facing the common defects and obstacles in the pipeline. The Mecanum wheel is selected as the driving wheel of the pipeline inspection robot to achieve omnidirectional flexible movement. At the same time, the roller can rotate around its own axis, around the center axis of the hub, and around its contact point with the ground, with three degrees of freedom. The whole wheel can rotate around the center axis of the hub and move vertically around the axis of the roller, with two degrees of freedom. Therefore, a number of Mecanum wheels can be combined into a Mecanum wheel set according to a specific arrangement, and the omnidirectional movement of the entire system can be achieved by controlling the speed of each wheel.
[0139] Since the rollers are installed on the wheel hub in an offset manner with different offset directions, the four-wheel drive intelligent pipeline robot has a variety of wheel set layouts.
[0140] The present invention adopts the following Figure 3 In the wheel set layout shown, the roller offset angles of the four Mecanum wheels are all ±α, where the counterclockwise direction of the angle with x is positive.
[0141] Image acquisition uses the OV5640 camera to collect images. The control system is used to control the working conditions of the pipeline robot in real time. Various control components are placed on the bottom plate. The control system is connected to the motor driver, image acquisition module, and light source module respectively. The structure is shown in the attached figure. Figure 4 shown.
[0142] Further, the motor driver is connected to the first motor, the second motor, the third motor, and the fourth motor.
[0143] Furthermore, the driving wheel can rotate driven by the first motor, the second motor, the third motor, and the fourth motor.
[0144] The image acquisition module is used to acquire images of the internal information of the pipeline and send the acquired image information to the control system for identification and classification.
[0145] The light source module analyzes the image information through the host computer, thereby sending a signal to the light source module to generate light.
[0146] The control module uses a single-chip microcomputer as the control core, a DC brushless motor as the actuator, a pipeline robot (wheel speed) as the controlled object, and a Hall speed measuring element as the detection device. It is a full closed-loop speed servo control system that uses a circumference measurement method to measure speed. Its structure is shown in the attached figure. Figure 5 shown.
[0147] In terms of control algorithm, since the actual pipeline is affected by uncertain factors such as its own quality and external corrosion, the pipeline robot control process is relatively complex and changeable, and it is difficult to establish an accurate mathematical model. The traditional PID control effect is not good. Figure 6 As shown, according to the real-time feedback of the control system, the PID control parameters are adjusted online through fuzzy reasoning.
[0148] The image acquisition module is used to collect images of the internal information of the pipeline and transmit them to the host computer through cables. At this time, the algorithm recognition part performs recognition and classification.
[0149] Abnormal viewing angles may appear in the image due to severe camera shaking caused by changes in pipeline terrain and large manual deflection. This type of viewing angle usually appears briefly in the video segment in a motion transition state and is likely to be identified as an abnormal frame with defects.
[0150] Therefore, in the pseudo-defect image filtering part, the improved Lucas-Kanade algorithm is used to monitor the posture changes of the camera, and the video frames with a yaw amplitude greater than a certain threshold are removed from the prediction sequence, which can effectively reduce the over-detection rate. The principle of the LK algorithm is to detect the corner points of the current video frame, and then track the detected corner points using the optical flow principle, and use the distance and direction of the corner point movement to monitor the posture changes of the camera. Define the corner point as a pixel point with a relatively high average intensity change value in multiple directions. Place a small window around the assumed point of interest and observe the average change in the intensity value in a certain direction within the window. Assuming the displacement vector is (μ, γ), the average intensity value change is:
[0151]
[0152] Where I(x,y)——image pixel grayscale;
[0153] W(x,y)——Neighborhood of the point of interest.
[0154] Taylor expansion of equation 1 yields equation 2, and equation 2 is converted into a matrix form to yield equation 3.
[0155]
[0156]
[0157] The middle matrix is called M. The two eigenvalues of the matrix represent the maximum average intensity change and the average intensity change in the vertical direction. If both are large, then it is at the corner point. Let the corner point response function S be defined as:
[0158] S=λ1λ2-k(λ1+λ2) 2 =det(M)-trace 2 (M)
[0159] Where λ1, λ2 are two eigenvalues of the matrix M;
[0160] det——matrix determinant;
[0161] trace - the trace of the matrix.
[0162] The center of the window whose response function is greater than a certain threshold δ is identified as a corner point. Since the overall grayscale of the pipeline scene tends to be smooth, this paper sets δ to 0.1 and the window size WinSize to 15. At the same time, non-maximum suppression is added to the algorithm to filter out the corner points adjacent to the extreme values, so that the detected corner points are more dispersed in the viewing angle.
[0163] After identifying the corner points, the pyramid LK algorithm is used to track the detected corner points according to the continuity of the video frames, determine the new position of the corner points of the current frame in the subsequent frames, and determine the degree of camera swing according to the amplitude of the position change.
[0164] The pyramid LK algorithm first calculates the optical flow at the top layer of the image pyramid, uses the motion result estimated in the previous layer as the initial value of the next layer of the pyramid, and the next layer calculates the optical flow vector based on the previous layer. Repeat this estimation until the bottom layer of the pyramid, and take the optical flow vector at the bottom layer as the final result, as shown in the attached figure. Figure 7 shown.
[0165] Since the background and foreground of the scene involved are all in motion, mistracking is prone to occur. In order to solve this problem, the bidirectional optical flow method is used. That is, in the current frame It, the LK algorithm is used to detect the feature point St+1 corresponding to the feature point St of the current frame in the next frame It+1. At the same time, reverse calculation is performed, taking It+1 as the current frame and It as the next frame, and calculating the feature point Str corresponding to St+1 in It. If the deviation between St and Str is less than a certain threshold, the tracking is considered successful. It has been verified in practice that the bidirectional optical flow method effectively improves the tracking effect of the feature points of this scene. After obtaining the position information of the feature points of adjacent frames, according to the following formula:
[0166]
[0167] Where n is the number of feature points in the current frame, |S(t+1)i-Sti| is the sum of the x and y coordinate differences of the feature point i before and after the frame, and δ is the set threshold. If the formula is established, the frame is identified as a pseudo-abnormal frame and is removed from the defect detection sequence.
[0168] In the visual inspection algorithm, a pipeline defect detection algorithm based on YOLO-TD is used. The image to be inspected is input into the backbone network for feature extraction, and then the robustness of the features is enhanced through the neck network. Finally, the pipeline defect detection is performed through the detection head composed of convolutional layers. Figure 8 As shown in the figure. Unlike YOLO v5s, the YOLO-TD proposed in this paper no longer uses CSPDarknet53 as the backbone network, but chooses Swin Transformer with better performance, so that the backbone network can extract more advanced semantic features. At the same time, in YOLO-TD, a dense spatial pyramid pooling DSPP module is designed to replace the SPP module in YOLO v5s to capture multi-scale detail features.
[0169] Swin Transformer uses a moving window to limit the self-attention calculation to non-overlapping local windows, while allowing cross-window connections, thereby improving efficiency. In addition, this hierarchical structure also has the flexibility to model at different scales, enhancing the model's ability to capture multi-scale information. Specifically, Swin Transformer solves the problem of the slow speed of applying Transformer to the field of computer vision that has long plagued the industry by replacing the multi-head self-attention (MSA) module in Transformer with a moving window-based module. At the same time, a LayerNorm layer is applied before each MSA module and each MLP, and a residual connection is applied after each module, as shown in the attached figure. Fig. 9 shown.
[0170] When the image features are input into DSPP, like SPP, 1×1, 5×5, 9×9 and 13×13 pools are used to perform maximum pooling operations of different scales, and the maximum pooling information of each branch is used as the input of the pooling operation together with the feature information of other branches. At the same time, the amount of supplementary pooling information is also determined by the amount of loss information. When the input feature information is X, the output information Y of the DSPP module is shown as follows:
[0171] Y=X+X2+X3+X4
[0172] Where X2, X3, and X4 are shown as follows:
[0173] X2=P5(X)
[0174] X3=P9(X+X2)
[0175] X4=P 13 (X+X2+X3)
[0176] Where: Pa is the maximum pooling operation of a×a; “+” is the concat operation. The DSPP diagram is shown in the attached figure. Fig.10 shown.
[0177] The loss function of the detection model YOLO-TD in this application consists of three types of losses: target loss function Loss_obj, category loss function Loss_cls and detection box loss function Loss_box. Among them, Loss_obj and Loss_cls are both calculated using cross entropy loss Loss_BEC:
[0178]
[0179] Where: N is the total number of images, is the Sigmoid function, Ti and They are the true value of the label and the predicted value respectively. The detection box loss function Loss_box is shown as follows:
[0180] Loss_box = 1-GIoU
[0181] Among them, GIoU is shown as follows:
[0182]
[0183] Where: IoU is the intersection over union ratio, A is the detection box, B is the prediction box, and C is the minimum enclosing box that can contain the detection box and the prediction box. The loss function Loss_ of the detection model in this paper is shown as follows:
[0184] Loss=αLoss_obj+βLoss_cls_+γ(1-GIoU)
[0185] In the formula: α=0.45, β=0.5, γ=0.05.
[0186] Simulation test: This pipeline defect detection system uses PyQt5 to design an end-to-end detection graphical user interface.
[0187] This interface can import the video images of the pipeline captured by the pipeline robot, and then automatically generate the corresponding pipeline defect detection report. This test tested 100 pipeline images, including 80 normal samples and 20 defective samples, including cracks, disconnections, obstacles and branch pipe concealed connections. In this test, the pipeline defect categories were correctly identified.
Claims
1. A pipeline defect detection robot, characterized in that: Including mechanical systems, control systems, image recognition systems and pipeline defect detection systems; The mechanical system is used to provide power, protection, structural support and photography for the robot's movement; The control system transmits images in real time, which is convenient for operators to plan routes, and realizes image transmission through cables and remote control of the mechanical system, image recognition system and pipeline defect detection system by the host computer; The image recognition system is used to collect images taken by the mechanical system and then import them into the computer for detection through algorithms, so as to determine whether the pipeline has defects; The pipeline defect detection system imports the video image in the pipeline recognized by the image recognition system, and then automatically generates a corresponding pipeline defect detection report; The mechanical system includes a supporting device, a driving device, and a shooting device; The support device is used for protection and structural support of the robot. The support device is square and includes a top plate and a bottom plate. The top plate and the bottom plate are connected by bolts through nails to form a hollow frame. The control system is placed in the middle of the hollow frame, and the bottom of the bottom plate is connected to the control system by set screws. A driving device is arranged on both sides of the supporting device, and the driving device includes a driving wheel, and a Mecanum wheel is selected as the driving wheel of the pipeline inspection robot; A shooting device is arranged in front of the bottom plate of the supporting device, and the shooting device includes a camera for detecting pipeline defect information; The control system is used to control the working conditions of the pipeline robot in real time, and various control components are placed on the bottom plate; the control system is divided into a motor driver module, an image acquisition module, and a light source module; The motor driving module drives the driving device of the robot through the motor; The image acquisition module is used to acquire images of the internal information of the pipeline by receiving pictures taken by the camera, and sends the acquired image information to the image recognition system for recognition and classification; The light source module analyzes the image information through the host computer, thereby sending a signal to the light source module to generate light; The image recognition system includes a pipeline defect detection algorithm module of YOLO-TD; The image recognition system filters out pseudo-abnormal frames caused by non-pipeline defects through pseudo-defect image filtering, and then uses the pipeline defect detection algorithm module of YOLO-TD for detection; The pseudo-defect image filtering uses an improved Lucas-Kanade algorithm to monitor the posture change of the camera of the mechanical system shooting device, and removes the video frames with a deflection amplitude greater than a certain threshold from the prediction sequence; Detect feature points of the current video frame, and then use the principle of optical flow to track the detected feature points, and use the moving distance and direction of the feature points to monitor the position change of the camera; The feature point detection is to select several points on the image in the pipeline transmitted back by the image acquisition module in real time as corner points, select the corner points as the feature points to be tracked, place a small window around the assumed corner points, and observe the average change of the intensity value in a certain direction in the window; The corner points are pixel points with relatively high average intensity change values in multiple directions; Assuming the displacement vector is (µ, γ), the change in the average intensity value is: (1) Where I (x, y) is the grayscale of the image pixel in the pipeline; W (x, y) – the corresponding pixel coordinate position in the window determined by the internal image of the pipeline; Taylor expansion of equation (1) yields equation (2), and converting equation (2) into matrix form yields equation (3): (2) (3) The middle matrix is denoted as M, and the two eigenvalues of the matrix represent the maximum average intensity value change and the average intensity value change in the vertical direction respectively; The corner point response function S is defined as follows: Where λ1, λ2 are two eigenvalues of the matrix M; det——matrix determinant; trace – trace of the matrix; The center of the window whose response function is greater than a certain threshold δ is identified as a corner point, and non-maximum suppression is added to the algorithm to filter out the corner points adjacent to the extreme value, so that the detected corner points are more dispersed in the viewing angle; The feature point tracking is inter-frame feature point tracking. According to the continuity of the video frames, the improved Lucas-kanade algorithm is used to track the detected corner points, determine the new position of the corner points of the current frame in the subsequent frames, and determine the degree of camera deflection according to the amplitude of the position change. The intensity value of the same feature point in adjacent frames is unchanged, and the following displacement (µ, γ) is found: Where It and It+1 represent the current frame and the next instant frame of the image in the pipeline acquired by the mechanical device respectively; The assumption that the intensity value remains unchanged applies to small displacements on adjacent images. Taylor expansion of the equation yields the following equation. Removing the two terms representing the intensity value yields the following equation: ; The improved Lucas-Kanade algorithm is a pyramid LK algorithm, which first calculates the optical flow at the top layer of the image pyramid, uses the motion result estimated by the previous layer as the initial value of the next layer of the pyramid, and the next layer calculates the optical flow vector based on the previous layer. This estimation is repeated until the bottom layer of the pyramid, and the optical flow vector at the bottom layer is used as the final result; The optical flow is calculated using a bidirectional optical flow method; The steps of the bidirectional optical flow method are to detect the feature point St of the current frame using the pyramid LK algorithm in the current frame It, where the feature point St is the corner point mentioned above and the feature point St+1 corresponding to the next frame It+1, and perform reverse calculations at the same time, taking It+1 as the current frame and It as the next frame, and calculating the feature point Str corresponding to St+1 in It. If the deviation between St and Str is less than a certain threshold, the tracking is considered successful. After actual verification, the bidirectional optical flow method effectively improves the tracking effect of the feature points of this scene. After obtaining the feature point position information of the adjacent frames, according to the following formula: Where n is the number of feature points in the current frame, |S(t+1)i-Sti| is the sum of the x and y coordinate differences of the feature point i before and after the frame, and δ is the set threshold. If the formula is established, the frame is identified as a pseudo-abnormal frame and is removed from the defect detection sequence.
2. The pipeline detection method of a pipeline defect detection robot according to claim 1, characterized in that: The steps include: Step 1: The camera of the shooting device in the mechanical system collects information and transmits the real-time picture to the computer through the control system. After ensuring that it is correct, the robot can be controlled to move forward for defect detection; Step 2: Filter the pseudo-defect image. After the image is acquired, the camera transmits it to the image acquisition module. By placing a small window around the assumed corner point and observing the average change of the intensity value in a certain direction within the window, assuming that the displacement vector is (µ, γ), the average intensity value change is: (1) Where I (x, y) is the grayscale of the image pixel in the pipeline; W (x, y) – the corresponding pixel coordinate position in the window determined by the internal image of the pipeline; Taylor expansion of equation (1) yields equation (2), and converting equation (2) into matrix form yields equation (3): (2) (3) The middle matrix is denoted as M. The two eigenvalues of the matrix represent the maximum average intensity change and the average intensity change in the vertical direction. If both are large, then it is at the corner point. The corner point response function S is defined as formula (4): (4) Where λ1, λ2 are two eigenvalues of the matrix M; det——matrix determinant; trace – trace of the matrix; The center of the window whose response function is greater than a certain threshold δ is identified as a corner point; since the overall grayscale of the pipeline scene tends to be smooth, δ is set to 0.1 and the window size WinSize is set to 15; at the same time, non-maximum suppression is added to the algorithm to filter out the corner points adjacent to the extreme values, so that the detected corner points are more dispersed in the viewing angle; Step 3: According to the continuity of the video frames, the improved Lucas-Kanade algorithm is used to track the detected corner points, determine the new position of the corner points of the current frame in the subsequent frames, and determine the degree of camera yaw based on the amplitude of the position change; assuming that the intensity value of the same feature point in adjacent frames is unchanged, this process is to find the following displacement (µ, γ): (1) Where It and It+1 represent the current frame and the next instant frame respectively. The assumption of unchanged intensity value is applicable to small displacements on adjacent images. Taylor expansion of equation (1) yields equation (2), and removing the two terms representing the intensity value yields equation (3): (2) (3) The improved Lucas-kanade algorithm is a pyramid LK algorithm, which first calculates the optical flow at the top layer of the image pyramid, uses the motion result estimated by the previous layer as the initial value of the next layer of the pyramid, and the next layer calculates the optical flow vector based on the previous layer. Repeat this estimation until the bottom layer of the pyramid, and take the optical flow vector at the bottom layer as the final result; In the current frame It, the pyramid LK algorithm is used to detect the feature point St+1 corresponding to the feature point St in the next frame It+1. At the same time, reverse calculation is performed, taking It+1 as the current frame and It as the next frame, and calculating the feature point Str corresponding to St+1 in It. If the deviation between St and Str is less than a certain threshold, the tracking is considered successful. As shown below Where n is the number of feature points in the current frame, |S(t+1)i-Sti| is the sum of the x and y coordinate differences of the feature point i before and after the frame, and δ is the set threshold. If the above formula is established, the frame is considered a pseudo-abnormal frame and is removed from the defect detection sequence; Step 4: After filtering the pseudo-defect images, the photos extracted by the mechanical system are then detected using the pipeline defect detection algorithm based on YOLO-TD. First, the image to be detected is input into Swin Transformer for feature extraction. Swin Transformer uses a moving window to limit the self-attention calculation to non-overlapping local windows, while allowing cross-window connections; Step 5: After the image features are extracted, they are input into DSPP. Like SPP, they are subjected to maximum pooling operations of different scales through four branches, namely 1×1, 5×5, 9×9 and 13×13. The maximum pooling information of each branch is used as the input of the pooling operation together with the feature information of other branches. When the input feature information is X, the output information Y of the DSPP module is as shown in formula (6): (6) in , , As shown in formulas (7) to (9) respectively: (7) (8) (9) Pa is the maximum pooling operation of a×a; "+" is the concat operation; Step 6: The robustness of the features is enhanced through the neck network, and finally the pipeline defect detection is performed through the detection head composed of convolutional layers.
