在Keras resNet50中为图像使用特定大小

时间:2018-10-02 15:54:22

标签: keras

我正在尝试使用RestNet50(keras)。我想用几个图像执行它  由于ResNet50的默认大小为224x244,因此大小有所不同。我试图将参数include_top更改为False,但是它仍然不起作用。

1 个答案:

答案 0 :(得分:1)

您可以按照以下说明使用apps.resnet50中包含的预处理功能:preprocessing images generated using keras function ImageDataGenerator() to train resnet50 model

这将从您的输入生成与ResNet50兼容的图像

from keras.applications.resnet50 import preprocess_input

train_datagen=ImageDataGenerator(preprocessing_function=preprocess_input)
train_generator = train_datagen.flow_from_directory(directory, batch_size, shuffle=True, target_size, class_mode)  
相关问题