keras 的 example 文件 mnist_cnn.py 解析

mnist_cnn.py 基本上就是最简单的一个卷积神经网络了,其结构如下:

________________________________________________________________________________
Layer (type)                        Output Shape                    Param #
================================================================================
conv2d_1 (Conv2D)                   (None, 26, 26, 32)              320
________________________________________________________________________________
conv2d_2 (Conv2D)                   (None, 24, 24, 64)              18496
________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D)      (None, 12, 12, 64)              0
________________________________________________________________________________
dropout_1 (Dropout)                 (None, 12, 12, 64)              0
________________________________________________________________________________
flatten_1 (Flatten)                 (None, 9216)                    0
________________________________________________________________________________
dense_1 (Dense)                     (None, 128)                     1179776
________________________________________________________________________________
dropout_2 (Dropout)                 (None, 128)                     0
________________________________________________________________________________
dense_2 (Dense)                     (None, 10)                      1290
================================================================================
Total params: 1,199,882
Trainable params: 1,199,882
Non-trainable params: 0
________________________________________________________________________________

不再过多解释

 

另一个更简单的网络结构为 mnist_mlp.py,即 多层感知器(MLP,Multilayer Perceptron)

__________________________________________________
Layer (type)          Output Shape        Param #
==================================================
dense_1 (Dense)       (None, 512)         401920
__________________________________________________
dropout_1 (Dropout)   (None, 512)         0
__________________________________________________
dense_2 (Dense)       (None, 512)         262656
__________________________________________________
dropout_2 (Dropout)   (None, 512)         0
__________________________________________________
dense_3 (Dense)       (None, 10)          5130
==================================================
Total params: 669,706
Trainable params: 669,706
Non-trainable params: 0
__________________________________________________

用全连接堆叠起来的图像识别

——————————————————————

总目录

keras的example文件解析

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值