| import json | |
| with open( | |
| "/mnt/bn/ziyang-storage-cloudnative-hl/VideoSimpleQA/o4-mini-2025-04-16_lvbench_agent_results.json", | |
| "r", | |
| ) as f: | |
| data = json.load(f) | |
| # print(data[0]) | |
| # import pdb; pdb.set_trace() | |
| # print(data[1]) | |
| frames_count = [] | |
| # for d in data: | |
| # num_frames = 0 | |
| # for turn in d["agent_conversation"]: | |
| # if turn["role"] == "assistant" and turn["tool_calls"]: | |
| # for tool_call in turn["tool_calls"]: | |
| # frame_ids = json.loads(tool_call["function"]["arguments"])["frame_ids"] | |
| # num_frames += len(frame_ids) | |
| # frames_count.append(num_frames) | |
| for d in data: | |
| num_frames = 0 | |
| for turn in d["agent_conversation"]: | |
| if turn["role"] == "user" and type(turn['content']) == list: | |
| for item in turn['content']: | |
| if item['type'] == 'image_url': | |
| num_frames += 1 | |
| frames_count.append(num_frames) | |
| print(f"mean frames: {sum(frames_count) / len(frames_count)}") | |
| print(f"max frames: {max(frames_count)}") | |
| print(f"min frames: {min(frames_count)}") | |