繁体   English   中英

在 Keras Python 中调整 Output 层的大小

[英]Resize Output Layer in Keras Python

我的目标是将 output 图像从[32,32,1]调整为[8,8,1]

我尝试使用 reshape 进行此操作,但出现错误:

Output_model = Reshape((8,8,-1))(out_1)
Error when checking target: expected reshape_1 to have shape (8, 8, 32) but got array with shape (32, 32, 1)

我怎么解决这个问题??

非常感谢

您不能直接重塑数组,因为 32*32*1 不等于 8*8*1,因此您必须进行子采样:

import keras
x=keras.layers.Input((32,32,1))
x=keras.layers.MaxPooling2D((4,4))(x)

然后您的图像将下采样到(8,8,1)。

暂无
暂无

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

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