ValueError:检查目标时出错:预期time_distributed_7具有4个维度,但数组的形状为(500,18,64)

时间:2018-09-02 20:02:47

标签: python python-3.x machine-learning keras

我在模型中找不到问题。这是我的模型摘要:

________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_11 (InputLayer)        (None, 32, 100, 3)        0         
_________________________________________________________________
conv2d_75 (Conv2D)           (None, 29, 97, 64)        3136      
_________________________________________________________________
max_pooling2d_23 (MaxPooling (None, 14, 48, 64)        0         
_________________________________________________________________
conv2d_76 (Conv2D)           (None, 10, 44, 256)       409856    
_________________________________________________________________
max_pooling2d_24 (MaxPooling (None, 5, 22, 256)        0         
_________________________________________________________________
conv2d_77 (Conv2D)           (None, 5, 22, 512)        1180160   
_________________________________________________________________
conv2d_78 (Conv2D)           (None, 5, 22, 1024)       4719616   
_________________________________________________________________
conv2d_79 (Conv2D)           (None, 5, 22, 1024)       9438208   
_________________________________________________________________
conv2d_80 (Conv2D)           (None, 5, 22, 3072)       3148800   
_________________________________________________________________
dropout_15 (Dropout)         (None, 5, 22, 3072)       0         
_________________________________________________________________
dense_8 (Dense)              (None, 5, 22, 4096)       12587008  
_________________________________________________________________
dropout_16 (Dropout)         (None, 5, 22, 4096)       0         
_________________________________________________________________
conv2d_81 (Conv2D)           (None, 5, 22, 64)         262208    
_________________________________________________________________
time_distributed_7 (TimeDist (None, 5, 22, 64)         4160      
=================================================================
Total params: 31,753,152
Trainable params: 31,753,152
Non-trainable params: 0

该模型在任何时候似乎都没有提供3D输出。请帮助我找出问题所在。

1 个答案:

答案 0 :(得分:1)

  • 模型的输出形状:(任意,5、22、64)
  • Y_train的输出形状:(500,18,64)

这两个形状必须匹配。