我是靠谱客的博主 冷静蜡烛,这篇文章主要介绍keras 的 example 文件 mnist_cnn.py 解析keras的example文件解析,现在分享给大家,希望可以做个参考。

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

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
________________________________________________________________________________ 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)

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
__________________________________________________ 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文件解析

最后

以上就是冷静蜡烛最近收集整理的关于keras 的 example 文件 mnist_cnn.py 解析keras的example文件解析的全部内容,更多相关keras内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部