ValueError: Target is multilabel-indicator but average=‘binary‘. Please choose another average ...

precision = precision_score(y_true=label, y_pred=img, average="binary"),执行这句话时报题目错误。

ValueError: Target is multilabel-indicator but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted', 'samples'].其中label和img都是一个二维数组,里面的元素只有0和1两种。开始报这个错误以为是数组除了0,1还有其他元素,最后发现跟数组维度有关。

img = np.reshape(img, newshape=(-1))
label = np.reshape(label, newshape=(-1))经过这么处理后输入,ok!

你可能感兴趣的:(python,tensorflow)