Fix Ego4D target compatibility in local baselines

This commit is contained in:
Xin Wang
2026-08-28 15:03:31 +08:00
parent 4abbde4f52
commit 0f6a72cfdf
5 changed files with 134 additions and 16 deletions
+24
View File
@@ -93,6 +93,8 @@ def preflight(args) -> str:
shape, contract = None, None
counts = {"visual": [0, 0], "audio": [0, 0]}
total = 0
noncanonical_target_rows = 0
target_row_pattern_counts: dict[str, int] = {}
for index, name in enumerate(names, 1):
data = load_session_data(
args.feature_root, args.target_root, name, dataset="ego4d",
@@ -117,6 +119,15 @@ def preflight(args) -> str:
counts[modality][1] += len(data.states)
offset += width + 1
total += len(data.states)
noncanonical_target_rows += int(
data.feature_metadata.get("num_noncanonical_target_rows", 0)
)
for pattern, count in data.feature_metadata.get(
"target_row_pattern_counts", {}
).items():
target_row_pattern_counts[pattern] = (
target_row_pattern_counts.get(pattern, 0) + int(count)
)
del data # Validate one clip at a time, including all test clips.
if not args.no_progress and (index == 1 or index % 25 == 0 or index == len(names)):
print(f"preflight: {index}/{len(names)} clips", flush=True)
@@ -128,6 +139,19 @@ def preflight(args) -> str:
if fusion != "single" and len(shape) != 2:
raise ValueError(f"--layer-fusion {fusion} requires stacked [T,L,D] global states")
print(f"Validated {total} states; global shape per row={shape}; fusion={fusion}", flush=True)
if noncanonical_target_rows:
canonical_patterns = {"100", "010", "001", "011"}
details = ", ".join(
f"[{','.join(pattern)}]={count}"
for pattern, count in sorted(target_row_pattern_counts.items())
if pattern not in canonical_patterns
)
print(
"Ego4D binary target rows outside the EasyCom four-state "
f"constraint: {noncanonical_target_rows}/{total} ({details}); "
"preserved exactly for the official LSTR MCE objective.",
flush=True,
)
for modality, (valid, count) in counts.items():
if count:
note = "; provided boxes, not an online detector" if modality == "visual" else ""