Closed archyin closed 1 year ago
Hi! You can binarize the anomaly map by selecting a threshold. I recommend using the optimal threshold obtained when calculating the F1-max score:
precisions, recalls, thresholds = precision_recall_curve(label, predict)
f1_scores = (2 * precisions * recalls) / (precisions + recalls)
f1_max = np.max(f1_scores[np.isfinite(f1_scores)])
f1_max_index = np.argmax(f1_scores[np.isfinite(f1_scores)])
where f1_max
represents the F1-max score, and thresholds[f1_max_index]
is the corresponding optimal threshold.
Hi! You can binarize the anomaly map by selecting a threshold. I recommend using the optimal threshold obtained when calculating the F1-max score:
precisions, recalls, thresholds = precision_recall_curve(label, predict) f1_scores = (2 * precisions * recalls) / (precisions + recalls) f1_max = np.max(f1_scores[np.isfinite(f1_scores)]) f1_max_index = np.argmax(f1_scores[np.isfinite(f1_scores)])
where
f1_max
represents the F1-max score, andthresholds[f1_max_index]
is the corresponding optimal threshold.
每类图像集用同一个阈值吗?
Yes, this is a viable approach.
跑了一下test,出来的结果是这样的, 有那种二值化的结果图,或者把异常区域圈出来的吗?