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)])

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

caozhy
贵阳老马马善福专业维修游泳池堵漏防水工程 采纳率太低,无法继续回答了
8 个月之前 回复

1个回答

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!