Add hard-negative balanced YOLO tile export
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-07 23:01:51 +02:00
parent 558c17129b
commit 9bd6752128
6 changed files with 187 additions and 25 deletions
@@ -64,6 +64,7 @@ def test_operator_yolo_tile_dataset_export_help_does_not_require_gis_dependencie
assert "--tile-size" in result.stdout
assert "--stride" in result.stdout
assert "--negative-keep-ratio" in result.stdout
assert "--background-negative-repeat" in result.stdout
def test_iter_tile_windows_covers_edges_without_duplicates() -> None:
@@ -93,3 +94,32 @@ def test_negative_tile_keep_is_deterministic_and_ratio_bound() -> None:
assert 1 <= sum(first) <= 25
assert all(all_kept)
assert not any(none_kept)
def test_background_negative_repeat_only_applies_to_training_background_tiles() -> None:
module = load_tile_exporter()
assert module.background_negative_repeat_count(
is_negative=True,
sample_role="background_candidate",
split="train",
background_negative_repeat=4,
) == 4
assert module.background_negative_repeat_count(
is_negative=True,
sample_role="background_candidate",
split="val",
background_negative_repeat=4,
) == 1
assert module.background_negative_repeat_count(
is_negative=False,
sample_role="background_candidate",
split="train",
background_negative_repeat=4,
) == 1
assert module.background_negative_repeat_count(
is_negative=True,
sample_role="reference",
split="train",
background_negative_repeat=4,
) == 1