如何查看keras模型的中间层?

时间:2018-02-01 15:39:56

标签: python keras keras-layer

我想像这个图像一样可视化keras模型的中间层。 enter image description here

我正在0使用github.com/EN10/KerasMNIST已经预先训练好的模型。模型看起来像这样

Layer (type)                 Output Shape              Param #   
=================================================================
conv2d_1 (Conv2D)            (None, 26, 26, 32)        320       
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 24, 24, 64)        18496     
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (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

我想要想象这个模型的第一个,第二个卷积和丢失层,根据CNN model,我只需要向我想要显示的图层进行前向传递。问题是图像的维度为28x28x1,而第一和第二卷积层维度分别为26x26x3224x24x64,而丢失层为12x12x64。如何将这些尺寸转换为图像尺寸,以便我们可以获得与上面相似的图像?

0 个答案:

没有答案