【问题标题】:Native TF vs Keras TF performance comparisonNative TF 与 Keras TF 性能对比
【发布时间】:2017-06-06 06:11:24
【问题描述】:

我使用原生和后端 tensorflow 创建了完全相同的网络,但在使用许多不同参数进行了数小时的测试后,仍然无法弄清楚为什么 keras 优于原生 tensorflow 并产生更好(稍微但更好)的结果。

Keras 是否实现了不同的权重初始化方法?还是执行除 tf.train.inverse_time_decay 之外的其他权重衰减方法?

附:分数差总是像

Keras with Tensorflow: ~0.9850 - 0.9885 - ~45 sec. avg. training time for 1 epoch
Tensorflow Native ~0.9780 - 0.9830 - ~23 sec.

我的环境是:

Python 3.5.2 -Anaconda / Windows 10
CUDA:8.0 与 cuDNN 5.1
Keras 1.2.1
TensorFlow 0.12.1
英伟达 Geforce GTX 860M

keras.json 文件:

{
    "image_dim_ordering": "tf", 
    "epsilon": 1e-07, 
    "floatx": "float32", 
    "backend": "tensorflow"
}

你也可以复制并执行以下两个文件

https://github.com/emrahyigit/deep/blob/master/keras_cnn_mnist.py
https://github.com/emrahyigit/deep/blob/master/tf_cnn_mnist.py
https://github.com/emrahyigit/deep/blob/master/mnist.py

【问题讨论】:

    标签: python tensorflow keras cudnn


    【解决方案1】:

    问题是由于错误使用了 dropout 层的 keep_prob 参数,因为我应该在训练和测试过程中为这个参数提供不同的值。

    【讨论】:

    • Keras 是 45s,TF 是 23s 吗?这是一个很大的区别
    • 您好,还有 5 秒。现在的区别。原生 TF 更快。
    猜你喜欢
    • 2018-01-06
    • 2018-07-08
    • 1970-01-01
    • 1970-01-01
    • 2020-11-21
    • 2020-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多