Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion neuracore-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ nans
posinf
neginf
rotvec
roundoff
dataconfig
pbtxt
tfrecord
widowx
calcsize
EADDRINUSE
metas
Expand All @@ -270,4 +273,4 @@ CREAT
getpid
WRONLY
rels
huggingface
huggingface
78 changes: 78 additions & 0 deletions neuracore/importer/config/bridge_v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
input_dataset_name: bridge_v2_dataset_converted_externally_to_tfds

output_dataset:
name: bridge_v2
tags: [widowx, bridge_v2, manipulation]
description: "BridgeData V2 is a large and diverse dataset of robotic manipulation
behaviors designed to facilitate research in scalable robot learning. The dataset is
compatible with open-vocabulary, multi-task learning methods conditioned on goal
images or natural language instructions. Skills learned from the data generalize to
novel objects and environments, as well as across institutions.

. Dataset source: https://rail-berkeley.github.io/bridgedata/"

robot:
name: widowx
urdf_path: "neuracore/neuracore/importer/config/widowx.urdf"
override_existing: true

frequency: 5.0

data_import_config:
RGB_IMAGES:
source: observation
image_convention: CHANNELS_LAST
order_of_channels: RGB
mapping:
- name: image_0
source_name: image_0
- name: image_1
source_name: image_1
- name: image_2
source_name: image_2
- name: image_3
source_name: image_3

JOINT_POSITIONS:
source: observation.state
units: RADIANS
mapping:
- name: joint_1
index: 0
- name: joint_2
index: 1
- name: joint_3
index: 2
- name: joint_4
index: 3
- name: joint_5
index: 4
- name: gripper_revolute_joint
index: 5


PARALLEL_GRIPPER_OPEN_AMOUNTS:
source: observation.state
inverted: false
mapping:
- name: gripper_open_amount
index: 6

VISUAL_JOINT_POSITIONS:
source: observation.state # path to the data in the input dataset
format:
visual_joint_type: GRIPPER
mapping:
- name: gripper_prismatic_joint_1
index: 6
inverted: false
offset: 0.0
- name: gripper_prismatic_joint_2
index: 6

LANGUAGE:
source: language_instruction
format:
language_type: BYTES
mapping:
- name: instruction
18 changes: 9 additions & 9 deletions neuracore/importer/core/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
if DATA_TYPE_TO_NC_DATA_CLASS[dt] == JointData
]

# Small absolute tolerance for floating point comparisons against joint limits.
# This avoids false-positive warnings caused by float32/float64 roundoff.
JOINT_LIMIT_EPSILON = 1e-6


def validate_rgb_images(data: Any, format: DataFormat) -> None:
"""Validate RGB image data.
Expand Down Expand Up @@ -135,17 +139,13 @@ def validate_joint_positions(
if name not in joint_info:
raise DataValidationError("Joint not found in robot model.")

if (
joint_info[name].limits.lower is not None
and data < joint_info[name].limits.lower
):
lower_limit = joint_info[name].limits.lower
if lower_limit is not None and data < lower_limit - JOINT_LIMIT_EPSILON:
raise DataValidationWarning(
f"Position {data} is below the lower limit {joint_info[name].limits.lower}."
f"Position {data} is below the lower limit {lower_limit}."
)
if (
joint_info[name].limits.upper is not None
and data > joint_info[name].limits.upper
):
upper_limit = joint_info[name].limits.upper
if upper_limit is not None and data > upper_limit + JOINT_LIMIT_EPSILON:
raise DataValidationWarning(
f"Position {data} is above the upper limit {joint_info[name].limits.upper}."
)
Expand Down
25 changes: 20 additions & 5 deletions neuracore/importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
validate_dataset_config_against_robot_model,
)
from neuracore.importer.lerobot_importer import LeRobotDatasetImporter
from neuracore.importer.rlds_importer import RLDSDatasetImporter
from neuracore.importer.rlds_tfds_importer import (
RLDSDatasetImporter,
TFDSDatasetImporter,
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -226,10 +229,20 @@ def _run_import(

logger.info("Setup complete; beginning import.")

importer: RLDSDatasetImporter | LeRobotDatasetImporter | None = None
skip_on_error = args.skip_on_error
importer: TFDSDatasetImporter | RLDSDatasetImporter | LeRobotDatasetImporter
if dataset_type == DatasetTypeConfig.TFDS:
raise NotImplementedError("TFDS import not yet implemented.")
logger.info("Starting TFDS dataset import from %s", args.dataset_dir)
importer = TFDSDatasetImporter(
input_dataset_name=dataconfig.input_dataset_name,
output_dataset_name=dataconfig.output_dataset.name,
dataset_dir=args.dataset_dir,
dataset_config=dataconfig,
joint_info=robot.joint_info,
dry_run=args.dry_run,
suppress_warnings=args.no_validation_warnings,
)
importer.import_all()
elif dataset_type == DatasetTypeConfig.RLDS:
logger.info("Starting RLDS dataset import from %s", args.dataset_dir)
importer = RLDSDatasetImporter(
Expand All @@ -256,14 +269,16 @@ def _run_import(
skip_on_error=skip_on_error,
)
importer.import_all()
else:
raise DatasetOperationError(f"Unsupported dataset type: {dataset_type}")

logger.info("Finished importing dataset.")


def main() -> None:
"""Delegate to the Typer CLI app located in neuracore.importer.CLI.app."""
"""Delegate to the Typer CLI app located in neuracore.importer.cli.app."""
# Import locally to keep importer.py free of Typer dependency for library use
from neuracore.importer.CLI.app import main as cli_main
from neuracore.importer.cli.app import main as cli_main

cli_main()

Expand Down
Loading