Add detailed usage examples
Browse files
README.md
CHANGED
|
@@ -64,20 +64,55 @@ This dataset contains tasks 0-9 from the original dataset:
|
|
| 64 |
|
| 65 |
## Usage
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
```python
|
| 68 |
from datasets import load_dataset
|
| 69 |
|
| 70 |
# Load the dataset
|
| 71 |
ds = load_dataset("ases200q2/libero_object")
|
| 72 |
-
|
| 73 |
-
# Access training data
|
| 74 |
train_data = ds["train"]
|
| 75 |
|
| 76 |
-
#
|
| 77 |
-
for
|
| 78 |
-
state =
|
| 79 |
-
action =
|
| 80 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
```
|
| 82 |
|
| 83 |
## Citation
|
|
|
|
| 64 |
|
| 65 |
## Usage
|
| 66 |
|
| 67 |
+
### Using LeRobot (Recommended for Robotics)
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
|
| 71 |
+
|
| 72 |
+
# Load the dataset with video support
|
| 73 |
+
ds = LeRobotDataset("ases200q2/libero_object")
|
| 74 |
+
|
| 75 |
+
# Access episodes with video frames
|
| 76 |
+
for i in range(len(ds)):
|
| 77 |
+
sample = ds[i]
|
| 78 |
+
# sample['observation.images.image'] - numpy array of shape (H, W, C)
|
| 79 |
+
# sample['observation.state'] - robot state
|
| 80 |
+
# sample['action'] - action
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
### Using Hugging Face Datasets
|
| 84 |
+
|
| 85 |
```python
|
| 86 |
from datasets import load_dataset
|
| 87 |
|
| 88 |
# Load the dataset
|
| 89 |
ds = load_dataset("ases200q2/libero_object")
|
|
|
|
|
|
|
| 90 |
train_data = ds["train"]
|
| 91 |
|
| 92 |
+
# Access individual frames
|
| 93 |
+
for frame in train_data:
|
| 94 |
+
state = frame["observation.state"] # robot joint state
|
| 95 |
+
action = frame["action"] # robot action
|
| 96 |
+
# Note: Videos are stored externally as MP4 files
|
| 97 |
+
# Use LeRobotDataset for automatic video loading
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
### For Training with LeRobot
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
|
| 104 |
+
from torch.utils.data import DataLoader
|
| 105 |
+
|
| 106 |
+
# Load dataset
|
| 107 |
+
dataset = LeRobotDataset("ases200q2/libero_object")
|
| 108 |
+
|
| 109 |
+
# Create dataloader
|
| 110 |
+
dataloader = DataLoader(dataset, batch_size=32, shuffle=True)
|
| 111 |
+
|
| 112 |
+
# Training loop
|
| 113 |
+
for batch in dataloader:
|
| 114 |
+
# batch contains observations and actions
|
| 115 |
+
pass
|
| 116 |
```
|
| 117 |
|
| 118 |
## Citation
|