Harden split background promotion preflight
This commit is contained in:
@@ -110,11 +110,24 @@ samples = payload.get("samples") or payload.get("items") or []
|
||||
if not isinstance(samples, list) or not samples:
|
||||
raise SystemExit(f"Operator sample manifest has no samples: {manifest_path}")
|
||||
|
||||
background_categories = {
|
||||
str(sample.get("background_category") or "")
|
||||
for sample in samples
|
||||
if str(sample.get("sample_role") or "") == "background_candidate"
|
||||
}
|
||||
background_categories = set()
|
||||
for sample in samples:
|
||||
if str(sample.get("sample_role") or "") != "background_candidate":
|
||||
continue
|
||||
|
||||
category = str(sample.get("background_category") or "").strip()
|
||||
if not category:
|
||||
try:
|
||||
reference_feature_count = int(sample.get("reference_feature_count") or 0)
|
||||
except (TypeError, ValueError):
|
||||
reference_feature_count = 0
|
||||
category = (
|
||||
"pure_empty_negative"
|
||||
if reference_feature_count == 0
|
||||
else "sparse_building_context"
|
||||
)
|
||||
|
||||
background_categories.add(category)
|
||||
missing = {"pure_empty_negative", "sparse_building_context"} - background_categories
|
||||
if missing:
|
||||
raise SystemExit(
|
||||
|
||||
Reference in New Issue
Block a user