小编Jor*_*Val的帖子

为什么在 Keras 中 CNN 的训练速度比完全连接的 MLP 慢?

我查看了来自 Keras 的以下示例:

MNIST 中的 MLP:https : //github.com/fchollet/keras/blob/master/examples/mnist_mlp.py

MNIST 中的 CNN:https : //github.com/fchollet/keras/blob/master/examples/mnist_cnn.py

我在 CPU 上的 Theano 中运行两者。在 MLP 中,我每个 epoch的平均时间约为16秒,共有 669,706 个参数:

Layer (type)                 Output Shape              Param #   
=================================================================
dense_33 (Dense)             (None, 512)               401920    
_________________________________________________________________
dropout_16 (Dropout)         (None, 512)               0         
_________________________________________________________________
dense_34 (Dense)             (None, 512)               262656    
_________________________________________________________________
dropout_17 (Dropout)         (None, 512)               0         
_________________________________________________________________
dense_35 (Dense)             (None, 10)                5130      
=================================================================
Total params: 669,706.0
Trainable params: 669,706.0
Non-trainable params: 0.0
Run Code Online (Sandbox Code Playgroud)

在 CNN 中,从原始代码中 …

neural-network theano conv-neural-network keras

6
推荐指数
2
解决办法
2930
查看次数