title_temp

defog python案例 霧氣場景中, 由于大氣顆粒對光線的散射, 造成場景中目標表面的反射光散射損失, 使其光強度降低, 且隨傳播距離呈指數衰減, 同時在反射光傳播過程中, 附加了環境中大氣光源, 并隨著傳播距離的增加而改變光強.

圖像去霧實施方案


介紹
方法介紹
霧氣場景中, 由于大氣顆粒對光線的散射, 造成場景中目標表面的反射光散射損失, 使其光強度降低, 且隨傳播距離呈指數衰減, 同時在反射光傳播過程中, 附加了環境中大氣光源, 并隨著傳播距離的增加而改變光強.

根據上述大氣光散射理論, 在計算機視覺與圖形學中, 形成了廣泛使用的大氣光散射模型:



其中, I表示采集到的有霧圖像, J是去霧后的場景圖像, t為光線傳播介質的透視率, A表示大氣光值, x為圖像中的像素點。

在現有的方法中,有些方法使用CNN計算出t(x),然后根據大氣光散射模型計算得出I(x),這樣做存在的問題是,也要能很好的估算A的值,去霧結果才比較好,否則t(x)算得的結果再準確,也無法達到很好的去霧效果。有些方法使用CNN分別計算t(x)和A的值,再根據大氣光散射模型計算得出I(x),這樣得到的結果可靠性更強。本文提出的模型就是采用這樣的方法實現圖像去霧。

網絡架構


模型的結構分為四部分(藍色方框):

Transmation Map Estimation
Transmation Map Estimation網絡的作用是得到圖像的透視圖,即t(x)。該網絡的結構如下圖所示:





該網絡是一種密集連接的編碼-解碼結構,使用密集塊作為基本結構。密集塊保留了densenet的優勢,能保證不同網絡層間信息的傳遞,從而更好的保留空間結構信息,在網絡訓練時也能保證更好地收斂。編碼部分(Dense Block)采用預訓練的dense-net121結構,包括一個conv層和三個dense block層。解碼部分包括五個dense block和一個conv層。

全局結構的上下文信息有助于表達圖像特征,為了使用本地信息來表示圖像的全局結構,網絡采用四個不同尺度的池化操作,因此編碼-解碼器部分輸出四個不同尺度的feature map(1/4,1/8,1/16,1/32),通過上采樣將其轉化成原圖片大小,并與編碼-解碼器的輸出特征拼接,由此可獲得不同尺度信息。

Atmospheric Light Estimation
Atmospheric Light Estimation網絡的作用是得到大氣光值A(x),由于大氣光A(x)對于給定的圖像是均勻的,因此A(x)是2D圖,與輸入圖像具有相同的尺寸,因此,我們采用U-net網絡。該網絡是一種編碼-解碼器結構,編碼器逐漸減少池化層的空間維度,解碼器逐步修復物體的細節和空間維度。編碼器和解碼器之間通常存在快捷連接,因此能幫助解碼器更好地修復目標的細節。U-Net常用于image-to-image的問題。

U-net網絡結構:



卷積層的數量大約在20個左右,4次下采樣,4次上采樣。

Atmospheric Scattering Model
Atmospheric Scattering Model 是根據大氣光散射模型變形的公式:



通過將上述兩個網絡生成的t(x)和A以及有霧圖片I(x)代入該公式,即可得到去霧圖片J(x)。

Discriminator
該部分采用GAN網絡的原理,僅使用discriminator部分。該部分使用四個conv層,1個fc層(參考論文《Single Image Dehazing via Convolutional Generativa Adversarial Network》)。discriminator將由(3)中計算得出的去霧圖與原圖(無霧)做比較,訓練網絡,直到discriminator判斷不出輸入的圖片是去霧圖還是原圖。這樣就能夠達到比較好的去霧效果。

相關說明
這里提出的方案主要參考論文《Densely Connected Pyramid Dehazing Network》,由于時間原因無法實現代碼驗證結果,所以不好作出較大改動,但是相較于論文中的方法有創新的部分,就是在原網絡的第(4)部分判別器的輸入這里。原文是將透視圖和去霧圖作為判別器的輸入,達到的目的是使透視圖和去霧圖達到同一分布,提高去霧效果。(修改:原文將透視圖與去霧圖拼接(即:透視圖+去霧圖),達到的目的是使得到的透視圖、去霧圖、透視圖+去霧圖這三部分,與原圖透視圖、原圖、原圖透視圖+原圖這三部分基本一致。)我們這里改成直接將去霧圖和無霧圖作為輸入,效果會更好,但前提是使用的數據集中包括去霧圖和無霧圖。







這樣改進的好處:

1、原文將透視圖與去霧圖拼接起來,作為判別器的輸入,在損失函數中,通過利用聯合分布優化,可以更好地利用它們之間的結構相關性,這樣做的問題是去霧圖是根據公式由透視圖t(x)與A得到的,當A確定時,兩者之間的關系可由公式:



得到,這樣的話,直接將去霧圖與原圖比較,與將(去霧圖+透視圖)與(原圖+原透視圖)比較,理論上來說能得到類似效果,而且更簡單(簡化損失函數)。

2、原文方法的損失函數如下:



該損失函數過多的考慮透視圖t(x)的效果,透視圖類似于深度圖,能表示圖片物體大致輪廓信息,但是彩色圖片中包含更豐富的信息,包括顏色、紋理、以及微小物體等外觀信息等,如果在損失函數中過于重視透視圖效果,相對的可能會忽視彩色圖中上述信息,影響去霧效果。



如下圖,透視圖只能表現原圖的部分特征。

defog python案例defog python案例


最先出自天才案例 python案例
合作:幽靈案例


Image defogging implementation
Introduction
Method introduction
In the fog scene, due to the scattering of light by the atmospheric particles, the reflected light of the target surface in the scene is scattered, causing the light intensity to decrease, and exponentially decay with the propagation distance. At the same time, in the process of the reflected light propagation, the atmosphere in the environment is added. Light source, and change the light intensity as the distance traveled.

According to the above theory of atmospheric light scattering, in the computer vision and graphics, a widely used atmospheric light scattering model is formed:

Wherein, I represents the collected foggy image, J is the image of the scene after defogging, t is the perspective of the light propagation medium, A represents the atmospheric light value, and x is the pixel point in the image.

In the existing method, some methods use CNN to calculate t(x), and then calculate I(x) according to the atmospheric light scattering model. The problem with this is that the value of A can be well estimated. The result of defogging is better, otherwise the result of t(x) is more accurate and can not achieve a good defogging effect. Some methods use CNN to calculate the values of t(x) and A, respectively, and then calculate I(x) according to the atmospheric light scattering model, so that the results obtained are more reliable. The model proposed in this paper is to achieve image defogging in this way.

Network Architecture
The structure of the model is divided into four parts (blue box):

Transmation Map Estimation
The role of the Transmation Map Estimation network is to get a perspective view of the image, t(x). The structure of the network is shown below:

The network is a densely connected code-decoding structure that uses dense blocks as the basic structure. The dense block retains the advantage of the densenet, which can ensure the transmission of information between different network layers, thereby better retaining the spatial structure information and ensuring better convergence during network training. The code portion (Dense Block) uses a pre-trained dense-net121 structure, including a conv layer and three dense block layers. The decoding part includes five sense blocks and one conv layer.

The context information of the global structure helps to express the image features. In order to use the local information to represent the global structure of the image, the network uses four different scales of pooling operations, so the code-decoder part outputs four different scale feature maps (1 /4, 1/8, 1/16, 1/32), which is converted into the original picture size by upsampling and spliced with the output features of the code-decoder, thereby obtaining different scale information.

Atmospheric Light Estimation
The role of the Atmospheric Light Estimation network is to obtain the atmospheric light value A(x). Since the atmospheric light A(x) is uniform for a given image, A(x) is a 2D image with the same size as the input image, so , we use U-net network. The network is a code-decoder structure, the encoder gradually reduces the spatial dimension of the pooling layer, and the decoder gradually repairs the details and spatial dimensions of the object. There is usually a quick connection between the encoder and the decoder, which helps the decoder better fix the details of the target. U-Net is often used for image-to-image problems.

U-net network structure:
The number of convolutional layers is about 20, 4 downsamples and 4 upsamples.

Atmospheric Scattering Model
The Atmospheric Scattering Model is a formula that deforms according to the atmospheric light scattering model:

By substituting the t(x) and A generated by the above two networks and the foggy picture I(x) into the formula, the defogging picture J(x) can be obtained.

Discriminator
This part uses the principle of the GAN network, using only the discriminator part. This part uses four conv layers, one fc layer (refer to the paper “Single Image Dehazing via Convolutional Generativa Adversarial Network”). The discriminator compares the dehazing map calculated in (3) with the original image (no fog) and trains the network until the discriminator cannot determine whether the input image is a defogging pattern or an original image. This will achieve a better defogging effect.

Related instructions
The proposed scheme mainly refers to the paper “Densely Connected Pyramid Dehazing Network”. Due to the time, the code verification result cannot be realized, so it is not easy to make major changes, but compared with the innovative method in the paper, it is the first in the original network. (4) The input of the partial discriminator is here. The original text uses the perspective and defogging diagrams as input to the discriminator. The purpose is to achieve the same distribution of the perspective and defogging diagrams, and to improve the defogging effect. (Modification: The original text will be stitched together with the defogging pattern (ie: perspective + defogging), and the purpose is to make the three parts of the perspective, defogging, perspective + defogging, and the original The perspective, original image, original image perspective + original image are basically the same.) We changed the direct defogging and fogless images as input, the effect will be better, but the premise is that the data set used includes Fog map and no fog map.

The benefits of this improvement:
1. The original text is spliced together with the defogging diagram. As the input of the discriminator, in the loss function, by using the joint distribution optimization, the structural correlation between them can be better utilized. The problem is to defogg. The graph is obtained from the perspectives t(x) and A according to the formula. When A is determined, the relationship between the two can be given by the formula:

Obtain, in this case, directly compare the dehazing map with the original image, and compare (defogging + perspective) with (original + original perspective), in theory, can get a similar effect, and simpler (simplify the loss) function).

2. The loss function of the original method is as follows:

The loss function considers the effect of the perspective t(x) too much. The perspective is similar to the depth map and can represent the outline information of the picture object, but the color picture contains more information, including color, texture, and tiny objects. Appearance information, etc., if the perspective effect is too much emphasized in the loss function, the above information may be ignored in the color map, which affects the defogging effect.

As shown in the figure below, the perspective view can only represent some features of the original image.

在線提交訂單



在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
加拿大澳洲英国代写,网课代上,网课代考,论文代写-assignment due® essay代写,留学生代写,英国硕士论文代,经济代写,数学,CS代写 essay代写,网课代考,统计代写,金融代写,代做功課服務-靠谱代写 一站式論文代寫,硕士论文代写,essay代写,统计代写 新西兰代写assignment,CS代写,数学代写,essay代写,统计代写-Excellent due 美国代写,北美专业代写留学生论文,CS作业代写-EasyDue™ Assignment代写,美国代写网课代做,商科assignment代写网课 作业代写,論文代寫代写assignment-北美最好的一站式学术代写服务机构 代写essay,论文加急,论文代写,北美顶级代写-EssayV美国论文代写 加拿大代写assignment,英国、美国、澳洲留学生论文代写,论文代写