Underground drainage pipeline defect detection method, medium and equipment
By introducing improved CA attention mechanism and deformable convolution DCNv2 into the YOLOv8 detection model, the problem of insufficient accuracy in underground drainage pipeline detection is solved, and higher detection accuracy and real-time performance are achieved.
Patent Information
- Application Number
- CN202510049561.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-04-25
AI Technical Summary
The existing YOLOv8 algorithm has insufficient accuracy in the detection of underground drainage pipeline defects, which is difficult to meet the needs of real-time detection.
A new defect detection model is constructed by adding the improved CA attention mechanism to the deformable convolution DCNv2 and replacing the previous layer of SPPF C2f module in the YOLOv8 backbone network. This model is optimized based on the training data set, improving detection accuracy.
Compared with the traditional YOLOv8 detection method, this method significantly improves the accuracy of defect detection of underground drainage pipelines and can more accurately identify and locate defects in the pipelines.
Smart Images

Figure CN119888352A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to an underground drainage pipe defect detection method, medium and equipment. Background Art
[0002] Object detection is a fundamental and crucial task in the field of computer vision, and its core lies in accurately identifying and locating the target object of interest from images or videos. Although traditional object detection algorithms, such as the R-CNN series, have excellent performance in terms of accuracy, they are difficult to meet the needs of real-time applications due to their high computational complexity and slow processing speed.
[0003] As an innovative target detection algorithm, the YOLO (You Only Look Once) algorithm achieves efficient target detection by converting it into a single inference problem. Unlike traditional methods, the YOLO algorithm uses a unified neural network to simultaneously predict the location and category of targets in an image. This design greatly improves the speed and efficiency of target detection and is particularly suitable for scenarios that require real-time response, such as video surveillance and autonomous driving.
[0004] The YOLO series of models was proposed by Joseph Redmon and others, and has evolved from YOLOv1 to YOLOv8. YOLOv1 was the first to directly predict bounding boxes and categories through a single convolutional neural network, creating a precedent for efficient object detection. With the iteration of technology, the YOLO series continues to introduce new technologies and improvements, such as YOLOv2's Batch Normalization technology, YOLOv3's multi-scale prediction mechanism, YOLOv4's CSPDarknet53 architecture, and YOLOv5's lightweight design, which have significantly improved the detection accuracy and speed of the YOLO algorithm.
[0005] YOLOv8 further optimized the model architecture on this basis, and adopted more efficient training strategies and optimization methods, thus achieving new breakthroughs in detection accuracy and speed. However, the existing technical process usually requires collecting enough pictures first, preprocessing the pictures, and then using the YOLOv8 model for training. After verification and good results, it is actually applied to the pictures that need to be detected, which has the problems of lack of real-time performance and insufficient accuracy. Summary of the invention
[0006] The purpose of the present invention is to provide a method, medium and device for detecting defects in underground drainage pipes, aiming to solve the problem of insufficient accuracy in the current use of YOLOv8 for underground drainage pipe detection. The specific technical solution is as follows:
[0007] A method for detecting defects in underground drainage pipes, the method comprising the following steps:
[0008] S100, obtaining an underground drainage pipe defect image, and using a labeling tool to label the pipe defects in the image to obtain a training data set;
[0009] S200, constructing a defect detection model, where the defect detection model is obtained by first adding the improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous C2f module of the SPPF in the YOLOv8 backbone network with the DCNv2 to which the improved CA attention mechanism is added;
[0010] S300: Use the training data set to train the defect detection model to obtain a trained defect detection model, and use the trained defect detection model to detect defects in underground drainage pipes.
[0011] Furthermore, the step S100 includes: after collecting the pictures of underground drainage pipe defects, the pictures are cropped into a required size, and the pipe defects in the pictures are marked using a labeling tool, and different types of defects are identified with different names.
[0012] Furthermore, in the step S200, the improved CA attention mechanism is added to the deformable convolution DCNv2 as follows: the deformable convolution DCNv2 first performs a convolution operation on the input feature layer to obtain an offset field, which contains the offset of each position, indicating the movement distance in the x and y directions; during the convolution process, the sampling points are no longer fixed grid points, but are moved according to the offset, and the eigenvalues of the offset positions are calculated by bidirectional linear interpolation. The improved CA attention mechanism is added during the convolution process to fully extract the features of each path and then generate the corresponding offset.
[0013] Furthermore, in step S200, the data processing process of the improved CA attention mechanism is as follows:
[0014] S210, dividing the input feature map into two directions, the X direction and the Y direction, and performing average pooling respectively, and adding a channel to perform global average pooling in both directions at the same time;
[0015] S220, after average pooling in the Y direction, readjust the dimensional order of the obtained feature map, and then splice the readjusted feature map in the Y direction and the feature map in the X direction;
[0016] S230, sending the spliced feature map to the first convolution module Conv for processing to extract image features;
[0017] S240, splitting the feature map obtained in step S230 in the X direction and the Y direction to obtain an attention tensor in a first X direction and an attention tensor in a first Y direction respectively;
[0018] S250, sending the feature map obtained in step S230 to the second convolution module Conv for processing to change the dimension, and then obtaining the global attention weights of the feature map after the Sigmoid activation function, and then splitting in the X direction and the Y direction to obtain the attention weight in the X direction and the attention weight in the Y direction;
[0019] S260, multiplying the attention tensor in the first X direction by the attention weight in the X direction to obtain the attention tensor in the second X direction; multiplying the attention tensor in the first Y direction by the attention weight in the Y direction to obtain the attention tensor in the second Y direction;
[0020] S270, after performing a global average pooling operation on an added channel, send the result to the third convolution module Conv to obtain a global attention tensor; calculate the average value of the global attention weight in step S250, and multiply it by the global attention tensor of the current channel to obtain a new global attention tensor;
[0021] S280. Finally, in step S260, the attention tensor in the second X direction is activated by the Sigmoid activation function, and the dimension of the attention tensor in the second Y direction is readjusted and then activated by the Sigmoid activation function, and then multiplied by the new global attention tensor after the Sigmoid activation function in step S270, and then multiplied by the tensor of the input feature map to obtain the output.
[0022] Furthermore, the convolution kernel size of the first convolution module Conv is 3×1.
[0023] Furthermore, the convolution kernel size of the second convolution module Conv is 1×1.
[0024] Furthermore, the convolution kernel size of the third convolution module Conv is 1×1.
[0025] The present invention also provides a method for detecting defects in underground drainage pipes, the method comprising the following steps:
[0026] S100, obtaining an underground drainage pipe defect image, and using a labeling tool to label the pipe defects in the image to obtain a training data set;
[0027] S200, constructing a defect detection model, where the defect detection model is obtained by first adding the improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous C2f module of the SPPF in the YOLOv8 backbone network with the DCNv2 to which the improved CA attention mechanism is added;
[0028] S300, using a training data set to train a defect detection model to obtain a trained defect detection model;
[0029] S400, loading the trained defect detection model into a microcomputer built into a video recording robot, the video recording robot being equipped with a plurality of cameras;
[0030] S500, when the video recording robot scans and inspects the underground drainage pipe, at least one camera sends the captured video frames to the trained defect detection model for detection in real time during the shooting process, and the video frames with defects are then included in the training data set for real-time training and accuracy correction. In addition, the video frames shot by at least one camera are then transmitted to the defect detection model after accuracy correction for detection to obtain the detection results.
[0031] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the underground drainage pipe defect detection method as described above are implemented.
[0032] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the underground drainage pipe defect detection method as described above when executing the program.
[0033] The present invention provides an underground drainage pipe defect detection method, medium and equipment, which have the following beneficial effects:
[0034] The present invention obtains underground drainage pipe defect pictures, and uses annotation tools to mark the pipe defects in the pictures to obtain a training data set, and constructs a defect detection model. The defect detection model is obtained by first adding an improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous C2f module of the SPPF in the YOLOv8 backbone network with the DCNv2 with the improved CA attention mechanism. The training data set is used to train the defect detection model to obtain a trained defect detection model. The trained defect detection model is used to detect underground drainage pipe defects. Compared with the current method of using YOLOv8 to detect underground drainage pipes, the defect detection model has higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1It is a schematic flow chart of a method for detecting defects in underground drainage pipes provided by the present invention;
[0036] Figure 2 It is a flowchart of the improved CA attention mechanism provided by the present invention;
[0037] Figure 3 It is an overall flow chart of an underground drainage pipe defect detection method provided by the present invention;
[0038] Figure 4 It is a structural block diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The following will be combined with the accompanying drawings provided by the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. According to the following description, the advantages and features of the present invention will be more clear. It should be noted that the accompanying drawings are all in a very simplified form and are not in precise proportions, which are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.
[0040] Example 1
[0041] This embodiment provides a method for detecting defects in underground drainage pipes. Figure 1 As shown, the method comprises the following steps:
[0042] S100, obtaining an underground drainage pipe defect image, and using a labeling tool to mark the pipe defects in the image to obtain a training data set.
[0043] Specifically, after collecting pictures of underground drainage pipe defects, the pictures are cropped into the required size, and annotation tools are used to mark the pipe defects in the pictures. Different categories of defects are identified with different names.
[0044] S200, construct a defect detection model. The defect detection model is obtained by first adding the improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous layer C2f module of SPPF in the YOLOv8 backbone network with the DCNv2 with the improved CA attention mechanism.
[0045] In one embodiment, the improved CA attention mechanism is added to the deformable convolution DCNv2 as follows: the deformable convolution DCNv2 first performs a convolution operation on the input feature layer to obtain an offset field, which contains the offset of each position, indicating the movement distance in the x and y directions; during the convolution process, the sampling points are no longer fixed grid points, but are moved according to the offset, and the eigenvalues of the offset positions are calculated by bidirectional linear interpolation. In this process, the ability of the deformable convolution DCNv2 to generate offsets is relatively weak, so the improved CA attention mechanism is added during the convolution process to enable it to fully extract the features of each path and then generate the corresponding offsets.
[0046] In one embodiment, see Figure 2 As shown in Figure 2, the data processing process of the improved CA attention mechanism is as follows:
[0047] S210, the input feature map is divided into two directions, X direction and Y direction, and average pooling is performed respectively - XAvgPool and YAvg Pool, and a channel newChannel is added to perform global average pooling - GAP in both directions at the same time.
[0048] S220, after average pooling is performed in the Y direction, the dimensional order of the obtained feature map is re-adjusted (Permute), and then the re-adjusted feature map in the Y direction and the feature map in the X direction are concatenated (Concat).
[0049] S230, sending the spliced feature map to the first convolution module Conv for processing to extract image features.
[0050] The first convolution module Conv slides the convolution kernel on the image, performs inner product operation on each local area, and extracts the features of the image. In a preferred embodiment, the convolution kernel size of the first convolution module Conv is 3×1, and the 3×1 convolution is mainly used to extract features of the width of the feature map while keeping the height of the feature map unchanged.
[0051] S240, splitting the feature map obtained in step S230 in the X direction and the Y direction to obtain an attention tensor in a first X direction and an attention tensor in a first Y direction, respectively.
[0052] S250, sending the feature map obtained in step S230 to the second convolution module Conv for processing to change the dimension, and then obtaining the global attention weights of the feature map after passing the Sigmoid activation function, and then splitting in the X direction and the Y direction to obtain the attention weight in the X direction and the attention weight in the Y direction.
[0053] In a preferred embodiment, the convolution kernel size of the second convolution module Conv is 1×1. The second convolution module Conv slides the convolution kernel on the image, performs inner product operation on each local area, and extracts the features of the image. The 1×1 convolution can change the dimension without changing the width and height of the image in the convolution layer, and realize the dimension increase or decrease, first reducing the dimension and then increasing the dimension, which can effectively reduce the parameter calculation amount in the network.
[0054] S260, the attention tensor in the first X direction is multiplied by the attention weight in the X direction to obtain the attention tensor in the second X direction; the attention tensor in the first Y direction is multiplied by the attention weight in the Y direction to obtain the attention tensor in the second Y direction.
[0055] S270. After performing a global average pooling operation on an added channel newChannel, the channel is sent to the third convolution module Conv to obtain a global attention tensor. The average value of the global attention weight in step S250 is calculated and multiplied by the global attention tensor of the current channel to obtain a new global attention tensor.
[0056] In a preferred embodiment, the convolution kernel size of the third convolution module Conv is 1×1.
[0057] S280. Finally, in step S260, the attention tensor in the second X direction is activated by the Sigmoid activation function, and the dimension of the attention tensor in the second Y direction is readjusted by Permute and then activated by the Sigmoid activation function, and then multiplied by the new global attention tensor after the Sigmoid activation function in step S270, and then multiplied by the tensor of the input feature map to obtain the output.
[0058] S300: Use the training data set to train the defect detection model to obtain a trained defect detection model, and use the trained defect detection model to detect defects in underground drainage pipes.
[0059] The embodiment of the present invention obtains a picture of underground drainage pipe defects, and uses a labeling tool to mark the pipe defects in the picture to obtain a training data set, and constructs a defect detection model. The defect detection model is obtained by first adding an improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous C2f module of the SPPF in the YOLOv8 backbone network with the DCNv2 to which the improved CA attention mechanism is added. The training data set is used to train the defect detection model to obtain a trained defect detection model, and the trained defect detection model is used to detect underground drainage pipe defects. Compared with the current method of using YOLOv8 to detect underground drainage pipes, the defect detection model has higher accuracy.
[0060] Example 2
[0061] This embodiment provides a method for detecting defects in underground drainage pipes. Figure 3 As shown, the method comprises the following steps:
[0062] S100, obtaining an underground drainage pipe defect image, and using a labeling tool to mark the pipe defects in the image to obtain a training data set.
[0063] Specifically, after collecting pictures of underground drainage pipe defects, the pictures are cropped into the required size, and annotation tools are used to mark the pipe defects in the pictures. Different categories of defects are identified with different names.
[0064] S200, construct a defect detection model. The defect detection model is obtained by first adding the improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous layer C2f module of SPPF in the YOLOv8 backbone network with the DCNv2 with the improved CA attention mechanism.
[0065] In one embodiment, the improved CA attention mechanism is added to the deformable convolution DCNv2 as follows: the deformable convolution DCNv2 first performs a convolution operation on the input feature layer to obtain an offset field, which contains the offset of each position, indicating the movement distance in the x and y directions; during the convolution process, the sampling points are no longer fixed grid points, but are moved according to the offset, and the eigenvalues of the offset positions are calculated by bidirectional linear interpolation. In this process, the ability of the deformable convolution DCNv2 to generate offsets is relatively weak, so the improved CA attention mechanism is added during the convolution process to enable it to fully extract the features of each path and then generate the corresponding offsets.
[0066] In one embodiment, see Figure 2 As shown in Figure 2, the data processing process of the improved CA attention mechanism is as follows:
[0067] S210, the input feature map is divided into two directions, X direction and Y direction, and average pooling is performed respectively - XAvgPool and YAvg Pool, and a channel newChannel is added to perform global average pooling - GAP in both directions at the same time.
[0068] S220, after average pooling is performed in the Y direction, the dimensional order of the obtained feature map is re-adjusted (Permute), and then the re-adjusted feature map in the Y direction and the feature map in the X direction are concatenated (Concat).
[0069] S230, sending the spliced feature map to the first convolution module Conv for processing to extract image features.
[0070] The first convolution module Conv slides the convolution kernel on the image, performs inner product operation on each local area, and extracts the features of the image. In a preferred embodiment, the convolution kernel size of the first convolution module Conv is 3×1, and the 3×1 convolution is mainly used to extract features of the width of the feature map while keeping the height of the feature map unchanged.
[0071] S240, splitting the feature map obtained in step S230 in the X direction and the Y direction to obtain an attention tensor in a first X direction and an attention tensor in a first Y direction, respectively.
[0072] S250, sending the feature map obtained in step S230 to the second convolution module Conv for processing to change the dimension, and then obtaining the global attention weights of the feature map after passing the Sigmoid activation function, and then splitting in the X direction and the Y direction to obtain the attention weight in the X direction and the attention weight in the Y direction.
[0073] In a preferred embodiment, the convolution kernel size of the second convolution module Conv is 1×1. The second convolution module Conv slides the convolution kernel on the image, performs inner product operation on each local area, and extracts the features of the image. The 1×1 convolution can change the dimension without changing the width and height of the image in the convolution layer, and realize the dimension increase or decrease, first reducing the dimension and then increasing the dimension, which can effectively reduce the parameter calculation amount in the network.
[0074] S260, the attention tensor in the first X direction is multiplied by the attention weight in the X direction to obtain the attention tensor in the second X direction; the attention tensor in the first Y direction is multiplied by the attention weight in the Y direction to obtain the attention tensor in the second Y direction.
[0075] S270. After performing a global average pooling operation on an added channel newChannel, the channel is sent to the third convolution module Conv to obtain a global attention tensor. The average value of the global attention weight in step S250 is calculated and multiplied by the global attention tensor of the current channel to obtain a new global attention tensor.
[0076] In a preferred embodiment, the convolution kernel size of the third convolution module Conv is 1×1.
[0077] S280. Finally, in step S260, the attention tensor in the second X direction is activated by the Sigmoid activation function, and the dimension of the attention tensor in the second Y direction is readjusted by Permute and then activated by the Sigmoid activation function, and then multiplied by the new global attention tensor after the Sigmoid activation function in step S270, and then multiplied by the tensor of the input feature map to obtain the output.
[0078] S300: Using a training data set to train a defect detection model to obtain a trained defect detection model.
[0079] S400, loading the trained defect detection model into a microcomputer built into a video recording robot, which is equipped with multiple cameras.
[0080] Specifically, the video recording robot has a built-in high-performance microcomputer and is equipped with three high-definition cameras, namely camera one, camera two, and camera three. The brightness, contrast, saturation and other parameters of camera one and camera two are adjusted to make the recorded data more diverse and the data set richer; camera three is set to normal parameters.
[0081] S500, when the video recording robot scans and inspects the underground drainage pipe, at least one camera sends the captured video frames to the trained defect detection model for detection in real time during the shooting process, and the video frames with defects are then included in the training data set for real-time training and accuracy correction. In addition, the video frames shot by at least one camera are then transmitted to the defect detection model after accuracy correction for detection to obtain the detection results.
[0082] Specifically, during the shooting process, cameras one and two put the captured video frames into the trained model for detection in real time. The defective data detected is then included in the training set for real-time training for accuracy correction. The recorded data from camera three is then transmitted to the computer for detection to obtain the detection results.
[0083] The embodiment of the present invention pre-embeds an improved YOLOv8 model and its training environment based on preliminary training of underground drainage pipeline defect videos in a microcomputer, and an improved CA attention mechanism is applied in the YOLOv8 model. Three high-definition cameras are configured on the top of the robot's exterior, which have the ability to capture the entire interior of the pipeline in real time and clearly. The three cameras are deliberately designed asymmetrically in layout, and the brightness, contrast and saturation of two of the cameras are adjusted differentially, aiming to improve the detection effect by increasing image diversity. In the actual detection process, the two specially adjusted cameras will capture video frames in real time and input them into the trained improved YOLOv8 model for defect detection. Once defect data is detected, these data will be immediately included in the training set for real-time training and accuracy correction, while the third camera maintains normal brightness, contrast and saturation settings. The video it is responsible for recording will be used as a verification set. After the data of the first two cameras are trained by the training set, they will be tested to ensure that the final defect detection results are both accurate and real-time.
[0084] Example 3
[0085] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the underground drainage pipe defect detection method described above are implemented.
[0086] The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above-mentioned types of memory.
[0087] Example 4
[0088] This embodiment provides a computer device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the underground drainage pipe defect detection method described above when executing the program.
[0089] like Figure 4 As shown, the computer device may include: at least one processor 71, such as a CPU (Central Processing Unit), at least one communication interface 73, a memory 74, and at least one communication bus 72. The communication bus 72 is used to realize the connection and communication between these components. The communication interface 73 may include a display screen (Display) and a keyboard (Keyboard), and the optional communication interface 73 may also include a standard wired interface and a wireless interface. The memory 74 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 74 may optionally be at least one storage device located away from the aforementioned processor 71. The memory 74 stores application programs, and the processor 71 calls the program code stored in the memory 74 to execute any of the above method steps.
[0090] The communication bus 72 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 72 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0091] Among them, the memory 74 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM); the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk (English: hard disk drive, abbreviated: HDD) or a solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 74 may also include a combination of the above types of memory.
[0092] The processor 71 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.
[0093] The processor 71 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0094] Optionally, the memory 74 is also used to store program instructions. The processor 71 can call the program instructions to implement the underground drainage pipeline defect detection method of the present invention.
[0095] Those skilled in the art should understand that the present invention can be implemented in many other specific forms without departing from the spirit and scope of the present invention. Based on the embodiments of the present invention, any changes and modifications made by ordinary technicians in the field of the present invention according to the above disclosure are within the scope of protection of the claims.
Claims
1. A method for detecting defects in underground drainage pipes, characterized in that: The method comprises the following steps: S100, obtaining an underground drainage pipe defect image, and using a labeling tool to label the pipe defects in the image to obtain a training data set; S200, constructing a defect detection model, where the defect detection model is obtained by first adding the improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous C2f module of the SPPF in the YOLOv8 backbone network with the DCNv2 to which the improved CA attention mechanism is added; S300: Use the training data set to train the defect detection model to obtain a trained defect detection model, and use the trained defect detection model to detect defects in underground drainage pipes.
2. The underground drainage pipe defect detection method according to claim 1, characterized in that: The step S100 includes: after collecting pictures of underground drainage pipe defects, cutting the pictures into a required size, using a marking tool to mark the pipe defects in the pictures, and marking different types of defects with different names.
3. The underground drainage pipe defect detection method according to claim 1, characterized in that: In the step S200, the improved CA attention mechanism is added to the deformable convolution DCNv2 specifically as follows: the deformable convolution DCNv2 first performs a convolution operation on the input feature layer to obtain an offset field, which contains the offset of each position, indicating the movement distance in the x and y directions; during the convolution process, the sampling points are no longer fixed grid points, but are moved according to the offset, and the eigenvalues of the offset positions are calculated by bidirectional linear interpolation. The improved CA attention mechanism is added during the convolution process to fully extract the features of each path and then generate the corresponding offset.
4. The underground drainage pipe defect detection method according to claim 1, characterized in that: In step S200, the data processing process of the improved CA attention mechanism is as follows: S210, dividing the input feature map into two directions, the X direction and the Y direction, and performing average pooling respectively, and adding a channel to perform global average pooling in both directions at the same time; S220, after average pooling in the Y direction, readjust the dimensional order of the obtained feature map, and then splice the readjusted feature map in the Y direction and the feature map in the X direction; S230, sending the spliced feature map to the first convolution module Conv for processing to extract image features; S240, splitting the feature map obtained in step S230 in the X direction and the Y direction to obtain an attention tensor in a first X direction and an attention tensor in a first Y direction respectively; S250, sending the feature map obtained in step S230 to the second convolution module Conv for processing to change the dimension, and then obtaining the global attention weights of the feature map after the Sigmoid activation function, and then splitting in the X direction and the Y direction to obtain the attention weight in the X direction and the attention weight in the Y direction; S260, multiplying the attention tensor in the first X direction by the attention weight in the X direction to obtain the attention tensor in the second X direction; multiplying the attention tensor in the first Y direction by the attention weight in the Y direction to obtain the attention tensor in the second Y direction; S270, after performing a global average pooling operation on an added channel, send the result to the third convolution module Conv to obtain a global attention tensor; calculate the average value of the global attention weight in step S250, and multiply it by the global attention tensor of the current channel to obtain a new global attention tensor; S280. Finally, in step S260, the attention tensor in the second X direction is activated by the Sigmoid activation function, and the dimension of the attention tensor in the second Y direction is readjusted and then activated by the Sigmoid activation function, and then multiplied by the new global attention tensor after the Sigmoid activation function in step S270, and then multiplied by the tensor of the input feature map to obtain the output.
5. The underground drainage pipe defect detection method according to claim 4, characterized in that: The convolution kernel size of the first convolution module Conv is 3×1.
6. The underground drainage pipe defect detection method according to claim 4, characterized in that: The convolution kernel size of the second convolution module Conv is 1×1.
7. The underground drainage pipe defect detection method according to claim 4, characterized in that: The convolution kernel size of the third convolution module Conv is 1×1.
8. A method for detecting defects in underground drainage pipes, characterized in that: The method comprises the following steps: S100, obtaining an underground drainage pipe defect image, and using a labeling tool to label the pipe defects in the image to obtain a training data set; S200, constructing a defect detection model, where the defect detection model is obtained by first adding the improved CA attention mechanism to the deformable convolution DCNv2, and then replacing the previous C2f module of the SPPF in the YOLOv8 backbone network with the DCNv2 to which the improved CA attention mechanism is added; S300, using a training data set to train a defect detection model to obtain a trained defect detection model; S400, loading the trained defect detection model into a microcomputer built into a video recording robot, the video recording robot being equipped with a plurality of cameras; S500, when the video recording robot scans and inspects the underground drainage pipe, at least one camera sends the captured video frames to the trained defect detection model for detection in real time during the shooting process, and the video frames with defects are then included in the training data set for real-time training and accuracy correction. In addition, the video frames shot by at least one camera are then transmitted to the defect detection model after accuracy correction for detection to obtain the detection results.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the underground drainage pipe defect detection method as described in any one of claims 1 to 7 are implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the underground drainage pipe defect detection method as described in any one of claims 1-7 are implemented.
Citation Information
Cited By
Underground structure bolt missing detection method assisted by robot dog
CN120747621A