简体   繁体   English

是否可以在 Keras 中看到 Conv2D 层之后的输出

[英]Is it possible to see the output after Conv2D layer in Keras

I am trying to understand each layer of Keras while implementing CNN.我在实施 CNN 时试图了解 Keras 的每一层。

In Conv2D layer i understand that it creates different convolution layer depending on various feature map values.在 Conv2D 层中,我知道它根据不同的特征图值创建不同的卷积层。

Now, My question is that现在,我的问题是

  1. Can i see different feature map matrix that are applied on input image to get the convolution layer我可以看到应用于输入图像以获得卷积层的不同特征映射矩阵吗
  2. Can i see the value of matrix that is generated after completion of Conv2D step.我能看到完成 Conv2D 步骤后生成的矩阵的值吗?

Thanks in advance提前致谢

You can get the output of a certain convolutional layer in this way:可以通过这种方式得到某个卷积层的输出:

import keras.backend as K

func = K.function([model.get_layer('input').input], model.get_layer('conv').output)
conv_output = func([numpy_input])  # numpy array

where 'input' and 'conv' denote the names of your input layer and convolutional layer.其中 'input' 和 'conv' 表示输入层和卷积层的名称。 And you can get the weights of a certain layer like this:您可以像这样获得某个层的权重:

conv_weights = model.get_layer('conv').get_weights()  # numpy array

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM