weixin_44347319
C医生
采纳率12.5%
2019-04-07 09:04 浏览 1.2k

keras结果ACC: 1.0000 Recall: 1.0000 F1-score: 1.0000 Precesion: 1.0000的原因?

用keras做的图像2分类,仅仅跑了5个epoch,
结果:
[[205 0]
[ 0 28]]
keras的AUC为: 1.0
AUC: 1.0000
ACC: 1.0000
Recall: 1.0000
F1-score: 1.0000
Precesion: 1.0000

代码:
data = np.load('.npz')
image_data, label_data= data['image'], data['label']
skf = StratifiedKFold(n_splits=3, shuffle=True)

for train, test in skf.split(image_data, label_data):
train_x=image_data[train]
test_x=image_data[test]
train_y=label_data[train]
test_y=label_data[test]

train_x = np.array(train_x)
test_x = np.array(test_x)
train_x = train_x.reshape(train_x.shape[0],1,28,28)
test_x = test_x.reshape(test_x.shape[0],1,28,28)
train_x = train_x.astype('float32')
test_x = test_x.astype('float32')
train_x /=255
test_x /=255
train_y = np.array(train_y)

test_y = np.array(test_y)

model.compile(optimizer='rmsprop',loss="binary_crossentropy",metrics=["accuracy"])
model.fit(train_x, train_y,batch_size=64,epochs=5,verbose=1,validation_data=(test_x, test_y)])

从结果看,代码存在离谱的错误,请教各位专家,错在哪?谢谢

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答 默认 最新

  • Amigo_1997 瓜波牛排 2019-10-12 20:52

    请问您最后用TensorFlow画出了ROC曲线吗?

    点赞 评论 复制链接分享

相关推荐