Single image defogging network and defogging method based on U-Net structure and residual network
By adopting U-Net structure and residual network in the image defogging network, combined with adaptive weighted summing and upsampling residual blocks, the problems of information loss and uneven defogging in the prior art are solved, and better image detail recovery and defogging effect are achieved.
Patent Information
- Application Number
- CN202210466613.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-04-27
AI Technical Summary
The existing image defogging methods have problems with information loss and uneven defogging, especially during the fusion upsampling and downsampling process.
Using a defogging network based on U-Net structure and residual network, the adaptive weighted summation of downsampling to the bottleneck area is preserved, and upsampling and residual blocks are used in the decoding layer to gradually restore image details.
Achieve better image detail recovery and defog removal effects, and the defog removal results perform well in subjective visual sense and achieve leading results in objective indicators such as PSNR and SSIM.
Smart Images

Figure CN114881875B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital image processing, and in particular to a single image defogging network and a defogging method thereof based on a U-Net structure and a residual network. Background Art
[0002] Haze weather is a common natural phenomenon. Under haze weather conditions, there are a large number of tiny particles in the air that can scatter light. By scattering sunlight and light reflected by objects, the image quality obtained by visible light image acquisition equipment is greatly reduced, which has a bad impact on advanced computer vision tasks. In order to improve the quality and clarity of images, it is necessary to perform dehazing on the images.
[0003] Image defogging methods can be roughly divided into two categories: traditional methods and learning-based methods. Traditional methods can be divided into two categories: one is the defogging method based on physical models, and the other is the method based on image enhancement. The physical model-based method relies on the atmospheric scattering model, obtains the unknown parameters in the atmospheric scattering model through various prior assumptions, and finally obtains the fog-free image by inversely solving the atmospheric scattering model. Among them, the more famous one is the dark channel prior hypothesis, which restores the transmittance distribution map by searching for the pixel points with the lowest value in the three channels of the RGB image, and constructs the global atmospheric illumination through the brightest area in the image, and finally restores the fog-free image through the atmospheric scattering model. However, the dark channel prior hypothesis will fail for images with a large range of sky areas, and cannot restore the detailed texture of white objects. Common defogging methods based on image enhancement include histogram equalization, contrast enhancement, and related algorithms based on Retinex theory. These methods do not have ideal enhancement effects on images with large depth changes, and are prone to excessive enhancement, making the image unnatural.
[0004] The learning-based method is different from the traditional method. This method no longer relies on manually extracted features, but builds a convolutional neural network to let the network learn how to extract features from the data set. Early dehazing networks relied on traditional atmospheric scattering models, such as DehazeNet, which restored the transmittance distribution map through the network and then input it into the atmospheric scattering model to obtain a dehazed image. AOD-Net deforms the atmospheric scattering model so that the dehazed image can be obtained by using the network to estimate only one unknown quantity. Although the deep network based on atmospheric scattering can achieve better dehazing effect than traditional methods, the atmospheric scattering model limits the learning ability of convolutional neural networks. Therefore, people began to try to use the network directly for end-to-end dehazing; at the same time, the emergence of residual networks has lifted the limitation of the depth of network models, and dehazing networks have begun to develop in a larger and deeper direction. Based on dense convolution residual blocks and attention mechanisms, GridDehazeNet proposes a grid-like network that combines upsampling and downsampling, which realizes end-to-end dehazing and achieves good results. However, the fusion of upsampling and downsampling will inevitably cause information loss, and the dehazing network will have problems such as uneven dehazing and poor detail restoration. Deep learning-based methods have developed rapidly in recent years, but they still have certain limitations and need further improvement and enhancement. Summary of the invention
[0005] In view of this, the present invention provides a defogging network and a defogging method based on a U-Net structure and a residual network. The network does not rely on an atmospheric scattering model and can achieve end-to-end defogging.
[0006] To achieve the above objectives, the technical solution of the present invention is: a residual network based on a U-Net structure and a residual module, based on the U-Net network structure, using a residual module to construct an end-to-end defogging residual network.
[0007] The network structure is a residual network built based on the U-Net structure, which consists of an encoding layer, a decoding layer, and an intermediate bottleneck area connecting the two areas.
[0008] The encoding area contains a 3x3 convolution layer and 3 downsampling layers with two times downsampling, where the step size of the downsampling layer is 2; after convolution, the image becomes a 16-channel feature map, and the feature map size is the same as the input image; after one downsampling, the feature map size is reduced to half of the original, and the number of layers is doubled; after the first convolution and the second downsampling of the downsampling layer, the attention mechanism residual block is connected; after the first and third downsampling, the ordinary residual block is connected.
[0009] The size of the feature map processed by the downsampling layer is one-eighth of the original image, and the number of channels is 128. After entering the bottleneck area, the feature map first passes through three series-connected smooth hole convolution residual blocks, and the size and number of channels of the new feature map remain unchanged; then, the features of different scales in the downsampling layer are further downsampled to obtain features with the same size and number of channels as the new features, and are weighted and summed element by element with the new features; the weight of each feature is a learnable parameter, which is adaptively adjusted during the network iteration process; finally, the new feature obtained by weighted summation passes through a set of three series-connected smooth hole convolution residual blocks, and this feature is input into the decoding layer.
[0010] The decoding layer consists of three upsampling layers and two 3x3 convolutional layers, each of which is followed by a residual block. After each upsampling, the size of the new feature obtained is doubled, and the number of feature channels is reduced by half. After each upsampling, the features of the corresponding size and dimension of the encoding layer are added element by element and then input into the residual block. The features output by the first convolutional layer of the network are added element by element with the features obtained by the last upsampling after passing through 5 series-connected dense convolution residual blocks. The new features thus obtained are finally input into the last two convolutional layers and output a clear image of the same size as the original input.
[0011] The present invention also provides a residual network image defogging method based on a U-Net structure and a residual module, the method comprising the following steps:
[0012] Step 1): Obtain the synthetic foggy dataset RESIDE as a training dataset and preprocess the dataset.
[0013] Step 2): Construct a defogging network model according to the residual network structure based on the U-Net structure and the residual module provided in claim 1.
[0014] Step 3): Input the synthetic foggy data set into the defogging network model, train the defogging network model, calculate the loss through the new loss function during the training process, continuously iterate and update the network parameters, and finally obtain the optimized defogging model to perform image defogging.
[0015] Furthermore, in step 1), the specific method for preprocessing the RESIDE dataset is as follows:
[0016] A pair of foggy images and clear images in the training dataset is (I, J), where I, J∈R C×H×W , I represents foggy image, J represents clear image, C represents the number of channels of the image, and H and W represent the height and width of the image.
[0017] After randomly cropping the image, the resulting image is (I crop , Jcrop ), where I crop represents the cropped foggy image, J crop represents the cropped clear image, I crop J crop ∈R C×h×w Here h and w represent the height and width of the cropped image.
[0018] Cut to get (I crop , J crop ), the foggy image is normalized; the normalized foggy image And with the cropped clear image J crop Form a pair of data This is used as the input of the dehazing network.
[0019] Furthermore, the steps of random cropping are as follows:
[0020] Set to h = w = 240, first determine the coordinates of the reference point for cropping (x0, y0), then determine the coordinates of the remaining three points of the rectangular frame based on the reference point (x0+240, y0), (x0, y0+240) and (x0+240, y0+240), and finally crop a rectangular frame of the same size at the same position of the image pair (I, J) based on these four points; where (x0, y0) must satisfy x0∈[0, Hh], y0∈[0, Ww];
[0021] Furthermore, the normalization process is as follows: first, the mean and variance std of the entire data set are obtained:
[0022]
[0023]
[0024] Among them, p nij represents the pixel value of point (i, j) on the nth foggy image, p nij ∈[0, 255]; N represents the total number of samples in the data set; based on the mean and variance, the pixel value of the normalized foggy image can be obtained as follows:
[0025]
[0026] Through the above formula, we can get the cropped and normalized foggy image
[0027] Furthermore, in step 3), the designed new loss function consists of two parts: smooth L1 loss and perceptual loss.
[0028] The smooth L1 loss combines the mean absolute error MAE and the mean square error MSE, and the formula is:
[0029]
[0030] in, represents the image output by EDA-Net, J i (x) represents a clear and fog-free image in the dataset, and the function F1 is expressed as: e represents a common variable in function F1.
[0031] The perceptual loss is to use other pre-trained feature extraction networks to extract the features of the output image and the target image and make them similar. The perceptual loss is L feat , the formula is:
[0032]
[0033] and φ j (J) represent the feature maps of VGG16 for the input foggy image and the real fog-free image; C j H j W j Represents the product of the number of channels of the feature extraction network output.
[0034] VGG16 trained on ImageNet is used as the feature extraction network, and its 3rd, 5th, and 7th layer features are used to generate perceptual losses, namely Conv1-2, Conv2-2, and Conv3, to enhance the details of the restored images.
[0035] The final loss function is expressed as: L = L1 + 0.04L feat .
[0036] Furthermore, the final value of the normalization parameter mean of the RESIDE training data set is [0.6111, 0.5743, 0.5631], and the final value of std is [0.1503, 0.1563, 0.1616].
[0037] Furthermore, when the defogging network model is trained, the training is terminated after 100 generations in the ITS indoor dataset of the RESIDE dataset, and the parameters are retained and the training is continued on the OTS outdoor dataset for 20 generations.
[0038] Beneficial effects:
[0039] 1. The defogging network based on U-Net structure and residual network proposed in the present invention has a residual network constructed based on U-Net structure, which is composed of a coding layer, a decoding layer and an intermediate bottleneck area connecting the two areas. The model better retains the information lost in the downsampling process by adaptive weighted summation of downsampling to the bottleneck area, can better restore the details of the image, and can directly perform end-to-end defogging.
[0040] 2. The dehazing results of the model proposed in the present invention perform well in subjective vision, and the objective indicators tested on SOTS are relatively leading.
[0041] 3. The dehazing network based on the Net structure and residual network proposed in the present invention consists of two groups of convolutional layers and relu layers, and the input features are jump-connected between the second convolutional layer and the relu layer by element-by-element addition. The convolutional network constructed in this way is called a residual network, which can solve the problems of network degradation and gradient disappearance / explosion in deep networks.
[0042] 4. This example uses a smoothed atrous convolution residual block, in which the SS layer is a separable shared weight convolution layer, that is, the network only learns the parameters of one layer of convolution kernel and expands it to the dimension of the input feature, and then convolves the input feature. In this way, the information of adjacent pixels is added to the feature before the atrous convolution, so as to avoid the grid effect caused by the atrous convolution. At the same time, the atrous convolution applied to the bottleneck layer can expand the network's receptive field without increasing parameters, and better restore the detailed information.
[0043] 5. For the data in the dataset, the dehazing method of the present invention performs preprocessing by random cropping and normalization in order to increase the batch size during training to obtain better training effect and adapt to low-configuration machines.
[0044] 6. The loss function used in the present invention consists of two parts: smooth L1 loss and perceptual loss. In order to ensure the details of the restored image, perceptual loss is introduced. Perceptual loss uses other pre-trained feature extraction networks to extract the features of the output image and the target image and make them as similar as possible. The application of this loss function can ensure that the features of the extracted image and the target image can ensure the details of the restored image. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is an implementation flow chart of the present invention;
[0046] Figure 2 It is a structural diagram of a convolutional neural network model of the present invention;
[0047] Figure 3 yes Figure 2Diagram of the residual block structure used in the network;
[0048] Figure 4 yes Figure 2 The structure diagram of the attention mechanism residual block used in the network;
[0049] Figure 5 yes Figure 4 The structure diagram of the channel attention (CA) and pixel attention (PA) modules in the attention mechanism module;
[0050] Figure 6 yes Figure 2 Structural diagram of the smoothed atrous convolutional residual block used in the network;
[0051] Figure 7 yes Figure 2 Diagram of the dense convolutional residual block structure used in the network. DETAILED DESCRIPTION
[0052] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0053] The present invention first provides a residual network based on the U-Net structure, which is composed of an encoding layer, a decoding layer, and an intermediate bottleneck area connecting the two areas. The encoding area includes a 3x3 convolution layer and three downsampling layers with two times downsampling, wherein the step size of the downsampling layer is 2; after convolution, the image becomes a 16-channel feature map, and the size of the feature map is the same as the input image; and after one downsampling, the size of the feature map is reduced to half of the original, and the number of layers is doubled. After the first convolution and the second downsampling of the downsampling layer, the attention mechanism residual block is connected; after the first and third downsampling, the ordinary residual block is connected.
[0054] The size of the feature map processed by the downsampling layer is one eighth of the original image, and the number of channels is 128. After entering the bottleneck area, the feature map first passes through three series-connected smooth hole convolution residual blocks, and the size and number of channels of the new feature map remain unchanged; then, the features of different scales in the downsampling layer are further downsampled to obtain features with the same size and number of channels as the new features, and are weighted and summed element by element with the new features; the weight of each feature is a learnable parameter, which is adaptively adjusted during the network iteration process. Finally, the new features obtained by weighted summation pass through a set of three series-connected smooth hole convolution residual blocks, and this feature is input to the decoding layer.
[0055] The decoding layer consists of three upsampling layers and two 3x3 convolutional layers, each of which is followed by a residual block. The size of the new features obtained after each upsampling is doubled, and the number of feature channels is reduced by half; after each upsampling, the features of the corresponding size and dimension of the encoding layer are added element by element, and then input into the residual block; the features output by the first convolutional layer of the network are added element by element with the features obtained by the last upsampling after passing through 5 series-connected dense convolution residual blocks, and the new features obtained are finally input into the last two convolutional layers and output a clear image of the same size as the original input.
[0056] Combination Figure 1 to Figure 7 , the present invention is described in further detail. Figure 1 This is an implementation flow chart of this example. This embodiment includes the following steps:
[0057] Step 1): Obtain the synthetic foggy dataset RESIDE as a training dataset, and perform preprocessing of cropping and normalization on the dataset.
[0058] For the data in the dataset, in order to increase the batch size during training to obtain better training results and adapt to low-configuration machines, preprocessing is performed through random cropping and normalization.
[0059] Assume that a pair of foggy images and clear images in the training dataset is (I, J), where I, J∈R C×H×W , C represents the number of channels of the image, which is 3 in this example, and H and W represent the height and width of the image; then the randomly cropped image is (I crop , J crop ), where I crop , J crop ∈R C×h×w Here, h and w represent the height and width of the cropped image, which are set to h=w=240.
[0060] The cropping process first determines the cropping reference point (x0, y0), then determines the coordinates of the remaining three points of the rectangular frame based on the reference point (x0+240, y0), (x0, y0+240) and (x0+240, y0+240), and finally crops a rectangular frame of the same size at the same position of the image pair (I, J) based on these four points. (x0, y0) must satisfy x0∈[0, Hh], y0∈[0, Ww].
[0061] Cut to get (I crop , J crop ), it needs to be normalized. Normalization requires first obtaining the mean and variance std of the entire data set:
[0062]
[0063]
[0064] Among them, p nij represents the pixel value of point (i, j) on the nth foggy image, p nij ∈[0, 255]. N represents the total number of samples in the data set. Based on the mean and variance, the pixel value of the normalized foggy image can be obtained as:
[0065]
[0066] Through the above formula, we can get the cropped and normalized foggy image And with the cropped clear image J cr o p Form a pair of data This is used as the input of the network. In particular, for this example, the final value of the normalization parameter mean of the RESIDE training set is [0.6111, 0.5743, 0.5631], and the final value of std is [0.1503, 0.1563, 0.1616].
[0067] Step 2): Based on the U-Net structure and residual module, a dehazing network model is constructed.
[0068] The network structure diagram of this example is as follows Figure 2 As shown. The network structure of this example is a residual network built based on the U-Net structure, which consists of an encoding layer, a decoding layer, and an intermediate bottleneck area connecting the two areas. The encoding area contains a 3x3 convolution layer and 3 downsampling layers with two times downsampling, where the step size of the downsampling layer is 2; after convolution, the image becomes a 16-channel feature map, and the size of the feature map is the same as the input image; and after one downsampling, the size of the feature map is reduced to half of the original, and the number of layers is doubled. After the first convolution and the second downsampling of the downsampling layer, the attention mechanism residual block is connected; after the first and third downsampling, the ordinary residual block is connected.
[0069] The size of the feature map processed by the downsampling layer is one eighth of the original image, and the number of channels is 128. After entering the bottleneck area, the feature map first passes through three series-connected smooth hole convolution residual blocks, and the size and number of channels of the new feature map remain unchanged; then, the features of different scales in the downsampling layer are further downsampled to obtain features with the same size and number of channels as the new features, and are weighted and summed element by element with the new features; the weight of each feature is a learnable parameter, which is adaptively adjusted during the network iteration process. Finally, the new features obtained by weighted summation pass through a set of three series-connected smooth hole convolution residual blocks, and this feature is input to the decoding layer.
[0070] The decoding layer consists of three upsampling layers and two 3x3 convolutional layers, each of which is followed by a residual block. The size of the new features obtained after each upsampling is doubled, and the number of feature channels is reduced by half; after each upsampling, the features of the corresponding size and dimension of the encoding layer are added element by element, and then input into the residual block; the features output by the first convolutional layer of the network are added element by element with the features obtained by the last upsampling after passing through 5 series-connected dense convolution residual blocks, and the new features obtained are finally input into the last two convolutional layers and output a clear image of the same size as the original input.
[0071] The residual block used in this example is Figure 3 As shown in the figure. The residual block consists of two sets of convolutional layers and relu layers, and jumps the input features between the second convolutional layer and the relu layer by element-by-element addition. The convolutional network constructed in this way is called a residual network, which can solve the problems of network degradation and gradient disappearance / explosion in deep networks.
[0072] The attention mechanism residual block used in this example is as follows Figure 4 As shown, the CA and PA modules used are as follows Figure 5 As shown. The attention mechanism residual block is composed of adding CA, PA and relu layers in series after the residual block, and jump-connecting the input to the relu layer. The CA module consists of an average pooling layer, a convolution layer, a relu layer, a convolution layer and a sigmoid layer. The features are compressed into a channel-wide attention of size Cx1x1 through average pooling, and the network is allowed to learn the channel-wide weights through convolution and sigmoid, and finally element-by-element multiplication is used to weight the input features. The PA module has one less average pooling layer than the CA module, and finally learns a 1xHxW pixel range feature to weight the input features.
[0073] The smoothed hole convolution residual block used in this example is as follows Figure 6 As shown in the figure. The SS layer is a convolutional layer with separable shared weights, that is, the network only learns the parameters of one convolution kernel and expands it to the dimension of the input feature, and then convolves the input feature. In this way, the information of adjacent pixels is added to the feature before the dilated convolution, so as to avoid the grid effect caused by the dilated convolution. At the same time, the dilated convolution applied to the bottleneck layer can expand the network's receptive field without increasing parameters, and better restore the detailed information.
[0074] The dense convolution residual block used in this example is Figure 7As shown in the figure. Its input feature is 16 channels. After each convolution layer and relu layer, a new 16-channel feature is obtained, which is concatenated onto the input feature to obtain the expanded feature, which is then input into the next convolution layer. The feature is gradually expanded from the input 16 dimensions to 32, 48, 64 to 80 dimensions, and finally compressed to 16 dimensions through a 1x1 convolution layer, and the output feature is obtained by element-by-element addition to the input feature.
[0075] Step 3): Input the synthetic foggy data set into the network model, calculate the loss through the new loss function during the training process, continuously iterate and update the network parameters, and finally obtain the optimized defogging model for image defogging.
[0076] The loss function used in this example consists of two parts: smooth L1 loss and perceptual loss. The smooth L1 loss combines the mean absolute error (MAE) and the mean square error (MSE), and the formula is:
[0077]
[0078] in, represents the image output by EDA-Net, J i (x) represents the clear and fog-free image in the dataset, and the function F1 can be expressed as:
[0079]
[0080] In order to ensure the details of the restored image, perceptual loss is introduced. Perceptual loss uses other pre-trained feature extraction networks to extract the features of the output image and the target image and make them as similar as possible. The formula is:
[0081]
[0082] and φ j (J) represent the feature maps of VGG16 for the input foggy image and the real fog-free image; C j H j W j Represents the product of the number of channels output by the feature extraction network. VGG16 trained on ImageNet is used as the feature extraction network, and its 3rd, 5th, and 7th layer features are used to generate perceptual losses, namely Conv1-2, Conv2-2, and Conv3, to enhance the details of the restored image. The final loss function is expressed as:
[0083] L=L1+0.04L feat
[0084] The model proposed in the present invention can directly perform end-to-end defogging. By downsampling to the bottleneck area, the adaptive weighted summation better retains the information lost in the downsampling process and can better restore the details of the image. The defogging results of the model proposed in the present invention perform well in subjective vision, and the objective indicators tested on SOTS are relatively leading.
[0085] Table 1 is a comparison of PSNR and SSIM of the method of the present invention with other methods on the SOTS data set. It can be seen that the method of the present invention is the best in both indicators.
[0086] Table 1 PSNR and SSIM indicators on synthetic datasets
[0087]
[0088] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A residual network based on a U-Net structure and a residual module, characterized in that: Based on the U-Net network structure, an end-to-end dehazing residual network is constructed using the residual module; The network structure consists of an encoding layer, a decoding layer, and an intermediate bottleneck area connecting the two areas; The encoding layer includes a 3x3 convolutional layer and three downsampling layers with a double downsampling, where the step size of the downsampling layer is 2; The decoding layer consists of three upsampling layers and two 3x3 convolutional layers, where each upsampling layer is followed by a residual block; The intermediate bottleneck area sequentially includes a first group of three serially connected smooth dilated convolution residual blocks, a downsampling layer, a feature weighted summation module, and a second group of three serially connected smooth dilated convolution residual blocks; In the encoding layer, after the picture is input, it becomes a 16-channel feature map after passing through the convolution layer, and the size of the feature map is the same as the input picture; after one downsampling, the size of the feature map is reduced to half of the original size, and the number of layers is doubled; after the first convolution and the second downsampling of the downsampling layer, the attention mechanism residual block is connected; after the first and third downsampling, the ordinary residual block is connected; The size of the feature map processed by the downsampling layer is one eighth of the original image, and the number of channels is 128. This feature map enters the bottleneck area; The bottleneck area first passes the feature map through the first group of three series-connected smooth hole convolution residual blocks, and the size and number of channels of the new feature map remain unchanged; then, the features of different scales in the downsampling layer are further processed by the downsampling layer to obtain features with the same size and number of channels as the new features, and the weighted summation module is performed element by element with the new features; the weight of each feature is a learnable parameter, which is adaptively adjusted during the network iteration process; finally, the new feature obtained by the weighted summation passes through the second group of three series-connected smooth hole convolution residual blocks, and the feature is input into the decoding layer; The decoding layer doubles the size of the new features obtained after each upsampling and reduces the number of feature channels to half; after each upsampling, the features of the encoding layer with corresponding size and dimension are added element by element and then input into the residual block; the features output by the first convolutional layer of the network are added element by element with the features obtained by the last upsampling after passing through 5 series-connected dense convolution residual blocks, and the new features thus obtained are finally input into the last two convolutional layers and output a clear image of the same size as the original input.
2. The residual network based on the U-Net structure and the residual module according to claim 1, characterized in that: The residual block of the decoding layer consists of two groups of convolutional layers and a relu layer, and the input features are jump-connected between the second group of convolutional layers and the relu layer by element-by-element addition.
3. A residual network image dehazing method based on U-Net structure and residual module, characterized in that: The method comprises the following steps: Step 1): Obtain the synthetic foggy dataset RESIDE as a training dataset and preprocess the dataset; Step 2): construct a defogging network model according to the residual network structure based on the U-Net structure and the residual module provided in claim 1; Step 3): Input the synthetic foggy data set into the defogging network model, train the defogging network model, calculate the loss through the new loss function during the training process, continuously iterate and update the network parameters, and finally obtain the optimized defogging model to perform image defogging.
4. The method according to claim 3, characterized in that In the step 1), the specific method for preprocessing the RESIDE data set is as follows: A pair of foggy images and clear images in the training dataset is (I, J), where I, J∈R C×H×W , I represents foggy image, J represents clear image, C represents the number of channels of the image, H and W represent the height and width of the image; After randomly cropping the image, the resulting image is (I crop , J crop ), where I crop represents the cropped foggy image, J crop represents the cropped clear image, I crop , J crop ∈R C×h×w Here h and w represent the height and width of the cropped image; Cut to get (I crop , J crop ), normalization is performed on the foggy image; Normalized foggy image And with the cropped clear image J crop Form a pair of data This is used as the input of the dehazing network.
5. The method according to claim 4, characterized in that The steps of random cropping are specifically as follows: Set to h=w=240, first determine the coordinates of the cropping reference point (x0, y0), and then determine the coordinates of the remaining three points of the rectangular frame based on the reference point: (x0+240, y0), (x0, y0+240) and (x0+240, y0+240), and finally, based on these four points, crop a rectangular frame of the same size at the same position of the image pair (I, J); where (x0, y0) must satisfy x0∈[0, Hh], y0∈[0, Ww].
6. The method according to claim 5, characterized in that The normalization process is as follows: first, the mean and variance std of the entire data set are obtained: Among them, p nij represents the pixel value of point (i, j) on the nth foggy image, p nij ∈[0, 255]; N represents the total number of samples in the data set; based on the mean and variance, the pixel value of the normalized foggy image can be obtained as follows: Through the above formula, we can get the cropped and normalized foggy image 7. The method according to any one of claims 4 or 6, characterized in that: In step 3), the designed new loss function consists of two parts: smooth L1 loss and perceptual loss; The smooth L1 loss combines the mean absolute error MAE and the mean square error MSE, and the formula is: in, represents the image output by EDA-Net, Ji(x) represents the clear and fog-free image in the data set, and the function F1 is expressed as: e represents a common variable in function F1; The perceptual loss is to use other pre-trained feature extraction networks to extract the features of the output image and the target image and make them similar. The perceptual loss is L feat , the formula is: and φ j (J) represent the feature maps of VGG16 for the input foggy image and the real fog-free image; C j H j W j Represents the product of the number of channels output by the feature extraction network; VGG16 trained on ImageNet is used as the feature extraction network, and its 3rd, 5th, and 7th layer features are used to generate perceptual losses, namely Conv1-2, Conv2-2, and Conv3, to enhance the details of the restored images; The final loss function is expressed as: L = L1 + 0.04L feat .
8. The method according to claim 7, characterized in that: The final value of the normalization parameter mean of the RESIDE training data set is [0.6111, 0.5743, 0.5631], and the final value of std is [0.1503, 0.1563, 0.1616].
9. The method according to claim 7, characterized in that: When the defogging network model is trained, the training is terminated after 100 generations in the ITS indoor dataset of the RESIDE dataset, and the parameters are retained and the training is continued on the OTS outdoor dataset for 20 generations.
Citation Information
Patent Citations
Single-image defogging method based on ResNet neural network
CN108230264A
Single-image defogging method based on residual learning
CN108876728A