python-3.x - 更改图像的形状以匹配模型输入形状的尺寸
问题描述
我训练了一个期望输入形状为(None, 9, 100, 100, 3)
. 当我运行以下代码时:
start_frame = 1
while success:
vid.set(cv2.CAP_PROP_POS_FRAMES, start_frame)
success, image = vid.read()
image = np.array(image).astype('float32')/255
image = image.reshape(1,*image.shape)
image = np.expand_dims(image, axis=0)
preds = model.predict(image)
我收到以下警告/错误:WARNING:tensorflow:Model was constructed with shape (None, 9, 100, 100, 3) for input Tensor("conv3d_1_input:0", shape=(None, 9, 100, 100, 3), dtype=float32), but it was called on an input with incompatible shape (1, 1, 100, 100, 3).
有没有什么办法解决这一问题?
解决方案
推荐阅读
- android - 自定义和 android seekbar
- c# - 将自定义代码(视图)添加到 DinkToPdf 标头
- tensorflow-federated - Tensorflow-federated 0.17.0 完全是 GPU 还是 GPU 和 CPU?
- c# - 如何根据C#中的数字上下值从文本框中删除字符?
- sql - 在 MSSQL 中使用多个搜索字符串过滤多个字段
- java - 如何将父地图中的地图值与java 8流结合起来
- python - 列单元格中的 Pyspark Row() 到完整数据框
- python - 将字节中的日文文本转换为字符串时出错
- makefile - 自动生成默认makefile时的鸡蛋和鸡肉问题
- android - 如何使用 Cordova 插件在 Android 的 SD 卡或手机存储的根目录中创建文件夹