Skip to content

Commit 5f3acf7

Browse files
author
Your Name
committed
Remove deprecated DROID conversion scripts and update README with new pipeline usage examples, including auto-scan and quick mode options for trajectory processing.
1 parent 017cc44 commit 5f3acf7

14 files changed

+2559
-783
lines changed

examples/droid_h5/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
results/

examples/droid_h5/README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,39 @@ The pipeline consists of three main steps:
4545

4646
### Complete Pipeline (Recommended)
4747

48-
**The easiest way is to use the complete pipeline that handles everything:**
48+
**The easiest way is to use the complete pipeline with auto-scan:**
4949

5050
```bash
51-
# Complete end-to-end pipeline: Download → Convert → Process → Validate
51+
# Quick mode: Use pre-defined sample trajectories (fastest for testing)
52+
python droid_hdf5_pipeline.py \
53+
--auto-scan --quick-mode \
54+
--num-trajectories 3 \
55+
--output-dir ./droid_hdf5_results \
56+
--question "Is this trajectory successful?" \
57+
--max-workers 2
58+
59+
# Full scan: Automatically discover and select from all available trajectories
60+
python droid_hdf5_pipeline.py \
61+
--auto-scan \
62+
--num-trajectories 10 \
63+
--output-dir ./droid_hdf5_results \
64+
--question "Is this trajectory successful?" \
65+
--max-workers 4
66+
67+
# Balanced selection (70% success, 30% failure) with reproducible results
68+
python droid_hdf5_pipeline.py \
69+
--auto-scan --quick-mode \
70+
--num-trajectories 20 \
71+
--balance 0.7 \
72+
--seed 42 \
73+
--output-dir ./results \
74+
--question "Did the robot complete the task successfully?"
75+
```
76+
77+
**Legacy manual specification:**
78+
79+
```bash
80+
# Manual trajectory specification
5281
python droid_hdf5_pipeline.py \
5382
--trajectories gs://gresearch/robotics/droid_raw/1.0.1/success/2023-07-21_16-18-07 \
5483
gs://gresearch/robotics/droid_raw/1.0.1/failure/2023-07-21_16-27-21 \

examples/droid_h5/convert_droid_to_hdf5.py

Lines changed: 0 additions & 265 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Create ground truth file from DROID metadata for validation.
4+
"""
5+
6+
import json
7+
import os
8+
import glob
9+
from pathlib import Path
10+
11+
def create_ground_truth_from_metadata(results_dir, output_file):
12+
"""
13+
Create a manual ground truth file from DROID metadata files.
14+
15+
Args:
16+
results_dir: Directory containing DROID trajectories
17+
output_file: Output JSON file for ground truth labels
18+
"""
19+
ground_truth = {}
20+
21+
# Find all metadata files
22+
metadata_files = glob.glob(os.path.join(results_dir, "droid_trajectories", "*", "metadata_*.json"))
23+
24+
for metadata_file in metadata_files:
25+
try:
26+
with open(metadata_file, 'r') as f:
27+
metadata = json.load(f)
28+
29+
# Extract trajectory directory name
30+
trajectory_dir = os.path.dirname(metadata_file)
31+
trajectory_name = os.path.basename(trajectory_dir)
32+
33+
# Create the path format used in VLM results
34+
trajectory_path = f"./results/droid_trajectories/{trajectory_name}"
35+
36+
# Extract success label
37+
success = metadata.get("success", None)
38+
if success is not None:
39+
ground_truth[trajectory_path] = success
40+
print(f"Added: {trajectory_name} -> {success}")
41+
42+
except Exception as e:
43+
print(f"Error processing {metadata_file}: {e}")
44+
continue
45+
46+
# Save ground truth file
47+
with open(output_file, 'w') as f:
48+
json.dump(ground_truth, f, indent=2)
49+
50+
print(f"\nCreated ground truth file: {output_file}")
51+
print(f"Total trajectories: {len(ground_truth)}")
52+
53+
# Count success/failure
54+
successful = sum(1 for v in ground_truth.values() if v)
55+
failed = sum(1 for v in ground_truth.values() if not v)
56+
print(f"Successful: {successful}")
57+
print(f"Failed: {failed}")
58+
59+
return ground_truth
60+
61+
if __name__ == "__main__":
62+
results_dir = "./results"
63+
output_file = "./results/ground_truth.json"
64+
65+
create_ground_truth_from_metadata(results_dir, output_file)

0 commit comments

Comments
 (0)