diff --git a/ppcls/metric/metrics.py b/ppcls/metric/metrics.py index 192ecb06ac16c9d8153bba34a05e381f1cab82a0..b1e40732fba1cf31e5d640bd22aaf53f3d323909 100644 --- a/ppcls/metric/metrics.py +++ b/ppcls/metric/metrics.py @@ -204,8 +204,10 @@ class TprAtFpr(nn.Layer): gt_pos_score_list > threshold) / len(gt_pos_score_list) if len(gt_neg_score_list) == 0 and tpr > max_tpr: max_tpr = tpr - result = "threshold: {}, fpr: {}, tpr: {:.5f}".format( - threshold, fpr, tpr) + result = "threshold: {}, fpr: 0.0, tpr: {:.5f}".format( + threshold, tpr) + msg = f"The number of negative samples is 0, please add negative samples." + logger.warning(msg) fpr = np.sum( gt_neg_score_list > threshold) / len(gt_neg_score_list) if fpr <= self.max_fpr and tpr > max_tpr: