File size: 24,998 Bytes
8221873 | 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | # LeRobot v3.0 Conversion Plan for PiPER Picking Tests Dataset
## Executive Summary
Converting piper_picking_tests from HDF5+PNG format to LeRobot v3.0 (Parquet+MP4) for VLA fine-tuning.
**VERIFIED Dataset Stats (from actual files):**
- Episodes: 13
- Tasks: 12 (unique picking tasks)
- Total frames: 5,016
- Cameras: 2 (table_cam 800×720, wrist_cam **1280×720**)
- FPS: **11-12 FPS** (verified from actual timestamps, NOT 30!)
- Robot: 7-DOF arm
- Current size: ~480 MB (PNG images + HDF5)
- Expected output: ~150-200 MB (compressed MP4)
- **Dependencies:** LeRobot v0.4.3, PyAV 15.1.0, PyTorch 2.7.1 (all installed ✅)
**Data Sources:**
- **State/Action/Timestamps**: HDF5 files (`observation/state`, `action`, `timestamp`)
- **Images**: PNG files referenced by paths in HDF5
- **FPS**: Calculated from actual timestamp data
**Strategy:** LIBERO multi-task approach with separate tasks.parquet and task_index in frames.
**Reference:** See `lerobotv3_format_explanation.md` for complete v3.0 format knowledge.
## Current Format (VERIFIED)
### Actual File Organization
```
piper_picking_tests/
├── {episode_name}_{timestamp}.hdf5 # 13 files, 58-98 KB each
├── {episode_name}_{timestamp}.json # Episode metadata (optional, not used)
└── {task_name}_images/ # 12 folders (NOTE: task name, NOT episode name!)
├── observation.images.table_cam/ # PNG frames (800×720), frame_000000.png format
└── observation.images.wrist_cam/ # PNG frames (1280×720), frame_000000.png format
```
**IMPORTANT:** Image folder naming uses task name only (e.g., `cleaningcloth_images`), not full episode name with timestamp!
### HDF5 Structure (VERIFIED from pencil episode)
```python
observation/state # [n_frames, 7] float32 - joint angles in degrees
action # [n_frames, 7] float32 - commands
timestamp # [n_frames] float64 - frame timestamps in seconds
episode_index # [n_frames] int64 - all same value per episode
observation/images/table_cam # [n_frames] object - paths to PNG files
observation/images/wrist_cam # [n_frames] object - paths to PNG files
```
**Key Finding:** HDF5 stores **PATHS** to images, not the images themselves!
- Example: `b'cleaningcloth_images/observation.images.table_cam/frame_000000.png'`
- Images are separate PNG files at 800×720 (table) and 1280×720 (wrist)
- **Image naming:** Current format uses `frame_000000.png` (underscore), but LeRobot's `encode_video_frames` expects `frame-000000.png` (dash)
- **Solution:** Copy/rename images during conversion to match required format
### Verified Episode List
```python
EPISODES = {
'cleaningcloth_20251104_205021': (168 frames, 14.6s),
'fillamentroll_20251104_204834': (276 frames, 23.1s),
'gamecontroller_20251104_203816': (335 frames, 25.0s),
'hexwrench_20251104_204002': (333 frames, 24.4s),
'pencil_20251104_205415': (297 frames, 23.2s),
'scissors_20251104_204120': (290 frames, 21.0s),
'scissors_hidden_20251104_205751': (358 frames, 28.6s),
'screwdriver_20251104_203022': (324 frames, 24.8s),
'smallkey_20251104_203257': (529 frames, 39.7s),
'smallpaper_20251104_203636': (429 frames, 31.2s),
'smallwoodenstick_20251104_204353': (485 frames, 34.4s),
'thinmetaldisk_20251104_204557': (764 frames, 55.5s),
'thinmetaldisk_20251104_204721': (428 frames, 30.7s),
}
# Total: 5,016 frames
```
### Image Resolution (CORRECTED)
- **table_cam**: 800×720 (W×H) RGB PNG
- **wrist_cam**: 1280×720 (W×H) RGB PNG ← **NOT 640×480!**
- File sizes: ~387 KB (table), ~619 KB (wrist) per frame
- Total images per episode: 2 × n_frames PNG files
## Target v3.0 Structure
```
piper_picking_tests_v3/
├── meta/
│ ├── info.json # Dataset configuration
│ ├── stats.json # Aggregated statistics
│ ├── tasks.parquet # 12 task descriptions (LIBERO style)
│ └── episodes/
│ └── chunk-000/
│ └── file-000.parquet # 13 episode metadata (NO tasks field)
├── data/
│ └── chunk-000/
│ └── file-000.parquet # All 5,016 frames (WITH task_index)
└── videos/
├── observation.images.table_cam/
│ └── chunk-000/
│ ├── file-000.mp4 # Episode 0 (cleaningcloth)
│ ├── file-001.mp4 # Episode 1 (fillamentroll)
│ └── ... # 13 videos total
└── observation.images.wrist_cam/
└── chunk-000/
└── ... # 13 videos total
```
### Why LIBERO Multi-Task Approach?
**Chosen because:**
- ✅ 12 distinct tasks (multi-task dataset)
- ✅ Clean task management via tasks.parquet
- ✅ Explicit task conditioning with task_index
- ✅ Scalable for adding more tasks
- ✅ One video per episode (flexible loading)
### Video Encoding Strategy
**Using LeRobot's built-in `encode_video_frames` function (recommended):**
```python
from lerobot.datasets.video_utils import encode_video_frames
import shutil
from pathlib import Path
def prepare_and_encode_video(image_paths, output_path, fps=12, temp_dir=None):
"""
Prepare images and encode to MP4 using LeRobot's encode_video_frames.
NOTE: encode_video_frames expects images named 'frame-XXXXXX.png' (dash, not underscore)
"""
temp = Path(temp_dir) if temp_dir else Path(output_path).parent / "temp_frames"
temp.mkdir(parents=True, exist_ok=True)
# Copy images with correct naming (frame-XXXXXX.png)
for i, src_path in enumerate(image_paths):
dst = temp / f"frame-{i:06d}.png"
shutil.copy(src_path, dst)
# Encode using LeRobot's function
encode_video_frames(
imgs_dir=temp,
video_path=output_path,
fps=fps,
vcodec="libsvtav1", # AV1 codec (default)
pix_fmt="yuv420p",
crf=30, # Quality (lower = better, 0-51)
overwrite=True
)
# Cleanup temp directory
shutil.rmtree(temp)
```
**✅ TESTED and VERIFIED:**
- 10 frames (800×720) encoded to 0.10 MB MP4 using libsvtav1
- Video properties: 800×720, AV1 codec (libdav1d decoder)
- Encoding parameters: YUV420, CRF 30, GOP 2
**Expected compression:**
- PNG: ~480 MB total (all episodes, both cameras)
- MP4 (libsvtav1): ~150-200 MB total (60-70% compression)
- Per episode: ~6-12 MB per camera, both cameras)
- MP4 (av1): ~150-200 MB total (60-70% compression)
- Per episode: ~6-12 MB per camera
## Conversion Requirements
### 1. Task Language Descriptions (CRITICAL for VLA)
**Current:** Task names only (`"screwdriver"`, `"scissors"`)
**Required:** Natural language instructions for VLA models (SmolVLA, Pi0, XVLA)
```python
TASK_LANGUAGE_MAP = {
0: "Pick up the cleaning cloth from the table.",
1: "Grasp and pick up the filament roll.",
2: "Pick up the game controller from the table.",
3: "Pick up the hex wrench tool.",
4: "Grasp and pick up the pencil.",
5: "Pick up the scissors from the table.",
6: "Find and pick up the scissors that are partially hidden.",
7: "Pick up the screwdriver from the table.",
8: "Grasp and pick up the small key.",
9: "Pick up the small piece of paper.",
10: "Pick up the small wooden stick.",
11: "Pick up the thin metal disk.",
}
```
**Episode-to-task mapping:**
```python
EPISODE_TO_TASK = {
'cleaningcloth_20251104_205021': 0,
'fillamentroll_20251104_204834': 1,
'gamecontroller_20251104_203816': 2,
'hexwrench_20251104_204002': 3,
'pencil_20251104_205415': 4,
'scissors_20251104_204120': 5,
'scissors_hidden_20251104_205751': 6,
'screwdriver_20251104_203022': 7,
'smallkey_20251104_203257': 8,
'smallpaper_20251104_203636': 9,
'smallwoodenstick_20251104_204353': 10,
'thinmetaldisk_20251104_204557': 11,
'thinmetaldisk_20251104_204721': 11, # Same task, different demo
}
```
### 2. Create tasks.parquet
Task descriptions as DataFrame INDEX (LIBERO style):
```python
import pandas as pd
# Create tasks DataFrame
tasks_data = {'task_index': list(range(12))}
task_descriptions = list(TASK_LANGUAGE_MAP.values())
tasks_df = pd.DataFrame(tasks_data, index=task_descriptions)
# Save to parquet
tasks_df.to_parquet('meta/tasks.parquet')
```
### 3. Data Parquet Schema
Frame-level data with task_index:
```python
{
'observation.state': float32[7], # Joint angles
'action': float32[7], # Commands
'timestamp': float32, # Frame time
'frame_index': int64, # Frame in episode
'episode_index': int64, # Which episode
'index': int64, # Global frame index
'task_index': int64, # Maps to tasks.parquet ← CRITICAL!
'next.done': bool # Last frame marker
}
```
### 4. Episode Metadata Schema
NO tasks field (LIBERO approach):
```python
{
'episode_index': int64,
'length': int64, # Number of frames
# Data file mappings
'data/chunk_index': 0,
'data/file_index': 0,
'dataset_from_index': int64,
'dataset_to_index': int64,
# Video file mappings (per camera)
'videos/observation.images.table_cam/chunk_index': 0,
'videos/observation.images.table_cam/file_index': int64,
'videos/observation.images.table_cam/from_timestamp': float,
'videos/observation.images.table_cam/to_timestamp': float,
# Per-episode statistics
'stats/action/min': float32[7],
'stats/action/max': float32[7],
// ... other stats
}
```
### Step 1: Setup
```python
import h5py
import json
import pandas as pd
import numpy as np
from pathlib import Path
from PIL import Image
import shutil
import tempfile
# CORRECT import paths for LeRobot v0.4.3
from lerobot.datasets.lerobot_dataset import LeRobotDataset
from lerobot.datasets.video_utils import encode_video_frames
# Dependencies (ALL INSTALLED ✅)
# - lerobot v0.4.3 (installed from local repo)
# - av 15.1.0 (PyAV for video encoding)
"observation.images.table_cam": {
"dtype": "video",
"shape": [720, 800, 3], # Height × Width × Channels
"names": ["height", "width", "channel"],
"video_info": {
"video.fps": 12.0, # ACTUAL FPS from timestamps (not 30!)
"video.codec": "libsvtav1", # CORRECT codec name
"video.pix_fmt": "yuv420p",
"video.is_depth_map": False,
"has_audio": False
}
},
"observation.images.wrist_cam": {
"dtype": "video",
"shape": [720, 1280, 3], # Height × Width × Channels ← CORRECTED!
"names": ["height", "width", "channel"],
"video_info": {
"video.fps": 12.0, # ACTUAL FPS from timestamps (not 30!)
"video.codec": "libsvtav1", # CORRECT codec name
"video.pix_fmt": "yuv420p",
"video.is_depth_map": False,
"has_audio": False
}
}, "video_info": {
"video.fps": 30.0,
"video.codec": "av1",
"video.pix_fmt": "yuv420p",
"video.is_depth_map": False,
"has_audio": False
}
},
"observation.images.wrist_cam": {
"dtype": "video",
"shape": [720, 1280, 3], # Height × Width × Channels ← CORRECTED!
"names": ["height", "width", "channel"],
"video_info": {
"video.fps": 30.0,
"video.codec": "av1",
"video.pix_fmt": "yuv420p",
"video.is_depth_map": False,
"has_audio": False
}
},
"observation.state": {
"dtype": "float32",
"shape": [7],
"names": {"motors": ["joint_1", "joint_2", "joint_3", "joint_4",
"joint_5", "joint_6", "joint_7"]},
"fps": 30.0
},
"action": {
"dtype": "float32",
"shape": [7],
"names": {"motors": ["joint_1", "joint_2", "joint_3", "joint_4",
"joint_5", "joint_6", "joint_7"]},
"fps": 30.0
},
"episode_index": {"dtype": "int64", "shape": [1], "names": None, "fps": 30.0},
"frame_index": {"dtype": "int64", "shape": [1], "names": None, "fps": 30.0},
"timestamp": {"dtype": "float32", "shape": [1], "names": None, "fps": 30.0},
"next.done": {"dtype": "bool", "shape": [1], "names": None, "fps": 30.0},
"index": {"dtype": "int64", "shape": [1], "names": None, "fps": 30.0},
"task_index": {"dtype": "int64", "shape": [1], "names": None, "fps": 30.0},
}
```
### Step 3: Create Tasks Parquet (LIBERO Style)
```python
def create_tasks_parquet(output_dir):
"""Create meta/tasks.parquet with task descriptions as index."""
task_descriptions = [
"Pick up the cleaning cloth from the table.",
"Grasp and pick up the filament roll.",
"Pick up the game controller from the table.",
"Pick up the hex wrench tool.",
"Grasp and pick up the pencil.",
"Pick up the scissors from the table.",
"Find and pick up the scissors that are partially hidden.",
"Pick up the screwdriver from the table.",
"Grasp and pick up the small key.",
"Pick up the small piece of paper.",
"Pick up the small wooden stick.",
"Pick up the thin metal disk.",
]
tasks_data = {'task_index': list(range(12))}
tasks_df = pd.DataFrame(tasks_data, index=task_descriptions)
output_path = Path(output_dir) / 'meta' / 'tasks.parquet'
output_path.parent.mkdir(parents=True, exist_ok=True)
tasks_df.to_parquet(output_path)
print(f"Created {output_path}")
```
### Step 4: Main Conversion Function
```python
def convert_piper_to_lerobot_v3(
source_path: Path,
output_path: Path,
repo_id: str = "your_username/piper_picking_tests"
):
"""Convert PiPER dataset to LeRobot v3.0 format."""
# Episode to task mapping (from verified data)
EPISODE_TO_TASK = {
'cleaningcloth_20251104_205021': 0,
'fillamentroll_20251104_204834': 1,
'gamecontroller_20251104_203816': 2,
'hexwrench_20251104_204002': 3,
'pencil_20251104_205415': 4,
'scissors_20251104_204120': 5,
'scissors_hidden_20251104_205751': 6,
'screwdriver_20251104_203022': 7,
'smallkey_20251104_203257': 8,
# Create dataset
dataset = LeRobotDataset.create(
repo_id=repo_id,
fps=12, # ACTUAL FPS from timestamp analysis
features=PIPER_FEATURES,
root=output_path,
robot_type="piper",
use_videos=True,
)
# Create dataset
dataset = LeRobotDataset.create(
repo_id=repo_id,
fps=30,
features=PIPER_FEATURES,
root=output_path,
robot_type="piper",
use_videos=True,
)
# Process each episode
for ep_idx, ep_name in enumerate(episodes):
print(f"\nProcessing episode {ep_idx}: {ep_name}")
task_idx = EPISODE_TO_TASK[ep_name]
# Load HDF5 data
hdf5_path = source_path / f"{ep_name}.hdf5"
with h5py.File(hdf5_path, 'r') as f:
# Load arrays from HDF5
states = f['observation/state'][:]
actions = f['action'][:]
timestamps = f['timestamp'][:]
n_frames = len(timestamps)
# Get image paths from HDF5
table_paths = [p.decode('utf-8') for p in f['observation/images/table_cam'][:]]
wrist_paths = [p.decode('utf-8') for p in f['observation/images/wrist_cam'][:]]
print(f" Frames: {n_frames}, Task: {task_idx}")
# Add frames
for frame_idx in range(n_frames):
# Load images from paths stored in HDF5
# NOTE: Paths use task name (e.g., cleaningcloth_images), not episode name
table_img_path = source_path / table_paths[frame_idx]
wrist_img_path = source_path / wrist_paths[frame_idx]
# Verify files exist
if not table_img_path.exists():
raise FileNotFoundError(f"Missing table image: {table_img_path}")
if not wrist_img_path.exists():
raise FileNotFoundError(f"Missing wrist image: {wrist_img_path}")
table_img = Image.open(table_img_path)
wrist_img = Image.open(wrist_img_path)
frame = {
"observation.state": states[frame_idx],
"action": actions[frame_idx],
"observation.images.table_cam": np.array(table_img),
"observation.images.wrist_cam": np.array(wrist_img),
"timestamp": timestamps[frame_idx],
"next.done": frame_idx == n_frames - 1,
"task_index": task_idx, # LIBERO approach
}
dataset.add_frame(frame)
# Save episode (NO task parameter - we use task_index in frames)
dataset.save_episode()
print(f" ✓ Saved {n_frames} frames")
# Create tasks.parquet
create_tasks_parquet(output_path)
# Finalize dataset
print("\nFinalizing dataset...")
dataset.finalize()
print("Conversion complete!")
return dataset
# Usage
if __name__ == "__main__":
source = Path("/home/charith/projects/PiPER/piper_picking_tests")
output = Path("/home/charith/projects/PiPER/piper_picking_tests_v3")
dataset = convert_piper_to_lerobot_v3(source, output)
```
### Step 5: Validation
```python
def validate_dataset(dataset_path):
"""Validate converted dataset."""
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
# Load dataset
dataset = LeRobotDataset(str(dataset_path))
print(f"Total episodes: {dataset.num_episodes}")
print(f"Total frames: {dataset.num_frames}")
print(f"Total tasks: {len(dataset.meta.tasks) if hasattr(dataset.meta, 'tasks') else 'N/A'}")
# Check tasks.parquet
tasks_path = dataset_path / 'meta' / 'tasks.parquet'
if tasks_path.exists():
tasks_df = pd.read_parquet(tasks_path)
print(f"\nTasks parquet: {len(tasks_df)} tasks")
print(tasks_df.head())
# Load sample episode
sample = dataset[0]
print(f"\nSample frame keys: {sample.keys()}")
print(f"Task index: {sample.get('task_index', 'NOT FOUND')}")
# Check video playback
print(f"\nVideo shapes:")
for key in sample.keys():
if 'image' in key:
print(f" {key}: {sample[key].shape}")
return dataset
```
## Testing Plan
### Phase 1: Single Episode Test (30 min)
```bash
# Test on screwdriver episode only
python convert_script.py --episode screwdriver_20251104_203022
```
**Validate:**
- [ ] HDF5 data loads correctly (observation/state, action, timestamp)
- [ ] Images load and convert to video
- [ ] task_index assigned correctly
- [ ] Episode metadata has file mappings
- [ ] Can load with LeRobotDataset
### Phase 2: Full Conversion (1-2 hours)
```bash
# Convert all 13 episodes
python convert_script.py --all
```
**Validate:**
- [ ] All 13 episodes present
- [ ] 5,016 total frames
- [ ] tasks.parquet has 12 tasks
- [ ] Video quality acceptable
- [ ] File sizes reasonable (~210 MB total)
### Phase 3: VLA Compatibility Test
```python
# Test with VLA model loading
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
dataset = LeRobotDataset("path/to/piper_picking_tests_v3")
# Check task conditioning
sample = dataset[0]
assert 'task_index' in sample
print(f"Task: {dataset.meta.tasks.iloc[sample['task_index']].name}")
# Try loading with VLA model
# from lerobot.common.policies.vla import SmolVLA
# model = SmolVLA(...)
# model.select_action(sample)
```
## Expected Outcomes
### File Structure
```
piper_picking_tests_v3/ (~150-200 MB total)
├── meta/
│ ├── info.json (~10 KB)
│ ├── stats.json (~2 KB)
│ ├── tasks.parquet (~5 KB)
│ └── episodes/
│ └── chunk-000/
│ └── file-000.parquet (~50 KB)
├── data/
│ └── chunk-000/
│ └── file-000.parquet (~400 KB)
└── videos/
├── observation.images.table_cam/
│ └── chunk-000/
│ └── file-000.mp4 to file-012.mp4 (~75 MB total)
└── observation.images.wrist_cam/
└── chunk-000/
└── file-000.mp4 to file-012.mp4 (~120 MB total)
```
### Statistics
### Dependencies Installed ✅
- ✅ **LeRobot v0.4.3** - Installed in editable mode from `/home/charith/projects/PiPER/lerobot`
- ✅ **PyAV 15.1.0** - Video encoding/decoding (downgraded from 16.0.1 for compatibility)
- ✅ **PyTorch 2.7.1** - Deep learning framework with CUDA 12.6
- ✅ **torchvision 0.22.1** - Image/video processing
## Next Steps
1. ✅ **Knowledge documented** in `lerobotv3_format_explanation.md`
2. ✅ **Conversion plan created** (this file)
3. ✅ **Dependencies installed** - LeRobot v0.4.3, PyAV 15.1.0, PyTorch 2.7.1
4. ✅ **Strategy validated** - End-to-end pipeline tested with 10 frames
5. ✅ **Video encoding verified** - libsvtav1 codec produces correct output
6. ⏭️ **Implement full conversion script**
7. ⏭️ **Test on single episode** (cleaningcloth or pencil)
8. ⏭️ **Debug and refine**
9. ⏭️ **Run full conversion** (all 13 episodes)
10. ⏭️ **Validate with VLA models**
11. ⏭️ **(Optional) Push to Hugging Face Hub**)
- **Metadata**: <100 KB total
### Dependencies Installed
- ✅ PyAV (av) - Video encoding/decoding
- ✅ OpenCV (cv2) - Already available
- ✅ h5py, pillow, pandas, pyarrow - Already installed
## Next Steps
1. ✅ **Knowledge documented** in `lerobotv3_format_explanation.md`
2. ✅ **Conversion plan created** (this file)
3. ⏭️ **Implement conversion script**
4. ⏭️ **Test on single episode**
5. ⏭️ **Debug and refine**
6. ⏭️ **Run full conversion**
7. ⏭️ **Validate with VLA models**
8. ⏭️ **(Optional) Push to Hugging Face Hub**
### Critical for Success
- ✅ Use LIBERO approach (tasks.parquet + task_index in frames)
- ✅ Natural language task descriptions (not just labels!)
- ✅ Correct HDF5 paths: `observation/state` (singular)
- ✅ One video per episode (13 files per camera)
- ✅ task_index in every frame
- ✅ NO tasks field in episode metadata
- ✅ **Correct import paths:** `lerobot.datasets.*` (NOT `lerobot.common.datasets.*`)
- ✅ **Actual FPS:** 11-12 FPS (calculate from timestamps, don't assume 30)
- ✅ **Image folder naming:** Uses task name only, not full episode name
- ✅ **Image renaming:** Copy `frame_XXXXXX.png` → `frame-XXXXXX.png` for encode_video_frames
- ✅ **Codec name:** `libsvtav1` (not just `av1`)tate` (singular)
- ✅ One video per episode (13 files per camera)
- ✅ task_index in every frame
- ✅ NO tasks field in episode metadata
### Common Mistakes to Avoid
- ❌ Using `observations/state` instead of `observation/state`
- ❌ Using task names instead of language descriptions
- ❌ Adding tasks field to episodes (SVLA style, not needed for LIBERO)
- ❌ Forgetting task_index in frames
- ❌ Consolidating all videos into one file (use one per episode for multi-task)
**Last Updated:** December 10, 2025
---
## Testing Summary (December 10, 2025)
### ✅ Pipeline Validation Complete
**Test Episode:** cleaningcloth_20251104_205021 (168 frames)
**Results:**
1. ✅ **All imports successful** - LeRobotDataset, encode_video_frames, PyAV, h5py, PIL
2. ✅ **HDF5 data loading** - States (168,7), Actions (168,7), Timestamps (168) all loaded correctly
3. ✅ **Image path resolution** - Successfully read paths from HDF5 and loaded PNG files
4. ✅ **Video encoding** - 10 frames encoded to 0.10 MB MP4 using libsvtav1 codec
5. ✅ **Video verification** - Output is 800×720, AV1 codec (libdav1d), playable
6. ✅ **FPS calculation** - Actual FPS is 11.53 (NOT 30 as initially assumed!)
**Key Findings:**
- Calculated FPS from timestamps: **11.53 FPS** (episode duration 14.6s for 168 frames)
- Video codec: libsvtav1 (SVT-AV1 Encoder v3.0.0)
- Encoding parameters: Preset M10, CRF 30, YUV420, 800×720
- Compression: 10 frames = 0.10 MB (excellent compression ratio)
- Image paths in HDF5 use task name: `cleaningcloth_images/...` (not full episode name)
**Next Action:** Create full conversion script and test with complete episode
## References
- **Complete format knowledge**: `lerobotv3_format_explanation.md`
- [LeRobot v3.0 Documentation](https://huggingface.co/docs/lerobot/lerobot-dataset-v3)
- [Porting Datasets Guide](https://huggingface.co/docs/lerobot/porting_datasets_v3)
- [DROID Example](https://github.com/huggingface/lerobot/blob/main/examples/port_datasets/port_droid.py)
**Last Updated:** December 2025
|