Add dated regional imagery training sources
This commit is contained in:
@@ -28,9 +28,9 @@ from app.models import Dataset # noqa: E402
|
||||
from normalize_belgium_building_labels import normalize # noqa: E402
|
||||
|
||||
REGION_SOURCES = {
|
||||
"flanders": ("digitaal_vlaanderen_orthophoto", "grb"),
|
||||
"wallonia": ("spw_orthophoto", "spw_picc"),
|
||||
"brussels": ("urbis_orthophoto", "urbis"),
|
||||
"flanders": ({"digitaal_vlaanderen_orthophoto"}, "grb"),
|
||||
"wallonia": ({"spw_orthophoto"}, "spw_picc"),
|
||||
"brussels": ({"urbis_orthophoto", "digitaal_vlaanderen_orthophoto"}, "urbis"),
|
||||
}
|
||||
SPLITS = {"train", "val", "calibration", "test", "background-test"}
|
||||
|
||||
@@ -56,8 +56,8 @@ def _validate_pair(sample: dict[str, Any], raster: Dataset, reference: Dataset)
|
||||
region = str(sample.get("region") or "").lower()
|
||||
if region not in REGION_SOURCES:
|
||||
raise SystemExit(f"Unsupported region for {sample.get('sample_slug')}: {region}")
|
||||
expected_raster, expected_reference = REGION_SOURCES[region]
|
||||
if raster.source_name != expected_raster:
|
||||
expected_rasters, expected_reference = REGION_SOURCES[region]
|
||||
if raster.source_name not in expected_rasters:
|
||||
raise SystemExit(f"Raster provider mismatch for {sample['sample_slug']}: {raster.source_name}")
|
||||
if reference.source_name != expected_reference or reference.reference_layer_name != "buildings":
|
||||
raise SystemExit(f"Reference provider/layer mismatch for {sample['sample_slug']}")
|
||||
@@ -156,6 +156,7 @@ def main() -> int:
|
||||
{
|
||||
"sample_slug": slug,
|
||||
"sample_role": sample.get("sample_role", "positive"),
|
||||
"require_empty": bool(sample.get("require_empty", False)),
|
||||
"region": region,
|
||||
"context": sample.get("context"),
|
||||
"split": sample["split"],
|
||||
|
||||
@@ -88,7 +88,13 @@ def main() -> int:
|
||||
manifest = json.loads(args.corpus_manifest.read_text(encoding="utf-8"))
|
||||
regions = {item["sample_slug"]: item["region"] for item in manifest["samples"]}
|
||||
pure_empty_slugs = {
|
||||
item["sample_slug"] for item in manifest["samples"] if bool(item.get("require_empty"))
|
||||
item["sample_slug"]
|
||||
for item in manifest["samples"]
|
||||
if bool(item.get("require_empty"))
|
||||
or (
|
||||
item.get("sample_role") == "background_candidate"
|
||||
and int(item.get("reference_feature_count") or 0) == 0
|
||||
)
|
||||
}
|
||||
tiles = [item for item in summary["tiles"] if item.get("kept", True) and item["split"] == args.split]
|
||||
image_paths = [item["image_path"] for item in tiles]
|
||||
|
||||
@@ -94,19 +94,19 @@ AOIS = (
|
||||
REGION_CONTRACT = {
|
||||
"flanders": {
|
||||
"area_id": "2a1a064e-cfd6-46f4-981a-d6ffa0ed5b5e",
|
||||
"orthophoto_product": "most_recent",
|
||||
"orthophoto_product": "2025",
|
||||
"reference_path": "datasets/grb/acquire",
|
||||
"reference_product": "buildings",
|
||||
},
|
||||
"wallonia": {
|
||||
"area_id": "e5fd742a-ca18-4520-abe0-d28416aa2ece",
|
||||
"orthophoto_product": "wallonia_latest",
|
||||
"orthophoto_product": "wallonia_2024",
|
||||
"reference_path": "datasets/official-vector/acquire",
|
||||
"reference_product": "spw_picc_buildings",
|
||||
},
|
||||
"brussels": {
|
||||
"area_id": "304b413d-d81c-40fc-922e-49907b8efaaa",
|
||||
"orthophoto_product": "brussels_latest",
|
||||
"orthophoto_product": "brussels_2025",
|
||||
"reference_path": "datasets/official-vector/acquire",
|
||||
"reference_product": "urbis_buildings",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user