Unmanned aerial vehicle infrared image detection method, computer equipment and storage medium
By improving the HRNet model and embedding the ECA module, combined with the multi-scale fusion feature map and Dice loss function, the problem of low resolution and slow processing speed of infrared image detection in drone inspections is solved, and more accurate and faster infrared images are achieved. detection.
Patent Information
- Application Number
- CN202410581284.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2024-08-30
AI Technical Summary
The detection resolution of infrared images in existing drone inspections is low, making it difficult to accurately detect targets, and the detection performance is affected in harsh environments. Traditional image processing is slow and cannot achieve real-time inspections.
Improve the HRNet model, embed the ECA module into BasicBlock and Bottleneck, combine multi-scale fusion feature maps and improved Dice loss function, optimize infrared image processing, and improve model performance and computing efficiency.
It improves the accuracy and speed of UAV infrared image detection, enhances the model's representation capabilities, and achieves more accurate category information acquisition and real-time inspection capabilities.
Smart Images

Figure CN118570670A
Abstract
Description
Technical Field
[0001] The invention relates to an unmanned aerial vehicle infrared image detection method, computer equipment and storage medium, and belongs to the technical field of unmanned aerial vehicle image detection. Background Art
[0002] Drone inspection is a process in which drone operators control drones to inspect and repair lines or substations, and use the drone's onboard equipment to photograph or clear faults. In order to improve the level of intelligent power grids, State Grid Corporation of China has vigorously developed drone inspection technology to solve the problems of long manual inspection cycles, high risks, and low automation. Drone inspection has achieved good results in the operation and maintenance of high-voltage transmission lines and has also begun to be used in substations.
[0003] Currently, drone inspections use infrared image detection. However, due to the low-resolution infrared sensors, the clarity and details of the images are limited, making it difficult to accurately detect targets or identify subtle features. At the same time, environmental conditions will also affect the quality and availability of infrared images, especially in severe weather conditions, which will affect detection performance. In real-time processing, a large number of real-time infrared images need to be processed and analyzed, which requires high-performance computing resources and complex methods to ensure fast and accurate target detection. After collecting the infrared image data, the data also needs to be labeled, especially for specific targets or scenes, which will affect the performance and generalization ability of the trained model.
[0004] In the existing technology, the safe distance of high-voltage power station drone inspection was determined through experimental simulation; after studying the route planning of substation drones, autonomous substation drone inspection was realized; and the system construction of substation autonomous inspection was completed through simulation experimental design. However, there are still many problems in image processing after drone inspection. The traditional method has a slow processing speed and cannot be configured on drones to realize real-time inspection. Summary of the invention
[0005] Purpose of the invention: In view of the deficiencies in the prior art, the present invention provides a method for detecting infrared images of drones, a computer device and a storage medium. The present invention improves the HRNet model and can more accurately obtain the category information of infrared images taken by drones.
[0006] Technical solution: A method for detecting infrared images of unmanned aerial vehicles, comprising the following steps:
[0007] Step S1: Establishing a UAV infrared image dataset;
[0008] Step S2: construct a standard HRNet network model;
[0009] Step S3: Based on the standard HRNet network model, the ECA module is embedded into the BasicBlock and Bottleneck blocks of the standard HRNet network model to construct the HRNet-ECA network model;
[0010] Step S4: Process the infrared image output by the HRNet-ECA network model through a fusion method, integrate the image information, and obtain a multi-scale fusion feature map;
[0011] Step S5: Optimize the multi-scale fusion feature map by improving the Dice loss function.
[0012] Preferably, the specific steps of step S1 are as follows:
[0013] S11. Filter the pictures with clear and complete images, and pre-process the filtered pictures: rotate the pictures to any angle, and simulate the shooting of drones along different routes;
[0014] S12, Image enhancement: Rotate, translate, flip horizontally or vertically the image, and simulate infrared images of photovoltaic panels with different shooting heights and different pixels by changing the image size;
[0015] S13. Label the pictures and complete the construction of the UAV infrared image dataset.
[0016] Preferably, the specific steps of step S2 are as follows:
[0017] The standard HRNet network model includes four stages. The first stage includes four stacked BottleNeck bottleneck blocks, and the second, third and fourth stages include four stacked BasicBlock basic blocks. Features are extracted for the standard HRNet model by adding downsampling branches stage by stage, and information propagation of each branch is realized through progressive sampling. At the same time, the feature information of each branch is fused by the element-by-element addition method, and feature maps of 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the image size in the S1 dataset are generated respectively. Finally, a feature map of 1 / 4 size is output separately for downstream tasks.
[0018] Preferably, the ECA module in step S3 includes an ECA attention mechanism, which is based on the SE attention model, and its fully connected layer is replaced by a one-dimensional convolution with a convolution kernel size of k, and channel weighting is performed on e neighboring ranges to achieve local crossover and channel interaction.
[0019] Preferably, the specific process of embedding the ECA module into the BasicBlock and Bottleneck blocks of the standard HRNet network model is as follows:
[0020] The ECA attention mechanism formula is as follows:
[0021] C=φ(k)=2 (γ×k-b)
[0022]
[0023] Where |t| odd represents the nearest odd number to t, C is the input channel, is the ratio between the number of channels C and the convolution kernel size, and γ is the nonlinear mapping;
[0024] The initial channel weight represents the feature mean F at the ath frequency ave,a :
[0025]
[0026] Where P a (c,w,h) represents a set of two-dimensional feature maps of size w×h in c channels at the ath frequency. c, w, h represent the channel, width, and height in the four-dimensional feature map, respectively; C, W, H represent the channel, width, and height lengths in the four-dimensional feature map.
[0027] F ave,a After being mapped to the attention weight P by the Sigmoid function, the calculation formula is as follows:
[0028] P = σ(f(F ave ))
[0029] Where f is a one-dimensional convolution operation; σ is a Sigmoid operation.
[0030] The output of the ECA module is directly fed to the subsequent network layer. In the BasicBlock, the input data first enters a Cov2d module with a convolution kernel size of 3×3, is normalized, and then input into the activation function for fitting, and then input into a Cov2d module with a convolution kernel size of 3×3, and then normalized and enters the ECA module, and is output through Add.
[0031] In the Bottleneck bottleneck block, the input data first enters a Cov2d module with a convolution kernel size of 3×3, and then is normalized and input into the activation function for fitting. The above process is repeated once, and then it is input into a Cov2d module with a convolution kernel size of 3×3, normalized and then entered into the ECA module, and output through Add;
[0032] Constructing a new activation function in the residual block helps to avoid the gradient vanishing problem and improve the training effect of the neural network. Its expression is as follows:
[0033]
[0034] Secondly, construct the Standard dropout method to prevent overfitting during the training phase. Its expression is as follows:
[0035]
[0036] Testing Phase:y2=(1-p)f(Wx)
[0037] Where y1 represents the training output; y2 represents the test output; Wx represents the result obtained after the input vector x is linearly transformed by the weight matrix W; m represents a mask vector with the same dimension as the output; m i represents a random variable that follows a Bernoulli distribution; p represents the probability of discarding.
[0038] The ECA module is embedded into the BasicBlock of the HRNet model, so that each residual unit is composed of ECA-BasicBlock; the HRNet-ECA model network model starts with a backbone consisting of two 3×3 convolutions with a stride of 1, in which the resolution of the feature map is reduced to 1 / 4 of the input image resolution.
[0039] Preferably, the step S4 is specifically as follows:
[0040] Assume that the multi-scale feature maps obtained by the HRNet-ECA network model are P I and P V , fusion feature map P F The calculation of is as follows:
[0041]
[0042] In the formula, and They are the feature maps obtained by spatial fusion and channel fusion respectively; (i, j) represents the element in the i-th row and j-th column in the matrix.
[0043] Assume that the feature map is First reshape and transpose it into Then the feature map is obtained through the n×n pooling operator P is obtained by reshaping and pooling operators P X and P Y Perform matrix multiplication and obtain the spatial factor through the normalization function The formula of spatial fusion method is as follows:
[0044]
[0045] In the formula, represents the positional relationship between μ and v; μ∈[1,HW]; v∈[1,HW / n 2 ]; Softmax(·) represents the Softmax normalization function;
[0046] and P Z Perform matrix multiplication, reshape and transpose the calculation results to obtain P S , the formula is as follows:
[0047]
[0048] Where R(·) is the reshaping function;
[0049] The spatial fusion feature map is calculated by the spatial fusion method and By its relevance weight and Get the spatial fusion feature map The formula is as follows:
[0050]
[0051]
[0052]
[0053] If the feature map is Through the above formula, we get: P X and P Y Perform matrix multiplication and obtain the channel factor through the normalization function The calculation formula is as follows:
[0054]
[0055] Where c∈[1,C] represents the cth channel; μ represents a specific position in the table matrix, which is used to calculate the Softmax function.
[0056] and P Z The calculation formula is as follows:
[0057]
[0058] After the above calculation, the channel fusion feature map is obtained and By its relevance weight and Get channel fusion feature map The formula is as follows:
[0059]
[0060]
[0061]
[0062] Preferably, the step S5 is specifically as follows:
[0063] Combined use of CE loss function and Dice loss function:
[0064] The CE loss function formula is as follows:
[0065]
[0066] Where: N represents the number of samples, c is the number of categories; y ij represents the true label of the jth category of the i-th sample; p ij Represents the predicted probability of the jth category of the i-th sample;
[0067] The DiceLoss formula is as follows:
[0068]
[0069] By using the CE loss function and the Dice loss function together, the total loss function can be expressed as:
[0070] L Total =L CE +λL Dice
[0071] In the formula, λ is a hyperparameter.
[0072] A computer device for a drone infrared image detection method, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the drone infrared image detection method according to any one of claims 1 to 7 when executing the computer program.
[0073] A computer storage medium for a method for detecting an infrared image of a drone, on which a computer program is stored, wherein when the computer program is executed by a processor, the method for detecting an infrared image of a drone according to any one of claims 1 to 7 is implemented.
[0074] Beneficial effects: The present invention embeds the ECA module into BasicBlock and Bottleneck, effectively reducing the number of model parameters and the amount of calculation, enhancing the network's representation ability, making the model more lightweight and improving the model's performance; the infrared image output by the HRNet-ECA network model is processed by combining the fusion method, which uses an n×n pooling operator to reduce the computational complexity, improve the fusion performance, integrate image information to the maximum extent, and reduce spatial and channel information redundancy; the infrared image is optimized by improving the Diceloss function, and the cross entropy loss function and the Dice loss function are used in combination to improve the average pixel accuracy and average intersection-over-union ratio of the model. By improving the HRNet model, the category information of the infrared image taken by the drone can be obtained more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0076] Figure 1 is a flow chart of the method of the present invention;
[0077] Figure 2(a) is a schematic diagram of the BasicBlock residual structure;
[0078] Figure 2(b) is a schematic diagram of the Bottleneck residual structure;
[0079] Figure 3 This is the ECA attention mechanism model diagram;
[0080] Figure 4(a) is a schematic diagram of ECA embedded in the BasicBlock module;
[0081] Figure 4(b) is a schematic diagram of ECA embedded in the Bottleneck module;
[0082] Figure 5 is a diagram of the HRNet-ECA model implemented by the present invention;
[0083] Figure 6(a) is a schematic diagram of the spatial fusion method;
[0084] FIG6( b ) is a schematic diagram of the channel fusion method. DETAILED DESCRIPTION
[0085] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0086] In the description of the present invention, it is necessary to understand that the terms "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0087] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.
[0088] like Figure 1 As shown, a method for detecting infrared images of unmanned aerial vehicles comprises the following steps:
[0089] Step S1: Establishing a UAV infrared image dataset;
[0090] Step S2: construct a standard HRNet network model;
[0091] Step S3: Based on the standard HRNet network model, the ECA module is embedded into the BasicBlock and Bottleneck blocks of the standard HRNet network model to construct the HRNet-ECA network model;
[0092] Step S4: Process the infrared image output by the HRNet-ECA network model through a fusion method, integrate the image information, and obtain a multi-scale fusion feature map;
[0093] Step S5: Optimize the multi-scale fusion feature map by improving the Diceloss function.
[0094] The specific steps of step S1 are as follows:
[0095] S11, filter the images, and pre-process the filtered images: rotate the images to any angle, and simulate the shooting of drones along different routes;
[0096] S12, Image enhancement: Rotate, translate, flip horizontally or vertically the image, and simulate infrared images of photovoltaic panels with different shooting heights and different pixels by changing the image size;
[0097] S13. Label the pictures and complete the construction of the UAV infrared image dataset.
[0098] The UAV infrared image dataset refers to the infrared photography of photovoltaic power stations by UAVs. The images are manually labeled using LabelImg software, and the screened images are preprocessed and enhanced to obtain 1,500 valid images, completing the construction of the dataset.
[0099] The specific steps of step S2 are as follows:
[0100] The standard HRNet network model includes four stages. The first stage includes four stacked BottleNeck bottleneck blocks, and the second, third and fourth stages include four stacked BasicBlock basic blocks. Features are extracted for the standard HRNet model by adding downsampling branches stage by stage, and information propagation of each branch is realized through progressive sampling. At the same time, the feature information of each branch is fused by the element-by-element addition method, and feature maps of 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the image size in the S1 dataset are generated respectively. Finally, a feature map of 1 / 4 size is output separately for downstream tasks.
[0101] HRNet can maintain high-resolution representation. It has two significant advantages. First, by connecting subnetworks from high to low resolution in parallel instead of in series, high resolution can be maintained instead of restored, thereby reducing the loss of feature information. Second, by repeatedly performing multi-scale fusion, the high-resolution representation is enhanced with the low-resolution representation of the same depth to obtain a rich high-resolution representation.
[0102] The ECA module in step S3 includes an ECA attention mechanism, which is based on the SE attention model. Its fully connected layer is replaced by a one-dimensional convolution with a convolution kernel size of k, and channel weighting is performed on e adjacent ranges to achieve local crossover and channel interaction.
[0103] The ECA module is embedded in BasicBlock and Bottleneck. To achieve diversity and improve feature extraction, the HRNet network model uses two residual block structures. Please refer to Figure 2. As shown in Figure 2(a), BasicBlock extracts features through two 3×3 convolutions, which has a stronger extraction effect but a large amount of calculation; as shown in Figure 2(b), the Bottleneck module passes through a 1×1 convolution, then a 3×3 convolution, and finally a 1×1 convolution. This module can adjust the dimension of the output feature for feature extraction, with a small amount of calculation, but the extraction effect is limited. When the HRNet network model extracts features of different resolutions, it passes through multiple Bottleneck modules and BasicBlock modules, which will deepen the model network depth and extract richer information, but it will cause the overall model training speed to slow down, the number of model parameters to increase exponentially, and the model reasoning speed to drop significantly. Therefore, we introduce the ECA module to improve the HRNet network.
[0104] The specific process of embedding the ECA module into the BasicBlock and Bottleneck blocks of the standard HRNet network model is as follows:
[0105] like Figure 3 As shown in the figure, the implementation process of the ECA attention mechanism is as follows: first, the input feature map is compressed, and the time and space dimensions are removed by global average pooling operation to obtain the 1×1×C initial channel weight, that is, the feature map is converted from a size of (N, C, H, W) to (N, C, 1, 1); then, the partial channel weights are obtained by calculating the size of the adaptive convolution kernel, and fused into the output features of all channel association information. The calculation process is as follows:
[0106] C=φ(k)=2 (γ×k-b)
[0107]
[0108] Where |t| odd represents the nearest odd number to t, C is the input channel, is the ratio between the number of channels C and the convolution kernel size, and γ is the nonlinear mapping;
[0109] The initial channel weight represents the feature mean F at the ath frequency ave,a :
[0110]
[0111] Where P a(c,w,h) represents a set of two-dimensional feature maps of size w×h in c channels at the ath frequency. c, w, h represent the channel, width, and height in the four-dimensional feature map, respectively; C, W, H represent the channel, width, and height lengths in the four-dimensional feature map.
[0112] F ave,a After being mapped to the attention weight P by the Sigmoid function, the calculation formula is as follows:
[0113] P = σ(f(F ave ))
[0114] Where f is a one-dimensional convolution operation; σ is a Sigmoid operation.
[0115] As shown in Figure 4, the output of the ECA module is directly fed into the subsequent network layer. As shown in Figure 4(a), in the BasicBlock, the input data first enters a Cov2d module with a convolution kernel size of 3×3, is normalized by BN, and then input into the activation function for fitting, and then input into a Cov2d module with a convolution kernel size of 3×3, and then enters the ECA attention mechanism module after BN normalization, and is output through Add;
[0116] As shown in Figure 4(b), in the Bottleneck bottleneck block, the input data first enters a Cov2d module with a convolution kernel size of 3×3, is normalized by BN, and then input into the activation function for fitting. The above process is repeated once, and then input into a Cov2d module with a convolution kernel size of 3×3, and then enters the ECA attention mechanism module after BN normalization, and is output through Add.
[0117] Constructing a new activation function in the residual block helps to avoid the gradient vanishing problem and improve the training effect of the neural network. Its expression is as follows:
[0118]
[0119] Secondly, construct the Standard dropout method to prevent overfitting during the training phase. Its expression is as follows:
[0120]
[0121] Testing Phase:y2=(1-p)f(Wx)
[0122] Where y1 represents the training output; y2 represents the test output; Wx represents the result obtained after the input vector x is linearly transformed by the weight matrix W; m represents a mask vector with the same dimension as the output; m irepresents a random variable that follows a Bernoulli distribution; p represents the probability of discarding.
[0123] like Figure 5 As shown in the figure, the ECA module is embedded into the BasicBlock of the HRNet model, so that each residual unit is composed of ECA-BasicBlock; the HRNet-ECA model network model starts with a backbone consisting of two 3×3 convolutions with a stride of 1, where the resolution of the feature map is reduced to 1 / 4 of the input image resolution;
[0124] The backbone network consists of four main stages. The first one contains four residual units, each of which consists of an ECA bottleneck of width 64 and a 3×3 convolution, where the ECA module is embedded in the bottleneck to reduce the width of the feature map. The second (third, fourth) stage contains one (four, three) multi-resolution modules. Each multi-resolution module consists of two parts, consisting of parallel multi-resolution convolution and multi-resolution fusion, as follows:
[0125] First, branches of different resolutions are connected in parallel, where each branch contains four residual units, and the ECA module is embedded in BasicBlock, and each unit consists of an ECA-BasicBlock;
[0126] Secondly, branches with different resolutions are feature fused to complete information exchange. Specifically, the conversion from low resolution to high resolution is achieved by bilinear upsampling, and the transition from high resolution to low resolution is achieved by one or more cross-stride convolutions, i.e., 3×3 convolution layers with a stride of 2.
[0127] At the end of the first, second, and third stages, a 3×3 convolution layer with a stride of 2 is used to reduce the resolution as the beginning of a new branch. In general, including the fourth stage, the resolution of each of the four branches is reduced by half from top to bottom (1, 1 / 2, 1 / 4, and 1 / 8), and the number of channels is doubled accordingly (32, 64, 128, and 256). Finally, the output is passed through a 1×1 convolution layer with a stride of 1.
[0128] The step S4 is specifically as follows:
[0129] Assume that the multi-scale feature maps obtained by the HRNet-ECA network model are P I and P V , fusion feature map P F The calculation of is as follows:
[0130]
[0131] In the formula, and They are the feature maps obtained by spatial fusion and channel fusion respectively; (i, j) represents the element in the i-th row and j-th column in the matrix.
[0132] As shown in Figure 6(a), assuming the feature map is First reshape and transpose it into Then the feature map is obtained through the n×n pooling operator P is obtained by reshaping and pooling operators P X and P Y Perform matrix multiplication and obtain the spatial factor through the normalization function The formula of spatial fusion method is as follows:
[0133]
[0134] In the formula, represents the positional relationship between μ and v; μ∈[1,HW]; v∈[1,HW / n 2 ];
[0135] Softmax(·) represents the Softmax normalization function;
[0136] and P Z Perform matrix multiplication, reshape and transpose the calculation results to obtain P S , the formula is as follows:
[0137]
[0138] Where R(·) is the reshaping function;
[0139] The spatial fusion feature map is calculated by the spatial fusion method and By its relevance weight and Get the spatial fusion feature map The formula is as follows:
[0140]
[0141]
[0142]
[0143] As shown in Figure 6(b), channel fusion is to integrate the image feature map from the number of channels to the dimension, and enhance the dimensional information of the fused feature map. Through the above formula, we get: P X and PY Perform matrix multiplication and obtain the channel factor through the normalization function The calculation formula is as follows:
[0144]
[0145] Where c∈[1,C] represents the cth channel; μ represents a specific position in the table matrix, which is used to calculate the Softmax function.
[0146] and P Z The calculation formula is as follows:
[0147]
[0148] After the above calculation, the channel fusion feature map is obtained and By its relevance weight and Get channel fusion feature map The formula is as follows:
[0149]
[0150]
[0151]
[0152] The spatial and channel fusion method can integrate image information to the maximum extent and reduce the redundancy of spatial and channel information.
[0153] The step S5 is specifically as follows:
[0154] The CE loss function can be used to measure the difference between the predicted result and the actual result. The smaller the value, the closer the predicted result of the model is to the actual result. The CE loss function and the Dice loss function are used together:
[0155] The CE loss function formula is as follows:
[0156]
[0157] Where: N represents the number of samples, c is the number of categories; y ij represents the true label of the jth category of the i-th sample; p ij Represents the predicted probability of the jth category of the i-th sample;
[0158] In the CE loss function, the loss weight of each pixel is the same, but in actual tasks, different categories may have different numbers of pixels, which shows that the CE loss function has limitations in segmentation tasks, so it must be combined with DiceLoss.
[0159] DiceLoss uses the Dice coefficient as a similarity measure. The value of this coefficient varies according to the similarity between the two sets, so that the prediction of each category has a different weight in the loss function, which can better train the model.
[0160] The DiceLoss formula is as follows:
[0161]
[0162] By using the CE loss function and the Dice loss function together, the total loss function can be expressed as:
[0163] L Total =L CE +λL Dice
[0164] In the formula, λ is a hyperparameter.
[0165] A computer device for a drone infrared image detection method, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the drone infrared image detection method according to any one of claims 1 to 7 when executing the computer program.
[0166] A computer storage medium for a method for detecting an infrared image of a drone, on which a computer program is stored, wherein when the computer program is executed by a processor, the method for detecting an infrared image of a drone according to any one of claims 1 to 7 is implemented.
[0167] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0168] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting infrared images of unmanned aerial vehicles, characterized in that: The following steps are involved: Step S1: Establishing a UAV infrared image dataset; Step S2: construct a standard HRNet network model; Step S3: Based on the standard HRNet network model, the ECA module is embedded into the BasicBlock and Bottleneck blocks of the standard HRNet network model to construct the HRNet-ECA network model; Step S4: Process the infrared image output by the HRNet-ECA network model through a fusion method, integrate the image information, and obtain a multi-scale fusion feature map; Step S5: Optimize the multi-scale fusion feature map by improving the Dice loss function.
2. The method for detecting infrared images of unmanned aerial vehicles according to claim 1, characterized in that: The specific steps of step S1 are as follows: S11, filter the images, and pre-process the filtered images: rotate the images to any angle, and simulate the shooting of drones along different routes; S12, Image enhancement: Rotate, translate, flip horizontally or vertically the image, and simulate infrared images of photovoltaic panels with different shooting heights and different pixels by changing the image size; S13. Label the pictures and complete the construction of the UAV infrared image dataset.
3. The method for detecting infrared images of unmanned aerial vehicles according to claim 2, characterized in that: The specific steps of step S2 are as follows: The standard HRNet network model includes four stages. The first stage includes four stacked BottleNeck bottleneck blocks, and the second, third and fourth stages include four stacked BasicBlock basic blocks. Features are extracted for the standard HRNet model by adding downsampling branches stage by stage, and information propagation of each branch is realized through progressive sampling. At the same time, the feature information of each branch is fused by the element-by-element addition method, and feature maps of 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the image size in the S1 dataset are generated respectively. Finally, a feature map of 1 / 4 size is output separately for downstream tasks.
4. The method for detecting infrared images of unmanned aerial vehicles according to claim 1, characterized in that: The ECA module in step S3 includes an ECA attention mechanism, which is based on the SE attention model. Its fully connected layer is replaced by a one-dimensional convolution with a convolution kernel size of k, and channel weighting is performed on e adjacent ranges to achieve local crossover and channel interaction.
5. The method for detecting infrared images of unmanned aerial vehicles according to claim 4, characterized in that: The specific process of embedding the ECA module into the BasicBlock and Bottleneck blocks of the standard HRNet network model is as follows: The ECA attention mechanism formula is as follows: C=φ(k)=2 (γ×k-b) Where |t| odd represents the nearest odd number to t, C is the input channel, is the ratio between the number of channels C and the convolution kernel size, and γ is the nonlinear mapping; The initial channel weight represents the feature mean F at the ath frequency ave,a : Where P a (c, w, h) represents a set of two-dimensional feature maps of size w×h in c channels at the ath frequency, c, w, h represent the channel, width, and height in the four-dimensional feature map respectively; C, W, H represent the channel, width, and height length in the four-dimensional feature map; F ave,a After being mapped to the attention weight P by the Sigmoid function, the calculation formula is as follows: P=σ(f(F ave )) Where, f is a one-dimensional convolution operation; σ is a Sigmoid operation; The output of the ECA module is directly fed into the subsequent network layer. In the BasicBlock, the input data first enters a Cov2d module with a convolution kernel size of 3×3, is normalized, and then input into the activation function for fitting, and then input into a Cov2d module with a convolution kernel size of 3×3, and then enters the ECA module after normalization, and is output through Add. In the Bottleneck block, the input data first enters a Cov2d module with a convolution kernel size of 3×3, is normalized, and then input into the activation function for fitting. After repeating this process to obtain the output, it is input into a Cov2d module with a convolution kernel size of 3×3, normalized, and then enters the ECA module and outputs through Add. Constructing a new activation function in the residual block helps to avoid the gradient vanishing problem and improve the training effect of the neural network. Its expression is as follows: Secondly, construct the Standard dropout method to prevent overfitting during the training phase. Its expression is as follows: Testing Phase: y2=(1-p)f(Wx) Where y1 represents the training output; y2 represents the test output; Wx represents the result obtained after the input vector x is linearly transformed by the weight matrix W; m represents a mask vector with the same dimension as the output; m i represents a random variable that follows a Bernoulli distribution; p represents the probability of discarding; The ECA module is embedded into the BasicBlock of the HRNet model, so that each residual unit is composed of ECA-BasicBlock; the HRNet-ECA model network model starts with a backbone consisting of two 3×3 convolutions with a stride of 1, in which the resolution of the feature map is reduced to 1 / 4 of the input image resolution.
6. The method for detecting infrared images of unmanned aerial vehicles according to claim 1, characterized in that: The step S4 is specifically as follows: Assume that the multi-scale feature maps obtained by the HRNet-ECA network model are P I and P V , fusion feature map P F The calculation of is as follows: In the formula, and They are the feature maps obtained by spatial fusion and channel fusion respectively; (i, j) represents the element in the i-th row and j-th column of the matrix; Assume that the feature map is First reshape and transpose it into Then the feature map is obtained through the n×n pooling operator P is obtained by reshaping and pooling operators P X and P Y Perform matrix multiplication and obtain the spatial factor through the normalization function The formula of spatial fusion method is as follows: In the formula, represents the positional relationship (μ, v); μ∈[1, HW]; v∈[1, HW / n 2 ]; Softmax(·) represents the Softmax normalization function; and P Z Perform matrix multiplication, reshape and transpose the calculation result to get P S , the formula is as follows: Where R(·) is the reshaping function; The spatial fusion feature map is calculated by the spatial fusion method and By its relevance weight and Get the spatial fusion feature map The formula is as follows: If the feature map is Through the above formula, we get: P X and P Y Perform matrix multiplication and obtain the channel factor through the normalization function. The calculation formula is as follows: Where c∈[1, C] represents the cth channel; μ represents a specific position in the table matrix, which is used to calculate the Softmax function; and P Z The calculation formula is as follows: After the above calculation, the channel fusion feature map is obtained and By its relevance weight and Get channel fusion feature map The formula is as follows:
7. The method for detecting infrared images of unmanned aerial vehicles according to claim 1, characterized in that: The step S5 is specifically as follows: Combined use of CE loss function and Dice loss function: The CE loss function formula is as follows: Where: N is the number of samples, c is the number of categories; y ij represents the true label of the jth category of the i-th sample; p ij represents the predicted probability of the jth category of the i-th sample; The DiceLoss formula is as follows: By using the CE loss function and the Dice loss function together, the total loss function can be expressed as: THE Total =L CE +λL Dice In the formula, λ is a hyperparameter.
8. A computer device for a method of detecting an infrared image of a drone, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the drone infrared image detection method according to any one of claims 1 to 7 is implemented.
9. A computer storage medium for a method for detecting infrared images of unmanned aerial vehicles, on which a computer program is stored, characterized in that: When the computer program is executed by a processor, the drone infrared image detection method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Infrared target detection method based on group feature interaction and assignment feature fusion
CN118762172A
Heterogeneous image searching method and device based on generative adversarial network and storage medium
CN120164196A
