一、分类模型的指标
TP
TN
FP
FN
Recall
Precision
FPR
TPR
计算Precision与recall的库函数:metrics.precision_recall_curve(),示例如下:
计算fpr&&tpr的库函数:metrics.roc_curve(),该函数某然正样本的label为1且score越大越接近于正样本,示例如下:
from sklearn import metrics ls_label=[] ls_score=[] for i in ls: jpgName=i.split(" ")[0].split("/")[-1] label=dic_label[jpgName] if label == "mask_no": ls_label.append(1) else: ls_label.append(0) score=float(i.strip().split(" ")[2]) ls_score.append(score) label=np.array(ls_label) score=np.array(ls_score) fpr, tpr, thresholds = metrics.roc_curve(label, score) precision, recall, thresholds = metrics.precision_recall_curve(label, score)
二、检测模型的指标【详见:目