keras验证的所有结果=1.0,啥原因?

keras做图像2分类,结果如下:
[[173 0]
[ 0 21]]
keras的AUC为: 1.0
AUC: 1.0000
ACC: 1.0000
Recall: 1.0000
F1-score: 1.0000
Precesion: 1.0000

代码如下:
data = np.load('1.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,verbose=1)

根据结果判断,肯定是代码哪错的很离谱,请教到底错在哪?

查看全部
weixin_44347319
C医生
2019/04/06 23:53
  • 机器学习
  • 深度学习
  • 人工智能
  • 神经网络
  • 数据挖掘
  • 点赞
  • 收藏
  • 回答
    私信

0个回复