[LAB 09 · 检测几何:框、匹配、NMS 与 AP](/course/notebooks/90d213b4e1e04c7e889ee6fc042b2358.html) # 7 · 只改一个条件,并用结果回答 · 实现代码 [独立阅读](/course/notebook-blocks/7a672ab1408b4a068337b1162bb625a6.html) 并入相关学习路径 固定框匹配、PR/AP、NMS误删相邻对象反例 展开完整实现代码 ``` # Optional one-condition experiments: preserve the baseline arrays. scores_rank_test = SCORES.copy() scores_rank_test[1] = .60 print("P2 score 0.60, AP50:", evaluate_single_class(PRED, scores_rank_test, GT, .5)["ap"]) boxes_localization_test = PRED.copy() boxes_localization_test[2, [0, 2]] -= .4 print("P3 shifted left 0.4, AP75:", evaluate_single_class(boxes_localization_test, SCORES, GT, .75)["ap"]) for threshold in [.50, .70]: candidate_keep, _ = class_aware_nms(NEIGHBOR_GT, NEIGHBOR_SCORES, [0, 0], threshold) print("Neighbor NMS", threshold, "keeps", (candidate_keep + 1).tolist(), "AP50", evaluate_single_class(NEIGHBOR_GT[candidate_keep], NEIGHBOR_SCORES[candidate_keep], NEIGHBOR_GT, .5)["ap"]) ```