File size: 3,930 Bytes
3c4b9d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import json
import re
import os
import sys

PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, PROJECT_ROOT)

from tools.warehouse import warehouse_init
from tools.household import household_init

# 1. Count tool numbers
print('=== Tool Count ===')
for scene in ['retail', 'kitchen', 'restaurant', 'warehouse', 'household']:
    tool_file = 'restaurant6_tools.json' if scene == 'restaurant' else f'{scene}_tools.json'
    with open(os.path.join(PROJECT_ROOT, 'tools', scene, tool_file), 'r') as f:
        tools = json.load(f)
        print(f'{scene}: {len(tools)}')

# 2. Count item numbers
print('\n=== Item Count ===')

# Retail
with open(os.path.join(PROJECT_ROOT, 'tools', 'retail', 'retail_init.py'), 'r') as f:
    content = f.read()
    products = re.findall(r'"name":\s*"([^"]+)"', content)
    print(f'retail: {len(set(products))} products')

# Kitchen
with open(os.path.join(PROJECT_ROOT, 'tools', 'kitchen', 'kitchen_init.py'), 'r') as f:
    content = f.read()
    if '"recipes"' in content:
        parts = content.split('"recipes"')
        ingredients = len(re.findall(r'"name":\s*"([^"]+)"', parts[0]))
        recipes = len(re.findall(r'"name":\s*"([^"]+)"', parts[1][:10000]))
        print(f'kitchen: {ingredients} ingredients + {recipes} recipes')
    else:
        ingredients = len(re.findall(r'"name":\s*"([^"]+)"', content))
        print(f'kitchen: {ingredients} ingredients')

# Restaurant
with open(os.path.join(PROJECT_ROOT, 'tools', 'restaurant', 'restaurant_init.py'), 'r') as f:
    content = f.read()
    if '"set_meals"' in content:
        parts = content.split('"set_meals"')
        dishes = len(re.findall(r'"name":\s*"([^"]+)"', parts[0]))
        print(f'restaurant: {dishes} dishes')
    else:
        dishes = len(re.findall(r'"name":\s*"([^"]+)"', content))
        print(f'restaurant: {dishes} dishes')

# Restaurant 6 (multi-restaurant variant)
with open(os.path.join(PROJECT_ROOT, 'tools', 'restaurant', 'restaurant6_init.py'), 'r') as f:
    content = f.read()
    if '"set_meals"' in content:
        parts = content.split('"set_meals"')
        dishes = len(re.findall(r'"name":\s*"([^"]+)"', parts[0]))
        print(f'restaurant6: {dishes} dishes')
    else:
        dishes = len(re.findall(r'"name":\s*"([^"]+)"', content))
        print(f'restaurant6: {dishes} dishes')

# Warehouse and household have one database snapshot per video scenario.
warehouse_count = sum(
    len(getattr(warehouse_init, f'warehouse_init_data{number}')['equipment'])
    for number in range(1, 26)
)
household_count = sum(
    len(getattr(household_init, f'household_init_data{number}')['items'])
    for number in range(1, 19)
)
print(f'warehouse: {warehouse_count} equipment records across database snapshots')
print(f'household: {household_count} item records across database snapshots')

# 3. Count scenario files
print('\n=== Scenario File Statistics ===')
scenarios_dir = os.path.join(PROJECT_ROOT, 'scenarios', 'final')

# Group by scenario
scene_stats = {}
for filename in sorted(os.listdir(scenarios_dir)):
    if filename.endswith('.json'):
        # Extract scenario name (remove numeric suffix)
        scene_name = re.match(r'([a-z]+)', filename).group(1)

        if scene_name not in scene_stats:
            scene_stats[scene_name] = {'videos': set(), 'tasks': 0, 'files': 0}

        filepath = os.path.join(scenarios_dir, filename)
        with open(filepath, 'r') as f:
            data = json.load(f)
            scene_stats[scene_name]['tasks'] += len(data)
            scene_stats[scene_name]['files'] += 1
            for item in data:
                if 'image_path' in item and item['image_path']:
                    scene_stats[scene_name]['videos'].add(item['image_path'])

for scene, stats in sorted(scene_stats.items()):
    print(f"{scene}: videos={len(stats['videos'])}, tasks={stats['tasks']}, scenarios={stats['files']}")