Downloads · 30 days
0
ShubhamRasal/pi0-ego-pipeline
pi0-ego-pipeline is a machine learning model from ShubhamRasal. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
[](https://huggingface.co/ShubhamRasal/pi0-ego-pipeline)
Downloads · 30 days
0
Access
Public
Updated May 7, 2026
Repo size
—
Likes
2
Public
Click a slice to open those files.
.py74.5 KB · 86%
From the Hugging Face model README
Extract hand poses from egocentric video (e.g., Build AI's Egocentric-100K) and convert to LeRobot v3.0 format for π₀.₅ VLA fine-tuning.
This pipeline:
observation.state + action columnsEgocentric Video (.mp4)
│
▼
┌─────────────────────────────┐
│ HandPoseExtractor │ ── MediaPipe Hands ──
│ (mediapipe) │ 21 landmarks, wrist pose, rot6D
└─────────────────────────────┘
│
▼
┌─────────────────────────────┐
│ ActionComputer │ ── Action deltas ──
│ (deltas + chunking) │ 50-step chunks, relative actions
└─────────────────────────────┘
│
▼
┌─────────────────────────────┐
│ LeRobotDatasetBuilder │ ── LeRobot v3.0 format ──
│ (parquet + mp4) │ meta/info.json + data/ + videos/
└─────────────────────────────┘
│
▼
LeRobot v3.0 Dataset ──► π₀.₅ fine-tuning
git clone https://huggingface.co/ShubhamRasal/pi0-ego-pipeline
cd pi0-ego-pipeline
pip install -e .
Note: Uses
mediapipe==0.10.18(legacy solutions API) for headless compatibility. Newer versions require GPU libraries that may not be available in all environments.
python examples/process_local_video.py \
--video /path/to/egocentric_video.mp4 \
--output ./output_dataset \
--task "pick up object" \
--sample-fps 3.0 \
--chunk-size 50 \
--action-dim 32 \
--state-dim 32
python examples/process_buildai_batch.py \
--video_dir /path/to/egocentric/videos \
--output ./buildai_dataset \
--task_map tasks.json \
--sample-fps 3.0 \
--chunk-size 50
Where tasks.json maps video filenames to task descriptions:
{
"factory001_worker001_000000.mp4": "assemble component",
"factory001_worker001_000001.mp4": "move package"
}
python scripts/process_hf_sample.py \
--hf_dataset Voxel51/Egocentric_10K_subset \
--output_dir ./hf_sample_output \
--repo_id ShubhamRasal/ego-pi0-sample \
--num_samples 5 \
--sample-fps 3.0 \
--chunk-size 4
# Single video
python -m pi0_ego_pipeline.main single \
--video my_video.mp4 \
--output ./dataset \
--task "perform manipulation"
# Batch from JSON list
python -m pi0_ego_pipeline.main batch \
--video-list videos.json \
--output ./dataset
from pi0_ego_pipeline.dataset_builder import EpisodeConfig, LeRobotDatasetBuilder
config = EpisodeConfig(
video_path="/data/egocentric.mp4",
output_dir="./dataset",
task_description="pick up the blue cube",
sample_fps=3.0,
chunk_size=50,
action_dim=32,
state_dim=32,
)
builder = LeRobotDatasetBuilder(config)
result = builder.process_episode("/data/egocentric.mp4", episode_idx=0)
builder.finalize(tasks=["pick up the blue cube"])
dataset/
├── meta/
│ ├── info.json # Schema: state(32), action(32), ego_0_rgb video
│ ├── stats.json # 1%/99% quantile normalization
│ ├── tasks.parquet # Task descriptions
│ └── episodes/
│ └── chunk-000/
│ └── file-000.parquet
├── data/
│ └── chunk-000/
│ └── file-000.parquet # observation.state, action, timestamp, frame_index
└── videos/
└── observation.images.ego_0_rgb/
└── chunk-000/
└── file-000.mp4 # 224×224 @ 3 FPS
| Component | Dimensions | Description |
|---|---|---|
observation.state | 10 (zero-pad to 32) | wrist_pos(3) + wrist_rot6d(6) + gripper(1) |
action | 503 + 506 + 50 = 500 (zero-pad to 32*) | trans_deltas + rot_deltas + gripper_deltas |
Note: chunk_size=50 produces action dimension >32. For π₀.₅, use chunk_size=4 to fit within 32D: 43 + 46 + 4 = 40, or use a custom action head.
After dataset creation, push to HuggingFace and fine-tune:
# Upload dataset to HF
python -c "
from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
folder_path='./output_dataset',
repo_id='your-username/your-dataset',
repo_type='dataset'
)
"
# Fine-tune π₀.₅
lerobot-train \
--dataset.repo_id=your-username/your-dataset \
--policy.type=pi05 \
--policy.pretrained_path=lerobot/pi05_base \
--policy.dtype=bfloat16 \
--policy.gradient_checkpointing=true \
--steps=3000 \
--batch_size=32
builddotai/Egocentric-100K is a gated dataset — you need access approval. Once approved:
from datasets import load_dataset
import os
# Set your HF token
os.environ["HF_TOKEN"] = "your_token_here"
# Load dataset (streaming recommended for 100K hours / 24.7 TB)
ds = load_dataset("builddotai/Egocentric-100K", streaming=True, split="train")
# Iterate and save video files locally
for i, sample in enumerate(ds):
video_bytes = sample["mp4"]
metadata = sample["json"]
# Save to local file
with open(f"video_{i:06d}.mp4", "wb") as f:
f.write(video_bytes)
print(f"Saved video {i}: {metadata}")
Then process with the batch script:
python examples/process_buildai_batch.py \
--video_dir ./downloaded_videos \
--output ./buildai_lerobot_dataset \
--sample-fps 3.0 \
--chunk-size 50
pi0-ego-pipeline/
├── src/pi0_ego_pipeline/
│ ├── __init__.py
│ ├── extractor.py # MediaPipe Hands → wrist pose
│ ├── action_computer.py # Action deltas + chunking
│ ├── dataset_builder.py # LeRobot v3.0 output
│ └── main.py # CLI entrypoint
├── scripts/
│ └── process_hf_sample.py # HF dataset sample processor
├── examples/
│ ├── process_local_video.py # Single video example
│ └── process_buildai_batch.py # Batch processing example
├── test_pipeline.py # Unit tests
├── requirements.txt
├── setup.py
└── README.md
This pipeline follows the approach from recent egocentric-to-robot papers:
| Resource | Link |
|---|---|
| π₀.₅ Paper | arXiv:2504.16054 |
| π₀.₅ Base Model | lerobot/pi05_base |
| EgoVLA Paper | arXiv:2507.12440 |
| EgoMimic Paper | arXiv:2410.24221 |
| VITRA Paper | arXiv:2510.21571 |
| Build AI Dataset | builddotai/Egocentric-100K |
| LeRobot | https://github.com/huggingface/lerobot |
If you use this pipeline in your research, please cite the relevant papers:
@article{black2025pi05,
title={$\pi_{0.5}$: a Vision-Language-Action Model with Open-World Generalization},
author={Black, Kevin and Brown, Noah and Darpinian, James and others},
journal={arXiv preprint arXiv:2504.16054},
year={2025}
}
@article{egovla2025,
title={EgoVLA: Learning Vision-Language-Action Models from Egocentric Human Videos},
journal={arXiv preprint arXiv:2507.12440},
year={2025}
}
This pipeline code is provided as-is for research purposes. The MediaPipe model is under Google's license. Build AI's Egocentric-100K is under Apache-2.0. π₀.₅ is under Gemma license.