【问题标题】:Keras Autoencoders - How to visualize the values of the hidden layer?Keras Autoencoders - 如何可视化隐藏层的值?
【发布时间】:2017-08-06 22:11:51
【问题描述】:

我正在尝试做一个项目,其中隐藏层的值起着关键作用。我正在尝试使用本教程中的示例自动编码器, https://blog.keras.io/building-autoencoders-in-keras.html 我能够进行梯度下降并且它也在收敛,但我不确定如何打印隐藏层的值。当我在 model.outputs 上使用打印状态时,我得到 tf.Tensor 'add:0' shape=(?, 30) dtype=float32,其中 30 是隐藏层中的节点数。任何人都可以帮忙吗?谢谢。

【问题讨论】:

    标签: tensorflow deep-learning keras autoencoder keras-layer


    【解决方案1】:

    这必须使用 Keras 函数来完成,您可以在此处阅读:(https://keras.io/getting-started/faq/#how-can-i-obtain-the-output-of-an-intermediate-layer)。

    本质上你构建了一个这样的函数:

    import keras.backend as K
    output_func = K.function([model.layers[0].input, K.learning_phase()],
                         [model.layers[1].output])
    intermediate_output = output_func([data, False])
    

    【讨论】:

      猜你喜欢
      • 2018-01-25
      • 2019-05-17
      • 2019-10-01
      • 2019-01-27
      • 2021-12-21
      • 1970-01-01
      • 2017-07-27
      • 2020-02-02
      • 1970-01-01
      相关资源
      最近更新 更多