Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aloha_hd5 to LerobotDataset v2 #586

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Raziel90
Copy link
Contributor

What this does

Adds Script for the conversion of aloha_hd5 dataset format to LerobotDataset (v2)

  • The scripts decouples the components dependant on the Original dataset format to those that create the dataset.
  • The script is easy to generalise to other datasets as long as an equivalent of the AlohaHD5Extractor (check code) is provided

NB: Automated testing will be provided in a separate PR.

How it was tested

Launched the script to upload the dataset in multiple ways (e.g. images as images or as videos, different episode descriptions)

These datasets are uploaded with this
https://huggingface.co/datasets/ccop/aloha-hd5-conversion-test
https://huggingface.co/datasets/ccop/test-again

Examples:

  • Added examples/port_datasets/aloha_hd5.py

How to checkout & try? (for the reviewer)

You can try on an hd5 dataset using the following. (change the arguments to fit your dataset).

python examples/port_datasets/aloha_hd5.py --fps=50 --raw-path=/home/ccop/code/aloha_data/aloha_stationary_pick_place_bottle/  --dataset-repo-id=ccop/test-again --video-encoding=false --push=True --description="Aloha HD5 dataset - Bottle Pick and Place"

@Michael-Equi
Copy link

Hi Raziel. Thanks for writing this! I think there is a bug in the implementation you are submitting that results in saving only one frame per episode. The fix should just be to tab in this line https://github.com/huggingface/lerobot/pull/586/files#diff-8a6e4cf809bbdbbde9c6d8d6887e9c3d1537f3dda6179c2bf819a04984bb9fd4R131

@Raziel90
Copy link
Contributor Author

Raziel90 commented Jan 9, 2025

Hi @Michael-Equi do you mean line 135?

frames.append(frame)

I'm fixing that

@Raziel90
Copy link
Contributor Author

Hi @Michael-Equi, I fixed it if you want to do a double check :)

"dtype": "video" if encode_as_video else "image",
"shape": cv2.imdecode(hdf5_file[topic][0], 1).transpose(2, 0, 1).shape
if image_compressed
else sample.shape,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does aloha use shape (c, h, w) when uncompressed? I remember it to be (h, w, c)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will give a check, but if I have transposed there, there is a reason that I don't recall right now.
The result seems good here

@Takuzenn
Copy link

Takuzenn commented Feb 22, 2025

Hi @Raziel90 I tried but it is very slow, do you know why?

@Raziel90
Copy link
Contributor Author

Hi @Takuzenn can you elaborate what you tried to run and why you think is slow?
In the script I am not doing any data heavy changes.

Have you tried to change set the number of workers? are you converting images to video or are you keeping images?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants