A kind of image defogging method based on deep neural network
Technical field
The present invention relates to image processing techniques and depth learning technology field, more particularly to one kind to be based on deep neural network
Image defogging method.
Background technique
In the case where sky quality condition is bad, the particle that the image of outdoor shooting is often suspended in air is obvious
A series of problems, such as degrading, leading to picture contrast decline, cross-color, this is because light can quilt in light communication process
Mist, haze and dust in air etc. are scattered, therefore eventually arrive at camera is the light scattered.Haze image is usually by straight
The atmosphere light for connecing decaying and scattering forms, the intensity of illumination after directly decaying to the body surface reflection loss that camera receives,
The atmosphere light of scattering is the atmosphere light by scattering process that camera receives.Image defogging algorithm is widely applied valence by it
Value, is increasingly becoming the research hotspot of military affairs, space flight, traffic and monitoring etc..
The image defogging method of early stage is broadly divided into the defogging method based on picture superposition and is based on atmospheric scattering
Model estimates the defogging method of fog free images.It is intended to improve the contrast of image based on method for enhancing picture contrast, and does not have
There are the mechanism and atmospherical scattering model for considering image attenuation;Image defogging method based on atmospherical scattering model mainly uses one
The feature of a little engineers goes estimation and refined image transmissivity, calculates clearly fog free images further according to model.For example, He[1]Et al. propose dark, and thus estimate transmissivity, refinement transmissivity gone using soft pick figure or guiding filtering, is dissipated according to atmosphere
Penetrate that model is counter to solve fogless figure;Zhu[2]Et al. establish linear model and describe image depth and pixel intensity, the relationship of saturation degree,
Picture depth is estimated, atmosphere light and atmospheric scattering coefficient are chosen, generates defogging figure using atmospherical scattering model.
Recently, some scientific research personnel carry out image defogging using the method for deep learning, and achieve good results.Example
Such as, Cai[3]Et al. propose DehazeNet, using convolutional neural networks study image and transmissivity relationship, given birth to by individual figure
At transmissivity, fogless figure is restored based on atmospherical scattering model.Li[4]Et al. derive COEFFICIENT K to replace in atmospherical scattering model
Atmosphere light and transmissivity simultaneously redefine atmospherical scattering model, COEFFICIENT K are estimated by convolutional neural networks study, according to again
The model of definition restores fogless figure.
Traditional image defogging method calculates depth or transmissivity by its manual features, however these manual features are deposited
In the limitation of its own, satisfactory defog effect is unable to reach to the picture of certain scenes.Figure based on deep learning
As defogging method can improve scene limitation, there is stronger scene adaptability, and good defog effect can be obtained.
Summary of the invention
The present invention provides a kind of image defogging method based on deep neural network, the present invention fight net using production
Network carries out image defogging, and generator is learnt by deep neural network from there is mist figure to the conversion fogless figure, using arbiter
Improve generator defogging performance, this method does not need prior information, compared with traditional image defogging method, it is easier easily
One after the completion of training, is had mist figure to input generator, obtains defogging figure by a propagated forward, in detail by row to defogging
See below description:
A kind of image defogging method based on deep neural network, which comprises
Global atmosphere light and atmospheric scattering coefficient are chosen, has mist figure and its transmittance figure using depth of field generation;By fogless figure,
Training set is formed by mist figure and transmittance figure;
It include the generator net of estimation transmissivity sub-network and defogging sub-network based on the building of coder-decoder framework
Network;And using the linear combination instruction of confrontation loss function, transmissivity L1 norm loss function and defogging figure L1 norm loss function
Practice generator;
Arbiter network is constructed based on convolutional layer, sigmoid activation primitive and LeakyReLU function;It will be true fogless
Figure and the defogging figure generated by defogging sub-network are respectively as positive negative sample, and using cross entropy as cost function, training differentiates
Device;
Dual training is carried out by the way of generator and arbiter alternately training;
After the completion of training, there is mist figure to input generator to defogging for one, obtains defogging by a propagated forward
Figure.
Wherein, the generator network includes:
The estimation transmissivity sub-network generates single pass transmittance figure, and the defogging sub-network generates going for triple channel
Mist figure;
Encoder is made of n-layer convolutional neural networks, and activation primitive is LeakyReLU function, and carries out to image data
Criticize standardization;
Decoder is made of n-layer convolutional neural networks, by transposition convolution come enlarged image size, the last layer convolution
Activation primitive uses Tanh function, other layer of activation primitive uses ReLU function;
Further, between the respective layer of the encoder and decoder by the way of jump connection, by encoder
As a result decoder, the symmetrical configuration of encoder and decoder are transmitted to;
Characteristic pattern after convolution is connected on the channel of the characteristic pattern of the decoder of identical size by encoder, is obtained new
Characteristic pattern.
Preferably, the confrontation loss function specifically:
In formula, IiBe generated by i-th fogless figure have mist figure, i=1,2 ..., N, N is the number of fogless figure in training set
Amount, D (Ii,G2(Ii)) indicate mist figure IiBy defogging sub-network G2The defogging figure G of generation2(Ii) by the output of arbiter.
Preferably, the transmissivity L1 norm loss function specifically:
In formula, IiAnd tiBe respectively generated by i-th fogless figure have mist figure and transmittance figure, i=1,2 ..., N, N is instruction
Practice the quantity for concentrating fogless figure, G1(Ii) represent have mist figure IiBy estimating transmissivity sub-network G1The transmittance figure of generation.
Preferably, the defogging figure L1 norm loss function specifically:
In formula, Ji、IiBe i-th fogless figure and it is corresponding have a mist figure, i=1,2 ..., N, N are fogless figure in training set
Quantity, G2(Ii) represent have mist figure IiBy defogging sub-network G2The defogging figure of generation.
Wherein, the arbiter network specifically:
Network is made of m convolutional layer, and the last layer output uses sigmoid activation primitive, remaining activation primitive uses
LeakyReLU function;
Training objective are as follows:
When input is true fogless figure J, arbiter output is 1;When input is defogging figure G2(I), arbiter output is 0.
Further, the loss function of the arbiter Web vector graphic specifically:
In formula, Ji、IiBe i-th fogless figure and it is corresponding have a mist figure, i=1,2 ..., N, N are fogless figure in training set
Quantity, D (Ii,Ji) represent have mist figure IiWhen as condition, true fogless figure JiBy the output of arbiter, D (Ii,G2(Ii)) generation
Table has mist figure IiWhen as condition, there is mist figure IiThe defogging figure G generated by defogging sub-network2(Ii) pass through arbiter output,
And D (Ii,G2(Ii)) ∈ (0,1), D (Ii,Ji)∈(0,1)。
The present invention have it is following the utility model has the advantages that
1, the present invention does not need prior information, by deep neural network study from there is mist figure to the conversion fogless figure,
Clearly defogging figure, method are simple for generation;
2, the present invention does not need calculating complicated in the hypothesis and prior information of conventional method, and defogging is high-efficient, speed is fast;
3, defogging method of the invention only needs individual to have mist figure to produce fogless figure, is conveniently easily achieved.
Detailed description of the invention
Fig. 1 is a kind of flow chart of the image defogging method based on deep neural network provided by the invention;
Fig. 2 is the structural schematic diagram that production provided by the invention fights generator network in network;
Fig. 3 is the structural schematic diagram that production provided by the invention fights arbiter network in network;
Fig. 4 is that real scene has mist figure and defogging figure in defogging result of the present invention;
Fig. 5 is that real scene has mist figure and defogging figure in defogging result of the present invention;
Fig. 6 is that real scene has mist figure and defogging figure in defogging result of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, embodiment of the present invention is made below further
Ground detailed description.
Embodiment 1
In order to realize that the image defogging of high quality, the embodiment of the present invention propose a kind of image based on deep neural network
Defogging method, described below referring to Fig. 1:
101: choosing global atmosphere light and atmospheric scattering coefficient, have mist figure and its transmittance figure using depth of field generation;By nothing
Mist figure forms training set by mist figure and transmittance figure;
102: including the generator of estimation transmissivity sub-network and defogging sub-network based on the building of coder-decoder framework
Network;And using the linear combination of confrontation loss function, transmissivity L1 norm loss function and defogging figure L1 norm loss function
Training generator;
103: arbiter network is constructed based on convolutional layer, sigmoid activation primitive and LeakyReLU function;It will be true
Fogless figure and the defogging figure generated by defogging sub-network are respectively as positive negative sample, and using cross entropy as cost function, training is sentenced
Other device;
104: carrying out dual training by the way of generator and arbiter alternately training;
105: after the completion of training, thering is mist figure to input generator to defogging for one, obtained by a propagated forward
Defogging figure.
Wherein, the specific steps for establishing sample data set in step 101 are as follows:
1) global atmosphere light A and atmospheric scattering factor beta are chosen, (on the spot using depth of field d that is known or estimating from original image
Distance of the scape to camera), there is mist figure I and its transmittance figure t using formula (1), (2) generation;
I (x)=J (x) t (x)+A (1-t (x)) (1)
T (x)=e-βd(x) (2)
In formula, x is the pixel in image.
2) training set is formed by mist figure I, fogless figure J and transmittance figure t by corresponding.
Wherein, after step 101, before step 102, this method further include: image preprocessing step, specifically:
1) all image sizes of data set are fixed as N × N;
2) after normalizing the pixel value of image, then it is standardized as [- 1,1].
Wherein, the specific steps of generator network are constructed in step 102 are as follows:
1) generator network design is two sub-networks, is estimation transmissivity sub-network G respectively1With defogging sub-network G2, two
A sub-network is all made of coder-decoder framework, estimates transmissivity sub-network G1Generate transmittance figure, defogging sub-network G2It is raw
At defogging figure, with no restrictions to estimation transmissivity sub-network and defogging sub-network structure;
2) encoder is mainly made of n-layer convolutional neural networks, realizes that downscaled images size, enlarged image are logical by convolution
Road number, activation primitive selects LeakyReLU function, and carries out batch standardization (Batch Normalization) to image data;
3) decoder is equally made of n-layer convolutional neural networks, by transposition convolution come enlarged image size, the last layer
The activation primitive of convolution uses Tanh function, other layer of activation primitive uses ReLU function;
4) result of encoder is transmitted to decoding by the way of jump connection between the respective layer of encoder and decoder
Characteristic pattern (channel k) after convolution is connected to the decoding of identical size by device, the symmetrical configuration of encoder and decoder, encoder
On the channel of the characteristic pattern (channel k) of device, new characteristic pattern (channel 2k) is obtained;
5) estimate transmissivity sub-network G1With defogging sub-network structure G2It is identical, there is mist figure I defeated as network using same
Enter, difference is estimation transmissivity sub-network G1Generate single pass transmittance figure G1(I), defogging sub-network G2Output is three
The defogging figure G in channel2(I);
6) confrontation loss function, transmissivity L1 norm loss function and defogging figure L1 norm damage is respectively adopted in training generator
Function is lost, specific as follows shown:
It fights shown in loss function such as formula (3):
In formula, IiBe generated by i-th fogless figure have mist figure, i=1,2 ..., N, N is the number of fogless figure in training set
Amount, D (Ii,G2(Ii)) indicate mist figure IiBy defogging sub-network G2The defogging figure G of generation2(Ii) by the output of arbiter.
Shown in transmissivity L1 norm loss function such as formula (4):
In formula, IiAnd tiBe respectively generated by i-th fogless figure have mist figure and transmittance figure, i=1,2 ..., N, N is instruction
Practice the quantity for concentrating fogless figure, G1(Ii) represent have mist figure IiBy estimating transmissivity sub-network G1The transmittance figure of generation.
Shown in defogging figure L1 norm loss function such as formula (5):
In formula, Ji、IiBe i-th fogless figure and it is corresponding have a mist figure, i=1,2 ..., N, N are fogless figure in training set
Quantity, G2(Ii) represent have mist figure IiBy defogging sub-network G2The defogging figure of generation.
In conjunction with above three loss functions, the total loss function of generator is obtained, as shown in formula (6):
Gen_loss=θ LA+λLt+αLJ (6)
In formula, θ, λ and α are respectively LA、LtAnd LJWeight.
Wherein, the specific steps of arbiter network are constructed in step 103 are as follows:
1) arbiter network is made of m convolutional layer, and the last layer output uses sigmoid activation primitive, remaining activation
Function uses LeakyReLU function, and using has mist figure I as condition, inputs true fogless figure J or defogging sub-network G2It generates
Defogging figure G2(I), that output is true fogless figure J or defogging figure G2(I) probability value, range are (0,1).To arbiter network
Structure with no restrictions.
Training objective are as follows: when the input of arbiter network is true fogless figure J, arbiter output is 1, when arbiter network
Input be defogging figure G2(I), arbiter output is 0.The effect of arbiter is to improve generator in generating dual training to go
The performance of mist.
2) shown in loss function such as formula (7) used in training arbiter:
In formula, Ji、IiBe i-th fogless figure and it is corresponding have a mist figure, i=1,2 ..., N, N are fogless figure in training set
Quantity, D (Ii,Ji) represent have mist figure IiWhen as condition, true fogless figure JiBy the output of arbiter, D (Ii,G2(Ii)) generation
Table has mist figure IiWhen as condition, there is mist figure IiThe defogging figure G generated by defogging sub-network2(Ii) pass through arbiter output,
And D (Ii,G2(Ii)) ∈ (0,1), D (Ii,Ji)∈(0,1)。
Wherein, in step 104 dual training specific steps are as follows:
1) by the way of generator and arbiter alternately training, the parameters of generator network fixed first, training
Arbiter network, then fixes the parameters of arbiter network, and training generator network carries out dual training;
2) the defogging figure G that arbiter network distinguishes true fogless figure J by learning and defogging sub-network generates2(I), raw
It is the true fogless figure J or defogging figure G that defogging sub-network generates that network of growing up to be a useful person allows arbiter network cannot be distinguished by study2
(I)。
Wherein, the specific steps of step 105 are as follows: after the completion of generator and arbiter training, by one wait go when test
Mist has mist figure input generator to obtain defogging figure by a propagated forward.
Embodiment 2
It describes in detail below with reference to specific attached drawing and calculation formula to the scheme in embodiment 1, it is as detailed below
Description:
201: choosing global atmosphere light and atmospheric scattering coefficient, have mist figure and its transmittance figure using depth of field generation;By nothing
Mist figure forms training set by mist figure and transmittance figure;
202: including the generator of estimation transmissivity sub-network and defogging sub-network based on the building of coder-decoder framework
Network;And using the linear combination of confrontation loss function, transmissivity L1 norm loss function and defogging figure L1 norm loss function
Training generator;
203: arbiter network is constructed based on convolutional layer, sigmoid activation primitive and LeakyReLU function;It will be true
Fogless figure and the defogging figure generated by defogging sub-network are respectively as positive negative sample, and using cross entropy as cost function, training is sentenced
Other device;
204: carrying out dual training by the way of generator and arbiter alternately training;
205: after the completion of training, thering is mist figure to input generator to defogging for one, obtained by a propagated forward
Defogging figure.
Wherein, the specific steps for establishing sample data set in step 201 are as follows:
1) treatment process for having mist figure and transmittance figure is generated are as follows: be randomly provided the global atmosphere light A in tri- channels RGB
Some value between [0.7,1.0], atmospheric scattering factor beta are randomly set to some value between [0.6,1.8], using known or
The depth of field d (i.e. the distance of scene to camera) estimated from original image[5], according to formula (1), (2) generate have mist figure I and its thoroughly
Penetrate rate figure t;
2) training set is made, 1399 width figures are selected, it is different to generate 10 width according to the above process by figure J fogless for every
There is mist figure I and its transmittance figure t, obtains 13990 fogless figure J, has mist figure I and transmittance figure t, composing training collection;
Wherein, after step 201, before step 202, this method further include: image preprocessing step, specifically:
1) all image sizes of training set are fixed as 256 × 256;
2) by the RGB color pixel value of training set picture divided by 255, [0,1] is normalized to from [0,255], later
Pixel value is normalized into [- 1,1], as network inputs multiplied by subtracting 1 after 2 again.
Wherein, the specific steps of generator network are constructed in step 202 are as follows:
1) generator network design is two sub-networks, is estimation transmissivity sub-network G respectively1With defogging sub-network G2, two
A sub-network is all made of coder-decoder framework, estimates transmissivity sub-network G1Generate transmittance figure, defogging sub-network G2It is raw
At defogging figure;
2) encoder is mainly made of 8 layers of convolutional neural networks, realizes that downscaled images size, enlarged image are logical by convolution
Road number, the convolution kernel size used are 4 × 4, and setting stride is 2, and activation primitive selects LeakyReLU function, and slope is set as
0.2, and batch standardization (Batch Normalization) is carried out to image data;
3) decoder is equally made of 8 layers of convolutional neural networks, by transposition convolution come enlarged image size, the volume that uses
Product core size is 4 × 4, and setting stride is 2, to guarantee that the output data range of generator network is (- 1,1), the last layer volume
Long-pending activation primitive uses Tanh function, other layer of activation primitive uses ReLU function;
4) result of encoder is transmitted to decoding by the way of jump connection between the respective layer of encoder and decoder
Characteristic pattern (channel k) after convolution is connected to the decoding of identical size by device, the symmetrical configuration of encoder and decoder, encoder
On the channel of the characteristic pattern (channel k) of device, new characteristic pattern (channel 2k) is obtained;
5) estimate transmissivity sub-network G1With defogging sub-network structure G2It is identical, there is mist figure I defeated as network using same
Enter, difference is estimation transmissivity sub-network G1Generate single pass transmittance figure G1(I), defogging sub-network G2Output is three
The defogging figure G in channel2(I);
6) confrontation loss function, transmissivity L1 norm loss function and defogging figure L1 norm damage is respectively adopted in training generator
Lose function.It fights shown in loss function such as formula (3), shown in transmissivity L1 norm loss function such as formula (4), defogging figure L1 norm damage
It loses shown in function such as formula (5).In conjunction with above three loss functions, the total loss function of generator is obtained, such as the formula in embodiment 1
(6) shown in.θ, λ and α are respectively LA、LtAnd LJWeight, θ=1.0, λ=1.0, α=100.0.
Wherein, the specific steps of arbiter network are constructed in step 203 are as follows:
1) arbiter network is made of 5 convolutional layers, and the last layer output uses sigmoid activation primitive, remaining activation
Function uses LeakyReLU function, and slope is set as 0.2, and using has mist figure I as condition, inputs true fogless figure J or defogging
Network G2The defogging figure G of generation2(I), that output is true fogless figure J or defogging figure G2(I) probability value, range are (0,1).
Training objective are as follows: when the input of arbiter network is true fogless figure J, arbiter output is 1, when the input of arbiter network is
Defogging figure G2(I), arbiter output is 0.The effect of arbiter is that the performance of generator defogging is improved in generating dual training.
2) shown in the formula (7) in loss function such as embodiment 1 used in training arbiter.
Wherein, for the specific steps of dual training referring to embodiment 1, the embodiment of the present invention does not repeat them here this in step 204.
Wherein, the specific steps of step 205 are as follows: after the completion of generator and arbiter training, by one wait go when test
Mist has mist figure input generator to obtain defogging figure by a propagated forward.
Embodiment 3
Feasibility verifying is carried out to the scheme in Examples 1 and 2 below by experimental data, described below:
3 real scenes are selected to have mist figure to carry out defogging using defogging method of the invention, Fig. 4, Fig. 5 and Fig. 6 are true
Real field scape has mist figure and defogging figure.As can be seen from the results, this method is more satisfactory to the defog effect for having mist figure of real scene.
Bibliography
[1]He K,Sun J,Tang X.Single Image Haze Removal Using Dark Channel
Prior[J].IEEE Transactions on Pattern Analysis And Machine Intelligence,2011,
33(12):2341-2353.
[2]Zhu Q,Mai J,Shao L.A Fast Single Image Haze Removal Algorithm
Using Color Attenuation Prior[J].IEEE Transactions on Image Processing,2015,
24(11):3522-3533.
[3]Cai B,Xu X,Jia K,et al.DehazeNet:An End-to-End System for Single
Image Haze Removal[J].IEEE Transactions on Image Processing,2016,25(11):5187-
5198.
[4]Li B,PengX,WangZ,et al.:AOD-Net:All-in-One Dehazing Network,2017
IEEE International Conference on Computer Vision,2017:4780-4788.
[5]Godard C,Mac Aodha O,Brostow G J,et al.:Unsupervised Monocular
Depth Estimation with Left-Right Consistency,30th IEEE Conference on Computer
Vision And Pattern Recognition,2017:6602-6611.
It will be appreciated by those skilled in the art that attached drawing is the schematic diagram of a preferred embodiment, the embodiments of the present invention
Serial number is for illustration only, does not represent the advantages or disadvantages of the embodiments.
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and
Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.