ValueError: expected dense_2 to have shape (2,) but got array with shape (1,)
一、问题对keras模型训练二分类模型,遇到了这个错误:ValueError: Error when checking target: expected dense_2 to have shape (2,) but got array with shape (1,)二、解决方式可以将标签转换成one_hot编码:for row in all_train_data.iterrows():train_
·
一、问题
对keras模型训练二分类模型,遇到了这个错误:
ValueError: Error when checking target: expected dense_2 to have shape (2,) but got array with shape (1,)
二、解决方式
可以将标签转换成one_hot编码:
for row in all_train_data.iterrows():
train_data.append([row[1][0],to_categorical(row[1][1])])
更多推荐




所有评论(0)