Three-stage-based cable tunnel waterlogging detection method under low-illumination complex interference condition

Through a three-stage method, Faster R-CNN, which includes low-light image enhancement, image segmentation and attention mechanism, the accuracy and timeliness of water accumulation in cable tunnels under low light and complex interference conditions are solved, and the detection effect is significantly improved .

CN119168963AActive Publication Date: 2024-12-20UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411201206.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-20
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

The existing intelligent detection algorithms have poor results in cable tunnel water accumulation detection under low light and complex interference conditions. The main reasons are insufficient training data and poor adaptability of the algorithm model to complex environments, which makes it difficult to ensure the accuracy and timeliness of detection.

Method used

Three-stage method is adopted: first, use the generative adversarial network to enhance low-light images, the second stage reduces background interference through image segmentation network, and the third stage introduces regularization and attention mechanisms in Faster R-CNN to improve the generalization of the model and robustness.

Benefits of technology

It significantly improves the accuracy of water accumulation detection in cable tunnels, improves image quality, eliminates complex background interference, and enhances the model's detection ability in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119168963A_ABST
    Figure CN119168963A_ABST
Patent Text Reader

Abstract

The invention discloses a three-stage-based cable tunnel waterlogging detection method under a low-illumination complex interference condition, and belongs to the technical field of deep learning. According to the problems existing in the actual application scene, the waterlogging area in the cable tunnel is detected through the three stages of low-illumination image enhancement, image segmentation and target detection. The method comprises the steps of firstly enhancing and improving image quality and enriching image details by using a low-illumination image, then accurately delineating a waterlogged road area while reducing complex background interference through image segmentation, and finally enhancing the ability of a model to identify basic features in a complex background by using a target detection method integrated with an attention mechanism. And the accuracy of detecting the ponding area is obviously improved. According to the method provided by the invention, when the cable tunnel waterlogging identification is carried out, the image quality and small target characteristics are effectively improved, the complex background interference in the cable tunnel is eliminated, and the waterlogging identification accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning technology, and specifically designs a three-stage cable tunnel water accumulation detection method under low-light and complex interference conditions. Background Art

[0002] In recent years, urban power grids have gradually developed into underground spaces. Cables have become an important part of urban power grids because of their excellent insulation performance and the ability to not occupy ground space and avoid the impact of transmission towers on the city's aesthetics. However, the environment in cable tunnels is complex and changeable. Problems such as low light, humidity, and interference from various debris are common, which poses a huge challenge to the monitoring and maintenance of cable tunnels. In particular, if the problem of water accumulation is not discovered and handled in time, it may cause cable insulation damage, short circuits, and even cause large-scale power outages, seriously affecting the safe operation of urban power grids.

[0003] Traditional methods for detecting water accumulation in cable tunnels mostly rely on manual inspections, which not only requires a large workload and is inefficient, but also makes it difficult to ensure the accuracy and timeliness of manual inspections under low light and complex interference conditions. To address this problem, AI-based intelligent detection technology has emerged to improve the efficiency and accuracy of cable tunnel water accumulation detection through automation and intelligent means. However, the detection effect of existing intelligent detection algorithms under low light and complex interference conditions is still unsatisfactory, mainly due to the lack of training data and the poor adaptability of algorithm models to complex environments.

[0004] In recent years, target detection technology has made significant progress in the field of computer vision. Target detection aims to accurately identify and locate the target object of interest in the image, and is widely used in many fields such as autonomous driving, security monitoring, and medical image analysis. For the problem of water accumulation in cable tunnels, a special detection model can be designed to analyze the tunnel image, accurately identify and locate the water accumulation area, and generate alarm information to promptly remind maintenance personnel to handle it. Summary of the invention

[0005] In order to solve the low illumination problem and complex background problems such as cable pipes in the current detection of water accumulation in cable tunnels, the present invention provides a three-stage cable tunnel water accumulation detection method under low-light complex interference conditions; in the first stage, the present invention uses a generative adversarial network to enhance the low-light image in the tunnel to restore rich image information, thereby improving the performance of subsequent tasks. In the second stage, an image segmentation network is used to segment the road area in the cable tunnel, effectively reducing the background interference of other fixed structures in the tunnel. In the third stage, water accumulation is detected in the tunnel pavement area. In water accumulation detection, regularization and attention mechanisms are incorporated into Faster R-CNN, which effectively suppresses model bias and significantly improves the generalization and robustness of the model in various scenarios. The method proposed in the present invention effectively improves image quality and small target features when identifying water accumulation in cable tunnels, eliminates complex background interference in cable tunnels, and improves the accuracy of water accumulation identification. The technical problem proposed by the present invention is solved as follows:

[0006] Specific content:

[0007] A three-stage method for detecting water accumulation in a cable tunnel under low-light and complex interference conditions comprises the following steps:

[0008] Step 1: Obtain the required low-light cable tunnel dataset and other normal-light image data, and perform preliminary processing on the images in the dataset to divide them into training and test sets;

[0009] Step 2, preprocessing the obtained low-light cable tunnel data and normal light data, and performing normalization processing;

[0010] Step 3, using the generator in the generative adversarial network to process the low-light cable tunnel data obtained in step 2, so as to convert the noise vector in the latent space into high-quality image data;

[0011] Step 4, inputting the image data generated in step 3 and the normal illumination data obtained in step 2 into the discriminator in the generative adversarial network to guide the update of the generator to improve the quality of the generated image;

[0012] Step 5, perform generator-discriminator adversarial training on low-light cable tunnel data, and train the image illumination enhancement generative adversarial network built in steps 3 and 4;

[0013] Step 6: Use the generative adversarial network obtained in step 5 to perform image enhancement on the low-light cable tunnel data and annotate the cable tunnel roads to obtain a cable tunnel road dataset, and perform preliminary processing on the images in the dataset to divide them into training sets and test sets;

[0014] Step 7, preprocessing the cable tunnel road data obtained in step 6 and performing normalization processing;

[0015] Step 8, use the YOLOv8n-seg model to extract the image data features in step 7, perform feature fusion and segmentation output;

[0016] Step 9, training the cable tunnel road segmentation network constructed in step 8 on the cable tunnel road data;

[0017] Step 10, using the cable tunnel road segmentation network obtained in step 9, obtain the cable tunnel data to perform segmentation mask on the cable tunnel, and annotate the cable tunnel water accumulation to obtain a cable tunnel road water accumulation dataset, and perform preliminary processing on the images in the dataset to divide it into a training set and a test set;

[0018] Step 11, preprocessing the cable tunnel road water accumulation data obtained in step 10 and performing normalization processing;

[0019] Step 12, using ResNet with attention mechanism as backbone to extract features from the cable tunnel road water accumulation image data obtained in step 11, and output a high-dimensional feature map;

[0020] Step 13, generate candidate regions on the feature map obtained in step 12 through the region proposal network, and then map the candidate regions to the feature map through ROI pooling, unify the feature map size and calculate the loss;

[0021] Step 14: Further process the features through the Fast R-CNN predictor, calculate the classification score and regression parameters, select positive and negative samples, calculate the loss, and filter and non-maximum suppress the prediction results, and map them back to the original coordinate system;

[0022] Step 15, training the cable tunnel water accumulation detection network constructed in steps 12, 13, and 14 on the cable tunnel road water accumulation dataset.

[0023] Step 1 of the present invention comprises:

[0024] Step 1-1, obtain a data set of cable tunnel-related scenes, including two categories: with and without water accumulation, and perform preliminary processing on the data set, delete irrelevant pictures, and crop the pictures into a uniform size.

[0025] Step 1-2: After step 1-1, the data set obtained is divided into a training set and a test set to facilitate subsequent training and testing of the network.

[0026] Step 2 of the present invention comprises:

[0027] Step 2-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image.

[0028] Step 2-2, use shuffle and file name to batch read the data obtained in step 2-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index.

[0029] Step 2-3, call the method in transforms to process the data and normalize the data read in step 2-2.

[0030] Step 3 of the present invention comprises:

[0031] Step 3-1, pass the data in step 2 through a U-net with self-attention mechanism as the generator of the generative adversarial network. In the present invention, the image data first passes through a reflection padding layer, and then passes through a 7x7 convolution layer to map the padded input to the feature map, using the ReLU activation function. Then, these features are sent to a series of downsampling layers consisting of a 3x3 convolution layer and a normalization layer to reduce the size of the feature map.

[0032] Step 3-2, after downsampling, a series of residual blocks are used to learn the details and structure of the image. In the present invention, 8 residual blocks are used, each of which contains two convolutional layers, and each convolutional layer is followed by a normalization layer and a ReLU activation function.

[0033] Step 3-3, increase the size of the feature map through a series of upsampling layers consisting of a 3x3 convolution layer and a normalization layer. The number of upsampling layers in the present invention is consistent with the number of downsampling layers in step 3-1. Then, after a reflection padding layer and a 7x7 convolution layer, the final feature map is mapped to the output channel.

[0034] In step 3-4, the Tanh activation function is used to limit the final output to the range of -1 to 1.

[0035] Step 4 of the present invention comprises:

[0036] Step 4-1: For the output image obtained in step 3, first use the local discriminator to learn to distinguish the authenticity of the image blocks. Each time, 5 patches are randomly cropped from the output image obtained in step 3 and the real illumination image obtained in step 2, and adversarial learning is performed using the local generator loss function and the local discriminator loss function. The relativistic discriminator function is used in the loss function, and the formula is as follows:

[0037]

[0038]

[0039] Among them, C represents the network, x r An image representing the real lighting, x f represents the enhanced output image, σ represents the linear function, Indicates expected value.

[0040] The local generator loss function formula is as follows:

[0041]

[0042] The local discriminator loss function formula is as follows:

[0043]

[0044] Step 4-2: For the output image obtained in step 3, use the global discriminator to judge the overall illumination difference between the generated image and the real image, and improve the adversarial loss of the global illumination feature of the image to minimize the distance between the illumination distribution of the real image and the output image. The formula of the global generator loss function is as follows:

[0045]

[0046] The loss function formula of the global discriminator is as follows:

[0047]

[0048] Step 6 of the present invention comprises:

[0049] Step 6-1, use the image enhancement network obtained in step 5 to enhance the illumination of the cable tunnel dataset, and mark the cable tunnel road in the enhanced image to prepare for training and testing.

[0050] Step 6-2: After processing in step 6-1, the data set obtained is divided into a training set and a test set to facilitate subsequent training and testing of the network.

[0051] Step 7 of the present invention comprises:

[0052] Step 7-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image.

[0053] Step 7-2, use shuffle and file name to batch read the data obtained in step 7-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index.

[0054] Step 7-3, call the method in transforms to process the data and normalize the data read in step 7-2.

[0055] Step 8 of the present invention comprises:

[0056] Step 8-1, build a new YOLO model from the model configuration file. This model configuration file defines that the backbone of the YOLO model contains multiple convolutional layers, C2F layers and SPPF layers, as well as the upsampling layer and segmentation layer of the head network;

[0057] Step 8-2, preload a YOLOv8n-seg pre-trained model on the YOLO model built in step 8-1 to speed up the training process.

[0058] Step 10 of the present invention comprises:

[0059] Step 10-1, use the road segmentation network obtained in step 9 to segment the cable tunnel dataset, extract the segmented road area, and mark the waterlogged area in the segmented image to prepare for training and testing.

[0060] Step 10-2: After step 10-2, the data set obtained is divided into a training set and a test set, which is convenient for subsequent training and testing of the network.

[0061] Step 11 of the present invention comprises:

[0062] Step 11-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image.

[0063] Step 11-2, use shuffle and file name to batch read the data obtained in step 11-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index.

[0064] Step 11-3, call the method in transforms to process the data and normalize the data read in step 11-2.

[0065] Step 12 of the present invention comprises:

[0066] In step 12-1, the input image is transformed from 3 channels to a 64-channel feature map through a convolution layer with a convolution kernel size of 7x7, a stride of 2, and a padding of 3, and then normalized and max-pooled.

[0067] Step 12-2, alternately pass through 4 attention enhancement layers and 4 residual layers, where the residual layer consists of a 1x1 downsampling layer and several 3x3 convolution blocks with residual connections.

[0068] Step 12-3, where the attention enhancement layer is enhanced by channel attention and spatial attention mechanism. The channel attention mechanism first applies batch normalization to emphasize features, and then uses rearrangement operations and multi-layer perceptrons to enhance the dependencies between channels and spatial dimensions. The channel attention mechanism formula is:

[0069]

[0070] Where W γ is the scaling factor for each channel, F1 and F3 represent the input and output feature maps, respectively, and p and Represents the three-dimensional rearrangement operation on the feature map. The spatial attention mechanism consists of two consecutive convolutional layers, and the formula is as follows:

[0071]

[0072] Where F1 and F2 represent the input and processed output feature maps respectively. s represents the pixel-level normalization operation, W λ is the corresponding scaling factor, calculated similarly to the channel attention module.

[0073] Step 13 of the present invention comprises:

[0074] Step 13-1, calculate the target probability and bounding box regression parameters on each predicted feature layer through the RPN network head.

[0075] Step 13-2, use "anchor_generator" to generate all candidate anchor points for each input feature map, and apply the predicted regression parameters to the candidate anchor points to obtain the final predicted boundary coordinates.

[0076] Step 13-3, calculate the target probability loss and regression loss in network training, and apply loss regularization. The loss regularization formula is as follows:

[0077] T′=T·(1-∈)+0.5·∈,

[0078] Where T is the original loss, T′ is the regularized loss, and ∈ is the smoothing parameter, which is generally set to 0.5.

[0079] In step 13-4, the predicted boundary coordinates and feature maps are pooled on four feature layers using a multi-scale ROI alignment pooling layer, and then passed through two fully connected layers to obtain feature representation.

[0080] Step 14 of the present invention comprises:

[0081] Step 14-1, flatten the feature representation obtained in step 13 into a two-dimensional tensor using the flatten method.

[0082] In step 14-2, the classification score is obtained through the fully connected layer of the classification score, and the bounding box regression parameters are obtained through the bounding box layer.

[0083] The present invention proposes a three-stage cable tunnel water accumulation detection method under low-light complex interference conditions, which has the following advantages and beneficial effects compared with the prior art:

[0084] According to the problems existing in the actual application scenarios, the invention detects the waterlogged areas in the cable tunnel by using three stages: low-light image enhancement, image segmentation, and target detection. First, low-light image enhancement is used to improve the image quality and enrich the image details. Then, through image segmentation, the flooded road area is accurately delineated while reducing the interference of complex backgrounds. Finally, the target detection method with integrated attention mechanism is used to enhance the model's ability to identify basic features in complex backgrounds, significantly improving the accuracy of detecting waterlogged areas. When identifying waterlogging in cable tunnels, the method proposed by the present invention effectively improves the image quality and small target features, eliminates the interference of complex backgrounds in cable tunnels, and improves the accuracy of waterlogging identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 1 It is the overall flow chart of the method of the present invention;

[0086] Figure 2 It is the overall network architecture diagram;

[0087] Figure 3 It is a schematic diagram of the output images of each part;

[0088] Figure 4 This is a schematic diagram of a low-light enhancement generative adversarial network;

[0089] Figure 5 This is a schematic diagram of the water accumulation detection network structure. DETAILED DESCRIPTION

[0090] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present invention.

[0091] The present invention is implemented including:

[0092] The overall process of the method proposed by the present invention is as follows Figure 1 As shown in Figure 2, the overall network architecture is as follows: Figure 2As shown, the output images of each part are as follows Figure 3 As shown, the specific construction steps of the cable tunnel water accumulation detection in the embodiment of the present invention are as follows:

[0093] Step 1: Obtain the required low-light cable tunnel dataset and other normal-light image data, and perform preliminary processing on the images in the dataset to divide them into training and test sets;

[0094] Step 2, preprocessing the obtained low-light cable tunnel data and normal light data, and performing normalization processing;

[0095] Step 3, using the generator in the generative adversarial network to process the low-light cable tunnel data obtained in step 2, so as to convert the noise vector in the latent space into high-quality image data;

[0096] Step 4: The image data generated in step 3 and the normal illumination data obtained in step 2 are input into the discriminator in the generative adversarial network to guide the update of the generator to improve the quality of the generated image. The structure of the low-light enhancement generative adversarial network is as follows: Figure 4 As shown;

[0097] Step 5, perform generator-discriminator adversarial training on low-light cable tunnel data, and train the image illumination enhancement generative adversarial network built in steps 3 and 4;

[0098] Step 6: Use the generative adversarial network obtained in step 5 to perform image enhancement on the low-light cable tunnel data and annotate the cable tunnel roads to obtain a cable tunnel road dataset, and perform preliminary processing on the images in the dataset to divide them into training sets and test sets;

[0099] Step 7, preprocessing the cable tunnel road data obtained in step 6 and performing normalization processing;

[0100] Step 8, use the YOLOv8n-seg model to extract the image data features in step 7, perform feature fusion and segmentation output;

[0101] Step 9, training the cable tunnel road segmentation network constructed in step 8 on the cable tunnel road data;

[0102] Step 10, using the cable tunnel road segmentation network obtained in step 9, obtain the cable tunnel data to perform segmentation mask on the cable tunnel, and annotate the cable tunnel water accumulation to obtain a cable tunnel road water accumulation dataset, and perform preliminary processing on the images in the dataset to divide it into a training set and a test set;

[0103] Step 11, preprocessing the cable tunnel road water accumulation data obtained in step 10 and performing normalization processing;

[0104] Step 12, using ResNet with attention mechanism as backbone to extract features from the cable tunnel road water accumulation image data obtained in step 11, and output a high-dimensional feature map;

[0105] Step 13, generate candidate regions on the feature map obtained in step 12 through the region proposal network, and then map the candidate regions to the feature map through ROI pooling, unify the feature map size and calculate the loss;

[0106] Step 14: Further process the features through the Fast R-CNN predictor, calculate the classification score and regression parameters, select positive and negative samples, calculate the loss, and filter and non-maximum suppress the prediction results, and map them back to the original coordinate system;

[0107] Step 15, training the cable tunnel water accumulation detection network built in steps 12, 13, and 14 on the cable tunnel road water accumulation dataset. The water accumulation detection network structure is as follows: Figure 5 shown.

[0108] Step 1 of the present invention comprises:

[0109] Step 1-1, obtain a data set of cable tunnel-related scenes, including two categories: with and without water accumulation, and perform preliminary processing on the data set, delete irrelevant pictures, and crop the pictures into a uniform size.

[0110] Step 1-2: After step 1-1, the data set obtained is divided into a training set and a test set to facilitate subsequent training and testing of the network.

[0111] Step 2 of the present invention comprises:

[0112] Step 2-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image.

[0113] Step 2-2, use shuffle and file name to batch read the data obtained in step 2-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index.

[0114] Step 2-3, call the method in transforms to process the data and normalize the data read in step 2-2.

[0115] Step 3 of the present invention comprises:

[0116] Step 3-1, pass the data in step 2 through a U-net with self-attention mechanism as the generator of the generative adversarial network. In the present invention, the image data first passes through a reflection padding layer, and then passes through a 7x7 convolution layer to map the padded input to the feature map, using the ReLU activation function. Then, these features are sent to a series of downsampling layers consisting of a 3x3 convolution layer and a normalization layer to reduce the size of the feature map.

[0117] Step 3-2, after downsampling, a series of residual blocks are used to learn the details and structure of the image. In the present invention, 8 residual blocks are used, each of which contains two convolutional layers, and each convolutional layer is followed by a normalization layer and a ReLU activation function.

[0118] Step 3-3, increase the size of the feature map through a series of upsampling layers consisting of a 3x3 convolution layer and a normalization layer. The number of upsampling layers in the present invention is consistent with the number of downsampling layers in step 3-1. Then, after a reflection padding layer and a 7x7 convolution layer, the final feature map is mapped to the output channel.

[0119] In step 3-4, the Tanh activation function is used to limit the final output to the range of -1 to 1.

[0120] Step 4 of the present invention comprises:

[0121] Step 4-1: For the output image obtained in step 3, first use the local discriminator to learn to distinguish the authenticity of the image blocks. Each time, 5 patches are randomly cropped from the output image obtained in step 3 and the real illumination image obtained in step 2, and adversarial learning is performed using the local generator loss function and the local discriminator loss function. The relativistic discriminator function is used in the loss function, and the formula is as follows:

[0122]

[0123]

[0124] Among them, C represents the network, x r An image representing the real lighting, x f represents the enhanced output image, σ represents the linear function, Indicates expected value.

[0125] The local generator loss function formula is as follows:

[0126]

[0127] The local discriminator loss function formula is as follows:

[0128]

[0129] Step 4-2: For the output image obtained in step 3, use the global discriminator to judge the overall illumination difference between the generated image and the real image, and improve the adversarial loss of the global illumination feature of the image to minimize the distance between the illumination distribution of the real image and the output image. The formula of the global generator loss function is as follows:

[0130]

[0131] The loss function formula of the global discriminator is as follows:

[0132]

[0133] Step 6 of the present invention comprises:

[0134] Step 6-1, use the image enhancement network obtained in step 5 to enhance the illumination of the cable tunnel dataset, and mark the cable tunnel road in the enhanced image to prepare for training and testing.

[0135] Step 6-2: After processing in step 6-1, the data set obtained is divided into a training set and a test set to facilitate subsequent training and testing of the network.

[0136] Step 7 of the present invention comprises:

[0137] Step 7-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image.

[0138] Step 7-2, use shuffle and file name to batch read the data obtained in step 7-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index.

[0139] Step 7-3, call the method in transforms to process the data and normalize the data read in step 7-2.

[0140] Step 8 of the present invention comprises:

[0141] Step 8-1, build a new YOLO model from the model configuration file. This model configuration file defines that the backbone of the YOLO model contains multiple convolutional layers, C2F layers and SPPF layers, as well as the upsampling layer and segmentation layer of the head network;

[0142] Step 8-2, preload a YOLOv8n-seg pre-trained model on the YOLO model built in step 8-1 to speed up the training process.

[0143] Step 10 of the present invention comprises:

[0144] Step 10-1, use the road segmentation network obtained in step 9 to segment the cable tunnel dataset, extract the segmented road area, and mark the waterlogged area in the segmented image to prepare for training and testing.

[0145] Step 10-2: After step 10-2, the data set obtained is divided into a training set and a test set, which is convenient for subsequent training and testing of the network.

[0146] Step 11 of the present invention comprises:

[0147] Step 11-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image.

[0148] Step 11-2, use shuffle and file name to batch read the data obtained in step 11-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index.

[0149] Step 11-3, call the method in transforms to process the data and normalize the data read in step 11-2.

[0150] Step 12 of the present invention comprises:

[0151] In step 12-1, the input image is transformed from 3 channels to a 64-channel feature map through a convolution layer with a convolution kernel size of 7x7, a stride of 2, and a padding of 3, and then normalized and max-pooled.

[0152] Step 12-2, alternately pass through 4 attention enhancement layers and 4 residual layers, where the residual layer consists of a 1x1 downsampling layer and several 3x3 convolution blocks with residual connections.

[0153] Step 12-3, where the attention enhancement layer is enhanced by channel attention and spatial attention mechanism. The channel attention mechanism first applies batch normalization to emphasize features, and then uses rearrangement operations and multi-layer perceptrons to enhance the dependencies between channels and spatial dimensions. The channel attention mechanism formula is:

[0154]

[0155] Where W γ is the scaling factor for each channel, F1 and F3 represent the input and output feature maps, respectively, and p and Represents the three-dimensional rearrangement operation on the feature map. The spatial attention mechanism consists of two consecutive convolutional layers, and the formula is as follows:

[0156]

[0157] Where F1 and F2 represent the input and processed output feature maps respectively. s represents the pixel-level normalization operation, W λ is the corresponding scaling factor, calculated similarly to the channel attention module.

[0158] Step 13 of the present invention comprises:

[0159] Step 13-1, calculate the target probability and bounding box regression parameters on each predicted feature layer through the RPN network head.

[0160] Step 13-2, use "anchor_generator" to generate all candidate anchor points for each input feature map, and apply the predicted regression parameters to the candidate anchor points to obtain the final predicted boundary coordinates.

[0161] Step 13-3, calculate the target probability loss and regression loss in network training, and apply loss regularization. The loss regularization formula is as follows:

[0162] T′=T·(1-∈)+0.5·∈,

[0163] Where T is the original loss, T′ is the regularized loss, and ∈ is the smoothing parameter, which is generally set to 0.5.

[0164] In step 13-4, the predicted boundary coordinates and feature maps are pooled on four feature layers using a multi-scale ROI alignment pooling layer, and then passed through two fully connected layers to obtain feature representation.

[0165] Step 14 of the present invention comprises:

[0166] Step 14-1, flatten the feature representation obtained in step 13 into a two-dimensional tensor using the flatten method.

[0167] In step 14-2, the classification score is obtained through the fully connected layer of the classification score, and the bounding box regression parameters are obtained through the bounding box layer.

[0168] The present invention provides a cable tunnel water accumulation detection method under low-light complex interference conditions based on three stages. The above description is only an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A three-stage method for detecting water accumulation in cable tunnels under low-light and complex interference conditions. It is characterized in that The following steps are involved: Step 1: Obtain the required low-light cable tunnel dataset and other normal-light image data, and perform preliminary processing on the images in the dataset to divide them into training and test sets; Step 2, preprocessing the obtained low-light cable tunnel data and normal light data, and performing normalization processing; Step 3, using the generator in the generative adversarial network to process the low-light cable tunnel data obtained in step 2, so as to convert the noise vector in the latent space into high-quality image data; Step 4, inputting the image data generated in step 3 and the normal illumination data obtained in step 2 into the discriminator in the generative adversarial network to guide the update of the generator to improve the quality of the generated image; Step 5, perform generator-discriminator adversarial training on low-light cable tunnel data, and train the image illumination enhancement generative adversarial network built in steps 3 and 4; Step 6: Use the generative adversarial network obtained in step 5 to perform image enhancement on the low-light cable tunnel data and annotate the cable tunnel roads to obtain a cable tunnel road dataset, and perform preliminary processing on the images in the dataset to divide them into training sets and test sets; Step 7, preprocessing the cable tunnel road data obtained in step 6 and performing normalization processing; Step 8, use the YOLOv8n-seg model to extract the image data features in step 7, perform feature fusion and segmentation output; Step 9, training the cable tunnel road segmentation network constructed in step 8 on the cable tunnel road data; Step 10, using the cable tunnel road segmentation network obtained in step 9, obtain the cable tunnel data to perform segmentation mask on the cable tunnel, and annotate the cable tunnel water accumulation to obtain a cable tunnel road water accumulation dataset, and preliminarily process the images in the dataset to divide it into a training set and a test set; Step 11, preprocessing the cable tunnel road water accumulation data obtained in step 10 and performing normalization processing; Step 12, using ResNet with attention mechanism as backbone to extract features from the cable tunnel road water accumulation image data obtained in step 11, and output a high-dimensional feature map; Step 13, generate candidate regions on the feature map obtained in step 12 through the region proposal network, and then map the candidate regions to the feature map through ROI pooling, unify the feature map size and calculate the loss; Step 14: Further process the features through the Fast R-CNN predictor, calculate the classification score and regression parameters, select positive and negative samples, calculate the loss, and filter and non-maximum suppress the prediction results, and map them back to the original coordinate system; Step 15, training the cable tunnel water accumulation detection network constructed in steps 12, 13, and 14 on the cable tunnel road water accumulation dataset.

2. The method according to claim 1, Features Step 2 includes: Step 2-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image. Step 2-2, use shuffle and file name to batch read the data obtained in step 2-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index. Step 2-3, call the method in transforms to process the data and normalize the data read in step 2-2.

3. The method according to claim 1, Features Step 3 includes: Step 3-1, pass the data in step 2 through a U-net with self-attention mechanism as the generator of the generative adversarial network. In the present invention, the image data first passes through a reflection padding layer, and then passes through a 7x7 convolution layer to map the padded input to the feature map, using the ReLU activation function. Then, these features are sent to a series of downsampling layers consisting of a 3x3 convolution layer and a normalization layer to reduce the size of the feature map. Step 3-2, after downsampling, a series of residual blocks are used to learn the details and structure of the image. In the present invention, 8 residual blocks are used, each of which contains two convolutional layers, and each convolutional layer is followed by a normalization layer and a ReLU activation function. Step 3-3, increase the size of the feature map through a series of upsampling layers consisting of a 3x3 convolution layer and a normalization layer. The number of upsampling layers in the present invention is consistent with the number of downsampling layers in step 3-1. Then, after a reflection padding layer and a 7x7 convolution layer, the final feature map is mapped to the output channel. In step 3-4, the Tanh activation function is used to limit the final output to the range of -1 to 1.

4. The method according to claim 1, Features Step 4 includes: Step 4-1: For the output image obtained in step 3, first use the local discriminator to learn to distinguish the authenticity of the image blocks. Each time, 5 patches are randomly cropped from the output image obtained in step 3 and the real illumination image obtained in step 2, and adversarial learning is performed using the local generator loss function and the local discriminator loss function. The relativistic discriminator function is used in the loss function, and the formula is as follows: Among them, C represents the network, x r An image representing the real lighting, x f represents the enhanced output image, σ represents the linear function, Indicates expected value. The local generator loss function formula is as follows: The local discriminator loss function formula is as follows: Step 4-2: For the output image obtained in step 3, use the global discriminator to judge the overall illumination difference between the generated image and the real image, and improve the adversarial loss of the global illumination feature of the image to minimize the distance between the illumination distribution of the real image and the output image. The formula of the global generator loss function is as follows: The loss function formula of the global discriminator is as follows:

5. The method according to claim 1, Features Step 7 includes: Step 7-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image. Step 7-2, use shuffle and file name to batch read the data obtained in step 7-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index. Step 7-3, call the method in transforms to process the data and normalize the data read in step 7-2.

6. The method according to claim 1, Features Step 8 includes: Step 8-1, build a new YOLO model from the model configuration file. This model configuration file defines that the backbone of the YOLO model contains multiple convolutional layers, C2F layers and SPPF layers, as well as the upsampling layer and segmentation layer of the head network; Step 8-2, preload a YOLOv8n-seg pre-trained model on the YOLO model built in step 8-1 to speed up the training process.

7. The method according to claim 1, Features Step 11 includes: Step 11-1, use imageio and opencv to complete the reading of the image, read the corresponding image file according to the input file name, file path and image size, and return an array containing the image. Step 11-2, use shuffle and file name to batch read the data obtained in step 11-1, shuffle its index according to the number of data files, and then complete the data reading according to the file corresponding to the index. Step 11-3, call the method in transforms to process the data and normalize the data read in step 11-2.

8. The method according to claim 1, Features Step 12 includes: In step 12-1, the input image is transformed from 3 channels to a 64-channel feature map through a convolution layer with a convolution kernel size of 7x7, a stride of 2, and a padding of 3, and then normalized and max-pooled. Step 12-2, alternately pass through 4 attention enhancement layers and 4 residual layers, where the residual layer consists of a 1x1 downsampling layer and several 3x3 convolution blocks with residual connections. Step 12-3, where the attention enhancement layer is enhanced by channel attention and spatial attention mechanism. The channel attention mechanism first applies batch normalization to emphasize features, and then uses rearrangement operations and multi-layer perceptrons to enhance the dependencies between channels and spatial dimensions. The channel attention mechanism formula is: <h2 style=";text-align:left;direction:ltr">F<h2 style=";text-align:left;direction:ltr"> 1 <h2 style=";text-align:left;direction:ltr"> =W<h2 style=";text-align:left;direction:ltr"> γ <h2 style=";text-align:left;direction:ltr"> (BN(F<h2 style=";text-align:left;direction:ltr"> 1 <h2 style=";text-align:left;direction:ltr"> )), F 2 =MLP(p(F 1 )), Where W γ is the scaling factor for each channel, F 1 and F 3 denote the input and output feature maps, p and Represents the three-dimensional rearrangement operation on the feature map. The spatial attention mechanism consists of two consecutive convolutional layers, and the formula is as follows: <h2 style=";text-align:left;direction:ltr">F<h2 style=";text-align:left;direction:ltr"> 1 <h2 style=";text-align:left;direction:ltr"> =W<h2 style=";text-align:left;direction:ltr"> λ <h2 style=";text-align:left;direction:ltr"> (BN<h2 style=";text-align:left;direction:ltr"> s <h2 style=";text-align:left;direction:ltr"> (F<h2 style=";text-align:left;direction:ltr"> 1 <h2 style=";text-align:left;direction:ltr"> )), F 2 =sigmoid(conv 5x5 (conv 5x5 (F 1 ))), Among them, F 1 and F 2 Represent the input and processed output feature maps respectively. BN s represents the pixel-level normalization operation, W λ is the corresponding scaling factor, calculated similarly to the channel attention module.

9. The method according to claim 1, Features Step 13 includes: Step 13-1, calculate the target probability and bounding box regression parameters on each predicted feature layer through the RPN network head. Step 13-2, use "anchor_generator" to generate all candidate anchor points for each input feature map, and apply the predicted regression parameters to the candidate anchor points to obtain the final predicted boundary coordinates. Step 13-3, calculate the target probability loss and regression loss in network training, and apply loss regularization. The loss regularization formula is as follows: T′=T·(1-∈)+0.5·∈, Where T is the original loss, T′ is the regularized loss, and ∈ is the smoothing parameter, which is generally set to 0.

5. In step 13-4, the predicted boundary coordinates and feature maps are pooled on four feature layers using a multi-scale ROI alignment pooling layer, and then passed through two fully connected layers to obtain feature representation.

10. The method according to claim 1, Features Step 14 includes: Step 14-1, flatten the feature representation obtained in step 13 into a two-dimensional tensor using the flatten method. In step 14-2, the classification score is obtained through the fully connected layer of the classification score, and the bounding box regression parameters are obtained through the bounding box layer.

Citation Information

Patent Citations

  • Subway tunnel disease detection method based on deep learning

    CN113674216A

  • Vision-based road waterlogging detection method, electronic equipment and vehicle alarm system

    CN114219791A

  • Underground substation infrared image accumulated water detection intelligent alarm method and system

    CN116071656A