计算ROC出错
File "/home/wyy/PycharmProjects/ABS2/pytorch-cutpaste-master/eval.py", line 173, in eval_model
roc_auc=round(roc_auc_score(labels, distances), 5)
File "/home/wyy/anaconda3/envs/pytorch/lib/python3.7/site-packages/sklearn/metrics/ranking.py", line 358, in roc_auc_score
sample_weight=sample_weight)
File "/home/wyy/anaconda3/envs/pytorch/lib/python3.7/site-packages/sklearn/metrics/base.py", line 74, in _average_binary_score
raise ValueError("{0} format is not supported".format(y_type))
ValueError: unknown format is not supported
原因分析:
输入的是图片形式的数据据,没有reval
解决方案:
roc_auc=round(roc_auc_score(labels.ravel(), distances.ravel()), 5)