特征提取尺寸与输入图像尺寸

时间:2019-07-03 05:36:53

标签: python python-3.x neural-network deep-learning

我正在使用Food-5K数据集在ResNet50(weights =“ imagenet”)(无FC层)上进行增量学习-将图像调整为224x224并将输出的特征取为

features = features.reshape((features.shape[0], 7 * 7 * 2048))

(100,352-dim)

我保存了功能并将其在简单的NN中重复使用

model = Sequential()
model.add(Dense(256, input_shape=(7 * 7 * 2048,), activation="relu"))
model.add(Dense(16, activation="relu"))
model.add(Dense(len(config.CLASSES), activation="softmax"))

所以我有一个关于增量学习的模型。 现在出现了问题。我想基于此模型预测图片。我应该以什么形状将图片插入模型?

我可以做这样的事情吗?

image = cv2.resize(image, (96, 96))
image = image.astype("float") / 255.0
image = img_to_array(image)
image = np.expand_dims(image, axis=0)

或者由于密集层,我应该使该图像变平吗?我可以使用numpy将其展平吗?或者

0 个答案:

没有答案
相关问题