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

dataset #91

Closed
Nimingez opened this issue May 13, 2024 · 27 comments
Closed

dataset #91

Nimingez opened this issue May 13, 2024 · 27 comments

Comments

@Nimingez
Copy link

I want to use my own UR5 to collect data for wiping tables. Are there any data collection scripts and scripts to convert to RLDS available?

@kpertsch
Copy link
Collaborator

We don't have data collection scripts -- it probably depends a lot on your robot hardware.
A utility to convert your custom dataset to RLDS is here: https://github.com/kpertsch/rlds_dataset_builder

@Nimingez
Copy link
Author

Nimingez commented May 13, 2024

Test the installation by finetuning on the debug dataset, I just run python scripts/finetune.py --config.pretrained_path=hf://rail-berkeley/octo-small --debug
It raise
ImportError: This version of TensorFlow Probability requires TensorFlow version >= 2.16; Detected an installation of version 2.15.0. Please upgrade TensorFlow to proceed.

@kpertsch
Copy link
Collaborator

Can you make sure that you are using the packages at the versions pinned in requirements.txt?
ie tensorflow_probability should be version 0.23.0
You can check your version via: pip freeze | grep tensorflow_probability

@Nimingez Nimingez reopened this May 17, 2024
@Nimingez
Copy link
Author

Do you know what 'action' represents? I actually didn't understand it.
Does it represent the difference between the xyzrpy of the robot arm end at this time step and the xyzrpy of the previous time step?
I printed out one of the trajectories.
image
image
image

@kpertsch
Copy link
Collaborator

Yes, the action should be the delta between the end-effector pose at this time step and the pose at the next time step.

@kpertsch
Copy link
Collaborator

(if the data is collected with non-blocking control this may not directly correspond to the actually achieved robot state at the next time step)

@Nimingez
Copy link
Author

Do you know how I should get this action? In this sample dataset, subtracting two XYZ values does not yield the action.
this time step 2.45179296e-01, 1.25298291e-01, -6.78761229e-02,5.92707310e-01, 7.93969614e-01, -5.74835867e-03,-1.35193394e-01
next time step 2.45277494e-01, 1.25291064e-01, -6.78688809e-02,5.92718418e-01, 7.93973078e-01, -5.69880711e-03,-1.35126432e-01
action 0, 0.000228571429, 0, 0, 0, 0

@kpertsch
Copy link
Collaborator

The dataset already has a field called "action" and that contains the correct end-effector action.
The fact that the delta between consecutive positions is not equal to the action is expected and is what I meant with my comment above re non-blocking control. Non-blocking control means that the robot does not wait until the delta commanded by the action is achieved before executing the next action. Thus, the next robot position may not exactly achieved the commanded delta.

@Nimingez
Copy link
Author

Nimingez commented May 21, 2024

Thank you!
How many wiping table tasks should I collect?
After fine-tuning my own UR5 data, how should I deploy and evaluate it on the actual robot?

@kpertsch
Copy link
Collaborator

We have an example here for evaluating a finetuned model on the BridgeV2 WidowX robot, you can modify this for your UR5 setup: https://github.com/octo-models/octo/blob/main/examples/04_eval_finetuned_on_robot.py

Re number of demos: 50 is usually a good number for a single task, though you may want to collect more if your task is complex.

@Nimingez
Copy link
Author

Nimingez commented May 23, 2024

I have collected my ur dataset like this
2024-05-23 15-35-27 的屏幕截图
when convert to rlds

2024-05-23 15-34-32 的屏幕截图
where should i change?
image

File "/home/nmz/mgit/rlds_dataset_builder/UR5_Wipe/UR5_Wipe_dataset_builder.py", line 112, in _parse_example
for i, step in enumerate(data):
TypeError: iteration over a 0-d array

@kpertsch
Copy link
Collaborator

Looks like the data variable may be empty -- can you pdb into the parse_example function and check that data correctly loads your raw data?
You can follow the instructions for modifying the parse_example function in the README here: https://github.com/kpertsch/rlds_dataset_builder/blob/main/README.md

@Nimingez
Copy link
Author

I have convert my dataset to rlds
when visualize dataset
The builder directory /home/nmz/tensorflow_datasets/u_r5__wipe doesn't contain any versions.
No builder could be found in the directory: /home/nmz/tensorflow_datasets for the builder: u_r5__wipe.
No registered data_dirs were found in:
- /home/nmz/tensorflow_datasets

@kpertsch
Copy link
Collaborator

Did you store your dataset into ~/tensorflow_datasets? If not, you need to add data_dir=path_to_data_root to the tfds.load() command. here the data root refers to the folder that contains u_r5__wipe

@Nimingez
Copy link
Author

Nimingez commented May 27, 2024 via email

@kpertsch
Copy link
Collaborator

What's the content of the directory ~/tensorflow_datasets/u_r5__wipe?

@Nimingez
Copy link
Author

/home/nmz/tensorflow_datasets/u_r5__wipe_dataset
I can see your example dataset is also in the same location.

@kpertsch
Copy link
Collaborator

Can you copy the dataset one folder up, ie it should look like this: ~/tensorflow_datasets/<dataset_name>/1.0.0 and then you can load it with tfds.load(<dataset_name>)

@Nimingez
Copy link
Author

Nimingez commented May 27, 2024

Do you have plans to open source the RLDS build process for the UR5 berkeley_autolab_ur5?

@kpertsch
Copy link
Collaborator

No, unfortunately it will be hard to open-source that, but there is nothing UR5-specific in the conversion code -- you can just follow another example, eg here for Bridge data V2: https://github.com/kpertsch/bridge_rlds_builder/blob/main/bridge_dataset/bridge_dataset_dataset_builder.py (note that this repo is forked off of the multithreaded branch here: https://github.com/kpertsch/rlds_dataset_builder/tree/multithreaded)

@Nimingez
Copy link
Author

Thank you for your patient response
When I initially did the installation test, there were no errors in fine-tuning, but now there are errors.
python finetune.py --config.pretrained_path=hf://rail-berkeley/octo-small-1.5 --debug
Traceback (most recent call last):
File "/home/nmz/mgit/octo/scripts/finetune.py", line 426, in
app.run(main)
File "/home/nmz/anaconda3/envs/octo-models/lib/python3.10/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/home/nmz/anaconda3/envs/octo-models/lib/python3.10/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "/home/nmz/mgit/octo/scripts/finetune.py", line 130, in main
pretrained_model = OctoModel.load_pretrained(
File "/home/nmz/mgit/octo/octo/model/octo_model.py", line 259, in load_pretrained
module = OctoModule.create(**config["model"])
TypeError: OctoModule.create() got an unexpected keyword argument 'use_correct_attention'

@Nimingez
Copy link
Author

Can you introduce the inputs and outputs in the UR5 wipe task? Is the input from one camera or two cameras?

@kpertsch
Copy link
Collaborator

It's single camera input and 7D end-effector action output

@Nimingez
Copy link
Author

7D means x,y,z, qx,qy,qz,qw or x y z rx ry rz and gripper?

@kpertsch
Copy link
Collaborator

the latter

@Nimingez
Copy link
Author

Does the seven dimensions represent the change of the end-effector relative to the previous frame? It's not the target position of the robotic arm?
Snipaste_2024-05-31_15-45-22
Snipaste_2024-05-31_09-14-42

@Nimingez
Copy link
Author

Nimingez commented Jun 6, 2024 via email

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

No branches or pull requests

2 participants