PiloBi commited on
Commit
3905794
·
verified ·
1 Parent(s): da687e4

Upload 6 files

Browse files

由XAI Lab数据集生成引擎提供。包含5000张汽车座舱用户异常动作、行为,包含不同性别、年龄、服饰等特征,动作包含打电话、吸烟、打瞌睡等。

.gitattributes CHANGED
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ pair_5000_prompts_with_details.xlsx filter=lfs diff=lfs merge=lfs -text
csv_to_json_converter.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import json
3
+ import os
4
+ from typing import List, Dict, Any
5
+
6
+ def csv_to_json(csv_file_path: str, output_json_path: str) -> None:
7
+ """
8
+ 将CSV格式的数据集转换为JSON格式用于训练
9
+
10
+ Args:
11
+ csv_file_path: CSV文件路径
12
+ output_json_path: 输出JSON文件路径
13
+ """
14
+
15
+ data = []
16
+
17
+ with open(csv_file_path, 'r', encoding='utf-8') as csvfile:
18
+ reader = csv.DictReader(csvfile)
19
+
20
+ for row in reader:
21
+ # 构建JSON结构
22
+ json_item = {
23
+ "id": row["id"],
24
+ "prompt_en": row["prompt_en"],
25
+ "image_path": row["path"],
26
+ "persons": [
27
+ {
28
+ "person_id": 1,
29
+ "demographics": row["person1_person"],
30
+ "clothing": {
31
+ "upper_clothing": row["person1_upper_clothing"],
32
+ "upper_clothing_color": row["person1_upper_clothing_color"],
33
+ "lower_body": row["person1_lower_body"],
34
+ "lower_body_color": row["person1_lower_body_color"]
35
+ },
36
+ "accessory": row["person1_accessory"],
37
+ "behavior": row["person1_person_behavior"]
38
+ },
39
+ {
40
+ "person_id": 2,
41
+ "demographics": row["person2_person"],
42
+ "clothing": {
43
+ "upper_clothing": row["person2_upper_clothing"],
44
+ "upper_clothing_color": row["person2_upper_clothing_color"],
45
+ "lower_body": row["person2_lower_body"],
46
+ "lower_body_color": row["person2_lower_body_color"]
47
+ },
48
+ "accessory": row["person2_accessory"],
49
+ "behavior": row["person2_person_behavior"]
50
+ }
51
+ ]
52
+ }
53
+
54
+ data.append(json_item)
55
+
56
+ # 保存为JSON文件
57
+ with open(output_json_path, 'w', encoding='utf-8') as jsonfile:
58
+ json.dump(data, jsonfile, ensure_ascii=False, indent=2)
59
+
60
+ print(f"转换完成!共处理 {len(data)} 条数据")
61
+ print(f"JSON文件已保存至: {output_json_path}")
62
+
63
+ def create_training_format(csv_file_path: str, output_json_path: str) -> None:
64
+ """
65
+ 创建适合机器学习训练的简化JSON格式
66
+
67
+ Args:
68
+ csv_file_path: CSV文件路径
69
+ output_json_path: 输出JSON文件路径
70
+ """
71
+
72
+ training_data = []
73
+
74
+ with open(csv_file_path, 'r', encoding='utf-8') as csvfile:
75
+ reader = csv.DictReader(csvfile)
76
+
77
+ for row in reader:
78
+ # 简化的训练格式
79
+ training_item = {
80
+ "image_id": row["id"],
81
+ "text": row["prompt_en"],
82
+ "image_path": row["path"],
83
+ "labels": {
84
+ "person1": {
85
+ "demographics": row["person1_person"],
86
+ "upper_clothing": row["person1_upper_clothing"],
87
+ "upper_color": row["person1_upper_clothing_color"],
88
+ "lower_clothing": row["person1_lower_body"],
89
+ "lower_color": row["person1_lower_body_color"],
90
+ "accessory": row["person1_accessory"],
91
+ "behavior": row["person1_person_behavior"]
92
+ },
93
+ "person2": {
94
+ "demographics": row["person2_person"],
95
+ "upper_clothing": row["person2_upper_clothing"],
96
+ "upper_color": row["person2_upper_clothing_color"],
97
+ "lower_clothing": row["person2_lower_body"],
98
+ "lower_color": row["person2_lower_body_color"],
99
+ "accessory": row["person2_accessory"],
100
+ "behavior": row["person2_person_behavior"]
101
+ }
102
+ }
103
+ }
104
+
105
+ training_data.append(training_item)
106
+
107
+ # 保存训练格式的JSON
108
+ with open(output_json_path, 'w', encoding='utf-8') as jsonfile:
109
+ json.dump(training_data, jsonfile, ensure_ascii=False, indent=2)
110
+
111
+ print(f"训练格式转换完成!共处理 {len(training_data)} 条数据")
112
+ print(f"训练JSON文件已保存至: {output_json_path}")
113
+
114
+ def main():
115
+ # 设置文件路径
116
+ csv_file = "/Volumes/XAI测试用1号机/Cabin_behavior_dataset/pair_5000_prompts_with_details.csv"
117
+
118
+ # 检查CSV文件是否存在
119
+ if not os.path.exists(csv_file):
120
+ print(f"错误:找不到CSV文件 {csv_file}")
121
+ return
122
+
123
+ # 转换为详细JSON格式
124
+ detailed_json = "/Volumes/XAI测试用1号机/Cabin_behavior_dataset/dataset_detailed.json"
125
+ csv_to_json(csv_file, detailed_json)
126
+
127
+ # 转换为训练JSON格式
128
+ training_json = "/Volumes/XAI测试用1号机/Cabin_behavior_dataset/dataset_training.json"
129
+ create_training_format(csv_file, training_json)
130
+
131
+ print("\n转换完成!生成了两个JSON文件:")
132
+ print(f"1. 详细格式: {detailed_json}")
133
+ print(f"2. 训练格式: {training_json}")
134
+
135
+ if __name__ == "__main__":
136
+ main()
dataset_detailed.json ADDED
The diff for this file is too large to render. See raw diff
 
dataset_training.json ADDED
The diff for this file is too large to render. See raw diff
 
demo.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ id,prompt_en,person1_person,person1_upper_clothing,person1_upper_clothing_color,person1_lower_body,person1_lower_body_color,person1_accessory,person1_person_behavior,person2_person,person2_upper_clothing,person2_upper_clothing_color,person2_lower_body,person2_lower_body_color,person2_accessory,person2_person_behavior,path
2
+ img_00001,"Top-down view inside a car cockpit, two people as the main subjects: First person: adult female, wearing a sophisticated gray jacket paired with mature brown shorts, vest accessory, playing on a smartphone; Second person: elderly female, wearing a sophisticated gray hoodie paired with vibrant pink tailored trousers, vest accessory, also playing on a smartphone; clean background, realistic style, high definition, natural lighting",成年-女性,夹克,成熟稳重-灰色,短裤,成熟稳重-棕色,马夹,玩手机,老年-女性,连帽衫,成熟稳重-灰色,西装长裤,光鲜靓丽-粉色,马夹,玩手机,/Cabin_behavior_dataset/img_00001.png
3
+ img_00002,"Top-down view inside a car cabin, two people as the main subjects: First person: adult male, wearing a pure and minimalist white coat, paired with mature and sophisticated gray jeans, accessorized with a vest, sleeping; Second person: adult female, wearing a mature and sophisticated brown shirt, paired with vibrant and stylish green casual pants, accessorized with sunglasses, reading; clean background, realistic style, high definition, natural lighting",成年-男性,大衣,纯净简约-白色,牛仔长裤,成熟稳重-灰色,马夹,睡觉,成年-女性,衬衫,成熟稳重-棕色,休闲长裤,光鲜靓丽-绿色,墨镜,阅读,/Cabin_behavior_dataset/img_00002.png
4
+ img_00003,"A top-down view inside a car cockpit, featuring two people as the main subjects: First person: elderly male, wearing a pure minimalist white sweater paired with vibrant orange denim jeans, no accessories, smoking a cigarette; Second person: adult female, wearing a vibrant red hoodie paired with vibrant red tailored trousers, eyewear accessories, applying makeup; clean background, realistic style, high definition, natural lighting",老年-男性,毛衣,纯净简约-白色,牛仔长裤,光鲜靓丽-橙色,无配饰,吸烟,成年-女性,连帽衫,光鲜靓丽-红色,西装长裤,光鲜靓丽-红色,眼镜,化妆,/Cabin_behavior_dataset/img_00003.png
5
+ img_00004,"Top-down view inside a car cockpit, two people as the main subjects: First person: adult female, wearing a mature and dignified brown T-shirt paired with vibrant green straight-leg jeans, accessorized with a scarf, playing a smartphone; Second person: adult male, wearing a mature and elegant brown coat paired with sophisticated gray casual trousers, wearing a mask, smoking; clean background, realistic style, high definition, natural lighting",成年-女性,T恤,成熟稳重-棕色,牛仔长裤,光鲜靓丽-绿色,围巾,玩手机,成年-男性,大衣,成熟稳重-棕色,休闲长裤,成熟稳重-灰色,口罩,吸烟,/Cabin_behavior_dataset/img_00004.png
6
+ img_00005,"Top-down view inside a car cockpit, two elderly women as main subjects: First person: elderly female, wearing a vibrant pink jacket paired with a sophisticated purple short, no accessories, sleeping peacefully; Second person: elderly female, wearing a bright orange shirt paired with vibrant yellow tailored trousers, with a scarf as accessory, eating; clean background, realistic style, high definition, natural lighting",老年-女性,夹克,光鲜靓丽-粉色,短裤,成熟稳重-紫色,无配饰,睡觉,老年-女性,衬衫,光鲜靓丽-橙色,西装长裤,光鲜靓丽-黄色,围巾,吃东西,/Cabin_behavior_dataset/img_00005.png
pair_5000_prompts_with_details.csv ADDED
The diff for this file is too large to render. See raw diff
 
pair_5000_prompts_with_details.xlsx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a965d71e78d1e18fc88d6b5008776c927ee6a6bbd4fdb445d349ea101b6ca9cf
3
+ size 662768