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)
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'sencode_video_framesexpectsframe-000000.png(dash) - Solution: Copy/rename images during conversion to match required format
Verified Episode List
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):
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)
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:
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):
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:
{
'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):
{
'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
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)
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
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
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)
# 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)
# 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
# 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
- ✅ Knowledge documented in
lerobotv3_format_explanation.md - ✅ Conversion plan created (this file)
- ✅ Dependencies installed - LeRobot v0.4.3, PyAV 15.1.0, PyTorch 2.7.1
- ✅ Strategy validated - End-to-end pipeline tested with 10 frames
- ✅ Video encoding verified - libsvtav1 codec produces correct output
- ⏭️ Implement full conversion script
- ⏭️ Test on single episode (cleaningcloth or pencil)
- ⏭️ Debug and refine
- ⏭️ Run full conversion (all 13 episodes)
- ⏭️ Validate with VLA models
- ⏭️ (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
- ✅ Knowledge documented in
lerobotv3_format_explanation.md - ✅ Conversion plan created (this file)
- ⏭️ Implement conversion script
- ⏭️ Test on single episode
- ⏭️ Debug and refine
- ⏭️ Run full conversion
- ⏭️ Validate with VLA models
- ⏭️ (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.*(NOTlerobot.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.pngfor encode_video_frames - ✅ Codec name:
libsvtav1(not justav1)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/stateinstead ofobservation/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:
- ✅ All imports successful - LeRobotDataset, encode_video_frames, PyAV, h5py, PIL
- ✅ HDF5 data loading - States (168,7), Actions (168,7), Timestamps (168) all loaded correctly
- ✅ Image path resolution - Successfully read paths from HDF5 and loaded PNG files
- ✅ Video encoding - 10 frames encoded to 0.10 MB MP4 using libsvtav1 codec
- ✅ Video verification - Output is 800×720, AV1 codec (libdav1d), playable
- ✅ 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
- Porting Datasets Guide
- DROID Example
Last Updated: December 2025