Expand YOLO training AOIs safely
This commit is contained in:
@@ -6,6 +6,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
@@ -75,6 +76,30 @@ def test_operator_yolo_tile_dataset_export_help_does_not_require_gis_dependencie
|
||||
assert "--blank-range-threshold" in result.stdout
|
||||
|
||||
|
||||
def test_default_validation_split_is_explicit_and_rejects_holdout_leakage() -> None:
|
||||
module = load_tile_exporter()
|
||||
samples = [
|
||||
{"sample_slug": "geel", "recommended_split": "train"},
|
||||
{"sample_slug": "turnhout", "recommended_split": "val"},
|
||||
{"sample_slug": "retie", "recommended_split": "val"},
|
||||
{"sample_slug": "westerlo", "recommended_split": "val"},
|
||||
{"sample_slug": "arendonk_heide", "recommended_split": "val"},
|
||||
]
|
||||
|
||||
assert module.DEFAULT_VALIDATION_SAMPLE_SLUGS == frozenset(
|
||||
{"turnhout", "retie", "westerlo", "arendonk_heide"}
|
||||
)
|
||||
assert module.validate_validation_split(
|
||||
samples,
|
||||
set(module.DEFAULT_VALIDATION_SAMPLE_SLUGS),
|
||||
) == set(module.DEFAULT_VALIDATION_SAMPLE_SLUGS)
|
||||
|
||||
with pytest.raises(SystemExit, match="recommended validation holdouts"):
|
||||
module.validate_validation_split(samples, {"turnhout"})
|
||||
with pytest.raises(SystemExit, match="unknown samples"):
|
||||
module.validate_validation_split(samples, {"turnhout", "missing"})
|
||||
|
||||
|
||||
def test_iter_tile_windows_covers_edges_without_duplicates() -> None:
|
||||
module = load_tile_exporter()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user