| import pandas as pd |
| import os |
|
|
| |
| TASK_TYPE_TO_ABBR = { |
| "Object Perception": "OP", |
| "Causal Reasoning": "CR", |
| "Clips Summarize": "CS", |
| "Attribute Perception": "ATP", |
| "Event Understanding": "EU", |
| "Text-Rich Understanding": "TR", |
| "Prospective Reasoning": "PR", |
| "Spatial Understanding": "SU", |
| "Action Perception": "ACP", |
| "Counting": "CT" |
| } |
|
|
| def split_by_task_type(input_file, output_dir="."): |
| """ |
| 读取 input_file,按 task_type 分组,保存为多个 CSV 文件。 |
| 文件名格式:Real_Time_Visual_Understanding_<缩写>.csv |
| """ |
| |
| df = pd.read_csv(input_file, encoding='utf-8') |
| |
| |
| os.makedirs(output_dir, exist_ok=True) |
| |
| |
| task_types = df['task_type'].unique() |
| |
| for task in task_types: |
| |
| abbr = TASK_TYPE_TO_ABBR.get(task, task.replace(' ', '_')) |
| |
| sub_df = df[df['task_type'] == task] |
| |
| out_file = os.path.join(output_dir, f"Real_Time_Visual_Understanding_{abbr}.csv") |
| |
| sub_df.to_csv(out_file, index=False, encoding='utf-8') |
| print(f"已保存 {len(sub_df)} 条记录到 {out_file}") |
|
|
| if __name__ == "__main__": |
| |
| input_csv = "/root/dataset/videoqa/StreamingBench/StreamingBench/Real_Time_Visual_Understanding_copy.csv" |
| split_by_task_type(input_csv) |