【问题标题】:ValueError: Error when checking target: expected time_distributed_7 to have 4 dimensions, but got array with shape (500, 18, 64)ValueError:检查目标时出错:预期 time_distributed_7 有 4 个维度,但得到了形状为 (500、18、64) 的数组
【发布时间】:2018-09-02 20:02:46
【问题描述】:

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

________________________________________________________________
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

该模型似乎在任何时候都没有提供 3 维输出。请帮我查明问题。

【问题讨论】:

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


    【解决方案1】:
    • 模型的输出形状:(any, 5, 22, 64)
    • Y_train 的输出形状:(500, 18, 64)

    这两个形状必须匹配。

    【讨论】:

    • 问题出在数据流上。我修好了。
    猜你喜欢
    • 2019-11-13
    • 2019-03-02
    • 2020-02-07
    • 1970-01-01
    • 2018-04-13
    • 1970-01-01
    • 2019-04-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多