Skip to content

Latest commit

 

History

History
232 lines (183 loc) · 10.5 KB

data.md

File metadata and controls

232 lines (183 loc) · 10.5 KB

OpenDM Data Format and Dataset Registration

OpenDM trains DM05 on robot episodes stored as JSON Lines (JSONL). This guide describes the frame format accepted by the current OpenDM data pipeline and how to register a dataset for use with --data-config.dataset-name.

1. Using Provided Data

OpenDM includes registrations for commonly used datasets. The paths below are relative to the OpenDM repository root.

Dataset Download Registered name Registered jsonl_dir Registered image_dir
LIBERO Dexmal/libero libero_pi0_all ./data/libero/libero_pi0_all ./data/libero/libero_pi0_all/image
RoboTwin 2.0 Dexmal/robotwin2-full robotwin2_generalist ./data/robotwin2.0 ./data/robotwin2.0/video
RoboDojo-Sim Dexmal/robodojo-sim robodojo_sim_cover_blocks ./data/robodojo_sim/jsonl/cover_blocks ./data/robodojo_sim/video

For LIBERO, download and organize the provided data from the repository root:

script/libero_runner.sh dataset

The LIBERO episode files are stored below the jsonl/ subdirectory of its registered jsonl_dir. RoboTwin 2.0 and RoboDojo-Sim also store episode files below jsonl/. Follow the RoboTwin 2.0 guide to download and extract its archive, and the RoboDojo-Sim guide for RoboDojo-Sim. See the LIBERO guide for the full LIBERO workflow.

These locations match opendm/dataset/libero.py, opendm/dataset/robotwin2.py, and opendm/dataset/robodojo.py. If the data is stored elsewhere, pass --data-config.jsonl-dir and --data-config.image-dir when training.

The same public RoboTwin 2.0 archive is also registered as 100 component views named robotwin2_component_<task>_<setting>. Each view points to a jsonl/<task>/<setting> directory inside ./data/robotwin2.0 and shares the archive's video/ directory. The weighted reference SFT recipe in playground/dm05_robotwin2.py combines these views with preset sampling weights; it does not require another dataset or a remote data root.

2. Dataset Layout

Store each episode in a separate .jsonl file. Media files may live below the same root or in another directory configured through image_dir.

assets/my_robot/
├── episode0.jsonl
├── episode1.jsonl
├── images/
│   ├── episode0/
│   └── episode1/
└── index_cache.json  # Generated by OpenDM when missing
  • jsonl_dir is scanned recursively for .jsonl files.
  • Each .jsonl file is treated as one episode. Each line must be one complete JSON object representing one frame; do not include blank lines.
  • Each episode must contain at least two frames because OpenDM builds action targets from the current and future frames.
  • index_cache.json is generated under jsonl_dir when it is missing. If JSONL files are added, removed, or edited after the cache is generated, delete the cache so OpenDM can rebuild it.

3. Frame Format

Image-backed frame example:

{"images_1":{"type":"image","url":"./images/episode0/cam_high/0.jpg"},"images_2":{"type":"image","url":"./images/episode0/cam_left_wrist/0.jpg"},"images_3":{"type":"image","url":"./images/episode0/cam_right_wrist/0.jpg"},"state":[0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0],"prompt":"Pick up the object","is_robot":true}

Video-backed image entry:

{"type":"video","url":"./videos/episode0/cam_high.mp4","frame_idx":21}

The first JSON object is a complete frame record. The second shows only the value of one video-backed image field.

Fields

Field Required Description
images_* Yes, for every registered image_keys entry Camera input metadata. type must be image or video. url is resolved relative to image_dir. Video entries also require frame_idx.
state Yes Numeric robot state vector for the current frame. Its dimension and ordering must match state_desc.
prompt Yes Natural-language task instruction.
action No Explicit target action vector. If omitted, OpenDM constructs targets from future state values. If present, this field must appear in every frame of the episode.
is_robot No Compatibility marker used by Dexdata-style robot records. OpenDM demo data sets it to true; the current DM05 training path does not use it to build targets.

Only the media keys listed in the registered image_keys are loaded, in the order given there. state is required in every frame because the action-building and normalization stages expect it. add_state only controls whether the current state, after normalization and discretization, is included in the model's user prompt as States: ... text. Setting add_state=False does not make state optional in the JSONL data.

Dexdata dialogue fields such as answer and conversations are not required.

Mem SFT entries (playground/dm05_mem_sft_demo.py and playground/dm05_mem_sft_robodojo_cover_blocks.py) sample past main-view frames from image_keys[0] at 1 FPS using the registered dataset fps. The JSONL does not need a history_images field.

4. Action Targets and Episode Boundaries

  • If a frame contains action, the action chunk starts from the current frame and reads future action values.
  • If action is absent, the chunk starts from the next frame and reads future state values as action targets.
  • When a requested action chunk extends beyond the episode, OpenDM repeats the last available value.
  • In relative action mode, OpenDM subtracts the current state from the target action while keeping dimensions marked as RobotStateDesc.GRIPPER absolute. The state, action, and state_desc dimensions must therefore agree.
  • In absolute action mode, action may have a different dimension from state. It must instead match the action schema used by the experiment, normalization statistics, and downstream controller.
  • Select relative or absolute action behavior in the experiment entry through data_config.action_mode (CLI: --data-config.action-mode); keep the choice consistent with the dataset and downstream controller.

Normalization statistics are computed per experiment. Data sources with the same robot_type share one state/action profile, while different robot types are stored separately under norm_stats_by_robot in the same norm_stats.json. Training and inference select the profile from the sample or request robot_type. Historical files containing only top-level norm_stats remain supported. Profiles may omit state when the corresponding experiment does not normalize state.

An extended file declares its default through default_robot_type and keeps a copy of that profile in top-level norm_stats for old readers. Multi-robot experiments must set norm_stats_default_robot_type; single-robot experiments infer it automatically.

5. Register a Dataset

Create a Python registration file. OpenDM automatically imports .py files under opendm/dataset/ whose names do not start with _, except register.py.

# opendm/dataset/my_robot.py

from opendm.constants.robot import RobotStateDesc, RobotType
from opendm.dataset.register import register_dataset

MY_ROBOT_STATE_DESC = (
    [RobotStateDesc.JOINT] * 6
    + [RobotStateDesc.GRIPPER]
    + [RobotStateDesc.JOINT] * 6
    + [RobotStateDesc.GRIPPER]
)

register_dataset(
    {
        "my_robot": {
            "jsonl_dir": "./assets/my_robot/",
            "image_dir": "./assets/my_robot/",
            "image_keys": ["images_1", "images_2", "images_3"],
            "image_prompts": ["Head", "Left wrist", "Right wrist"],
            "robot_type": RobotType.ALOHA,
            "state_desc": MY_ROBOT_STATE_DESC,
        },
    },
)

Registration Fields

Field Description
Dataset key (my_robot) Name passed to --data-config.dataset-name.
jsonl_dir Directory recursively containing episode JSONL files.
image_dir Base directory used to resolve media url values.
image_keys Ordered camera fields to load from every frame.
image_prompts Required. Camera labels one-to-one with image_keys for the chat template (e.g. Head, Left wrist).
state_desc Semantic type of each state dimension. It also identifies dimensions that remain absolute in relative action mode. Supported values are RobotStateDesc.JOINT, RobotStateDesc.EEF, and RobotStateDesc.GRIPPER.
robot_type Robot label, normally one of the values in RobotType. It selects the state description and matching normalization profile. Historical untyped data remains supported.
fps Video frame rate. Required when mem SFT samples history frames at 1 FPS.

Paths may be absolute or relative to the directory from which training is launched. Commands in this repository are intended to run from the OpenDM repository root.

Pass the registered dataset name to the training command:

--data-config.dataset-name my_robot

To register a family of datasets, pass a prefix:

register_dataset({"pick": {...}}, prefix="my_robot")

The resulting dataset name is my_robot_pick; pass that prefixed name to the training command.

6. Use an External Registry Directory

To keep custom registration files outside the repository, place them in one directory and set OPENDM_DATA_PATH before launching training:

export OPENDM_DATA_PATH=/absolute/path/to/my_dataset_registry

OPENDM_DATA_PATH points to registry Python modules, not to a raw dataset directory. Use unique module names (for example, custom_libero_paths.py) to avoid conflicts with built-in modules.

The same filename rules apply to this directory, and each file should call register_dataset as shown above.

Checklist

  • One episode per .jsonl file, one frame per line, no blank lines, and at least two frames per episode.
  • Every registered image_keys field exists on every frame; each media url resolves relative to image_dir, and video entries include frame_idx.
  • state_desc has one entry for each state dimension, in matching order. In relative action mode, action has the same dimension and ordering as state; in absolute mode, it matches the experiment's action schema.
  • Explicit action is either present on all frames of an episode or omitted from all of them.
  • A stale index_cache.json is removed after changing the JSONL files.
  • The name passed to --data-config.dataset-name matches the registered name.