A neural network-based method for defogging aerial images of UAV inspection
By constructing a heuristic perceptual dehazing neural network and using downsampling and upsampling modules to directly learn the mapping from hazy images to haze-free images, the problems of unsatisfactory dehazing effect and long processing time in the existing technology are solved, and the problem of dehazing in the existing technology is achieved. Fast and accurate dehazing in drones.
Patent Information
- Application Number
- CN202410741565.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-11
AI Technical Summary
Existing defogging methods have unsatisfactory defogging effects in foggy days. Fixed atmospheric scattering coefficients and atmospheric light value parameters are not flexible enough, resulting in unnatural haze images. The algorithm takes a long time to process and is not suitable for embedding in small mobile devices. It is prone to artifacts. shadow and oversaturation.
Construct a heuristic perceptual defogging neural network. By constructing a UAV inspection aerial image data set, train the neural network to achieve image dehazing. It uses a down-sampling perceptual layer, a heuristic perceptual residual module, an up-sampling reconstruction layer and multiple The scale dehazing adaptation module directly learns the mapping relationship from hazy images to haze-free images.
It achieves good dehazing effect in real foggy days, and the dehazing process is fast. It is suitable for embedding drones to perform real-time tasks, retains image details, and is suitable for small mobile devices to avoid artifacts and oversaturation.
Smart Images

Figure CN118314053B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular relates to a method for defogging unmanned aerial vehicle inspection aerial images based on a neural network. Background Art
[0002] At present, the use of drones to perform outdoor inspection tasks is an important trend in the power industry. Drones are equipped with high-definition advanced sensors and can fly to places that are difficult to reach manually. They can conduct all-round inspections of places that need to be surveyed to ensure the safe and stable operation of the power system. The inspection images taken by drones outdoors often show poor contrast and visibility due to the scattering and absorption of light in the air, especially in foggy and haze weather, which affects the staff's further judgment of high-voltage towers, transmission lines and other inspection areas. Therefore, it is very important to quickly defog the images taken by drones outdoors, which can bring certain conveniences to power grid inspections at critical moments.
[0003] Prior-based dehazing methods rely on physical scattering models and estimate atmospheric light and transmittance maps by using the statistical properties of clear images. For example, the classic dark channel prior dehazing algorithm finds the prior relationship between the fog-free image and certain parameters in the atmospheric scattering model by performing feature analysis on a large number of fog-free images. The algorithm calculates the minimum value of each pixel on all channels to obtain the corresponding dark channel image to estimate the global atmospheric light value and transmittance, and then substitutes it into the atmospheric scattering model to calculate the dehazed image. Although these methods based on prior knowledge have shown effectiveness in dehazing tasks, they are not applicable to all real-world scenarios.
[0004] With the rise of deep learning, defogging methods based on deep learning have attracted widespread attention and use. However, the existing technology still has the following technical defects: (1) The fog map for training the defogging model is usually generated based on the atmospheric scattering model. The method of fixing the atmospheric scattering coefficient and atmospheric light value parameters is not flexible enough, and the generated fog is rigid and unnatural. In addition, the atmospheric scattering model cannot well add fog to the bright white area, resulting in the inability of the trained model to complete the defogging task in real foggy days. (2) The algorithm processing time of the image defogging method based on the physical model is relatively long, and a large amount of calculation is required to estimate parameters such as transmittance and atmospheric light. It cannot fully and accurately describe the actual atmospheric scattering and imaging process, resulting in unsatisfactory defogging effect. (3) Many existing defogging neural network models are not smart enough for the defogging conversion of continuous areas, and are prone to artifacts, which affects the judgment of further analysis work. The restored image is prone to oversaturation or color cast. (4) Many existing defogging neural network models are complex and not suitable for embedding in small mobile devices. The real-time performance is insufficient. Therefore, the present invention proposes a defogging method for drone inspection aerial images based on a neural network. Summary of the invention
[0005] In order to solve the above technical problems, the present invention proposes a method for defogging drone inspection aerial images based on a neural network to solve the problems existing in the above-mentioned prior art.
[0006] To achieve the above object, the present invention provides a method for defogging drone inspection aerial images based on a neural network, comprising:
[0007] Construct an image dataset based on drone inspection aerial images;
[0008] Constructing a heuristic perception defogging neural network, and training the heuristic perception defogging neural network based on the image data set to obtain a trained heuristic perception defogging neural network;
[0009] The unmanned aerial inspection image to be defogged is input into the trained heuristic perception defogging neural network for processing to obtain a fog-free and clear aerial image.
[0010] Optionally, the process of constructing an image dataset based on drone inspection aerial images includes:
[0011] Build a reference data source based on fog-free and clear drone inspection aerial images;
[0012] Performing index calculation on the reference data source to obtain a darkened, fog-free, clear image;
[0013] Performing fog processing on the darkened fog-free clear image to obtain a foggy UAV inspection aerial image;
[0014] Each image in the reference data source and the corresponding foggy drone inspection aerial image form an ordered pair;
[0015] An image dataset is constructed based on a number of the ordered pairs.
[0016] Optionally, the expression for performing index calculation on the reference data source is:
[0017]
[0018] In the formula, It indicates fog-free and clear drone inspection aerial images. express The pixel value of It means that all pixel values of the fog-free clear reference image are subjected to exponential calculation with an exponent of 0.8. Indicates a darkened, fog-free, clear image.
[0019] Optionally, the process of performing fogging processing on the darkened fog-free clear image includes adjusting the transmittance of the darkened fog-free clear image and increasing the atmospheric light value;
[0020] The expression for performing fog processing on the darkened fog-free clear image is:
[0021]
[0022] In the formula, Indicates the aerial image of the drone inspection in fog. represents the corresponding pixel, Indicates fog-free and clear image The transmittance of the corresponding pixel, represents the atmospheric scattering coefficient, express The scene depth at the corresponding pixel corresponding to the pixel point, Indicates the atmospheric light value.
[0023] Optionally, the heuristic perception defogging neural network includes: a downsampling perception layer, a heuristic perception residual module, an upsampling reconstruction layer and a multi-scale defogging adaptation module;
[0024] The process of performing image defogging based on the heuristic perception defogging neural network includes:
[0025] The foggy UAV inspection aerial image is subjected to two convolutional layers to obtain a first feature map;
[0026] The first feature map is sequentially subjected to a plurality of downsampling processes to obtain a second feature map, wherein the downsampling process is implemented based on a layer of the downsampling perception layer and a layer of the heuristic perception residual module;
[0027] The second feature map is passed through a downsampling perception layer to obtain a third feature map;
[0028] The first feature map is passed through a convolution layer and a multi-scale dehazing adaptation module to obtain a fourth feature map;
[0029] The third feature map is sequentially passed through three layers of upsampling and reconstruction layers to obtain a fifth feature map;
[0030] The fourth feature map and the fifth feature map are concatenated according to the channel dimension and processed by a convolution layer to obtain a sixth feature map;
[0031] Processing the sixth feature map sequentially through two upsampling reconstruction layers and one convolution layer to obtain a seventh feature map;
[0032] The seventh feature map is processed by the Sigmoid activation function to obtain a fog-free and clear aerial image.
[0033] Optionally, the process of performing image processing by the heuristic perception residual module includes:
[0034] Input feature map , the feature map The feature map is calculated by convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 1, and the LeakyReLU activation function. ;
[0035] For the feature map Perform global average pooling operation to obtain feature map ;
[0036] For the feature map The channel weight value is calculated by the convolution operation with a convolution kernel size of 1, a step size of 1, and a padding value of 0 and the Sigmoid activation function;
[0037] For the feature map The feature map is obtained by sequentially performing convolution operations with a kernel size of 1, a step size of 1, and a padding value of 0 and normalization operations. ;
[0038] For the feature map The feature map is obtained by sequentially performing convolution operations with a kernel size of 3, a step size of 1, and a padding value of 1 and normalization operations. ;
[0039] The feature map Multiply the channel weight value by the channel dimension to get the feature map ;
[0040] The feature map , feature map , feature map Fusion to obtain feature map ;
[0041] The feature map And the feature map The sum is used to get the output of the heuristic perceptual residual module.
[0042] Optionally, the image processing process of the multi-scale dehazing adaptation module includes:
[0043] Input feature map , the feature map The feature map is obtained by convolution operation with a convolution kernel size of 1, a step size of 1, and a padding value of 0. ;
[0044] The feature map The feature map is obtained by the dilated convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 1, and a dilation value of 1. ;
[0045] The feature map The feature map is obtained by the dilated convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 2, and a dilation value of 2. ;
[0046] The feature map The feature map is obtained by the dilated convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 5, and a dilation value of 5. ;
[0047] The feature map , feature map , feature map , feature map Concatenate by channel dimension to get feature map .
[0048] Optionally, the feature map The calculation expression is:
[0049]
[0050] In the formula, Represents a splicing operation, Represented in the channel dimension.
[0051] Compared with the prior art, the present invention has the following advantages and technical effects:
[0052] The present invention constructs an image data set based on drone inspection aerial images; constructs a heuristic perception defogging neural network, and trains the heuristic perception defogging neural network based on the image data set to obtain a trained heuristic perception defogging neural network; and inputs the drone inspection aerial images to be defogged into the trained heuristic perception defogging neural network for processing to obtain fog-free and clear aerial images.
[0053] The present invention can retain the details and textures in the original image as much as possible while removing fog, which brings convenience to the inspection staff in analyzing the defogging image. The model method proposed in the present invention is lightweight, the network training difficulty is low, and it has good generalization, which is suitable for embedding in drones to perform real-time defogging tasks. The model trained by the drone inspection aerial image data set constructed by the fogging method proposed in the present invention can also perform well in the real drone inspection aerial image defogging task. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0055] Figure 1This is a flow chart of a method for defogging aerial images of unmanned aerial vehicle inspection based on a neural network according to an embodiment of the present invention;
[0056] Figure 2 This is a structural diagram of a downsampling perception layer according to an embodiment of the present invention;
[0057] Figure 3 This is a structural diagram of a heuristic perception residual module according to an embodiment of the present invention;
[0058] Figure 4 This is a structural diagram of an upsampling reconstruction layer according to an embodiment of the present invention;
[0059] Figure 5 This is a structural diagram of a multi-scale defogging adaptation module according to an embodiment of the present invention;
[0060] Figure 6 This is a structural diagram of a heuristic perception defogging neural network according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0062] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0063] The prior art can use an end-to-end convolutional neural network (CNN) to estimate the transmission map of the blurred input, or estimate the true coefficients of the physical scattering model through neural network learning. An end-to-end deep convolutional neural network (CNN) can also be used to directly repair the blurred image without relying on the physical scattering model. Such models usually have better defogging effects and lower computational complexity because they directly learn the mapping relationship from foggy images to fog-free images without explicitly estimating intermediate parameters. The method of the present invention learns the mapping relationship from foggy images to fog-free images through an end-to-end neural network to quickly defog.
[0064] The present invention discloses a method for defogging drone inspection aerial images based on a neural network. A heuristic perception defogging neural network is designed, which can effectively eliminate fog in images taken by drones when performing power grid inspection tasks outdoors. The method process includes constructing a drone inspection aerial image dataset for training, building a heuristic perception defogging neural network for defogging drone inspection aerial images, training the heuristic perception defogging neural network, and applying the heuristic perception defogging neural network to defog foggy inspection images taken by drones. The corresponding method flow chart is shown in FIG. Figure 1shown.
[0065] An image dataset is constructed based on drone inspection aerial images; a heuristic perceptual defogging neural network is constructed, and the heuristic perceptual defogging neural network is trained based on the image dataset to obtain a trained heuristic perceptual defogging neural network; the drone inspection aerial images to be defogged are input into the trained heuristic perceptual defogging neural network for processing to obtain fog-free and clear aerial images.
[0066] Step 1: Build a drone inspection aerial image dataset for training
[0067] The fog-free and clear UAV inspection aerial images are selected as the reference data source to generate the corresponding darker images, and the information of the two images is fused to generate the corresponding foggy UAV inspection aerial images.
[0068] Step 1.1: Select 1,200 fog-free and clear images taken by drones during power grid inspection as the reference data source for the drone inspection aerial image dataset.
[0069] Step 1.2: Apply the exponential function to all pixel values of the fog-free clear image selected in Step 1.1, perform exponential calculation with an exponent of 0.8, reduce the overall brightness of the image, and obtain a darkened fog-free clear image.
[0070]
[0071] in, It is a fog-free and clear image. yes The pixel value of It represents the exponential calculation of all pixel values of the fog-free clear reference image with an exponent of 0.8. It is a fog-free, clear image with a dimmed overall brightness.
[0072] Step 1.3: Get the value from Step 1.2 By adjusting the transmittance and increasing the atmospheric light value, we can obtain the natural synthetic fog image of the fog-free clear image selected in Step 1.1, that is, the foggy drone inspection aerial image. The process of adding fog can be expressed as:
[0073]
[0074] Indicates the aerial image of the drone inspection in fog. Indicates the corresponding pixel. Indicates fog-free and clear image The transmittance at that pixel. Represents the atmospheric scattering coefficient, and a value with two decimal places after a random decimal point is selected in the range [0.01, 0.10] as The value of . express The depth of the scene at this pixel. It represents the atmospheric light value, and uses the cosine function to simulate its change with the change of transmittance. The calculation result retains two decimal places. Compared with setting a fixed value, it is more flexible and the simulated fog is more natural. Among them, the scene depth of a pixel refers to the distance from the point in the scene represented by the pixel to the center of the camera imaging. The scene depth is obtained through depth estimation technology, including binocular or multi-eye image depth estimation, monocular image depth estimation, etc.
[0075] Step 1.4: Generate 4 fog images corresponding to different fog concentrations for all fog-free clear images selected in Step 1.1. Therefore, a total of 4,800 foggy drone inspection aerial images are obtained.
[0076] Step 1.5: Synthesize the foggy drone inspection aerial image The corresponding real fog-free reference image Form a group of ordered pairs, so the experimental data set of the present invention is 4800 pairs of drone inspection aerial images consisting of 1200 clear drone inspection aerial reference images and 4800 foggy and blurred drone inspection aerial images.
[0077] Finally, the experimental dataset is divided into a training set train and a test set test in a ratio of 8:2, that is, 3840 pairs of drone inspection aerial images are used for training, and 960 pairs of drone inspection aerial images are used for testing.
[0078] Specific implementations include:
[0079] Take the atmospheric scattering coefficient 0.10, atmospheric light value The calculation is 0.83, and the simulated fog is thicker.
[0080] Take the atmospheric scattering coefficient 0.08, atmospheric light value The calculated value is 0.88, and the simulated fog density is moderate.
[0081] Take the atmospheric scattering coefficient 0.06, atmospheric light value The calculated value is 0.91, and the simulated fog density is moderate.
[0082] Take the atmospheric scattering coefficient 0.02, atmospheric light value Calculated to be 0.94, the simulated fog is thinner.
[0083] Step 2: Build a heuristic perception defogging neural network for defogging of drone inspection aerial images
[0084] First, we build a module that can help the model to complete image defogging, including: downsampling perception layer, heuristic perception residual module, upsampling reconstruction layer and multi-scale defogging adaptation module. Then, we build a heuristic perception defogging neural network for defogging drone inspection aerial images.
[0085] Step 2.1: Construct downsampling perception layer
[0086] In order to reduce the spatial resolution of the drone inspection aerial photography feature map during the training process, reduce the amount of calculation and memory consumption, while increasing the receptive field of each pixel and improving the model's ability to perceive global features, the present invention designs a downsampling perception layer Down_p Layer (Downsampling perception layer), the structure of which is as follows: Figure 2 shown.
[0087] Step 2.1.1: Take the drone inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C as input, and first use a pooling operation to halve the spatial resolution of the feature map to H / 2×H / 2, while keeping the number of channels at C.
[0088] Step 2.1.2: The output of Step 2.1.1 is subjected to two convolution operations with a kernel size k of 3, a step size s of 1, and a padding value p of 1. In order to suppress the overfitting phenomenon of the model, the drone inspection aerial photography feature map output by the two convolutions is normalized to obtain a drone inspection aerial photography feature map with further enhanced image feature properties, a spatial resolution of H / 2×H / 2, and a channel number of 2C.
[0089] The specific implementation method includes: downsampling the perception layer inputting the drone inspection aerial photography feature map with a spatial resolution of 128×128 and 64 channels, and outputting the drone inspection aerial photography feature map with enhanced global features, a spatial resolution of 64×64 and 128 channels.
[0090] Step 2.2: Constructing a heuristic perception residual module
[0091] In order to enable the model to adaptively learn the relationship between the scene and fog features in the image, this module calculates the importance weights between channels to inspire the model to focus on the important parts of the input features, thereby improving the model's ability to distinguish fog features. At the same time, through appropriate convolution operations, the feature expression ability is further enhanced. The present invention designs a heuristic perceptual residual block HPR Block (Heuristic Perceptual Residual Block), the structure of which is as follows: Figure 3 shown.
[0092] Step 2.2.1: The UAV inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C As input, after a convolution operation without changing the spatial resolution and number of channels of the feature map, the convolution kernel size k is 3, the step size s is 1, and the padding value p is 1, the feature map obtained after the convolution is calculated by the LeakyReLU activation function once, and the UAV inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C is obtained. . The calculation process is as follows:
[0093]
[0094] Step 2.2.2: Yes Perform a global average pooling operation GAP (Global Average Pooling) to obtain the drone inspection aerial photography feature map with a spatial resolution of 1×1 and a channel number of C. .
[0095] Step 2.2.3: A convolution operation is performed without changing the spatial resolution and number of channels of the feature map, with the convolution kernel size k being 1, the step size s being 1, and the padding value p being 0. The convolved feature map is then subjected to a Sigmoid activation function calculation to obtain a channel weight value with a weight range of [0,1] and a size of 1×1×C. . The calculation process is as follows:
[0096]
[0097] Step 2.2.4: A convolution operation is performed without changing the spatial resolution and number of channels of the feature map, with the convolution kernel size k being 1, the step size s being 1, and the padding value p being 0. The feature map after convolution is normalized once to obtain a UAV inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C. .
[0098] Step 2.2.5: Similar to Step 2.1.4, A convolution operation is performed without changing the spatial resolution and number of channels of the feature map, with the convolution kernel size k being 3, the step size s being 1, and the padding value p being 1. The feature map after convolution is normalized once to obtain a UAV inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C. .
[0099] Step 2.2.6: Input and channel weight value By multiplying by the channel dimension, we get the UAV inspection aerial photography feature map with important features enhanced, redundant information suppressed, spatial resolution of H×W, and number of channels C. . The calculation process is as follows:
[0100]
[0101] Step 2.2.7: , and Add the values and fuse the three feature maps to provide a more comprehensive and accurate image representation, and obtain the drone inspection aerial photography feature map with a spatial resolution of H×W and a channel number of C. , the calculation process is as follows:
[0102]
[0103] Step 2.2.8: With input Add the values and complete a residual connection to get the output of the heuristic perception residual module, that is, the drone inspection aerial photography feature map with a spatial resolution of H×W and a channel number of C. , the calculation process is as follows:
[0104]
[0105] Step 2.3: Construct upsampling reconstruction layer
[0106] In order to increase the spatial resolution of the downsampled feature map, the model can reconstruct a fog-free, clear and natural drone inspection aerial image. The present invention designs an upsampling reconstruction layer Up_r layer (Upsamplingreconstruction layer), the structure of which is as follows: Figure 4 shown.
[0107] Step 2.3.1: The UAV inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C As input, Perform bilinear interpolation to make It becomes a feature map of drone inspection aerial photography with a spatial resolution of 2H×2W and a channel number of C. .
[0108] Step 2.3.3: Yes Perform two convolution operations without changing the spatial resolution of the feature map, with the convolution kernel size k being 3, the step size s being 1, and the padding value p being 1. The feature map after convolution is normalized once to obtain a UAV inspection aerial photography feature map with a spatial resolution of 2H×2W and a channel number of C / 2. .
[0109] The specific implementation method includes: upsampling and reconstructing the input spatial resolution of the UAV inspection aerial photography feature map of 128×128 and 64 channels to the reconstruction layer, and outputting the UAV inspection aerial photography feature map with weakened fog, enhanced scenery, spatial resolution of 256×256 and 32 channels.
[0110] Step 2.4: Construct a multi-scale dehazing adaptation module
[0111] In order to simultaneously learn receptive fields of different sizes and consider the global context information of the image in the defogging task, better remove continuous foggy areas without leaving artifacts, and restore a clearer and more realistic image. The present invention designs a multi-scale defogging adaptation module MDA Block (Multi-scale Defogging Adaptation Block), the structure of which is as follows: Figure 5 shown.
[0112] Step 2.4.1: The UAV inspection aerial photography feature map with a spatial resolution of H×W and a number of channels of C As input, a convolution operation is performed with the convolution kernel size k being 1, the step size s being 1, and the padding value p being 0 without changing the spatial resolution of the feature map, and the spatial resolution size of H×W and the number of channels being C / 4 are obtained. .
[0113] Step 2.4.2: Perform a dilated convolution operation with a convolution kernel size k of 3, a step size s of 1, a padding value p of 1, and a dilation value of 1 to obtain a drone inspection aerial photography feature map with a constant spatial resolution and a channel number of C / 4. .
[0114] Step 2.4.3: Perform a dilated convolution operation with a convolution kernel size k of 3, a step size s of 1, a padding value p of 2, and a dilation value of 2 to obtain a feature map of drone inspection aerial photography with a constant spatial resolution and a channel number of C / 4. .
[0115] Step 2.4.4: Perform a dilated convolution operation with a convolution kernel size k of 3, a step size s of 1, a padding value p of 5, and a dilation value of 5 to obtain a feature map of drone inspection aerial photography with a constant spatial resolution and a channel number of C / 4. .
[0116] Step 2.4.5: , , and The output of the multi-scale defogging adaptation module is obtained by splicing according to the channel dimension, that is, the feature map with a spatial resolution of H×W and a channel number of C. .
[0117] The calculation process is shown in the following formula: Represents a splicing operation, Represented in the channel dimension.
[0118]
[0119] Step 2.5: Build a heuristic perception dehazing neural network
[0120] After constructing the downsampling perception layer Down_p Layer, the heuristic perception residual module HPR Block, the upsampling reconstruction layer Up_r Layer, and the multi-scale defogging adaptation module MDA Block in Step2.1, Step2.2, Step2.3, and Step2.4, respectively, a complete heuristic perception defogging neural network can be built. The heuristic perception defogging neural network accepts foggy drone inspection aerial images with a spatial resolution of H×W and 3 channels as input, and obtains natural fog-free drone inspection aerial images with a spatial resolution of H×W and 3 channels. The network structure is as follows: Figure 6 shown.
[0121] Step 2.5.1: Build a convolution layer with a convolution kernel size k of 3, a step size s of 2, and a padding value p of 1 to obtain a drone inspection aerial photography feature map with a spatial resolution of H / 2×W / 2 and a channel number of C.
[0122] Step 2.5.2: Build a convolution operation with a kernel size k of 3, a step size s of 1, and a padding value p of 1. Accept the output of Step 2.5.1 as input to obtain the first feature map with a spatial resolution of H / 2×W / 2 and a channel number of 2C.
[0123] Step 2.5.3: Accept the output of Step 2.5.2 as input, build a downsampling perception layer and a HPR module in sequence, and obtain the drone inspection aerial photography feature map with a spatial resolution of H / 4×W / 4 and a channel number of 4C.
[0124] Step 2.5.4: Accept the output of Step 2.5.3 as input, build a downsampling perception layer and a HPR module in sequence, and obtain the drone inspection aerial photography feature map with a spatial resolution of H / 8×W / 8 and 8C channels.
[0125] Step 2.5.5: Accept the output of Step 2.5.4 as input, build a downsampling perception layer and a HPR module in sequence, and obtain the second feature map with a spatial resolution of H / 16×W / 16 and a channel number of 16C.
[0126] Step 2.5.6: Accept the output of Step 2.5.5 as input, build a downsampling perception layer, and obtain the third feature map with a spatial resolution of H / 32×W / 32 and a channel number of 32C.
[0127] Step 2.5.7: Build a convolution layer with a convolution kernel size k of 5, a step size s of 2, and a padding value p of 2. Accept the output of Step 2.5.2 as input to obtain a drone inspection aerial photography feature map with a spatial resolution of H / 4×W / 4 and a channel number of 4C.
[0128] Step 2.5.8: Accept the output of Step 2.5.7 as input, build a layer of MDA module, and obtain the fourth feature map with a spatial resolution of H / 4×W / 4 and a channel number of 4C.
[0129] Step 2.5.9: Accept the output of Step 2.5.6 as input, and build three upsampling and reconstruction layers in sequence to obtain the fifth feature map with a spatial resolution of H / 4×W / 4 and a channel number of 4C.
[0130] Step 2.5.10: Concatenate the output of Step 2.5.8 and the output of Step 2.5.9 according to the channel dimension to obtain a drone inspection aerial photography feature map with a spatial resolution of H / 4×W / 4 and 8C channels.
[0131] Step 2.5.11: Build a convolution operation with a kernel size k of 1, a step size s of 1, and a padding value p of 0. Accept the output of Step 2.5.10 as input to obtain the sixth feature map with a spatial resolution of H / 4×W / 4 and a channel number of 4C.
[0132] Step 2.5.12: Accept the output of Step 2.5.11 as input, and build two upsampling reconstruction layers in sequence to obtain a drone inspection aerial photography feature map with a spatial resolution of H×W and a channel number of C.
[0133] Step 2.5.13: Build a convolution operation with a convolution kernel size k of 3, a step size s of 1, and a padding value p of 1. Accept the output of Step 2.5.12 as input to obtain the seventh feature map with a spatial resolution of H×W and a channel number of 3.
[0134] Step 2.5.14: Build a layer of Sigmoid activation function, accept the output of Step 2.5.13 as input, and get the final output of the heuristic perception defogging neural network, which is a clear and fog-free drone inspection aerial photography feature map with a spatial resolution of H×W and a channel number of 3.
[0135] The specific implementation method includes: inputting a foggy power grid inspection image taken by a drone with a spatial resolution of 512×512 and RGB3 channels into a heuristic perception defogging neural network. .
[0136] (1) After a convolution layer with a convolution kernel size k of 3, a step size s of 2, and a padding value p of 1, a drone inspection aerial photography feature map with a spatial resolution of 256×256 and a number of channels of 16 is obtained. .
[0137] (2) After a convolution layer with a convolution kernel size k of 3, a step size s of 1, and a padding value p of 1, a drone inspection aerial photography feature map with a spatial resolution of 256×256 and a channel number of 32 is obtained. .
[0138] (3) After passing through a downsampling perception layer and a HPR module, a feature map of drone inspection aerial photography with a spatial resolution of 128×128 and 64 channels is obtained. .
[0139] (4) After passing through a downsampling perception layer and a HPR module, a feature map of drone inspection aerial photography with a spatial resolution of 64×64 and 128 channels is obtained. .
[0140] (5) After passing through a downsampling perception layer and a HPR module, a feature map of drone inspection aerial photography with a spatial resolution of 32×32 and a channel number of 256 is obtained. .
[0141] (6) After a downsampling perception layer, the UAV inspection aerial photography feature map with a spatial resolution of 16×16 and a channel number of 512 is obtained. .
[0142] (7) After another convolution layer with a convolution kernel size k of 5, a step size s of 2, and a padding value p of 2, the UAV inspection aerial photography feature map with a spatial resolution of 128×128 and a number of channels of 64 is obtained. .
[0143] (8) After a layer of MDA module, the UAV inspection aerial photography feature map with a spatial resolution of 128×128 and 64 channels is obtained. .
[0144] (9) After three layers of upsampling and reconstruction, the UAV inspection aerial photography feature map with a spatial resolution of 128×128 and 64 channels is obtained. .
[0145] (10) and By splicing according to the channel dimension, we get the feature map of drone inspection aerial photography with a spatial resolution of 128×128 and 128 channels. .
[0146] (11) After a convolution operation with a kernel size k of 1, a step size s of 1, and a padding value p of 0, a drone inspection aerial photography feature map with a spatial resolution of 128×128 and a number of channels of 64 is obtained. .
[0147] (12) After two upsampling reconstruction layers, the UAV inspection aerial photography feature map with a spatial resolution of 512×512 and 16 channels is obtained. .
[0148] (13) After a convolution operation with a kernel size k of 3, a step size s of 1, and a padding value p of 1, a feature map of drone inspection aerial photography with a spatial resolution of 512×512 and a channel number of 3 is obtained. .
[0149] (14) After a layer of Sigmoid activation function, the output is a clear and fog-free drone inspection aerial photography feature map with a spatial resolution of 512×512 and 3 channels.
[0150] Step 3: Train the heuristic perception dehazing neural network
[0151] Use the training data set constructed in Step 1 to train the heuristic perception defogging neural network built in Step 2, and optimize the model parameters through the calculation of the back propagation algorithm.
[0152] Before starting training, initialize the hyperparameters required for training the model, such as the batch size of the training set, the number of training rounds, the initial learning rate, etc.
[0153] During the training process, the drone inspection aerial images to be defogged are input into the heuristic perceptual defogging neural network in batches, and the L2 loss function is used to adjust the weight values in the network so that the calculation result of the loss function tends to a stable minimum value, thereby obtaining a heuristic perceptual defogging neural network with the best defogging effect.
[0154] The specific implementation method includes: on the Linux operating system, a GeForce RTX 3090 is used to train and test the network, the batch size is set to 16, the epoch is set to 600, the initial learning rate is set to 0.001, and it decays to 50% of the current learning rate every 50 epochs. At the beginning of training, the value of the L2 loss function is about 0.62. When the training reaches 55 epochs, the value of the L2 loss function decreases to about 0.1. After the 55th epoch, the L2 loss function begins to slowly decrease and stabilizes at about 0.025 at the 550th epoch. After completing the 600th epoch, a trained heuristic perception dehazing neural network is obtained.
[0155] Among them, the back propagation algorithm is an existing optimization algorithm for training neural networks. It can continuously adjust the weights in the neural network to minimize the error between the model's predicted output and the actual label.
[0156] The L2 norm loss function, also known as the least square error (LSE), is a commonly used loss function in image enhancement, as shown below:
[0157]
[0158] It is a real fog-free reference picture. It can be regarded as the dehazed image output by the heuristic perceptual dehazing neural network. is the number of images in a batch fed into the neural network, This is the first image in this batch. open.
[0159] Step 4: Apply the heuristic perception defogging neural network to defog the foggy inspection images taken by the drone
[0160] The inspection aerial images taken by drones that need to be dehazed are input into the trained heuristic perceptual residual network. The images are processed by the heuristic perceptual residual network and the corresponding fog-free and clear aerial images with unchanged resolution and natural colors are output.
[0161] The fog in the fog map in the data set constructed by the present invention is closer to real natural fog, and the model trained with this data set is applied to the defogging task of drone inspection aerial images in real foggy scenes, and the effect is good. The defogging time of the present invention is fast and efficient, and it is a lightweight model. It is suitable for embedding the model program into the drone to perform real-time defogging tasks. The present invention can extract rich deep features, more accurately obtain the haze area and its concentration, and perform correct defogging conversion.
[0162] The present invention has the following technical advantages: (1) The present invention designs a calculation method for adding fog to an image, which does not require manual adjustment of parameters, and first performs exponential operation on the pixel value to adjust the brightness of the image, so that fog can also be added to the bright white area in the image. (2) The present invention designs a method for downsampling perception and upsampling reconstruction of high-resolution outdoor scene aerial images taken by drones. Downsampling can well extract global features, and upsampling can restore detailed information in the image to the greatest extent. (3) The present invention designs a method that can adaptively focus on and distinguish different features of the image, such as fog and scenery, and can remove fog from the image without learning at different scales.
[0163] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for defogging aerial images of UAV inspection based on neural network, characterized in that: include: Construct an image dataset based on drone inspection aerial images; Constructing a heuristic perception defogging neural network, and training the heuristic perception defogging neural network based on the image data set to obtain a trained heuristic perception defogging neural network; Inputting the unmanned aerial inspection image to be defogged into the trained heuristic perception defogging neural network for processing to obtain a fog-free and clear aerial image; The process of constructing an image dataset based on drone inspection aerial images includes: Build a reference data source based on fog-free and clear drone inspection aerial images; Performing index calculation on the reference data source to obtain a darkened, fog-free, clear image; Performing fog processing on the darkened fog-free clear image to obtain a foggy UAV inspection aerial image; Each image in the reference data source and the corresponding foggy drone inspection aerial image form an ordered pair; constructing an image dataset based on a number of the ordered pairs; The process of performing fog processing on the darkened fog-free clear image includes adjusting the transmittance of the darkened fog-free clear image and increasing the atmospheric light value; The expression for performing fog processing on the darkened fog-free clear image is: In the formula, Indicates the aerial image of the drone inspection in fog. represents the corresponding pixel, Indicates fog-free and clear image The transmittance of the corresponding pixel, represents the atmospheric scattering coefficient, express The scene depth at the corresponding pixel corresponding to the pixel point, Indicates the atmospheric light value; Indicates a fog-free clear image that becomes darker under the corresponding pixel; The heuristic perception defogging neural network includes: a downsampling perception layer, a heuristic perception residual module, an upsampling reconstruction layer and a multi-scale defogging adaptation module; The process of performing image defogging based on the heuristic perception defogging neural network includes: The foggy UAV inspection aerial image is subjected to two convolutional layers to obtain a first feature map; The first feature map is sequentially subjected to a plurality of downsampling processes to obtain a second feature map, wherein the downsampling process is implemented based on a layer of the downsampling perception layer and a layer of the heuristic perception residual module; The second feature map is passed through a downsampling perception layer to obtain a third feature map; The first feature map is passed through a convolution layer and a multi-scale dehazing adaptation module to obtain a fourth feature map; The third feature map is sequentially passed through three layers of upsampling and reconstruction layers to obtain a fifth feature map; The fourth feature map and the fifth feature map are concatenated according to the channel dimension and processed by a convolution layer to obtain a sixth feature map; Processing the sixth feature map sequentially through two upsampling reconstruction layers and one convolution layer to obtain a seventh feature map; The seventh feature map is processed by a Sigmoid activation function to obtain a fog-free and clear aerial image; The process of image processing by the heuristic perception residual module includes: Input feature map , the feature map The feature map is calculated by convolution operation with a kernel size of 3, a step size of 1, a padding value of 1, and the LeakyReLU activation function. ; For the feature map Perform global average pooling operation to obtain feature map ; For the feature map The channel weight value is calculated by the convolution operation with a convolution kernel size of 1, a step size of 1, and a padding value of 0 and the Sigmoid activation function; For the feature map The feature map is obtained by sequentially performing convolution operations with a kernel size of 1, a step size of 1, and a padding value of 0 and normalization operations. ; For the feature map The feature map is obtained by sequentially performing convolution operations with a kernel size of 3, a step size of 1, and a padding value of 1 and normalization operations. ; The feature map Multiply the channel weight value by the channel dimension to get the feature map ; The feature map , feature map , feature map Fusion to obtain feature map ; The feature map And the feature map Add together to get the output of the heuristic perception residual module; The image processing process of the multi-scale dehazing adaptation module includes: Input feature map , the feature map The feature map is obtained by convolution operation with a convolution kernel size of 1, a step size of 1, and a padding value of 0. ; The feature map The feature map is obtained by the dilated convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 1, and a dilation value of 1. ; The feature map The feature map is obtained by the dilated convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 2, and a dilation value of 2. ; The feature map The feature map is obtained by the dilated convolution operation with a convolution kernel size of 3, a step size of 1, a padding value of 5, and a dilation value of 5. ; The feature map , feature map , feature map , feature map Concatenate by channel dimension to get feature map .
2. The method for defogging aerial images of unmanned aerial vehicle inspection based on neural network according to claim 1 is characterized in that: The expression for calculating the index of the reference data source is: In the formula, It indicates fog-free and clear drone inspection aerial images. express The pixel value of It means that all pixel values of the fog-free clear reference image are subjected to exponential calculation with an exponent of 0.
8. Indicates a darkened, fog-free, clear image.
3. The method for defogging aerial images of unmanned aerial vehicle inspection based on neural network according to claim 1 is characterized in that: The feature map The calculation expression is: In the formula, Represents a splicing operation, Represented in the channel dimension.
