Expand operator hard-negative AOIs
This commit is contained in:
@@ -25,7 +25,16 @@ def test_operator_sample_registry_includes_kempen_reference_and_background_candi
|
||||
module = load_sample_preparer()
|
||||
|
||||
expected_reference_slugs = {"geel", "mol", "turnhout", "herentals", "balen", "retie", "westerlo"}
|
||||
expected_background_slugs = {"postel_bos", "lommel_heide", "kasterlee_bos"}
|
||||
expected_background_slugs = {
|
||||
"postel_bos",
|
||||
"lommel_heide",
|
||||
"kasterlee_bos",
|
||||
"dessel_heide",
|
||||
"ravels_bos",
|
||||
"meerhout_bos",
|
||||
"geel_bel",
|
||||
"arendonk_heide",
|
||||
}
|
||||
|
||||
assert expected_reference_slugs.issubset(module.SAMPLES)
|
||||
assert expected_background_slugs.issubset(module.SAMPLES)
|
||||
@@ -34,6 +43,26 @@ def test_operator_sample_registry_includes_kempen_reference_and_background_candi
|
||||
assert all(module.SAMPLES[slug].sample_role == "background_candidate" for slug in expected_background_slugs)
|
||||
|
||||
|
||||
def test_operator_background_candidates_are_unique_enough_for_hard_negative_training() -> None:
|
||||
module = load_sample_preparer()
|
||||
|
||||
background_samples = [
|
||||
sample
|
||||
for sample in module.SAMPLES.values()
|
||||
if sample.sample_role == "background_candidate"
|
||||
]
|
||||
centers = {(round(sample.center_lon, 4), round(sample.center_lat, 4)) for sample in background_samples}
|
||||
half_sizes = {sample.half_size_m for sample in background_samples}
|
||||
|
||||
assert len(background_samples) >= 8
|
||||
assert len(centers) == len(background_samples)
|
||||
assert min(sample.center_lon for sample in background_samples) < 4.85
|
||||
assert max(sample.center_lon for sample in background_samples) > 5.25
|
||||
assert min(sample.center_lat for sample in background_samples) < 51.18
|
||||
assert max(sample.center_lat for sample in background_samples) > 51.33
|
||||
assert half_sizes == {260.0}
|
||||
|
||||
|
||||
def test_background_candidate_can_write_empty_reference_geojson(tmp_path: Path, monkeypatch) -> None:
|
||||
module = load_sample_preparer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user