mirror of
https://github.com/Tavish9/any4lerobot.git
synced 2026-05-22 01:19:42 +00:00
make script compatible with lerobot (b536f47) (#38)
* bump openx2lerobot script * bump agibot2lerobot script * bump robomind2lerobot script
This commit is contained in:
+5
-14
@@ -1,5 +1,7 @@
|
||||
# OpenX to LeRobot
|
||||
|
||||
Open X-Embodiment assembles a dataset from 22 different robots collected through a collaboration between 21 institutions, demonstrating 527 skills (160266 tasks). (Copied from [docs](https://robotics-transformer-x.github.io/))
|
||||
|
||||
## 🚀 What's New in This Script
|
||||
|
||||
In this dataset, we have made several key improvements:
|
||||
@@ -69,18 +71,7 @@ Dataset Structure of `meta/info.json`:
|
||||
## Get started
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 1.Before running the following code, modify `save_episode()` function in lerobot.
|
||||
> ```python
|
||||
> def save_episode(self, episode_data: dict | None = None, keep_images: bool | None = False) -> None:
|
||||
> ...
|
||||
> # delete images
|
||||
> if not keep_images:
|
||||
> img_dir = self.root / "images"
|
||||
> if img_dir.is_dir():
|
||||
> shutil.rmtree(self.root / "images")
|
||||
> ...
|
||||
> ```
|
||||
> 2.for `bc_z` dataset, modify `encode_video_frames()` in `lerobot/common/datasets/video_utils.py`.
|
||||
> 1.for `bc_z` dataset, modify `encode_video_frames()` in `lerobot/common/datasets/video_utils.py`.
|
||||
>
|
||||
> ```python
|
||||
> # add the following content to line 141:
|
||||
@@ -99,7 +90,7 @@ Dataset Structure of `meta/info.json`:
|
||||
git clone https://github.com/Tavish9/any4lerobot.git
|
||||
```
|
||||
|
||||
2. Modify path in `openx2lerobot/convert.sh`:
|
||||
2. Modify path in `convert.sh`:
|
||||
|
||||
```bash
|
||||
python openx_rlds.py \
|
||||
@@ -113,7 +104,7 @@ Dataset Structure of `meta/info.json`:
|
||||
3. Execute the script:
|
||||
|
||||
```bash
|
||||
cd openx2lerobot && bash convert.sh
|
||||
bash convert.sh
|
||||
```
|
||||
|
||||
## Available OpenX_LeRobot Dataset
|
||||
|
||||
@@ -37,10 +37,8 @@ from pathlib import Path
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
import tensorflow_datasets as tfds
|
||||
from huggingface_hub import HfApi
|
||||
from lerobot.common.constants import HF_LEROBOT_HOME
|
||||
from lerobot.common.datasets.lerobot_dataset import LeRobotDataset
|
||||
|
||||
from oxe_utils.configs import OXE_DATASET_CONFIGS, ActionEncoding, StateEncoding
|
||||
from oxe_utils.transforms import OXE_STANDARDIZATION_TRANSFORMS
|
||||
|
||||
@@ -149,10 +147,10 @@ def save_as_lerobot_dataset(lerobot_dataset: LeRobotDataset, raw_dataset: tf.dat
|
||||
**image_dict,
|
||||
"observation.state": traj["proprio"][i],
|
||||
"action": traj["action"][i],
|
||||
"task": traj["task"][0].decode(),
|
||||
}
|
||||
},
|
||||
task=traj["task"][0].decode(),
|
||||
)
|
||||
lerobot_dataset.save_episode(keep_images=kwargs.get("keep_images", False))
|
||||
lerobot_dataset.save_episode()
|
||||
|
||||
|
||||
def create_lerobot_dataset(
|
||||
@@ -209,7 +207,7 @@ def create_lerobot_dataset(
|
||||
repo_id=repo_id,
|
||||
robot_type=robot_type,
|
||||
root=local_dir,
|
||||
fps=fps,
|
||||
fps=int(fps),
|
||||
use_videos=use_videos,
|
||||
features=features,
|
||||
image_writer_threads=image_writer_threads,
|
||||
@@ -287,11 +285,6 @@ def main():
|
||||
default=10,
|
||||
help="Number of threads per process of image writer for saving images.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--keep-images",
|
||||
action="store_true",
|
||||
help="Whether to keep the cached images.",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
create_lerobot_dataset(**vars(args))
|
||||
|
||||
Reference in New Issue
Block a user