Dam leakage infrared image target detection method based on deep learning
By using the UAV platform equipped with infrared image sensors and deep learning technology, combined with the improved Yolov5 model of Ghostnet and CBAM attention mechanism, the problem of low efficiency of traditional dam leakage detection has been solved, and efficient and accurate detection of dam leakage has been achieved, improving Improve detection accuracy and flexibility.
Patent Information
- Application Number
- CN202411006674.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-09-20
AI Technical Summary
Traditional dam leakage detection methods are inefficient, cannot achieve all-weather, full coverage detection, and are limited by geographical conditions, making it difficult to flexibly respond to the leakage detection needs of different regions.
The UAV platform is equipped with an infrared image sensor, combined with deep learning technology and the improved Yolov5 model, and uses the Ghostnet convolution network and CBAM attention mechanism module to achieve efficient and accurate detection of dam leakage.
It achieves real-time, full-coverage leakage detection on the dam surface, improves detection efficiency and accuracy, reduces dependence on manpower, and enhances the detection effect and robustness of the model.
Smart Images

Figure CN118675072A
Abstract
Description
Technical Field
[0001] The present invention relates to dam leakage detection technology, which collects infrared images through an unmanned aerial vehicle platform and develops a deep learning target detection algorithm to achieve dam inspection and leakage detection. Background Art
[0002] Dams play a vital role in water resource management and flood control projects. However, due to the influence of natural and human factors, dams may face leakage problems, leading to serious safety hazards. Timely and accurate detection of leakage targets on the surface of dams is crucial to ensure the safety of dam structures and flood prevention and disaster reduction.
[0003] Traditional methods of levee leakage detection mainly rely on inefficient manual inspections. For dam projects, floods last for a long time and cover a large area. Leakage problems may occur at any time during the flood season, making it difficult to achieve all-weather and full-coverage detection. At the same time, it may be limited by geographical conditions and cannot flexibly respond to leakage detection needs in different regions. Therefore, it is urgent to develop an efficient, economical and practical dam leakage target detection system.
[0004] With the continuous development of drone technology and deep learning, the use of drones for dam leakage target detection has become a solution with great potential. Drones have the advantages of rapid response, flexibility, and low cost by carrying advanced sensors. They can conduct comprehensive and high-resolution monitoring of the dam surface in a short time. Using deep learning image processing technology, drones can achieve real-time detection and positioning of leakage targets, providing important information support for timely maintenance measures. Among them, the Yolov5 model is a target detection network based on convolutional neural networks. Target detection is one of the tasks in the field of computer vision. Its goal is to accurately identify and locate objects in images or videos.
[0005] Therefore, the present invention aims to provide a dam leakage target detection system based on drones. The present invention establishes a dam leakage detection method based on drone infrared images of Yolov5, which improves the Yolov5 model. By giving full play to the advantages of drones, efficient detection of dam leakage can be achieved, providing reliable protection for the safety of dam structures. Summary of the invention
[0006] The present invention relates to a method for detecting dam leakage targets based on infrared thermal imaging of unmanned aerial vehicles, aiming to overcome the limitations of traditional monitoring methods and improve the efficiency and accuracy of leakage target detection. The system makes full use of the flexibility and high maneuverability of unmanned aerial vehicles, and through the use of advanced sensors, it can realize real-time monitoring of the dam surface and quickly discover potential leakage problems with the help of post-processing image processing technology.
[0007] In order to achieve the above object, the present invention provides the following technical solutions:
[0008] A deep learning-based dam leakage infrared image target detection method mainly includes improving and training the Yolov5 model and using the improved and optimized Yolov5 model to perform dam leakage detection, specifically including the following steps:
[0009] Step S1, data collection: using a drone equipped with an infrared lens to obtain infrared images and visible light image data of the dam, with a pixel size of 640*640;
[0010] Step S2, data set preparation: using the labelImg data annotation tool, select the leakage area in the infrared image data for annotation, and use data enhancement techniques such as rotation, flipping, scaling, and brightness adjustment to operate the annotated data to amplify the data. The original annotated data and the data after data enhancement together constitute the data set;
[0011] Step S3, dividing the data set: the prepared data set is divided into a training set, a validation set, and a test set in a ratio of 6:2:2;
[0012] Step S4, improving the Yolov5 model: introducing the Ghostnet convolutional network into the Yolov5 model, and adding the CBAM attention mechanism module that combines channel attention and spatial feature attention;
[0013] Step S5, training the improved Yolov5 model: input the infrared images in the training set to train the improved Yolov5 model based on the PyCharm software; each training batch will be trained and verified from the verification set;
[0014] Step S6, dam leakage target detection: input the test set images in the data set prepared in S3 into the Yolov5 model trained in S5 and set the hyperparameters, predict the data and obtain the final detection result, i.e., the dam leakage target.
[0015] Further technology of the present invention:
[0016] Preferably, the improved Yolov5 model is specifically as follows:
[0017] Use Ghostnet convolutional network to replace the backbone network and neck network of Yolov5;
[0018] Use ordinary 1×1 convolution to compress the number of channels of the input image, and then perform depth-wise separable convolution to obtain more feature maps;
[0019] Concat different feature maps together to form a new output;
[0020] The CBAM attention mechanism applies a combination of channel attention module and spatial attention module;
[0021] Among them, the channel attention module performs global average pooling and global maximum pooling on the input feature layer;
[0022] The results of average pooling and maximum pooling are processed using a shared fully connected layer;
[0023] Add the results of the shared fully connected layer and use the Sigmoid activation function to obtain the channel attention map, that is, the weight of each channel in the input feature layer, between 0 and 1;
[0024] The weights are added to the input feature layer channel by channel through multiplication;
[0025] The spatial attention module focuses on which part of the input image is more important, which is a complement to the channel attention module;
[0026] Among them, the spatial attention module is a supplement to the channel attention module. It applies average pooling and maximum pooling along the channel direction of each feature point and stacks them to generate an effective feature descriptor;
[0027] They are the average pooling characteristics and the maximum pooling characteristics of the channels, respectively, and then a standard convolutional layer is used for connection and convolution;
[0028] Use the Sigmoid activation function to obtain a two-dimensional spatial attention map, that is, to obtain the weight value of each feature point in the input feature map, between 0 and 1;
[0029] The weights are added channel by channel to the input feature layer through multiplication.
[0030] The beneficial effects of the present invention are:
[0031] 1. Ghost convolution first generates a small amount of leakage feature maps through ordinary convolution, and then generates more feature maps through linear operations based on a small amount of feature maps. This not only ensures the extraction of leakage features, but also improves the detection effect of the leakage detection model.
[0032] 2. The combination of channel attention module and spatial attention module CBAM is applied to process the input feature layer by channel attention module and spatial attention module respectively. It highlights the leakage information in the image and further improves the detection accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flow chart of a deep learning-based infrared image target detection method for dam leakage;
[0034] Figure 2 This is a schematic diagram of the Yolov5 network structure;
[0035] Figure 3 Schematic diagram of Ghost convolution;
[0036] Figure 4 This is a schematic diagram of Ghost BottleNeck;
[0037] Figure 5 Schematic diagram of CBAM attention mechanism;
[0038] Figure 6 This is a schematic diagram of the Yolov5-Ghost-CBAM network structure. DETAILED DESCRIPTION
[0039] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0040] The present invention relates to a dam leakage target detection method based on unmanned aerial vehicle infrared thermal imaging, comprising:
[0041] Human-machine platform: UAVs are equipped with sensors such as infrared thermal imaging and high-resolution optical cameras to obtain multimodal data on the surface of the dam. UAVs can fly over the dam surface in a relatively short time to quickly obtain data on the dam surface. High-resolution cameras can capture images of the dam surface for visual inspection. It is used to detect potential leakage problems, as leakage may cause local temperature changes. The data obtained by the sensor can be processed by image processing and data analysis algorithms. Using deep learning technology, automatic identification and classification of potential leakage targets can be achieved. The use of UAV platforms reduces dependence on manpower and reduces the risk of personnel in conducting inspections on the dam surface. The UAV platform has good scalability and can be equipped with different types of sensors according to needs to adapt to different reservoir leakage detection tasks.
[0042] Image processing: Collect annotated dam image data through the UAV platform, including samples containing leakage targets and normal structures. The data annotation should include the location and bounding box information of the leakage target. Perform data enhancement on the training data, including random rotation, flipping, scaling, brightness adjustment, etc., to increase the robustness and generalization ability of the model. Construct a dam leakage dataset to provide deep learning model training. Calibrate the data by using labelImg.
[0043] Object detection and classification: Yolov5 (You Only Look Once version 5) is an object detection algorithm and the latest version of the Yolov5 series. Compared with previous versions, Yolov5 has significant improvements in accuracy, speed, and model size. The following figure shows the original Yolov5 network model structure. The network structure of Yolov5 is as follows Figure 2 As shown in the figure, the network structure of Yolov5 includes an end-to-end detection process: image input and preprocessing, feature extraction, border detection and classifier. Among them, image preprocessing scales and normalizes the original image; the feature extraction process uses a residual neural network to extract image features and obtain a feature map; border detection is used to predict the position and size of the bounding box; the classifier is used to predict the type of target in each bounding box. Yolov5 uses the focal loss function during training. Compared with the traditional CROSS ENTROPY loss, focal loss reduces the loss of simple samples and increases the loss of difficult samples, so that the model pays more attention to positive samples that are easily ignored. At the same time, techniques such as the Adam optimizer and early stopping are used to accelerate model training and avoid overfitting.
[0044] The present invention makes certain optimization and improvement on the original network model structure, and adds Ghostnet module and CBAM: Convolutional Block Attention Module attention mechanism module on the basis of Yolov5 model.
[0045] Specific steps are as follows Figure 1 :
[0046] Step S1, data collection: using a drone equipped with an infrared lens to obtain infrared images and visible light image data of the dam, with a pixel size of 640*640;
[0047] Step S2, data set preparation: using the labelImg data annotation tool, manually select the leakage area in the infrared image data for annotation, and use data enhancement techniques such as rotation, flipping, scaling, brightness adjustment, etc. to amplify the data to increase the robustness and generalization ability of the model; the original annotated data and the data after data enhancement together constitute the data set;
[0048] Step S3, dividing the data set: the prepared data set is divided into a training set, a validation set, and a test set in a ratio of 6:2:2;
[0049] Step S4, improving the Yolov5 model: Based on the Yolov5 model, the original convolutional network is improved, the Ghostnet convolutional network is introduced, and the CBAM attention mechanism module that integrates channel attention and spatial feature attention is added;
[0050] Step S5, training the improved Yolov5 model: input the infrared images in the training set to train the improved Yolov5 model based on the PyCharm software; each training batch will be trained and verified from the verification set;
[0051] Step S6, dam leakage target detection: input the test set images in the dataset prepared in S3 into the Yolov5 model trained in S5 and set hyperparameters, predict the data and obtain the final detection results.
[0052] Furthermore, the improved Yolov5 model in step S4 is composed of the basic Yolov5 model, Ghostnet convolution and CBAM attention mechanism modules, as follows:
[0053] (1) Ghostnet
[0054] In order to better meet the needs of dam leakage detection, the present invention uses the Ghost module to replace part of the backbone network and neck network of Yolov5. Ghost convolution is used, such as Figure 3 , replacing the ordinary convolution in the original network. The traditional convolution method will generate a lot of redundant information in the process of comprehensively extracting leakage features, resulting in a large amount of model calculation, difficulty in real-time detection, and poor results. Ghost convolution is divided into two parts. The first part is a normal ordinary convolution, which generates a small amount of leakage feature maps. The second part is based on the first part, through linear operations to generate more feature maps, which can not only ensure the extraction of leakage features, but also improve the detection effect of the leakage detection model.
[0055] Ghost Module replaces traditional convolution. It first uses ordinary 1×1 convolution to compress the number of channels of the input image, and then performs depth-separable convolution (layer-by-layer convolution) to obtain more feature maps. Then different feature maps are concat together to form a new output. The number of input channels of 1×1 convolution is the number of output channels of GhostModule output / 2, because the final output feature layer is composed of the result of 1×1 convolution and the result of layer-by-layer convolution stacked together. The number of channels of the feature layer remains unchanged when performing layer-by-layer convolution. If the number of channels of the final output feature layer is to be guaranteed to be a fixed value, then the number of channels of the result after 1×1 convolution must be 1 / 2 of the final output feature layer.
[0056] Ghost BottleNeck is a bottleneck structure composed of Ghost Modules. Figure 4 The overall architecture of Ghost BottleNeck is very similar to that of Residual Block, and it can also be directly considered as replacing the ordinary convolution operation in Residual Block with Ghost Module.
[0057] Figure 4 The backbone is composed of two Ghost Modules (GMs) in series, where the first GM expands the number of channels and the second GM reduces the number of channels to the same as the input channels; the residual part is the same as the ResNet network. Since S = 1, the height and width of the input feature layer will not be compressed, and its function is to deepen the depth of the network.
[0058] Figure 4 In the right figure, a stride=2 Deepwise convolution is added between the two GMs in the main part, which can compress the height and width of the feature map to reduce its size to 1 / 2 of the input; in the residual side part, a 2×2 depthwise separable convolution and a 1×1 ordinary convolution are also added to ensure that the Add operation can be aligned. Since S=2, the height and width of the input feature layer are compressed, and its function is to change the shape of the input feature layer.
[0059] In practical applications, in order to further improve efficiency, all conventional convolutions in GhostModule are replaced by pointwise convolutions. The entire Ghostnet is composed of Ghost Bottlenecks. When an image is input into Ghostnet, a 16-channel ordinary 1×1 convolution block (convolution + normalization + activation function) is first performed. Then the Ghost Bottlenecks are stacked, and using Ghost Bottlenecks, a 7×7×160 feature layer is finally obtained (when the input is 224×224×3). Then a 1×1 convolution block is used to adjust the number of channels, and a 7×7×960 feature layer can be obtained. After that, a global average pooling is performed, and then a 1×1 convolution block is used to adjust the number of channels to obtain a 1×1×1280 feature layer. Finally, after tiling and full connection, classification can be performed.
[0060] (2) CBAM
[0061] Since the size of dam leakage varies, there is a problem of missed detection during detection. At the same time, considering that the leakage accounts for a small proportion of the image, it is easy to cause some leakage information to be lost during training. Therefore, in order to highlight the leakage information in the image and improve the detection accuracy of the model, the CBAM attention mechanism module is introduced in the feature extraction part, such as Figure 5 .
[0062] The core of CBAM: It applies the combination of Channel Attention Module and SpatialAttention Module, and processes the input feature layer with channel attention module and spatial attention module respectively.
[0063] The channel attention module performs global average pooling (AvgPool) and global maximum pooling (MaxPool) on the input feature layer (both poolings are for the height and width of the input feature layer), and then processes the results of average pooling and maximum pooling using a shared fully connected layer (Shared MLP). The results of the shared fully connected layer are then added together and the Sigmoid activation function is used to obtain the channel attention map, that is, the weight of each channel of the input feature layer (between 0 and 1). Finally, the weights are weighted to the input feature layer channel by channel through multiplication.
[0064] Since each channel of the Feature Map extracts a certain level of feature information, the ChannelAttention Module focuses on what level of feature information in the image is more important. In order to effectively calculate channel attention, the Channel Attention Module uses a method of compressing the spatial dimension of the input feature map. Compared with the single pooling method, the Channel Attention Module uses the AvgPool (average pooling) and MaxPool (maximum pooling) methods and proves that the double pooling method has stronger representation power. The specific calculation process is as follows, where σ represents the Sigmoid function, W0∈R C×C / r , W1∈R C×C / r The weights of MLP are shared by W0 and W1. There is a ReLU activation function before W0.
[0065]
[0066] Unlike the channel attention module, the spatial attention module focuses on which part of the input image is more important, and is a complement to the channel attention module. To calculate spatial attention, first apply average pooling and maximum pooling along the channel direction of each feature point (both poolings are for the channels of the input feature layer) and stack them up to generate a valid feature descriptor (using two poolings to aggregate the channel information of a Feature Map to generate two 2D Maps: and The average pooling characteristics and maximum pooling characteristics of the channel are respectively used), and then a standard convolution layer (convolution with a channel number of 1) is used for connection and convolution (the number of channels is adjusted), and then the Sigmoid activation function is used to obtain a two-dimensional spatial attention map, that is, the weight value (between 0 and 1) of each feature point in the input feature map is obtained. Finally, the weight is weighted to the input feature layer channel by channel through multiplication. The specific calculation process is as follows, where σ represents the Sigmoid function, and f 7×7 Represents a convolution kernel of size 7×7.
[0067]
[0068] (3)Yolov5-Ghost-CBAM
[0069] Fusion CBAM: Convolutional Block Attention Module attention mechanism. The CBAM attention mechanism is added to the backbone network. While paying attention to the information connection between channels, it also considers the position information in the feature space, effectively enhancing the expressiveness of learning features, thereby improving the model accuracy. The Ghost module is introduced and embedded into the ordinary Conv and C3 convolution modules in the backbone network to reduce the number of parameters and ensure the lightweight model on the basis of slightly reducing the accuracy. The overall structure of the improved network model is as follows: Figure 6 shown.
[0070] Step S5, training the improved Yolov5 model: training the improved Yolov5 model based on the PyCharm software, specifically:
[0071] First, the infrared image in the input training set passes through the first Focus module to obtain the feature map A;
[0072] Among them, the Focus module inputs the original 640*640*3 image into the Focus structure, uses a slicing operation, first turns it into a 320*320*12 feature map, and then undergoes a convolution operation to finally turn it into a 320*320*32 feature map.
[0073] Next, feature map A passes through the first Ghostnet module to obtain feature map B;
[0074] Next, feature map B passes through the first CBAM module to obtain feature map C;
[0075] Next, feature map C passes through the second Ghostnet module to obtain feature map D;
[0076] Next, feature map D passes through the second CBAM module to obtain feature map E;
[0077] Next, feature map E passes through the third Ghostnet module to obtain feature map F;
[0078] Next, the feature map F passes through the third CBAM module to obtain the feature map G;
[0079] Next, the feature map G passes through the fourth Ghostnet module to obtain the feature map H;
[0080] Next, the feature map H passes through the first SPP module to obtain the feature map I;
[0081] Among them, the SPP module effectively avoids problems such as incomplete cropping and shape distortion caused by the algorithm's cropping and scaling operations on the image area. It solves the problem of repeated feature extraction of images by convolutional neural networks, greatly improves the speed of generating candidate boxes, and saves computing costs.
[0082] Next, feature map I is upsampled for the first time and concatenated with feature map F to obtain feature map J.
[0083] Next, feature map J is upsampled for the second time and concatenated with feature map D to obtain feature map K.
[0084] Then, the feature map K is convolved to obtain the recognition result.
[0085] Then, each training batch will be verified from the validation set to ensure the accuracy of the training. Through continuous iterations, the model training is completed until it becomes stable.
[0086] After model improvement and optimization, and the addition of the Ghost module and the CBAM attention mechanism module, the accuracy of dam leakage detection has been significantly improved compared with the original network. The detection results for the same leakage target have also changed significantly.
[0087] The above is only a preferred embodiment of the present invention. Any person skilled in the art may modify the present invention by using the above technical solution or modify it into an equivalent technical solution. Therefore, any simple modification or equivalent replacement made according to the technical solution of the present invention shall fall within the scope of protection claimed by the present invention.
Claims
1. A deep learning-based infrared image target detection method for dam leakage, It is characterized in that It mainly includes improving and training the Yolov5 model and using the improved and optimized Yolov5 model to detect dam leakage, which specifically includes the following steps: Step S1, data collection: using a drone equipped with an infrared lens to obtain infrared images and visible light image data of the dam, with a pixel size of 640*640; Step S2, data set preparation: using the label Img data annotation tool, select the leakage area in the infrared image data for annotation, and use data enhancement techniques such as rotation, flipping, scaling, and brightness adjustment to operate the annotated data to amplify the data. The original annotated data and the data after data enhancement together constitute the data set; Step S3, dividing the data set: the prepared data set is divided into a training set, a validation set, and a test set in a ratio of 6:2:2; Step S4, improving the Yolov5 model: introducing the Ghostnet convolutional network into the Yolov5 model, and adding the CBAM attention mechanism module that combines channel attention and spatial feature attention; Step S5, training the improved Yolov5 model: input the infrared images in the training set to train the improved Yolov5 model based on the PyCharm software; each training batch will be trained and verified from the verification set; Step S6, dam leakage target detection: input the test set images in the data set prepared in S3 into the Yolov5 model trained in S5 and set the hyperparameters, predict the data and obtain the final detection result, i.e., the dam leakage target.
2. According to the deep learning-based infrared image target detection method for dam leakage described in claim 1, It is characterized in that The improved Yolov5 model is as follows: Use Ghostnet convolutional network to replace the backbone network and neck network of Yolov5; Use ordinary 1×1 convolution to compress the number of channels of the input image, and then perform depth-wise separable convolution to obtain more feature maps; Concat different feature maps together to form a new output; The CBAM attention mechanism applies a combination of channel attention module and spatial attention module; Among them, the channel attention module performs global average pooling and global maximum pooling on the input feature layer; The results of average pooling and maximum pooling are processed using a shared fully connected layer; Add the results of the shared fully connected layer and use the Sigmoid activation function to obtain the channel attention map, that is, the weight of each channel in the input feature layer, between 0 and 1; The weights are added to the input feature layer channel by channel through multiplication; The spatial attention module focuses on which part of the input image is more important, which is a complement to the channel attention module; Among them, the spatial attention module is a supplement to the channel attention module. It applies average pooling and maximum pooling along the channel direction of each feature point and stacks them to generate an effective feature descriptor; They are the average pooling characteristics and the maximum pooling characteristics of the channels, respectively, and then a standard convolutional layer is used for connection and convolution; Use the Sigmoid activation function to obtain a two-dimensional spatial attention map, that is, to obtain the weight value of each feature point in the input feature map, between 0 and 1; The weights are added channel by channel to the input feature layer through multiplication.
Citation Information
Patent Citations
Power grid harmful bird species target detection method based on deep learning
CN114842208A
Thermal infrared image dam leakage dangerous case intelligent identification method based on multi-task assistance
CN116580328A
Cited By
Infrared and visible double-light leakage target detection method, system and medium
CN119600605A
An infrared and visible dual-light leakage target detection method, system and medium
CN119600605B
Infrared leakage detection method, device and equipment for hydraulic structure and medium
CN119888203A
Earth-rockfill dam leakage thermal infrared image prediction method and device
CN120088239A
Transient electromagnetic three-dimensional embankment leakage hidden danger detection method based on unmanned aerial vehicle carrying
CN120141758A
