tensorflow - TimeDistributed Convolution2D Keras 的正确输入
问题描述
我有一个 327 帧的序列,尺寸为 480 行和 640 列,灰度。
print (X_train.shape) 给出:(327, 480, 640, 1)
我有以下模型:
N = 2 #number of frames to distribute
model = Sequential()
model.add(TimeDistributed(Convolution2D(32, activation='relu'), input_shape = (N, 480,640,1)))
...
print (model.output_shape) 给出:(None, 2, 480, 640, 32)
我需要多一维才能将此输入传递给卷积。实际上我有以下错误: ValueError: Error when checks input: expected time_distributed_1_input to have 5 dimension, but got array with shape (327, 480, 640, 1)
如何解决这个问题?
谢谢!
编辑:从根本上说,我需要将输入 (327, 480, 640, 1) 转换为 (x, 2, 480, 640, 1) (x=327/2 ?)
解决方案
您正在尝试对 3D 数据 (2x480x640) 执行 2D 卷积。使用Convolution3D。
推荐阅读
- python - 使用 Scrapy 抓取 rss 提要不会返回任何结果
- aframe - AFrame 文本组件不使用“logarithmicDepthBuffer=true”呈现
- kubernetes - 在没有外部 IP 的 GKE 上设置内部服务
- linux - xm64 填充了我在 Linux Mageia 6 中的处理器资源
- java - 替换用户输入的字符
- android - Nativescript Listview 不可滚动
- reactjs - 刚刚评估了 console.log 错误/下面的值
- go - 使用 Go 删除链表中的项目
- c - C、如何让程序在使用fork()时不跳过scanf()
- vue.js - 如何在运行时在使用 webpack 构建的 Vue 中使用环境变量?