Tensorflow maxpool负维度大小,卷积可视化

Tensorflow maxpool负维度大小,卷积可视化,tensorflow,conv-neural-network,tensorflow2.0,layer,max-pooling,Tensorflow,Conv Neural Network,Tensorflow2.0,Layer,Max Pooling,我有一个名为“model”的CNN模型,我试图将卷积特征图可视化。 我可以通过执行以下操作来完成前两个卷积层: inp= model.inputs #input of model out2= model.layers[2].output #output feature_map_2= Model(inputs= inp, outputs= out2) #defining the model f2=feature_map_2.predict(test_img) #predicting 但是当我

我有一个名为“model”的CNN模型,我试图将卷积特征图可视化。 我可以通过执行以下操作来完成前两个卷积层:

inp= model.inputs #input of model
out2= model.layers[2].output #output
feature_map_2= Model(inputs= inp, outputs= out2)  #defining the model
f2=feature_map_2.predict(test_img)  #predicting
但是当我尝试包括下一层,一个maxpool层时,我得到了以下错误

ValueError: Negative dimension size caused by subtracting 2 from 1 for '{{node functional_57/max_pooling2d_4/MaxPool}} = MaxPool[T=DT_FLOAT, data_format="NHWC", ksize=[1, 2, 2, 1], padding="VALID", strides=[1, 2, 2, 1]](functional_57/conv2d_24/Relu)' with input shapes: [32,256,1,64].
图像有形状(256256,1),运行完整模型unet时没有错误

我试图定义一个顺序模型,但没有成功