keras 的 example 文件 mnist_denoising_autoencoder.py 解析
生活随笔
收集整理的這篇文章主要介紹了
keras 的 example 文件 mnist_denoising_autoencoder.py 解析
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
mnist_denoising_autoencoder.py 是一個編解碼神經網絡,其意義就是如果圖片中有噪點的話,可以去除噪點,還原圖片
其編碼網絡為:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
encoder_input (InputLayer) (None, 28, 28, 1) 0
_________________________________________________________________
conv2d_1 (Conv2D) (None, 14, 14, 32) 320
_________________________________________________________________
conv2d_2 (Conv2D) (None, 7, 7, 64) 18496
_________________________________________________________________
flatten_1 (Flatten) (None, 3136) 0
_________________________________________________________________
latent_vector (Dense) (None, 16) 50192
=================================================================
Total params: 69,008
Trainable params: 69,008
Non-trainable params: 0
_________________________________________________________________
?
就是輸入一張圖片,生成一個16維的向量
?
其解碼網絡為:
__________________________________________________________________________________________
Layer (type) Output Shape Param #
==========================================================================================
decoder_input (InputLayer) (None, 16) 0
__________________________________________________________________________________________
dense_1 (Dense) (None, 3136) 53312
__________________________________________________________________________________________
reshape_1 (Reshape) (None, 7, 7, 64) 0
__________________________________________________________________________________________
conv2d_transpose_1 (Conv2DTranspose) (None, 14, 14, 64) 36928
__________________________________________________________________________________________
conv2d_transpose_2 (Conv2DTranspose) (None, 28, 28, 32) 18464
__________________________________________________________________________________________
conv2d_transpose_3 (Conv2DTranspose) (None, 28, 28, 1) 289
__________________________________________________________________________________________
decoder_output (Activation) (None, 28, 28, 1) 0
==========================================================================================
Total params: 108,993
Trainable params: 108,993
Non-trainable params: 0
__________________________________________________________________________________________
就是輸入一個16維的向量,生成一個 28*28 的黑白圖片
?
合并之后的網絡結構就是
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
encoder_input (InputLayer) (None, 28, 28, 1) 0
_________________________________________________________________
encoder (Model) (None, 16) 69008
_________________________________________________________________
decoder (Model) (None, 28, 28, 1) 108993
=================================================================
Total params: 178,001
Trainable params: 178,001
Non-trainable params: 0
_________________________________________________________________
輸入就是有噪音的圖片,輸出是原圖,損失函數是mse,均方差
效果如下:第一行是原圖,第二行是加上噪點之后的圖,第三行是解碼出來的圖
?
——————————————————————
總目錄
keras的example文件解析
總結
以上是生活随笔為你收集整理的keras 的 example 文件 mnist_denoising_autoencoder.py 解析的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: keras 的 example 文件 m
- 下一篇: keras 的 example 文件 m