Record Dataset

From Waveshare Wiki
Jump to: navigation, search
RoArm-M3-AI-Kit
RoArm-M3

UART
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

LeRobot Tutorial Catalog

4. Record Dataset

  • Note: The following operations are performed inside the container
  • Note: You need to navigate to the lerobot directory to execute the following code
  • It is recommended to record the data set after being familiar with the remote control operation to save time

4.1 Parameter Description

The following parameters can be adjusted according to actual needs.

--warmup-time-s: Indicates the initialization time.
--episode-time-s: Indicates the time for collecting data in each episode.
--reset-time-s: Indicates the preparation time between each data collection.
--num-episodes: Indicates the number of episodes of data expected to be collected.
--push-to-hub: Decide whether to upload the data to HuggingFace Hub.
--control.resume: Decide whether to continue recording, the default is false.

If you wish to save the data locally (--control.push_to_hub=false), replace --control.repo_id=${HF_USER}/roarm_m3_test with a custom local folder name, for example, --control.repo_id=waveshare/roarm_m3_test. The dataset will be stored in "~/.cache/huggingface/lerobot" in the system home directory.

If you have uploaded your dataset to the Hugging Face Hub using --control.push_to_hub=true, you can visualize your dataset online.

4.2 Record Dataset

If you want to use the Hugging Face Hub functionality to upload your dataset and have not done so before, make sure to log in with a write access token, which can be generated from the Hugging Face settings.

huggingface-cli login --token ${HUGGINGFACE_TOKEN} --add-to-git-credential

Store the Hugging Face repository name in a variable to run the following command:

HF_USER=$(huggingface-cli whoami | head -n 1)
echo $HF_USER

Record 2 episodes without uploading the dataset

python lerobot/scripts/control_robot.py \
  --robot.type=roarm_m3 \
  --control.type=record \
  --control.fps=30 \
  --control.single_task="Grasp a block and put it in the bin." \
  --control.repo_id=${HF_USER}/roarm_m3_test \
  --control.tags='["roarm_m3","tutorial"]' \
  --control.warmup_time_s=5 \
  --control.episode_time_s=30 \
  --control.reset_time_s=30 \
  --control.num_episodes=2 \
  --control.push_to_hub=false
  • Press the right arrow -> at any time during the round recording process to stop early and enter the reset state. During the reset process, you can also stop early and move on to the next round.
  • Press the left arrow <- at any time while recording or resetting to an earlier stage to stop the current episode early and re-record it.
  • Press Q at any time during the recording process to end the session early and go directly to video encoding and dataset saving.

Once you are familiar with the data recording, you can create a larger dataset for training. A good starting task is to grasp objects at different positions and place them in a box. We recommend recording at least 50 scenes, with 10 scenes for each position. Keep the camera fixed and maintain consistent grasping behavior throughout the recording. Also make sure that the objects you're working on is visible in the camera's field of view. A good rule of thumb is that you should be able to complete this task just by looking at the camera images.

In the next chapter, you will train your neural network. After achieving reliable grasping performance, you can introduce more variations during the data collection process, such as adding more grasping positions, different grasping techniques, and changing the camera position. Avoid quickly adding too many variations, as this may hinder your results.