A three-stage method for detecting water accumulation in cable tunnels under complex interference conditions with low illumination.

By employing a three-stage approach, including low-light image enhancement, image segmentation, and target detection using an attention mechanism, the accuracy problem of detecting water accumulation in cable tunnels under low-light and complex interference conditions was solved, achieving higher detection accuracy.

CN119168963BActive Publication Date: 2025-10-28UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing intelligent detection algorithms are not ideal for detecting water accumulation in cable tunnels under low light and complex interference conditions, mainly due to insufficient training data and poor adaptability of algorithm models to complex environments.

Method used

A three-stage approach is adopted: first, a generative adversarial network is used to enhance the quality of low-light images; then, an image segmentation network is used to reduce background interference; and finally, Faster R-CNN, which combines regularization and attention mechanisms, is used for water accumulation detection to improve the model's generalization and robustness in various scenarios.

Benefits of technology

It significantly improves the accuracy of water accumulation detection in cable tunnels, effectively eliminates interference from complex backgrounds, and enhances the accuracy of water accumulation identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119168963B_ABST
    Figure CN119168963B_ABST
Patent Text Reader

Abstract

This invention discloses a three-stage method for detecting water accumulation in cable tunnels under low-light and complex interference conditions, belonging to the field of deep learning technology. Based on the problems encountered in practical application scenarios, this invention detects water accumulation areas in cable tunnels through three stages: low-light image enhancement, image segmentation, and target detection. First, low-light image enhancement improves image quality and enriches image details. Then, image segmentation accurately delineates water accumulation areas while reducing interference from complex backgrounds. Finally, an integrated attention mechanism-based target detection method enhances the model's ability to identify basic features in complex backgrounds, significantly improving the accuracy of water accumulation area detection. The proposed method effectively improves image quality and small target features, eliminates complex background interference in cable tunnels, and increases the accuracy of water accumulation identification when identifying water accumulation in cable tunnels.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of deep learning technology, and specifically designs a method for detecting water accumulation in cable tunnels under complex interference conditions with low light, based on a three-stage approach. Background Technology

[0002] In recent years, urban power grids have gradually expanded underground. Cables, due to their excellent insulation properties and ability to avoid occupying surface space and the aesthetic impact of transmission towers, have become an important component of urban power grids. However, the environment inside cable tunnels is complex and variable, with low light levels, humidity, and various obstructions being common problems, posing significant challenges to the monitoring and maintenance of cable tunnels. In particular, water accumulation, if not detected and addressed promptly, can lead to cable insulation damage, short circuits, and even large-scale power outages, seriously affecting the safe operation of the urban power grid.

[0003] Traditional methods for detecting water accumulation in cable tunnels largely rely on manual inspections, which are not only labor-intensive and inefficient, but also struggle to guarantee accuracy and timeliness under low-light and complex interference conditions. To address this issue, AI-based intelligent detection technology has emerged, improving the efficiency and accuracy of cable tunnel water accumulation detection through automation and intelligent means. However, existing intelligent detection algorithms still perform poorly under low-light and complex interference conditions, primarily due to insufficient training data and the algorithm models' poor adaptability to complex environments.

[0004] In recent years, object detection technology has made significant progress in the field of computer vision. Object detection aims to accurately identify and locate objects of interest in images, and it is widely used in various fields such as autonomous driving, security monitoring, and medical image analysis. For the problem of water accumulation detection in cable tunnels, specialized detection models can be designed to analyze tunnel images, accurately identify and locate water accumulation areas, and generate alarm information to promptly remind maintenance personnel to handle the situation. Summary of the Invention

[0005] To address the low illumination problem and complex background issues such as cable ducts in current cable tunnel water accumulation detection methods, this invention provides a three-stage method for cable tunnel water accumulation detection under low illumination and complex interference conditions. In the first stage, a generative adversarial network (GAN) is used to enhance the low-light image within the tunnel to recover 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 within the cable tunnel, effectively reducing background interference from other fixed structures within the tunnel. In the third stage, water accumulation detection is performed on the tunnel road surface area. During water accumulation detection, regularization and attention mechanisms are incorporated into Faster R-CNN, effectively suppressing model bias and significantly improving the model's generalization and robustness in various scenarios. The proposed method effectively improves image quality and small target features, eliminates complex background interference in cable tunnels, and improves the accuracy of water accumulation detection when identifying water accumulation in cable tunnels. The technical problem addressed by this invention is solved as follows:

[0006] Specific content:

[0007] A three-stage method for detecting water accumulation in cable tunnels under complex interference conditions with low illumination includes the following steps:

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

[0009] Step 2: Preprocess the obtained low-light cable tunnel data and normal illumination data, and then perform normalization processing.

[0010] Step 3: The generator in the generative adversarial network is used to process the low-light cable tunnel data obtained in step 2, in order to transform the noise vector in the latent space into high-quality image data.

[0011] Step 4: The image data generated in Step 3 and the normal lighting data obtained in Step 2 are input into the discriminator in the generative adversarial network to guide the generator's update and improve the quality of the generated image.

[0012] Step 5: Perform generator-discriminator adversarial training on low-light cable tunnel data to train the image illumination enhancement generative adversarial network built in Steps 3 and 4.

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

[0014] Step 7: Preprocess the cable tunnel road data obtained in Step 6 and perform normalization processing;

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

[0016] Step 9: Train the cable tunnel road segmentation network built 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, perform cable tunnel segmentation masking, and label the cable tunnel water accumulation to obtain the cable tunnel road water accumulation dataset. Then, perform preliminary processing on the images in the dataset to divide them into training and test sets.

[0018] Step 11: Preprocess the water accumulation data of the cable tunnel road obtained in Step 10, and then perform normalization processing;

[0019] Step 12: Use ResNet with an added attention mechanism as the 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, then map the candidate regions onto the feature map through ROI pooling, unify the feature map size, and calculate the loss;

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

[0022] Step 15: Train the cable tunnel water accumulation detection network built in Steps 12, 13, and 14 on the cable tunnel road water accumulation dataset.

[0023] Step 1 of the present invention includes:

[0024] Step 1-1: Obtain a dataset of cable tunnel related scenes, including two categories: those with water accumulation and those without. Perform preliminary processing on the dataset by deleting irrelevant images and cropping the images to a uniform size.

[0025] Step 1-2: The dataset obtained after processing in step 1-1 is divided into a training set and a test set, which facilitates the subsequent training and testing of the network.

[0026] Step 2 of the present invention includes:

[0027] Step 2-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images.

[0028] Step 2-2: Use shuffle and filename to batch read the data obtained in Step 2-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 2-2.

[0030] Step 3 of the present invention includes:

[0031] Step 3-1: The data from Step 2 is passed through a U-net with a self-attention mechanism as the generator of the generative adversarial network. The image data first passes through a reflection padding layer, then through a 7x7 convolutional layer, and the padded input is mapped onto the feature map. The ReLU activation function is used. Then, these features are fed into a series of downsampling layers consisting of 3x3 convolutional layers and normalization layers 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; 8 residual blocks are used, each containing two convolutional layers, followed by a normalization layer and a ReLU activation function.

[0033] Step 3-3: Increase the size of the feature map by using a series of upsampling layers consisting of 3x3 convolutional layers and normalization layers; the number of upsampling layers is the same as the number of downsampling layers in step 3-1. Then, the feature map is mapped to the output channel by a reflection padding layer and a 7x7 convolutional layer.

[0034] Steps 3-4 use the Tanh activation function to limit the final output to the range of -1 to 1.

[0035] Step 4 of the present invention includes:

[0036] Step 4-1: For the output image obtained in Step 3, a local discriminator is first used to learn and distinguish the authenticity of image patches. Each time, 5 patches are randomly cropped from the output image obtained in Step 3 and the real illumination image obtained in Step 2. Adversarial learning is performed using the local generator loss function and the local discriminator loss function. The relative discriminator function is used in the loss function, and the formula is shown below:

[0037]

[0038]

[0039] Where C represents the network, x r The image representing real lighting, x f The image represents the enhanced output, σ represents the linear function, E represents the expected value, and x represents the desired value. f ~P fake This indicates that the fake images generated by the generator follow a probability distribution of fake images, x r ~P real This indicates that the real image follows a probability distribution of the real image;

[0040] Local generator loss function formula Formula for loss function of local discriminator As shown below:

[0041]

[0042]

[0043] Where, x f ~P fake-patches Let x represent the probability distribution of a random variable that follows a spurious image patch. r ~P real-patches This indicates that the random variable follows a probability distribution of a real image patch, and D represents the local discriminator network;

[0044] Step 4-2: For the output image obtained in Step 3, use a global discriminator to determine the overall illumination difference between the generated image and the real image, improve the adversarial loss of the global illumination features of the image to minimize the distance between the illumination distribution of the real image and the output image. The global generator loss function formula is... With global discriminator The loss function formula is shown below:

[0045]

[0046]

[0047] where x r ~P fake This indicates that the fake images generated by the generator follow a probability distribution of fake images, x r ~P real D represents the probability distribution of a real image. Ra This represents the global discriminator network.

[0048] Step 6 of the present invention includes:

[0049] Step 6-1: Use the image enhancement network obtained in step 5 to enhance the illumination of the cable tunnel dataset, and annotate the cable tunnel roads in the enhanced images to prepare for training and testing.

[0050] Step 6-2: The dataset obtained after processing in step 6-1 is divided into a training set and a test set, which facilitates the subsequent training and testing of the network.

[0051] Step 7 of the present invention includes:

[0052] Step 7-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images.

[0053] Step 7-2: Use shuffle and filename to batch read the data obtained in step 7-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 7-2.

[0055] Step 8 of the present invention includes:

[0056] Step 8-1: Build a new YOLO model from the model configuration file. This model configuration file defines the YOLO model's backbone, which contains multiple convolutional layers, C2F layers, and SPPF layers, as well as the upsampling and segmentation layers of the head network.

[0057] Step 8-2: Preload a YOLOv8n-seg pre-trained model onto the YOLO model constructed in step 8-1 to accelerate the training process.

[0058] Step 10 of the present invention includes:

[0059] Step 10-1: Use the road segmentation network obtained in step 9 to segment the cable tunnel dataset and extract the segmented road regions. Mark the water accumulation areas in the segmented images to prepare for training and testing.

[0060] Step 10-2: The dataset obtained after processing in step 10-2 is divided into a training set and a test set, which facilitates the subsequent training and testing of the network.

[0061] Step 11 of the present invention includes:

[0062] Step 11-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images.

[0063] Step 11-2: Use shuffle and filename to batch read the data obtained in step 11-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 11-2.

[0065] Step 12 of the present invention includes:

[0066] Step 12-1: The input image is transformed from a 3-channel feature map to a 64-channel feature map through a convolutional layer with a kernel size of 7x7, a stride of 2, and 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 layers consist of 1x1 downsampling layers and several 3x3 convolutional blocks with residual connections;

[0068] Step 12-3, where the attention enhancement layer enhances channel attention and spatial attention mechanisms. The channel attention mechanism first applies batch normalization to emphasize features, and then uses rearrangement operations and a multilayer perceptron to enhance the dependency between channel and spatial dimensions; the formula for the channel attention mechanism is:

[0069]

[0070] Among them W γ For each channel, the scaling factors are F1 and F3, which represent the input and output feature maps, respectively, and p and... This represents a 3D rearrangement operation on the feature map. MLP stands for Multilayer Perceptron, and sigmoid is the sigmoid activation function. The spatial attention mechanism consists of two consecutive convolutional layers, as shown in the following formula:

[0071]

[0072] Where F1 and F2 represent the input and processed output feature maps, respectively, and BN s W represents pixel-level normalization operation. λ It is the scaling factor for each space, conv 5x5 This represents a 5×5 convolution operation.

[0073] Step 13 of the present invention includes:

[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 during network training, and apply loss regularization. The loss regularization formula is as follows:

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

[0078] Where T is the original loss, T′ is the regularized loss, and c is the smoothing parameter, which is usually set to 0.5;

[0079] 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 the feature representation.

[0080] Step 14 of the present invention includes:

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

[0082] Step 14-2: Obtain the classification score through the fully connected layer of the classification score, and obtain the bounding box regression parameters through the bounding box layer.

[0083] This invention proposes a three-stage method for detecting water accumulation in cable tunnels under complex interference conditions with low illumination. Compared with existing technologies, it has the following advantages and beneficial effects:

[0084] This invention addresses problems encountered in practical applications by employing a three-stage approach: low-light image enhancement, image segmentation, and target detection, to detect water accumulation areas in cable tunnels. First, low-light image enhancement improves image quality and enriches image details. Then, image segmentation accurately delineates water-filled road areas while reducing interference from complex backgrounds. Finally, an integrated attention mechanism-based target detection method enhances the model's ability to identify basic features in complex backgrounds, significantly improving the accuracy of water accumulation area detection. The proposed method effectively improves image quality and small target features, eliminates interference from complex backgrounds in cable tunnels, and increases the accuracy of water accumulation identification when identifying water accumulation in cable tunnels. Attached Figure Description

[0085] Figure 1 This is the overall flowchart of the method of the present invention;

[0086] Figure 2 This is a diagram of the overall network architecture;

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

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

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

[0090] The preferred embodiments of the present invention are described in detail below with reference to 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 precise definition of the protection scope of the present invention.

[0091] The present invention includes:

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

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

[0094] Step 2: Preprocess the obtained low-light cable tunnel data and normal illumination data, and then perform normalization processing.

[0095] Step 3: The generator in the generative adversarial network is used to process the low-light cable tunnel data obtained in step 2, in order to transform 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 lighting data obtained in Step 2 are input into the discriminator in the generative adversarial network (GAN) to guide the generator's updates and improve the quality of the generated image. The low-light enhancement GAN structure is as follows: Figure 4 As shown;

[0097] Step 5: Perform generator-discriminator adversarial training on low-light cable tunnel data to train the image illumination enhancement generative adversarial network built in Steps 3 and 4.

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

[0099] Step 7: Preprocess the cable tunnel road data obtained in Step 6 and perform normalization processing;

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

[0101] Step 9: Train the cable tunnel road segmentation network built 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, perform cable tunnel segmentation masking, and label the cable tunnel water accumulation to obtain the cable tunnel road water accumulation dataset. Then, perform preliminary processing on the images in the dataset to divide them into training and test sets.

[0103] Step 11: Preprocess the water accumulation data of the cable tunnel road obtained in Step 10, and then perform normalization processing;

[0104] Step 12: Use ResNet with an added attention mechanism as the 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, then map the candidate regions onto the feature map through ROI pooling, unify the feature map size, and calculate the loss;

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

[0107] Step 15: Train the cable tunnel water accumulation detection network constructed 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 As shown.

[0108] Step 1 of the present invention includes:

[0109] Step 1-1: Obtain a dataset of cable tunnel related scenes, including two categories: those with water accumulation and those without. Perform preliminary processing on the dataset by deleting irrelevant images and cropping the images to a uniform size.

[0110] Step 1-2: The dataset obtained after processing in step 1-1 is divided into a training set and a test set, which facilitates the subsequent training and testing of the network.

[0111] Step 2 of the present invention includes:

[0112] Step 2-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images.

[0113] Step 2-2: Use shuffle and filename to batch read the data obtained in Step 2-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 2-2.

[0115] Step 3 of the present invention includes:

[0116] Step 3-1: The data from Step 2 is passed through a U-net that incorporates a self-attention mechanism as the generator of a generative adversarial network. The image data first passes through a reflection padding layer, then through a 7x7 convolutional layer, which maps the padded input onto the feature map and uses the ReLU activation function. Next, these features are fed into a series of downsampling layers consisting of 3x3 convolutional layers and normalization layers 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. Eight residual blocks are used, each containing two convolutional layers, followed by a normalization layer and a ReLU activation function.

[0118] Step 3-3: Increase the size of the feature map by using a series of upsampling layers consisting of 3x3 convolutional layers and normalization layers. The number of upsampling layers is the same as the number of downsampling layers in Step 3-1. Then, the feature map is mapped to the output channel by a reflection padding layer and a 7x7 convolutional layer.

[0119] Steps 3-4 use the Tanh activation function to limit the final output to the range of -1 to 1.

[0120] Step 4 of the present invention includes:

[0121] Step 4-1: For the output image obtained in Step 3, a local discriminator is first used to learn and distinguish the authenticity of image patches. Each time, 5 patches are randomly cropped from the output image obtained in Step 3 and the real illumination image obtained in Step 2. Adversarial learning is performed using the local generator loss function and the local discriminator loss function. The relative discriminator function is used in the loss function, and the formula is shown below:

[0122]

[0123]

[0124] Where C represents the network, x r The image representing real lighting, x f The image represents the enhanced output, σ represents the linear function, E represents the expected value, and x represents the desired value. f ~P fake This indicates that the fake images generated by the generator follow a probability distribution of fake images, x r ~P real This indicates that the real image follows a probability distribution of the real image;

[0125] Local generator loss function formula Formula for loss function of local discriminator As shown below:

[0126]

[0127]

[0128] Where, x f ~P fake-patches Let x represent the probability distribution of a random variable that follows a spurious image patch. r ~P real-patches This indicates that the random variable follows a probability distribution of a real image patch, and D represents the local discriminator network;

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

[0130]

[0131]

[0132] Where x f ~P fakeThis indicates that the fake images generated by the generator follow a probability distribution of fake images, x r ~P real D represents the probability distribution of a real image. Ra This represents the global discriminator network.

[0133] Step 6 of the present invention includes:

[0134] Step 6-1: Use the image enhancement network obtained in step 5 to enhance the illumination of the cable tunnel dataset, and annotate the cable tunnel roads in the enhanced images to prepare for training and testing.

[0135] Step 6-2: The dataset obtained after processing in step 6-1 is divided into a training set and a test set, which facilitates the subsequent training and testing of the network.

[0136] Step 7 of the present invention includes:

[0137] Step 7-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images.

[0138] Step 7-2: Use shuffle and filename to batch read the data obtained in step 7-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 7-2.

[0140] Step 8 of the present invention includes:

[0141] Step 8-1: Build a new YOLO model from the model configuration file. This model configuration file defines the YOLO model's backbone, which contains multiple convolutional layers, C2F layers, and SPPF layers, as well as the upsampling and segmentation layers of the head network.

[0142] Step 8-2: Preload a YOLOv8n-seg pre-trained model onto the YOLO model constructed in step 8-1 to accelerate the training process.

[0143] Step 10 of the present invention includes:

[0144] Step 10-1: Use the road segmentation network obtained in step 9 to segment the cable tunnel dataset and extract the segmented road regions. Mark the water accumulation areas in the segmented images to prepare for training and testing.

[0145] Step 10-2: The dataset obtained after processing in step 10-2 is divided into a training set and a test set, which facilitates the subsequent training and testing of the network.

[0146] Step 11 of the present invention includes:

[0147] Step 11-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images.

[0148] Step 11-2: Use shuffle and filename to batch read the data obtained in step 11-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 11-2.

[0150] Step 12 of the present invention includes:

[0151] Step 12-1: The input image is transformed from a 3-channel feature map to a 64-channel feature map through a convolutional layer with a kernel size of 7x7, a stride of 2, and 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 layers consist of 1x1 downsampling layers and several 3x3 convolutional blocks with residual connections;

[0153] Step 12-3 involves an attention enhancement layer that incorporates channel attention and spatial attention mechanisms. The channel attention mechanism first applies batch normalization to emphasize features, then uses rearrangement operations and a multilayer perceptron to enhance the dependency between channel and spatial dimensions. The formula for the channel attention mechanism is:

[0154]

[0155] Where W γ For each channel, the scaling factors are F1 and F3, which represent the input and output feature maps, respectively, and p and... This represents a 3D rearrangement operation on the feature map. MLP stands for Multilayer Perceptron, and sigmoid is the sigmoid activation function. The spatial attention mechanism consists of two consecutive convolutional layers, as shown in the following formula:

[0156]

[0157] Where F1 and F2 represent the input and processed output feature maps, respectively, and BN s W represents pixel-level normalization operation. λ It is the scaling factor for each space, conv 5x5 This represents a 5×5 convolution operation.

[0158] Step 13 of the present invention includes:

[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 during network training, and apply loss regularization. The loss regularization formula is as follows:

[0162] T' = T·(1-c) + 0.5·c

[0163] Where T is the original loss, T′ is the regularized loss, and c is the smoothing parameter, which is usually set to 0.5;

[0164] 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 the feature representation.

[0165] Step 14 of the present invention includes:

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

[0167] Step 14-2: Obtain the classification score through the fully connected layer of the classification score, and obtain the bounding box regression parameters through the bounding box layer.

[0168] This invention provides a method for detecting water accumulation in cable tunnels under complex interference conditions with low light, based on a three-stage process. The above description is merely an embodiment of this invention and does not limit the scope of the patent. Any equivalent structural or procedural transformations made using the description and drawings of this invention, or any direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this invention.

Claims

1. A three-stage method for detecting water accumulation in cable tunnels under complex interference conditions with low illumination, characterized in that, Includes the following steps: Step 1: Obtain the required low-light cable tunnel dataset and other normal lighting image data, and perform preliminary processing on the images in the dataset to divide them into training and test sets; Step 2: Preprocess the obtained low-light cable tunnel data and normal illumination data, and then perform normalization processing. Step 3: The generator in the generative adversarial network is used to process the low-light cable tunnel data obtained in step 2, in order to transform the noise vector in the latent space into high-quality image data. Step 4: The image data generated in Step 3 and the normal lighting data obtained in Step 2 are input into the discriminator in the generative adversarial network to guide the generator's update and improve the quality of the generated image. Step 5: Perform generator-discriminator adversarial training on low-light cable tunnel data to train the image illumination enhancement generative adversarial network built in Steps 3 and 4. Step 6: Using the generative adversarial network obtained in Step 5, perform image enhancement on the low-light cable tunnel data and label the cable tunnel roads to obtain the cable tunnel road dataset. Then, perform preliminary processing on the images in the dataset and divide them into training and test sets. Step 7: Preprocess the cable tunnel road data obtained in Step 6 and perform normalization processing; Step 8: Use the YOLOv8n-seg model to extract the image data features from Step 7, perform feature fusion and segmentation output; Step 9: Train the cable tunnel road segmentation network built 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, perform cable tunnel segmentation masking, and label the cable tunnel water accumulation to obtain the cable tunnel road water accumulation dataset. Then, perform preliminary processing on the images in the dataset to divide them into training and test sets. Step 11: Preprocess the water accumulation data of the cable tunnel road obtained in Step 10, and then perform normalization processing; Step 12: Use ResNet with an added attention mechanism as the 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, then map the candidate regions onto the feature map through ROI pooling, unify the feature map size, and calculate the loss; Step 14: Further process the features using the Fast R-CNN predictor, calculate the classification score and regression parameters, select positive and negative samples, calculate the loss, filter the prediction results and perform non-maximum suppression, and map them back to the original coordinate system. Step 15: Train the cable tunnel water accumulation detection network built in Steps 12, 13, and 14 on the cable tunnel road water accumulation dataset.

2. The method according to claim 1, characterized in that... Step 2 includes: Step 2-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images. Step 2-2: Use shuffle and filename to read the data obtained in step 2-1 in batches. Shuffle the index according to the number of data files, and then read the data according to the file corresponding to the index. Step 2-3: Call the methods in transforms to process the data and normalize the data read in step 2-2.

3. The method according to claim 1, characterized in that... Step 3 includes: Step 3-1: The data from Step 2 is passed through a U-net with a self-attention mechanism as the generator of the generative adversarial network. The image data first passes through a reflection padding layer, then through a 7x7 convolutional layer, and the padded input is mapped onto the feature map. The ReLU activation function is used. Then, these features are fed into a series of downsampling layers consisting of 3x3 convolutional layers and normalization layers 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. Eight residual blocks are used, each containing two convolutional layers, followed by a normalization layer and a ReLU activation function. Step 3-3: Increase the size of the feature map by using a series of upsampling layers consisting of 3x3 convolutional layers and normalization layers. The number of upsampling layers is the same as the number of downsampling layers in Step 3-1. Then, the feature map is mapped to the output channel by a reflection padding layer and a 7x7 convolutional layer. Steps 3-4 use the Tanh activation function to limit the final output to the range of -1 to 1.

4. The method according to claim 1, characterized in that... Step 4 includes: Step 4-1: For the output image obtained in Step 3, a local discriminator is first used to learn and distinguish the authenticity of image patches. Each time, 5 patches are randomly cropped from the output image obtained in Step 3 and the real illumination image obtained in Step 2. Adversarial learning is performed using the local generator loss function and the local discriminator loss function. The relative discriminator function is used in the loss function, and the formula is shown below: Where C represents the network, x r The image representing real lighting, x f The image represents the enhanced output, σ represents the linear function, E represents the expected value, and x represents the desired value. f ~P fake This indicates that the fake images generated by the generator follow a probability distribution of fake images, x r ~P real This indicates that the real image follows a probability distribution of the real image; Local generator loss function formula Formula for loss function of local discriminator As shown below: Where, x f ~P fake-patches Let x represent the probability distribution of a random variable that follows a spurious image patch. r ~P real-patches This indicates that the random variable follows a probability distribution of a real image patch, and D represents the local discriminator network; Step 4-2: For the output image obtained in Step 3, use a global discriminator to determine the overall illumination difference between the generated image and the real image, improve the adversarial loss of the global illumination features of the image to minimize the distance between the illumination distribution of the real image and the output image. The global generator loss function formula is... With global discriminator The loss function formula is shown below: Where x f ~P fake This indicates that the fake images generated by the generator follow a probability distribution of fake images, x r ~P real D represents the probability distribution of a real image. Ra This represents the global discriminator network.

5. The method according to claim 1, characterized in that... Step 7 includes: Step 7-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images. Step 7-2: Use shuffle and filename to batch read the data obtained in step 7-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 7-2.

6. The method according to claim 1, characterized in that... Step 8 includes: Step 8-1: Build a new YOLO model from the model configuration file. This model configuration file defines the YOLO model's backbone, which includes multiple convolutional layers, C2F layers, and SPPF layers, as well as upsampling and segmentation layers in the head network. Step 8-2: Preload a YOLOv8n-seg pre-trained model onto the YOLO model built in Step 8-1 to accelerate the training process.

7. The method according to claim 1, characterized in that... Step 11 includes: Step 11-1: Use imageio and opencv to read the image. Read the corresponding image file according to the input file name, file path and image size, and return an array containing the images. Step 11-2: Use shuffle and filename to batch read the data obtained in step 11-1. Shuffle the 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 methods in transforms to process the data and normalize the data read in step 11-2.

8. The method according to claim 1, characterized in that... Step 12 includes: Step 12-1: The input image is transformed from a 3-channel feature map to a 64-channel feature map through a convolutional layer with a kernel size of 7x7, a stride of 2, and 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 layers consist of 1x1 downsampling layers and several 3x3 convolutional blocks with residual connections; Step 12-3 involves an attention enhancement layer that incorporates channel attention and spatial attention mechanisms. The channel attention mechanism first applies batch normalization to emphasize features, then uses rearrangement operations and a multilayer perceptron to enhance the dependency between channel and spatial dimensions. The formula for the channel attention mechanism is: F1=W γ ((EBN(F1)), F2 = MLP(p(F1)), Where W γ For each channel, the scaling factors are F1 and F3, which represent the input and output feature maps, respectively, and p and... This represents a 3D rearrangement operation on the feature map. MLP stands for Multilayer Perceptron, and sigmoid is the sigmoid activation function. The spatial attention mechanism consists of two consecutive convolutional layers, as shown in the following formula: F1=Wλ(BN s (F1)), F2=sigmoid(conv 5x5 conv 5x5 (F1))), Where F1 and F2 represent the input and processed output feature maps, respectively, and BN s W represents pixel-level normalization operation. λ It is the scaling factor for each space, conv 5x5 This represents a 5×5 convolution operation.

9. The method according to claim 1, characterized in that... 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 during network training, and apply loss regularization. The loss regularization formula is as follows: T′=T·(1-c)+0.5·c Where T is the original loss, T′ is the regularized loss, and c is the smoothing parameter, which is usually set to 0.5; 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 the feature representation.

10. The method according to claim 1, characterized in that... Step 14 includes: Step 14-1: Flatten the feature representation obtained in step 13 into a two-dimensional tensor using the flatten method; Step 14-2: Obtain the classification score through the fully connected layer of the classification score, and obtain the bounding box regression parameters 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