feat(boxes): generate_boxes.py 的 --target 默认改为 label
框的类别应该来自人工归类(图片所在目录),分类模型只负责定位。原先默认 predicted, 框的类别取模型 top1 预测,模型分错的图会把错误类别写进标签:boxes_shap 那次预测与 目录一致率 0.9915,约 95 张图的类别因此是错的。 两种取值只在预测与目录不一致的图上有区别,其余图解释的是同一个 logit、框完全相同。 --target predicted 仍保留。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
7dd0f89d18
commit
32e56cb230
@@ -162,6 +162,14 @@ def test_full_dataset_by_default_and_subsampling_is_opt_in(project, tmp_path, mo
|
||||
assert json.loads((per_class / "summary.json").read_text("utf-8"))["num_images"] == 2
|
||||
|
||||
|
||||
def test_target_defaults_to_folder_label(project, tmp_path, monkeypatch):
|
||||
"""框的类别默认用人工标注,不让分类模型的错误预测混进标签。"""
|
||||
out = tmp_path / "out_default"
|
||||
assert run(base_argv(project, out, "gradcam"), monkeypatch) == 0
|
||||
summary = json.loads((out / "summary.json").read_text(encoding="utf-8"))
|
||||
assert summary["target"] == "label"
|
||||
|
||||
|
||||
def test_target_can_be_prediction_or_folder_label(project, tmp_path, monkeypatch):
|
||||
for target in ("predicted", "label"):
|
||||
out = tmp_path / f"out_{target}"
|
||||
|
||||
Reference in New Issue
Block a user