KillzoneCC commited on
Commit
581cd7b
·
1 Parent(s): a034807

Порядочное действие по столбцам

Browse files
Files changed (1) hide show
  1. collect_and_upload.py +36 -14
collect_and_upload.py CHANGED
@@ -201,9 +201,9 @@ def collect_data_and_save():
201
 
202
  info_path = META_DIR / "info.json"
203
  episodes_jsonl_path = META_DIR / "episodes.jsonl"
204
-
205
- episode_idx = 0
206
- episodes_data = []
207
 
208
  # --- Определение задач (пример) ---
209
  tasks_list = [
@@ -227,19 +227,39 @@ def collect_data_and_save():
227
 
228
  if not info:
229
  info = {
230
- "codebase_version": "v1.1",
231
- "total_frames": 0,
232
  "total_episodes": 0,
233
- "episode_lengths": [],
 
 
 
 
234
  "fps": 30,
235
- "robot_type": "ainex_robot",
236
  "data_path": "data/chunk-000/episode_{episode_index:06d}.parquet",
237
  "video_path": "videos/chunk-000/observation.images.generic/episode_{episode_index:06d}.mp4",
238
  "features": {
239
- "action": { "dtype": "float32", "shape": [26] },
 
 
 
 
240
  "observation": {
241
- "joint_positions": { "dtype": "float32", "shape": [26] },
242
- "imu": { "dtype": "float32", "shape": [10] },
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  "images.generic": {
244
  "dtype": "video",
245
  "media_type": "video/mp4",
@@ -247,12 +267,12 @@ def collect_data_and_save():
247
  "shape": [480, 640, 3]
248
  }
249
  },
250
- "timestamp": { "dtype": "float64" },
251
- "frame_index": { "dtype": "int64" },
252
- "episode_index": { "dtype": "int64" }
253
  }
254
  }
255
-
256
  if episodes_jsonl_path.exists():
257
  try:
258
  with open(episodes_jsonl_path, 'r', encoding='utf-8') as f:
@@ -333,6 +353,7 @@ features:
333
  df = pd.DataFrame({
334
  'observation.images.generic': [f"../../videos/chunk-000/observation.images.generic/episode_{episode_idx:06d}.mp4"] * len(all_images_generic),
335
  'observation.joint_positions': all_joint_positions,
 
336
  'observation.imu': all_imu_data,
337
  'action.servo_commands': all_actions,
338
  'timestamp': all_timestamps,
@@ -380,6 +401,7 @@ features:
380
  df = pd.DataFrame({
381
  'observation.images.generic': [f"../../videos/chunk-000/observation.images.generic/episode_{episode_idx:06d}.mp4"] * len(all_images_generic),
382
  'observation.joint_positions': all_joint_positions,
 
383
  'observation.imu': all_imu_data,
384
  'action.servo_commands': all_actions,
385
  'timestamp': all_timestamps,
 
201
 
202
  info_path = META_DIR / "info.json"
203
  episodes_jsonl_path = META_DIR / "episodes.jsonl"
204
+
205
+ # Создаем список имен для 26 сервоприводов
206
+ joint_names = [f"servo_{i+1}" for i in range(26)]
207
 
208
  # --- Определение задач (пример) ---
209
  tasks_list = [
 
227
 
228
  if not info:
229
  info = {
230
+ "codebase_version": "v2.1",
231
+ "robot_type": "ainex_robot",
232
  "total_episodes": 0,
233
+ "total_frames": 0,
234
+ "total_tasks": len(tasks_list),
235
+ "total_videos": 0,
236
+ "total_chunks": 1,
237
+ "chunks_size": 1000,
238
  "fps": 30,
 
239
  "data_path": "data/chunk-000/episode_{episode_index:06d}.parquet",
240
  "video_path": "videos/chunk-000/observation.images.generic/episode_{episode_index:06d}.mp4",
241
  "features": {
242
+ "action": {
243
+ "dtype": "float32",
244
+ "shape": [26],
245
+ "names": joint_names
246
+ },
247
  "observation": {
248
+ "joint_positions": {
249
+ "dtype": "float32",
250
+ "shape": [26],
251
+ "names": joint_names
252
+ },
253
+ "state": {
254
+ "dtype": "float32",
255
+ "shape": [26],
256
+ "names": joint_names
257
+ },
258
+ "imu": {
259
+ "dtype": "float32",
260
+ "shape": [10],
261
+ "names": ["orientation.x", "orientation.y", "orientation.z", "orientation.w", "angular_velocity.x", "angular_velocity.y", "angular_velocity.z", "linear_acceleration.x", "linear_acceleration.y", "linear_acceleration.z"]
262
+ },
263
  "images.generic": {
264
  "dtype": "video",
265
  "media_type": "video/mp4",
 
267
  "shape": [480, 640, 3]
268
  }
269
  },
270
+ "timestamp": { "dtype": "float64", "shape": [1] },
271
+ "frame_index": { "dtype": "int64", "shape": [1] },
272
+ "episode_index": { "dtype": "int64", "shape": [1] }
273
  }
274
  }
275
+
276
  if episodes_jsonl_path.exists():
277
  try:
278
  with open(episodes_jsonl_path, 'r', encoding='utf-8') as f:
 
353
  df = pd.DataFrame({
354
  'observation.images.generic': [f"../../videos/chunk-000/observation.images.generic/episode_{episode_idx:06d}.mp4"] * len(all_images_generic),
355
  'observation.joint_positions': all_joint_positions,
356
+ 'observation.state': all_joint_positions, # Используем те же данные для state
357
  'observation.imu': all_imu_data,
358
  'action.servo_commands': all_actions,
359
  'timestamp': all_timestamps,
 
401
  df = pd.DataFrame({
402
  'observation.images.generic': [f"../../videos/chunk-000/observation.images.generic/episode_{episode_idx:06d}.mp4"] * len(all_images_generic),
403
  'observation.joint_positions': all_joint_positions,
404
+ 'observation.state': all_joint_positions, # Используем те же данные для state
405
  'observation.imu': all_imu_data,
406
  'action.servo_commands': all_actions,
407
  'timestamp': all_timestamps,