import json import string from pathlib import Path def option_label(index: int) -> str: """Return spreadsheet-style labels: A, B, ... Z, AA, AB, ...""" label = "" n = index + 1 while n > 0: n, rem = divmod(n - 1, 26) label = string.ascii_uppercase[rem] + label return label def main() -> None: source_path = Path("/home/jisoo/ECCV2026/data/Video-Holmes/test_Video-Holmes.json") video_root = Path("/home/jisoo/ECCV2026/data/Video-Holmes/videos_cropped") output_path = Path("/home/jisoo/ECCV2026/data/Video-Holmes/tests_videoholmes_all.json") all_tests = json.load(source_path.open("r", encoding="utf-8")) print(len(all_tests)) videos2paths = {p.stem: p for p in video_root.rglob("*") if p.is_file()} new_test = [] missing_videos = [] for test_i, test in enumerate(all_tests): video_id = test["video ID"] video_path = videos2paths.get(video_id) if video_path is None: missing_videos.append(video_id) continue options_dict = test["Options"] option_keys = sorted(options_dict.keys()) options = [f"{k}. {options_dict[k]}" for k in option_keys] answer_key = str(test["Answer"]).strip().upper() if answer_key not in option_keys: # Keep parity with MVBench conversion style while skipping bad rows safely. continue question_text = test["Question"] new_test.append( { "problem_id": test_i, "data_type": "video", "problem_type": "multiple choice", "options": options, "data_source": "Video-Holmes", "answer": f"{answer_key}", "videos": [str(video_path).replace("/home/jisoo/ECCV2026/data/Video-Holmes/", "./")], "problem": f"