模型训练维度不匹配
- 问题描述:
ValueError: Error when checking target: expected to have 5 dimensions, but got array with shape (1, 1)
- 解决方案:在最后一层前添加GAP层
self.gb = layers.GlobalAveragePooling3D()(self.dense2)
self.drop = layers.Dropout(rate=0.6)(self.gb)
或 添加 Flatten层
model.add(Flatten())