【发布时间】:2019-03-04 12:55:12
【问题描述】:
我是训练模型,将模型保存在磁盘上,使用模型时出错。
Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (150, 150, 3)
火车模型:
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(150, 150, 3))
使用模型:
model = load_model(os.path.join('models', 'myModel.h5'))
model.predict(img) # img - OpenCV image
【问题讨论】:
标签: keras model python-3.6