Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Keras中是否可能有宽度和高度为32x32的输入_形状?_Python_Tensorflow_Keras_Vgg Net - Fatal编程技术网

Python 在Keras中是否可能有宽度和高度为32x32的输入_形状?

Python 在Keras中是否可能有宽度和高度为32x32的输入_形状?,python,tensorflow,keras,vgg-net,Python,Tensorflow,Keras,Vgg Net,我使用Python,Keras和Tensorflow作为后端,我希望为我的模型使用尽可能小的输入图像 VGG19应用程序表示,它可以用于宽度和高度。几周前,Keras网站上的最小值为48。我用它与48没有问题。现在,我想试试32,但我做不到,因为我得到: ValueError: Input size must be at least 48x48; got `input_shape=(32, 32, 3)` 我提到我将Keras更新到了2.2.2版本,还删除了我为VGG19准备的权重模型文件(从

我使用Python,Keras和Tensorflow作为后端,我希望为我的模型使用尽可能小的输入图像
VGG19应用程序表示,它可以用于宽度和高度。几周前,Keras网站上的最小值为48。我用它与48没有问题。现在,我想试试32,但我做不到,因为我得到:

ValueError: Input size must be at least 48x48; got `input_shape=(32, 32, 3)`
我提到我将Keras更新到了2.2.2版本,还删除了我为VGG19准备的权重模型文件(从
~/.Keras/models/
)。如果我将input_形状设置为(48,48,3),它会再次下载模型,否则会出现上面提到的错误

简而言之,我的代码只想加载经过预训练的模型:

vgg_conv = VGG19(weights='imagenet', include_top=False, input_shape=(32, 32, 3)) 

任何可以遵循的想法都是值得赞赏的。

VGG使用最大池,因此它必须具有特定的输入大小,否则到最后一层时,您将没有像素。您的意思是,特定的输入大小应该至少为48,而不是低至32?我刚从Keras文档中获取了这个32的值。您可以通过创建一个没有或有更少池(下采样)层的新模型来绕过这个限制,并将预训练权重复制到您的新模型中。@user36624:谢谢,这是一个很好的解决方法。@Denninger:“input_shape:可选的形状元组,仅在include_top为False时指定(否则输入形状必须为(224、224、3)(使用“channels_last”数据格式)或(3、224、224)(使用“channels_first”数据格式)。它应该正好有3个输入通道,宽度和高度不应小于32。”