Improved sewer internal defect detection method and system based on YOLOv11

By introducing the SENet attention mechanism, adaptive feature fusion module and MPDIoU loss function in the YOLOv11 model, the problem of insufficient feature fusion and bounding box regression accuracy of the YOLOv11 model in the internal defect detection of sewer channels is solved, and higher detection accuracy and robustness are achieved.

CN119540725AActive Publication Date: 2025-02-28NANJING UNIV OF INFORMATION SCI & TECH

Patent Information

Application Number
CN202510027737.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-02-28
Estimated Expiration
2045-01-08

AI Technical Summary

Technical Problem

The existing YOLOv11 model has problems such as limited feature fusion capability, low detection accuracy for small objects in complex backgrounds, low bounding box regression accuracy, and lack of modeling of inter-channel dependencies in the detection of internal defects of sewer channels.

Method used

By introducing the SENet attention mechanism and adaptive feature fusion module, the bounding box regression loss function is optimized as the MPDIoU loss function, enhancing the model's capture ability of multi-scale features and the accuracy of bounding box prediction.

Benefits of technology

It significantly improves the detection accuracy and robustness of the model in the detection of internal defects in the sewer, can detect multiple types of defects more accurately, and maintains a high real-time detection capability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention provides a sewer internal defect detection method and system based on YOLOv11 improvement, and the method achieves the dynamic weight fusion of multi-level features through a self-adaptive feature fusion module, and improves the detection capability of a model for small targets and complex backgrounds. The selectivity of channel characteristics is improved through an SENet attention mechanism, and background interference is reduced; and introducing an MPDIOU loss function to improve bounding box regression loss. The performance of the improved model in detection tasks of sewer defects such as cracks, obstacles, corrosion, deformation and the like is remarkably superior to that of original YOLOv11, and particularly key indexes such as mAP50 (average precision), Box precision (P), recall rate (R) and the like are remarkably improved. According to the invention, efficient and accurate detection of multiple types of defects in the sewer can be realized, and a better solution is provided for maintenance and management of the sewer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image recognition, and in particular relates to a method and system for detecting internal defects of a sewer based on an improved YOLOv11. Background Art

[0002] With the acceleration of urbanization and the aging of infrastructure, the maintenance and repair of sewer systems have become increasingly important. Traditional sewer inspection methods mainly rely on manual inspection or the use of simple visual equipment, which is not only inefficient and costly, but also difficult to cope with complex internal environments such as dim light and poor water quality. In recent years, deep learning-based object detection technology has been widely used in various fields due to its high efficiency and accuracy, but the performance of existing models is still limited in specific application scenarios such as underground pipeline defect detection. The internal environment of sewers is usually harsh, including but not limited to dim lighting conditions, complex background interference (such as sewage, sediments), irregular geometric shapes, etc. These factors make it difficult for traditional object detection algorithms to achieve good performance. In addition, there are many types of defects in sewers, ranging from subtle cracks to large-scale damage, and different types of defects are very sparsely distributed, which puts higher requirements on the detection model. Due to the different pipe diameters and changes in viewing angles, the size of the target object in the image will also vary greatly, which increases the difficulty of detection. Therefore, it is particularly important to develop an automated detection system that can accurately identify multiple types of defects in complex environments.

[0003] Deep learning is a branch of machine learning that simulates complex data patterns by building multi-layer neural networks. In particular, convolutional neural networks (CNNs) have achieved great success in image recognition tasks and have gradually become a mainstream tool in the field of computer vision. As one of the classic representatives of real-time object detection, the YOLO (You Only Look Once) series of algorithms are known for their fast speed and high accuracy. However, when faced with problems in specific fields, such as crack, obstacle, corrosion and other defect detection in underground pipes, the standard YOLO model may not meet the actual needs, because these scenes usually have low lighting conditions, high noise levels and diverse defect morphology. Although the existing YOLOv11 model has demonstrated excellent performance on multiple public datasets, there are still some problems in directly applying it to sewer internal defect detection: limited feature fusion capability, low detection accuracy for small targets in complex backgrounds; low bounding box regression accuracy, especially when the aspect ratio is the same but the specific size is different; lack of modeling of inter-channel dependencies, resulting in the loss of some key information, affecting the final detection results. These problems limit the effectiveness of YOLOv11 in practical applications, especially in situations where high accuracy and robustness are required.

[0004] In order to solve the above limitations, various improvement measures have been introduced in recent years to improve the performance of the YOLOv11 model. First, in terms of feature fusion, the traditional YOLOv11 uses a fixed feature pyramid network (FPN). Although it can handle multi-scale features, the detection accuracy of small targets in complex backgrounds still needs to be improved. Secondly, for the bounding box regression problem, the traditional IoU loss function is difficult to optimize the relationship between the predicted box and the true box, especially when the aspect ratio is the same but the specific size is different, the performance is not satisfactory. Finally, the ordinary CNN structure fails to make full use of the correlation between channels, resulting in the loss of some key information, which affects the final detection results. Summary of the invention

[0005] Purpose of the invention: The technical problem to be solved by the present invention is to provide a method and system for detecting internal defects of sewers based on an improved YOLOv11 in view of the shortcomings of the prior art.

[0006] The method comprises:

[0007] Step 1, preprocessing the internal image of the sewer;

[0008] Step 2: Build an improved YOLOv11 network structure, extract multi-scale features of the image, and generate feature maps of different scales;

[0009] Step 3: Introduce the channel attention mechanism SENet to enhance the model's attention to important features and generate channel weighted feature maps of different scales;

[0010] Step 4, adaptively fuse the multi-scale channel weighted feature maps to generate weighted fused feature maps;

[0011] Step 5: Introduce the multi-parameter dynamic optimization intersection-over-union loss function MPDIoU to optimize the bounding box regression and calculate the total loss, and back-propagate to optimize the training parameters;

[0012] Step 6, output the final detection result;

[0013] In step 1, in order to ensure that the input image meets the input requirements of the network, the input image is scaled to meet the input requirements of the network, such as adjusting it to a resolution of 640×640. In order to expand the diversity of the dataset, data augmentation operations such as random cropping, flipping, and color jittering are used. Specifically, random cropping can change the cropping area of ​​the image and enhance the model's ability to recognize different parts of the object; image flipping helps the model learn the left-right symmetrical object features; and color jittering simulates different lighting and environmental conditions by adjusting the brightness, contrast, and saturation of the image;

[0014] Furthermore, the pixel values ​​are normalized so that they fall within the interval [0, 1] to ensure that the numerical range of different image data is consistent. The data normalization operation normalizes the mean and variance of the image to ensure that the distribution of each pixel value is close to zero mean and unit variance. Specifically, the normalization formula is . Among them, among them, is the standardized image data, is the image data after data enhancement, and are the mean and standard deviation of the image data, respectively;

[0015] In step 2, the YOLOv11 network structure includes a backbone network, a neck network, and a head network. These networks include multiple convolutional layers, downsampling layers, and activation function modules. On the basis of the YOLOv11 network structure, a processing layer introducing the SENet (Squeeze-and-Excitation Network) module is added after the 16th, 19th, and 22th layers of the neck network structure, and an adaptive feature fusion module is added to the head network. In the improved network structure, by processing the image layer by layer, the 16th, 20th, and 24th layers generate three scales of feature maps: low-level feature map P3, middle-level feature map P4, and high-level feature map P5; these feature maps represent different levels of information: the low-level feature map P3 retains more spatial detail information, such as basic features such as edges and textures; the middle-level feature map P4 not only retains certain spatial detail information, but also captures some semantic information, playing a transitional role between low-level and high-level features; the high-level feature map P5 mainly captures high-level semantic information, such as object category and position, and is suitable for the detection of complex semantic patterns and large targets. After the image is input into the network, the basic features are first extracted through more than two convolution operations, and then the spatial resolution of the feature map is reduced through step-by-step downsampling and convolution operations, while the number of channels is increased to enhance the feature expression capability, thereby gradually generating a multi-scale feature map. This design can fully utilize the complementarity of low-level, mid-level, and high-level features, which not only improves the detection accuracy of small targets, but also strengthens the recognition capability of complex targets.

[0016] In step 3, SENet is an effective channel attention mechanism that can automatically learn the relationship between different channels and enhance the focus on key information, thereby improving the representation ability of the model;

[0017] In this invention, the network architecture weights are redefined, and a continuous value ranging from 0 to 1 is assigned to the candidate operations on the feature maps of each scale (P3, P4, P5) as the architecture weight. These weights represent the importance of each scale and are dynamically adjusted according to the performance during training. For example, when detecting small targets, the weight of the P3 layer may be higher; when detecting large targets, the weight of the P5 layer will be more important;

[0018] Architecture Weights refers to a set of parameters used to represent the importance of different components or paths in neural network design. These weights are usually used to control the flow of information in the network structure and determine which parts should be given more attention or ignored;

[0019] In the present invention, the three layers to which the SENet module is added are responsible for capturing target information of three different scales, small, medium, and large, respectively. Targets of different scales have different feature distributions, so applying SENet independently at each scale can help the model better focus on the key features of each scale. For each feature layer, a squeezing and excitation process is first performed to generate a set of channel weights for the feature maps of each layer. These weights are then applied to the corresponding feature maps to strengthen those features that are critical for detecting targets of a specific scale, while weakening those features that are less relevant. This feature enhancement method based on the attention mechanism helps to reduce the impact of background noise and improve the model's recognition accuracy for targets;

[0020] The squeezing refers to compressing the feature map at each spatial position into a global descriptor, which is achieved through global average pooling (GAP). The function of GAP is to average the feature map of each channel in the spatial dimension to generate a vector with the same length as the number of channels. This vector is regarded as a comprehensive representation of all spatial information of the channel;

[0021] The excitation is to build a small neural network using a fully connected layer or a convolutional layer, which takes the vector generated in the squeezing phase as input and outputs a vector of the same length, where each element represents the weight of the corresponding channel. This process usually includes two fully connected layers, with a ReLU activation function in between, and a Sigmoid activation function to ensure that the output value is between 0 and 1. These weights reflect the importance of each channel in the entire image;

[0022] Step 3 includes:

[0023] Step 3.1, preprocess the initial feature map and perform channel separation: separate the feature map F into c separate feature maps according to the number of channels , where the feature map It represents one of the three scale feature maps P3, P4, and P5. is a three-dimensional feature map, , Represents the input feature map The three-dimensional real space, Represents the number of channels of the feature map, also known as depth, Represents the height of the feature map, that is, the number of pixels of the feature map in the vertical direction, represents the width of the feature map, that is, the number of pixels of the feature map in the horizontal direction, n represents a positive integer in the interval [1, c], represents a separate feature map for the nth channel, is a two-dimensional feature map, , each channel represents a feature map A specific feature pattern or information (such as edge, texture, color, etc.)

[0024] To address the common problems of low contrast and high noise in sewer environments, the adaptive normalization (AN) technology is used. AN converts the individual feature maps of each channel into The pixel values ​​are normalized to the range of [0, 1]. By enhancing the local contrast, the weak edge and texture information in the feature map are amplified, so that the final normalized result can not only maintain good numerical stability but also highlight the key features. The formula is:

[0025] ,

[0026] in, Represents the feature map The result after normalization is and Represent the mean and standard deviation of channel features respectively, represents a small positive number (e.g. ), used to avoid the denominator being zero;

[0027] Step 3.2: Obtain the global representation of each channel through global average pooling GAP , perform channel-by-channel calculations and convert the feature map Compress to a scalar , the formula is:

[0028] ,

[0029] in, represents the pixel value of channel n at position (i, j), represents the normalization factor. Based on this formula, considering the particularities of the sewer scene, such as dimness, complex environment, and variable shapes of the detected targets, the improved model considers the influence of the surrounding area when calculating the global representation, and captures small targets or key parts more accurately in a weighted manner. The improved formula is:

[0030] ,

[0031] in, Represents the similarity between each pixel in the feature map and its surrounding pixels. ,in, is a trainable parameter, The initial value is 0.5, and They are spatial distance weight and feature similarity weight, ,in, and are the horizontal and vertical coordinates of the pixel of channel n in the neighborhood of position (i, j), is (i, j) and ( ) standard deviation of the distance, Represents the exponential function , ,in, Indicates that channel n is at position ( )’s pixel value;

[0032] Step 3.3, the global representation of c channels Gather together to form a high-dimensional feature z with a dimension of c. Project z into a low-dimensional space to reduce the computational complexity and achieve information compression. Perform a linear transformation. The formula is: ,in, represents the dimension reduction matrix, represents the scaling factor (usually 16), the feature vector after dimensionality reduction represents the channel relationship after compression, , represents the channel dimension (i.e. the number of channels); then Apply the ReLU activation function to introduce nonlinear characteristics, the formula is ,in, express The result after being processed by the ReLU activation function, is the ReLU activation function, ;

[0033] Step 3.4, remap the low-dimensional features to the high-dimensional channel weights to perform dimensionality transformation. Specifically, the feature vector after dimensionality reduction is Through a dimension-enhanced matrix Mapping back to the original number of channels , thereby generating the channel weight vector In order to improve the flexibility of the model, a multi-scale fusion strategy (MSF) is introduced. MSF allows the model to learn from information at multiple scales (edge, texture, shape, layout, etc.) to enhance the understanding of complex scenes. The formula is ,in, represents a dimension-raising matrix, Represents the generated channel weight vector, which is the set of channel weights of all channels; then normalize it and apply S The gmoid activation function converts the channel weight vector Restricted to Range, the formula is , where the Sigmoid function is defined as , express After S Channel weight vector after gmoid activation function processing;

[0034] Step 3.5, perform weight expansion, The channel weight of each channel in Expanded to a matrix consistent with the dimension of the feature map, the formula is .in, Indicates that the channel weight Expanded to feature map The weight matrix with the same spatial size, that is, the expanded weight matrix of the nth channel, Indicates the size is height width The all-1 matrix; considering the importance of different positions, the spatial-aware weighted fusion mechanism (Spatial-Aware Weighted Fusion, SAWF) is introduced, and the formula is ,in, Represents the nth channel feature map after channel weighting, which integrates the channel weight information;

[0035] Step 3.6, recombines all weighted channel feature maps to ensure that the final generated feature map not only contains rich spatial and semantic information, but also maximizes the use of the channel weight information adjusted by the attention mechanism. The formula is .in, Represents the output feature map generated after fusion of channel weights, that is, the channel weighted feature map, which contains the input feature map spatial, semantic and other information as well as channel weight information adjusted by the attention mechanism;

[0036] In step 4, the adaptive feature fusion is a technology used to improve the feature extraction capability of the neural network, allowing the model to automatically adjust the weights of each scale feature map according to the input data, so as to better capture the target information of different scales. Specifically, the adaptive feature fusion module can filter conflicting information spatially, suppress the inconsistency between features of different scales, and enhance scale invariance;

[0037] Step 4 includes:

[0038] Step 4.1, align the multi-scale feature maps;

[0039] Step 4.2, generate weights;

[0040] Step 4.3, weighted fusion feature map;

[0041] Step 4.4, perform feature re-optimization.

[0042] Step 4.1 includes:

[0043] Step 4.1.1: Receive the channel weighted feature maps of the three scale feature maps P3, P4, and P5 and process them through the SENet attention mechanism , , .in, Represents the channel weighted feature map of the low-level feature map P3 obtained by step 3, Represents the channel weighted feature map of the middle-level feature map P4 obtained in step 3, Represents the channel weighted feature map of the high-level feature map P5 obtained in step 3;

[0044] Step 4.1.2: In order to ensure that feature maps of different scales can be effectively fused, an upsampling operation is used to adjust all received feature maps to a uniform resolution. Adjust to Consistent resolution, the formula is ,in, express , , Feature map obtained after upsampling, UpSample is an upsampling operation;

[0045] Step 4.1.3, perform feature alignment. During the alignment process, in order to ensure In order to effectively fuse the three scale feature maps, it is necessary to perform channel alignment processing on them through 1×1 convolution to solve the problem of inconsistent channel numbers of feature maps of different scales. The number of channels of the feature map is 256. The number of channels of the feature map is 512. The number of channels of the feature map is 1024. The number of channels is increased to 512, The number of channels is reduced to 512, and the formula is:

[0046]

[0047] in, represents a 1×1 convolution operation, It represents the feature alignment feature map obtained after the feature map channel is reduced or upgraded, where , , Respectively indicate the corresponding Feature maps obtained after feature alignment of three scale feature maps.

[0048] Step 4.2 includes:

[0049] Step 4.2.1, Initialization , , Weight parameters of the three feature maps ,in, , the weight parameters are initialized to positive values ​​with equal means (such as ), indicating that in the initial stage, the contributions of the three feature maps are equal;

[0050] Step 4.2.2, introduce a dynamic adjustment mechanism for weight parameters, so that the network can automatically learn the most appropriate weight distribution scheme based on the characteristics of the sewer data set: make the sum of the weight parameters equal to 1, the formula is , where the function , Softmax function is a commonly used normalization function used to map a set of input values ​​to the range of [0, 1] and make their sum equal to 1, represents the initial weight value of each feature map, , Indicates that each input value Amplify it through an exponential function to ensure that the value is positive. Represents all input values The sum of the exponentials of , α, β, and γ are the calculated weight parameters, corresponding to exist The calculation result in the function. In addition, α, β, and γ are trainable weight parameters. In each training, the model will automatically learn which scale features are more important for the current detection task, and update these weight parameters for the next training. For example, if the P3 scale features are more important for the target detection task, the network will learn to increase the value of α and reduce the value of β or γ.

[0051] Step 4.3 includes:

[0052] Step 4.3.1, comprehensively consider the information of each feature map, and introduce the importance of features of different scales through weight parameters. Specifically, the weight parameters α, β, γ and each feature map , , Multiply element by element to get the weighted feature map , the formula is: .

[0053] Step 4.4 includes:

[0054] Step 4.4.1, adjust the number of channels of the feature map, improve the representation ability of the feature through nonlinear transformation, so that the model can achieve better performance with less computing resources, and perform better on the fused feature map. Apply 1×1 convolutional layer operation to further optimize, the formula is ,in, express The feature map obtained after the 1×1 convolution operation;

[0055] Step 4.4.2, combine Batch Normalization and ReLU activation function to make the feature distribution more stable, speed up the training and prevent the gradient disappearance problem. The formula is ,in, Representation feature map Normalized and activated output feature map; ,in, and Represents the current feature map The mean and variance of each channel data, and Initially 1 and 0, respectively, represent the trainable parameters of the network, which are used for scaling and translation to enhance the expressiveness of the model; ), specifically, The function sets the input values ​​less than 0 to 0 and keeps the values ​​greater than 0 unchanged;

[0056] Step 4.4.3, feature map The 3×3 convolution operation is further optimized to maintain computational efficiency while avoiding overfitting. The formula is: ,in express The feature map obtained by the 3×3 convolution operation, Represents a 3×3 convolution operation;

[0057] In step 5, after the weighted fusion is completed, the fused feature map is sent to the detection head for target category prediction and bounding box regression. The bounding box regression loss function is improved by multi-parameter dynamic optimization of the intersection-over-union loss function MPDIoU, which specifically includes the following steps:

[0058] Step 5.1, feature map branch processing;

[0059] Step 5.2, calculate the classification loss;

[0060] Step 5.3, calculate the loss function MPDIoU and improve the regression loss;

[0061] Step 5.4, calculate the confidence loss;

[0062] Step 5.5, loss optimization and weight balance;

[0063] Step 5.1 includes:

[0064] Step 5.1.1, the detection head will fused feature map It is divided into two branches: classification branch and regression branch. The classification branch is used to predict the target category distribution of each anchor box anchor. The output of the classification branch is ,in is the number of categories, and the regression branch is used to regress the bounding box parameters of each anchor box, which include the center point coordinates and size ,in, Indicates the width, which refers to the horizontal span of the bounding box. represents the height, which refers to the span of the bounding box in the vertical direction. The output of the regression branch is ;

[0065] Step 5.1.2: The classification branch calculates the category probability distribution of each anchor box through the Softmax function. The formula is: , the regression branch directly outputs the bounding box parameters, the formula is ;

[0066] Step 5.2 includes:

[0067] Step 5.2.1, use cross-extraction loss to calculate classification loss :

[0068] ,

[0069] in, is the number of positive samples, Indicates the positive sample The true label of samples in the kth category, Indicates the positive sample The predicted probability of a sample in the kth category, Data from , is the number of positive samples;

[0070] Step 5.3 includes:

[0071] Step 5.3.1, calculate the intersection over union (IoU):

[0072] ,

[0073] in, Represents the prediction box and real frame The area of ​​the intersection of Represents the prediction box and real frame The area of ​​the union of Data from , The data is derived from the initial real image parameters;

[0074] Step 5.3.2, calculate the Euclidean distance between the center of the predicted box and the center of the real box :

[0075] ,

[0076] in, Represents the prediction box Center coordinates, Represents the real box Center coordinates;

[0077] Step 5.3.3, calculate the minimum distance from the real box key point to the predicted box boundary :

[0078] ,

[0079] in The first The coordinates of the key points, Represents the prediction box The coordinates of the boundary points;

[0080] Step 5.3.4, calculate MPDIoU loss , the formula is:

[0081] ,

[0082] in, Represents the normalization coefficient, which refers to the diagonal length of the minimum enclosing rectangle containing the predicted box and the true box. Represents the number of ground-truth box key points, and represents the weight coefficient;

[0083] Step 5.4 includes:

[0084] Step 5.4.1, calculate the confidence loss :

[0085] ,

[0086] in, represents the total number of samples, Indicates the total sample The true confidence of samples, Indicates the total sample The prediction confidence of samples;

[0087] Step 5.5 includes:

[0088] Step 5.5.1, consider the classification, regression and confidence losses comprehensively and calculate the total loss , the formula is:

[0089] ,

[0090] in, represents the weight coefficient;

[0091] Step 5.5.2, update the parameters through back propagation to maximize the detection performance. For each trainable parameter (such as α, β, γ, etc.), calculate the total loss Gradient of (partial derivative) , the gradient reflects the extent to which the current parameters affect the total loss, and is used to guide the adjustment of the parameters. Specifically, through the optimization algorithm Adam, the learning rate is used (Take 0.01) Update the trainable parameters according to the following formula: , to achieve the purpose of updating model parameters, after the model is trained for internal defect detection of sewers many times, each training repeats step 2 (extracting multi-scale features of the image and generating feature maps of different scales), step 3, step 4 and step 5 to achieve optimal parameters, thereby improving the model detection performance;

[0092] In step 6, after 100 trainings, the final detection results include data such as average accuracy, target category, bounding box coordinates, and confidence, which are used for analysis and decision-making of sewer internal scenes;

[0093] The present invention also provides a sewer internal defect detection system based on the improved YOLOv11, comprising:

[0094] A data preprocessing module is used to process the image data collected inside the sewer, including image enhancement, size normalization and data annotation;

[0095] The feature extraction and fusion module introduces the SENet attention mechanism and the feature fusion technology of the adaptive feature fusion module to enhance the model's ability to capture multi-scale features and optimize the expression effect of spatial features.

[0096] The object detection module is based on the improved YOLOv11 model and introduces the MPDIoU loss function to achieve accurate bounding box prediction and object positioning;

[0097] The result output module performs post-processing on the inspection results, including target classification, defect marking and confidence scoring, and outputs them in the form of image overlay and statistical reports.

[0098] The present invention effectively improves the performance of the YOLOv11 model in the task of detecting internal defects in sewers by introducing an adaptive feature fusion module, MPDIoU loss function and SENet attention mechanism. The adaptive feature fusion module enhances the model's ability to express multi-scale information by dynamically weighted fusion of feature maps of different scales, thereby better adapting to the complex environment inside the sewer. The MPDIoU loss function improves the accuracy of the detection box by improving the bounding box regression loss, especially when dealing with complex defects. The SENet attention mechanism highlights key areas by adaptively adjusting the weights of channel features, effectively suppressing the interference of irrelevant information. Combining these innovations, the present invention significantly improves the detection accuracy and robustness of the model for defects such as cracks, corrosion, and obstacles in sewers, overcomes the shortcomings of the traditional YOLOv11 model in complex environments, and provides an efficient and accurate new solution for the field of automatic sewer detection;

[0099] The beneficial effects of the present invention are as follows: the method of the present invention proposes an efficient detection scheme based on the improvement of the YOLOv11 model for the task of detecting internal defects in sewers. The scheme significantly improves the detection performance of the model by introducing an adaptive spatial feature fusion module, MPDIoU loss function and SENet attention mechanism. The adaptive feature fusion module can dynamically fuse multi-scale feature maps, enhance the model's ability to capture diverse features in complex environments, and especially perform outstandingly under the conditions of dimness and complex structures inside the sewer. The MPDIoU loss function optimizes the bounding box regression process, improves the accuracy of target positioning through the joint constraints of the center point distance and the minimum distance of the key points, and solves the problem of insufficient positioning accuracy in traditional methods. The SENet attention mechanism further improves the expression ability of the feature map, making the model more robust in multi-class defect detection. Through the organic combination of these three major innovations, the method of the present invention not only improves the detection accuracy, but also maintains a high reasoning speed, has good real-time detection capabilities, is particularly suitable for efficient and accurate internal defect detection of sewers, and has high practical value and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0100] Figure 1 Flow chart of the method of the present invention.

[0101] Figure 2 This is the overall network structure diagram of the improved YOLOv11 in the present invention.

[0102] Figure 3 This is the network structure diagram of the SENet module in the present invention.

[0103] Figure 4 This is the network structure diagram of the adaptive feature fusion module in the present invention.

[0104] Figure 5 This is a network structure diagram of the detection head module in the present invention.

[0105] Figure 6 It is a schematic diagram of the average accuracy mAP50.

[0106] Figure 7 It is a schematic diagram of comparing the average accuracy of each training with the original YOLOv11 model in the present invention. DETAILED DESCRIPTION

[0107] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and other advantages of the present invention will become more clear.

[0108] like Figure 1As shown, an embodiment of the present invention provides a method for detecting internal defects of a sewer based on an improved YOLOv11, comprising the following steps:

[0109] Step 1, such as Figure 1 , preprocess the sewer interior image; the size of the input waterway interior image X is usually not fixed, so preprocessing is required to adapt to the network input requirements. The waterway interior image X will be scaled to the target resolution, such as 640×640, and will undergo data augmentation operations (such as random cropping, flipping, color jittering, etc.) to expand the diversity of the dataset. Subsequently, the pixel values ​​are normalized to the [0, 1] interval and standardized to zero mean unit variance, as follows: ,in, refers to the standardized image data, Refers to the image data after data enhancement, is the mean value of the image data, Refers to the standard deviation of the image data. These preprocessing steps can significantly improve the generalization ability of the model.

[0110] Step 2, such as Figure 1 and Figure 2 , the YOLOv11 network structure design includes a backbone network, a neck network, and a head network. These networks include multiple convolutional layers, downsampling layers, and activation function modules. On the basis of the YOLOv11 network structure, a processing layer introducing the SENet module is added after the 16th, 19th, and 22th layers of the neck network structure, and an adaptive feature fusion module is added to the head network. In the improved network structure, by processing the image layer by layer, the 16th, 20th, and 24th layers generate feature maps of three scales, namely P3, P4, and P5. These feature maps represent information at different levels: the low-level feature map P3 retains more spatial detail information, such as basic features such as edges and textures; the middle-level feature map P4 not only retains certain spatial detail information, but also captures some semantic information, playing a transitional role between low-level and high-level features; the high-level feature map P5 mainly captures high-level semantic information, such as object categories and positions, and is suitable for the detection of complex semantic patterns and large targets. After the image is input into the network, the basic features are first extracted through more than two convolution operations, and then the spatial resolution of the feature map is reduced through step-by-step downsampling and convolution operations, while the number of channels is increased to enhance the feature expression capability, thereby gradually generating a multi-scale feature map. This design can fully utilize the complementarity of low-level, mid-level, and high-level features, which not only improves the detection accuracy of small targets, but also strengthens the recognition capability of complex targets;

[0111] Step 3, such as Figure 1 and Figure 3After completing feature extraction, in order to further improve the feature expression ability, the present invention introduces the SENet attention mechanism to weight multi-scale features. SENet uses a channel weighting strategy to make the network pay more attention to key features.

[0112] Step 3 includes:

[0113] Step 3.1, preprocess the initial feature map and perform channel separation: Input feature map Separate into c separate feature maps according to the number of channels ,in, It represents one of the three scale feature maps P3, P4, and P5. is a three-dimensional feature map, , Represents the input feature map The three-dimensional real space, middle Represents the number of channels of the feature map, also known as depth, Represents the height of the feature map, that is, the number of pixels of the feature map in the vertical direction, represents the width of the feature map, that is, the number of pixels of the feature map in the horizontal direction, n represents a positive integer in the interval [1, c], represents a separate feature map for the nth channel, is a two-dimensional feature map, , each channel represents a feature map A specific feature pattern or information (such as edge, texture, color, etc.)

[0114] To address the common problems of low contrast and high noise in sewer environments, the adaptive normalization (AN) technology is used. AN converts the individual feature maps of each channel into The pixel values ​​are normalized to the range of [0, 1], and the weak edge and texture information in the feature map are amplified through local contrast enhancement, so that the final normalized result can not only maintain good numerical stability but also highlight the key features. The formula is ,in, Represents the feature map The result after normalization is and Represent the mean and standard deviation of channel features respectively, Represents a small positive number (such as 1e−5) to avoid the denominator being zero;

[0115] Step 3.2: Obtain the global representation of each channel through global average pooling GAP , perform channel-by-channel calculations and convert the feature map Compress to a scalar , the formula is ,in, represents the pixel value of channel n at position (i, j), represents the normalization factor. Based on this formula, considering the particularities of the sewer scene, such as dimness, complex environment, and variable shapes of the detected targets, the improved model considers the influence of the surrounding area when calculating the global representation, and captures small targets or key parts more accurately in a weighted manner. The improved formula is: ,in, Represents the similarity between each pixel in the feature map and its surrounding pixels, ,in, is a trainable parameter, The initial value is 0.5, and They are spatial distance weight and feature similarity weight, ,in, and are the horizontal and vertical coordinates of the pixel in the neighborhood of channel n at position (i, j), is (i, j) and ( ) standard deviation of the distance, Represents the exponential function , ,in, Indicates that channel n is at position ( )’s pixel value;

[0116] Step 3.3, the global representation of c channels Gather together to form a high-dimensional feature z with a dimension of c. Project z into a low-dimensional space to reduce the computational complexity and achieve information compression. Perform a linear transformation. The formula is: ,in, represents the dimension reduction matrix, represents the scaling factor (usually 16), the feature vector after dimensionality reduction represents the channel relationship after compression, , represents the channel dimension (i.e. the number of channels); then Apply the ReLU activation function to introduce nonlinear characteristics, the formula is ,in, express The result after being processed by the ReLU activation function, is the ReLU activation function, ;

[0117] Step 3.4, remap the low-dimensional features to the high-dimensional channel weights to perform dimensionality transformation. Specifically, the feature vector after dimensionality reduction is Through a dimension-enhancing matrix Mapping back to the original number of channels , thus generating the channel weight vector In order to improve the flexibility of the model, a multi-scale fusion strategy (MSF) is introduced. MSF allows the model to learn from information at multiple scales (edges, textures, shapes, layouts, etc.) and enhance the understanding of complex scenes. The formula is ,in, Represents the dimension-upgraded matrix, mapped back to the original number of channels, Represents the generated channel weight vector, which is the set of channel weights of all channels; then normalize it and apply S The gmoid activation function converts the channel weight vector Restricted to Range, the formula is , where the Sigmoid function is defined as ;

[0118] Step 3.5, perform weight expansion, The channel weight of each channel in Expanded to a matrix consistent with the dimension of the feature map, the formula is .in, Indicates that the channel weight Expanded to feature map The weight matrix with the same spatial size, that is, the expanded weight matrix of the nth channel, Indicates the size is height width Considering the importance of different positions, the spatial-aware weighted fusion mechanism (SAWF) is introduced. SAWF uses convolutional neural networks to extract spatial information from the original feature map and integrate it into the matrix In the formula ,in, represents the nth channel feature map after channel weighting, which integrates the channel weight information, and n represents a positive integer in the interval [1, c];

[0119] Step 3.6, recombines all weighted channel feature maps to ensure that the final generated feature map not only contains rich spatial and semantic information, but also maximizes the use of the channel weight information adjusted by the attention mechanism. The formula is .in, Represents the output feature map generated after fusion of channel weights, that is, the channel weighted feature map, which contains the input feature map spatial, semantic and other information as well as channel weight information adjusted by the attention mechanism;

[0120] Step 4, such as Figure 1 and Figure 4 ,In order to fully fuse features of different scales, this paper proposes an ,adaptive feature fusion module that dynamically adjusts the weights of ,feature maps of each scale to avoid information loss and improve the ,efficiency of multi-scale feature fusion.

[0121] Step 4 includes:

[0122] Step 4.1, alignment processing of multi-scale feature maps;

[0123] Step 4.2, generate weights;

[0124] Step 4.3, weighted fusion feature map;

[0125] Step 4.4, feature re-optimization;

[0126] Step 4.1 includes:

[0127] Step 4.1.1: Receive the channel weighted feature maps of the three scale feature maps P3, P4, and P5 and process them through the SENet attention mechanism , , .in, It represents the channel weighted feature map obtained by step 3 of the P3 scale feature map. It represents the channel weighted feature map obtained by step 3 of the P4 scale feature map. Represents the channel weighted feature map of the P5 scale feature map obtained through step 3;

[0128] Step 4.1.2: In order to ensure that feature maps of different scales can be effectively fused, an upsampling operation is used to adjust all received feature maps to a uniform resolution. Adjust to Consistent resolution, the formula is ,in, express , , Feature map obtained after upsampling, UpSample is an upsampling operation;

[0129] Step 4.1.3, perform feature alignment. During the alignment process, in order to ensure In order to effectively fuse the three scale feature maps, it is necessary to perform channel alignment processing on them through 1×1 convolution to solve the problem of inconsistent channel numbers of feature maps of different scales. The number of channels of the feature map is 256. The number of channels of the feature map is 512. The number of channels of the feature map is 1024. The number of channels is increased to 512, The number of channels is reduced to 512, and the formula is:

[0130]

[0131] in, represents a 1×1 convolution operation, Represents the feature alignment feature map obtained after the feature map channel is reduced or upgraded, including , , , respectively, representing the corresponding Feature maps obtained after feature alignment of three scale feature maps;

[0132] Step 4.2 includes:

[0133] Step 4.2.1, Initialization , , Weight parameters of the three feature maps ,in, , the weight parameters are initialized to positive values ​​with equal means (such as ), indicating that in the initial stage, the contributions of the three feature maps are equal;

[0134] Step 4.2.2, introduce a dynamic adjustment mechanism for weight parameters, so that the network can automatically learn the most appropriate weight allocation scheme based on the characteristics of the sewer data set: make the sum of the weight parameters equal to 1, the formula is , where the function , Softmax function is a commonly used normalization function used to map a set of input values ​​to the range of [0, 1] and make their sum equal to 1, represents the initial weight value of each feature map, , Indicates that each input value Amplify it through an exponential function to ensure that the value is positive. Represents all input values The sum of the exponentials of , α, β, and γ are the calculated weight parameters, corresponding to exist The calculation result in the function. In addition, α, β, and γ are trainable weight parameters. In each training, the model will automatically learn which scale features are more important for the current detection task, and update these weight parameters for the next training. For example, if the P3 scale features are more important for the target detection task, the network will learn to increase the value of α and reduce the value of β or γ.

[0135] Step 4.3 includes:

[0136] Step 4.3.1, comprehensively consider the information of each feature map, and introduce the importance of features of different scales through weight parameters. Specifically, the weight parameters α, β, γ and each feature map , , Multiply element by element to get the weighted feature map , the formula is: ;

[0137] Step 4.4 includes:

[0138] Step 4.4.1, adjust the number of channels of the feature map, improve the representation ability of the feature through nonlinear transformation, so that the model can achieve better performance with less computing resources, and perform better on the fused feature map. Apply 1×1 convolutional layer operation to further optimize, the formula is ,in, express The feature map obtained after the 1×1 convolution operation;

[0139] Step 4.4.2, combine Batch Normalization and ReLU activation function to make the feature distribution more stable, speed up the training and prevent the gradient disappearance problem. The formula is ,in, Representation feature map Normalized and activated output feature map; ,in, and Represents the current feature map The mean and variance of each channel data, and Initially 1 and 0, respectively, represent the trainable parameters of the network, which are used for scaling and translation to enhance the expressiveness of the model; ), specifically, The function sets the input values ​​less than 0 to 0 and keeps the values ​​greater than 0 unchanged;

[0140] Step 4.4.3, feature map The 3×3 convolution operation is further optimized to maintain computational efficiency while avoiding overfitting. The formula is: ,in express The feature map obtained by the 3×3 convolution operation, Represents a 3×3 convolution operation;

[0141] Step 5, such as Figure 1 and Figure 5 ,After feature fusion, the fused feature map is fed into the detection head for object prediction.

[0142] Step 5 includes:

[0143] Step 5.1, feature map branch processing;

[0144] Step 5.2, calculate the classification loss;

[0145] Step 5.3, calculate the loss function MPDIoU and improve the regression loss;

[0146] Step 5.4, calculate the confidence loss;

[0147] Step 5.5, loss optimization and weight balance;

[0148] Step 5.1 includes:

[0149] Step 5.1.1, the detection head will fused feature map It is divided into two branches: classification branch and regression branch. The classification branch is used to predict the target category distribution of each anchor box anchor. The output of the classification branch is ,in is the number of categories, and the regression branch is used to regress the bounding box parameters of each anchor box, which include the center point coordinates and size ,in, Indicates the width, which refers to the horizontal span of the bounding box. represents the height, which refers to the span of the bounding box in the vertical direction. The output of the regression branch is ;

[0150] Step 5.1.2: The classification branch calculates the category probability distribution of each anchor box through the Softmax function. The formula is: , the regression branch directly outputs the bounding box parameters, the formula is ;

[0151] Step 5.2 includes:

[0152] Step 5.2.1, use cross-extraction loss to calculate classification loss :

[0153] ,

[0154] in, is the number of positive samples, Indicates the positive sample The true label of samples in the kth category, Indicates the positive sample The predicted probability of a sample in the kth category, Data from ;

[0155] Step 5.3 includes:

[0156] Step 5.3.1, calculate the intersection over union (IoU):

[0157] ,

[0158] in, Represents the prediction box and real frame The area of ​​the intersection of Represents the prediction box and real frame The area of ​​the union of Data from , The data is derived from the initial real image parameters;

[0159] Step 5.3.2, calculate the Euclidean distance between the center of the predicted box and the center of the real box :

[0160] ,

[0161] in, Represents the prediction box Center coordinates, Represents the real box Center coordinates;

[0162] Step 5.3.3, calculate the minimum distance from the real box key point to the predicted box boundary :

[0163] ,

[0164] in The first The coordinates of the key points, Represents the prediction box The coordinates of the boundary points;

[0165] Step 5.3.4, calculate MPDIoU loss , the formula is:

[0166] ,

[0167] in, Represents the normalization coefficient, which refers to the diagonal length of the minimum enclosing rectangle containing the predicted box and the true box. Represents the number of ground-truth box key points, and represents the weight coefficient;

[0168] Step 5.4 includes:

[0169] Step 5.4.1, calculate confidence loss :

[0170] ,

[0171] in, represents the total number of samples, Indicates the total sample The true confidence of samples, Indicates the total sample The prediction confidence of samples;

[0172] Step 5.5 includes:

[0173] Step 5.5.1, consider the classification, regression and confidence losses comprehensively and calculate the total loss , the formula is:

[0174] ,

[0175] in, represents the weight coefficient;

[0176] Step 5.5.2, update the parameters through back propagation to maximize the detection performance. For each trainable parameter (such as α, β, γ, etc.), calculate the total loss Gradient of (partial derivative) , the gradient reflects the extent to which the current parameters affect the total loss, and is used to guide the adjustment of the parameters. Specifically, through the optimization algorithm Adam, the learning rate is used (Take 0.01) Update the trainable parameters according to the following formula: , to achieve the purpose of updating model parameters, after the model is trained for internal defect detection of sewers many times, each training repeats step 2 (extracting multi-scale features of the image and generating feature maps of different scales), step 3, step 4 and step 5 to achieve optimal parameters, thereby improving the model detection performance;

[0177] Step 6, output the final detection result;

[0178] Compared with the existing technology, the method of the present invention significantly improves the detection performance, especially in terms of accuracy and multi-scale target adaptability. It can more accurately detect cracks, obstacles, corrosion, deformation, rupture, sedimentation, misalignment, concealed connection of branch pipes, penetration of foreign objects, detachment and disconnection of interface materials in sewers, and other targets, demonstrating extremely strong robustness and wide practicality. Under the same experimental conditions (model size is m, no pre-trained weights are used, and NVIDIA 4090 graphics card is used, etc. Among them, m: [0.50, 1.00, 512], m represents medium, 0.50 represents the depth scaling factor of the model is 0.50, which is used to control the number of layers of the network; 1.00 represents the width scaling factor of the model is 1.00, which is used to control the number of channels of each convolutional layer; 512 represents the maximum number of channels allowed for each convolution layer in the network.), with 100 epochs (number of times) of training time, Box P (precision) increased from 79.3% to 83.5%, Box R (recall rate) increased from 63.1% to 69.7%, mAP50 increased from 70.9% to 78.9%, and mAP50-95 increased from 49.3% to 54.7%. Specifically, in step 1, an improved YOLOv11 network structure is constructed, integrating the adaptive feature fusion module, MPDIoU loss function and SENet attention mechanism. In step 2, the sewer dataset is trained 100 times, using the same experimental environment, including the same model scale m, no pre-trained weights, and NVIDIA 4090 graphics card, to obtain the training results; the average accuracy mAP50 obtained in step 2 is as follows Figure 6 As shown;

[0179] During the training process, the present invention compares the average accuracy of each training with the original YOLOv11 model (using the same experimental environment), such as Figure 7 Compared with YOLOv11, which improves slowly in the early stage of training and eventually converges to a lower mAP50 value (i.e., the lower convergence effect shown by the orange curve), the method of the present invention shows significant advantages. The improved model can improve the accuracy faster, maintain a stable optimization trend in the middle and late stages of training, and finally converge to a higher verification accuracy.

[0180] The present invention provides a method and system for detecting internal defects of sewers based on an improved YOLOv11. There are many methods and ways to implement the technical solution. The above is only a preferred implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention. All components not specified in this embodiment can be implemented using existing technologies.

Claims

1. A sewer internal defect detection method based on improved YOLOv11, characterized in that: The following steps are involved: Step 1, preprocessing the internal image of the sewer; Step 2: Build an improved YOLOv11 network structure, extract multi-scale features of the image, and generate feature maps of different scales; Step 3: Introduce the channel attention mechanism SENet to enhance the model's attention to important features and generate channel weighted feature maps of different scales; Step 4, adaptively fuse the multi-scale channel weighted feature maps to generate weighted fused feature maps; Step 5: Introduce the multi-parameter dynamic optimization intersection-over-union loss function MPDIoU to optimize the bounding box regression and calculate the total loss, and back-propagate to optimize the training parameters; Step 6: Output the final detection result.

2. The method according to claim 1, characterized in that In step 1, the input image is scaled and then data augmentation is performed; Normalize the pixel values ​​so that they fall within the range [0, 1].

3. The method according to claim 2, characterized in that In step 2, the YOLOv11 network structure includes a backbone network, a neck network, and a head network. On the basis of the YOLOv11 network structure, a processing layer introducing the SENet module is added after the 16th, 19th, and 22nd layers of the neck network structure, and an adaptive feature fusion module is added to the head network. In the improved network structure, by processing the image layer by layer, the 16th, 20th, and 24th layers generate feature maps of three scales respectively: low-level feature map P3, middle-level feature map P4, and high-level feature map P5; after the image is input into the network, the basic features are first extracted through more than two convolution operations, and then the spatial resolution of the feature map is reduced through step-by-step downsampling and convolution operations, while the number of channels is increased to enhance the feature expression capability, thereby gradually generating multi-scale feature maps.

4. The method according to claim 3, characterized in that Step 3 includes: Step 3.1, preprocess the initial feature map and perform channel separation: Separate into c separate feature maps according to the number of channels c , where the feature map It represents one of the three scale feature maps P3, P4, and P5. , Represents the input feature map The three-dimensional real space, Indicates the number of channels of the feature map, represents the height of the feature map, represents the width of the feature map, n represents a positive integer in the interval [1, c], represents a separate feature map for the nth channel, is a two-dimensional feature map, ; Adaptive normalization technology AN is used to transform the individual feature maps of each channel The pixel value is normalized to the range of [0, 1], and the formula is: , in, Represents the feature map The result after normalization is and Represent the mean and standard deviation of channel features respectively, represents a positive number; Step 3.2: Obtain the global representation of each channel through global average pooling GAP , perform channel-by-channel calculations and convert the feature map Compress to a scalar , the formula is: , in, represents the pixel value of channel n at position (i, j), represents the normalization factor, The improved formula is: , in, Represents the similarity between each pixel in the feature map and its surrounding pixels. ,in, is a trainable parameter, and They are spatial distance weight and feature similarity weight, ,in, and are the horizontal and vertical coordinates of the pixel of channel n in the neighborhood of position (i, j), is (i, j) and ( ) standard deviation of the distance, represents the exponential function, ,in, Indicates that channel n is at position ( )’s pixel value; Step 3.3, the global representation of c channels Gather together to form a high-dimensional feature z with a dimension of c. Project z into a low-dimensional space to reduce the computational complexity and achieve information compression. Perform a linear transformation. The formula is: ,in, represents the dimension reduction matrix, Represents the scaling factor, the feature vector after dimensionality reduction represents the channel relationship after compression, , represents the channel dimension; Apply the ReLU activation function to introduce nonlinear characteristics, the formula is ,in, express The result after being processed by the ReLU activation function, is the ReLU activation function; Step 3.4, remap the low-dimensional features to the high-dimensional channel weights and perform dimensionality transformation: the feature vector after dimensionality reduction Through a dimension-enhanced matrix Mapping back to the original number of channels , thereby generating the channel weight vector , introduce the multi-scale fusion strategy MSF, the formula is ,in, represents a dimension-raising matrix, Represents the generated channel weight vector; then normalize it and apply S The gmoid activation function converts the channel weight vector Restricted to Range, the formula is , where the Sigmoid function is defined as , express After S Channel weight vector after gmoid activation function processing; Step 3.5, perform weight expansion, The channel weight of each channel in Expanded to a matrix consistent with the dimension of the feature map, the formula is ,in, Indicates that the channel weight Expanded to feature map The weight matrix with the same spatial size, that is, the expanded weight matrix of the nth channel, Indicates the size is height width The all-1 matrix is ​​introduced; the spatial perception weighted fusion mechanism SAWF is introduced, and the formula is ,in, Represents the nth channel feature map after channel weighting; Step 3.6, recombining all weighted channel feature maps, the formula is ,in, Represents the output feature map generated after fusing channel weights.

5. The method according to claim 4, characterized in that Step 4 includes: Step 4.1, align the multi-scale feature maps; Step 4.2, generate weights; Step 4.3, weighted fusion feature map; Step 4.4, perform feature re-optimization.

6. The method according to claim 5, characterized in that Step 4.1 includes: Step 4.1.1: Receive the channel weighted feature maps of the three scale feature maps P3, P4, and P5 and process them through the SENet attention mechanism , , ,in, Represents the channel weighted feature map of the low-level feature map P3 obtained by step 3, Represents the channel weighted feature map of the middle-level feature map P4 obtained in step 3, Represents the channel weighted feature map of the high-level feature map P5 obtained in step 3; Step 4.1.2, use upsampling operation to adjust all received feature maps to a uniform resolution, that is, Adjust to Consistent resolution, the formula is ,in, Respectively , , Feature map obtained after upsampling, UpSample is an upsampling operation; Step 4.1.3, perform feature alignment. The number of channels is increased to 512, The number of channels is reduced to 512, and the formula is: , in, represents a 1×1 convolution operation, It represents the feature alignment feature map obtained after the feature map channel is reduced or upgraded, where , , Respectively indicate the corresponding Feature maps obtained after feature alignment of three scale feature maps.

7. The method according to claim 6, characterized in that Step 4.2 includes: Step 4.2.1, Initialization , , Weight parameters of the three feature maps ,in, , the weight parameters are initialized to positive values ​​with equal means; Step 4.2.2, introduce a dynamic adjustment mechanism for weight parameters, so that the network can automatically learn the most appropriate weight distribution scheme based on the characteristics of the sewer data set: make the sum of the weight parameters equal to 1, the formula is , where Softmax function is a normalization function, α, β, and γ are calculated weight parameters, corresponding to exist The result of calculation in the function.

8. The method according to claim 7, characterized in that Step 4.3 includes: Step 4.3.1: weight parameters α, β, γ and each feature map , , Multiply element by element to get the weighted feature map , the formula is: .

9. The method according to claim 8, characterized in that Step 4.4 includes: Step 4.4.1, the fused feature map Apply 1×1 convolutional layer operation to further optimize, the formula is ,in, express The feature map obtained after the 1×1 convolution operation; Step 4.4.2, combined with Batch Normalization and ReLU activation function, the formula is ,in, Representation feature map Normalized and activated output feature map; ,in, and Represent the current feature map The mean and variance of each channel data, and Initially they are 1 and 0 respectively; ); Step 4.4.3, feature map The 3×3 convolution operation is further optimized, and the formula is ,in express The feature map obtained by the 3×3 convolution operation, Represents a 3×3 convolution operation; In step 5, after the weighted fusion is completed, the fused feature map is sent to the detection head for target category prediction and bounding box regression. The bounding box regression loss function is improved by multi-parameter dynamic optimization of the intersection-over-union loss function MPDIoU, which specifically includes the following steps: Step 5.1, feature map branch processing; Step 5.2, calculate the classification loss; Step 5.3, calculate the loss function MPDIoU and improve the regression loss; Step 5.4, calculate the confidence loss; Step 5.5, loss optimization and weight balance; Step 5.1 includes: Step 5.1.1, the detection head will fused feature map It is divided into two branches: classification branch and regression branch. The classification branch is used to predict the target category distribution of each anchor box anchor. The output of the classification branch is ,in is the number of categories; the regression branch is used to regress the bounding box parameters of each anchor box, and the bounding box parameters include the center point coordinates and size ,in, Indicates the width, which refers to the horizontal span of the bounding box. represents the height, which refers to the span of the bounding box in the vertical direction. The output of the regression branch is ; Step 5.1.2: The classification branch calculates the category probability distribution of each anchor box through the Softmax function. The formula is: ; The regression branch directly outputs the bounding box parameters, the formula is ; Step 5.2 includes: Step 5.2.1, use cross-extraction loss to calculate classification loss : , in, is the number of positive samples, Indicates the positive sample The true label of samples in the kth category, Indicates the positive sample The predicted probability of a sample in the kth category, Data from ; Step 5.3 includes: Step 5.3.1, calculate the intersection over union (IoU): , in, Represents the prediction box and real frame The area of ​​the intersection of Represents the prediction box and real frame The area of ​​the union of ; Step 5.3.2, calculate the Euclidean distance between the center of the predicted box and the center of the real box : , in, Represents the prediction box Center coordinates, Represents the real box Center coordinates; Step 5.3.3, calculate the minimum distance from the real box key point to the predicted box boundary : , in The first The coordinates of the key points, Represents the prediction box The coordinates of the boundary points; Step 5.3.4, calculate MPDIoU loss , the formula is: , in, represents the normalization coefficient, Represents the number of ground-truth box key points, and represents the weight coefficient; Step 5.4 includes: Step 5.4.1, calculate the confidence loss : , in, represents the total number of samples, Indicates the total sample The true confidence of samples, Indicates the total sample The prediction confidence of samples; Step 5.5 includes: Step 5.5.1, calculate the total loss , the formula is: , in, represents the weight coefficient; In step 5.5.2, update the parameters through back-propagation to maximize the detection performance.

10. A sewer internal defect detection system based on improved YOLOv11 implemented by the method according to claim 1, characterized in that: include: A data preprocessing module is used to process the image data collected inside the sewer, including image enhancement, size normalization and data annotation; The feature extraction and fusion module introduces the SENet attention mechanism and the feature fusion technology of the adaptive feature fusion module to enhance the model's ability to capture multi-scale features and optimize the expression effect of spatial features. The object detection module is based on the improved YOLOv11 model and introduces the MPDIoU loss function to achieve accurate bounding box prediction and object positioning; The result output module performs post-processing on the inspection results, including target classification, defect marking and confidence scoring, and outputs them in the form of image overlay and statistical reports.

Citation Information

Patent Citations

  • Construction and detection method of small target detection model based on Yolov5

    CN115331126A

  • Underground drainage pipeline defect detection and identification method based on improved YOLOX

    CN115359399A

  • Forest weed detection method based on improved YOLOv5 model

    CN115546639A

  • Lightweight small target detection method and device fusing multi-scale features

    CN115965827A

  • Multi-scale nixie tube detection method based on improved YOLO adaptive attention-feature enhancement network

    CN117095155A

Cited By

  • Defect detection method for aero-engine fan blade preform

    CN120070436A

  • A defect detection method for a preform of an aeroengine fan blade

    CN120070436B

  • Corrosion reinforced concrete crack detection method and device based on YOLOV11

    CN120259319A

  • Drainage pipeline defect detection method and device based on cost-sensitive risk decision and scale perception optimization, and computer readable storage medium

    CN122049873A