evaluate models on fresh regional calibration AOIs
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
from scripts.provision_belgium_building_training_portfolio import AOIS
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.provision_belgium_building_training_portfolio import AOIS, load_custom_aois
|
||||
|
||||
|
||||
V63_CANDIDATES = {
|
||||
@@ -32,3 +37,57 @@ def test_v66_lowrise_candidates_are_flemish_train_role_inputs() -> None:
|
||||
assert all(aoi.region == "flanders" for aoi in candidates.values())
|
||||
assert all(aoi.split == "train" for aoi in candidates.values())
|
||||
assert all("lowrise" in aoi.context for aoi in candidates.values())
|
||||
|
||||
|
||||
def test_custom_aoi_spec_loads_non_protected_calibration(tmp_path: Path) -> None:
|
||||
spec = tmp_path / "aois.json"
|
||||
spec.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"aois": [
|
||||
{
|
||||
"slug": "fresh-rural-cal",
|
||||
"region": "wallonia",
|
||||
"context": "rural-lowrise",
|
||||
"split": "calibration",
|
||||
"lon": 5.25,
|
||||
"lat": 50.25,
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = load_custom_aois(spec)
|
||||
|
||||
assert len(result) == 1
|
||||
assert result[0].slug == "fresh-rural-cal"
|
||||
assert result[0].split == "calibration"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("split", ["test", "background-test"])
|
||||
def test_custom_aoi_spec_rejects_protected_splits(
|
||||
tmp_path: Path, split: str
|
||||
) -> None:
|
||||
spec = tmp_path / "aois.json"
|
||||
spec.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"aois": [
|
||||
{
|
||||
"slug": "forbidden",
|
||||
"region": "flanders",
|
||||
"context": "urban",
|
||||
"split": split,
|
||||
"lon": 4.5,
|
||||
"lat": 51.0,
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with pytest.raises(SystemExit, match="protected/unsupported split"):
|
||||
load_custom_aois(spec)
|
||||
|
||||
Reference in New Issue
Block a user