File size: 2,506 Bytes
0390c2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
"""Check that released benchmark image references resolve and private reasoning is absent."""
import json
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
TASKS = {
    "任务1.1.json": "task1", "任务1.2.json": "task1", "任务1.3.json": "task1",
    "任务2.1.json": "task2", "任务2.2.json": "task2", "任务2.3.json": "task2",
    "任务3.1基础任务.json": "task3.1", "任务3.2方位任务.json": "task3.2",
    "任务3.3属性任务.json": "task3.3", "任务3.4几何任务.json": "task3.4",
    "任务3.5三维定位.json": "task3.5", "任务4.1平移缩放旋转.json": "task4.1",
    "任务4.2特殊操作.json": "task4.2", "任务4.3框选拖拽.json": "task4.3",
    "任务5.1_非画图操作.json": "task5.1", "任务5.2_画图操作.json": "task5.2",
}

missing = []
items = 0
steps = 0
for filename, image_folder in TASKS.items():
    with (ROOT / "Benchmark" / filename).open(encoding="utf-8-sig") as stream:
        data = json.load(stream)
    items += len(data)
    for item in data:
        image_paths = [item["image_path"]] if "image_path" in item else []
        if filename.startswith("任务5.") and "subtasks" in item:
            raise ValueError(f"Private subtask explanations remain in {filename}")
        for step in item.get("steps", []):
            steps += 1
            if filename.startswith("任务5.") and "thought" in step:
                raise ValueError(f"Private annotator reasoning remains in {filename}")
            image_paths.append(step["image_path"])
        for relative in image_paths:
            relative = relative.replace("\\", "/")
            candidates = [ROOT / "images" / image_folder / relative]
            flattened = relative.replace("/raw_images/", "/")
            candidates.append(ROOT / "images" / image_folder / flattened)
            if relative.startswith("record_"):
                candidates.append(
                    ROOT / "images" / image_folder
                    / f"record_{item.get('task_id', 0):03d}" / "raw_images" / Path(flattened).name
                )
            if not any(path.is_file() for path in candidates):
                missing.append(f"{filename}: {relative}")

if missing:
    raise FileNotFoundError("Missing image references:\n" + "\n".join(missing[:20]))

image_count = sum(1 for _ in (ROOT / "images").rglob("*.png"))
print(f"Validated {len(TASKS)} task files, {items} items/tasks, {steps} multi-step frames, and {image_count} screenshots.")