holgerson's picture
Add files using upload-large-folder tool
4baac50 verified
|
Raw History Blame Contribute Delete
6.47 kB
---
pretty_name: SPARC DROID Annotations
language:
- en
tags:
- robotics
- robot-learning
- droid
- object-tracking
- segmentation
- hdf5
task_categories:
- object-detection
- image-segmentation
---
# SPARC DROID annotations
SPARC annotations for DROID. This repository contains annotations only. It does **not** redistribute DROID
images, videos, actions, or robot states; obtain the source dataset separately.
Each JSONL row describes one interaction subtask from one camera view. Dense
arrays live in HDF5 sidecars referenced by that row. All coordinates, masks,
and frame indices refer to the original uncropped, unresized DROID camera
frames.
## Release contents
| View | Camera key | Annotation rows | Source episodes covered | Manifest |
|---|---|---:|---:|---|
| left | `observation.images.left_external` | 63,887 | 52,599 / 53,282 (98.72%) | `annotations.jsonl` |
| right | `observation.images.right_external` | 64,249 | 52,930 / 53,282 (99.34%) | `annotations.jsonl` |
The total release contains **128,136 unique annotation rows**. One source
episode may contain multiple subtasks, so annotation count and episode count
are intentionally different.
Each camera view has one consolidated `annotations.jsonl` manifest. The HDF5
sidecars remain sharded for reliable parallel access; each row contains the
exact sidecar path and HDF5 group needed to load its arrays.
## Download
```python
from huggingface_hub import snapshot_download
root = snapshot_download(
repo_id="irl-kit/sparc-droid-annotations",
repo_type="dataset",
token=True, # uses your cached HF token
)
print(root)
```
Dependencies for the examples:
```bash
pip install huggingface_hub h5py numpy
```
## Read annotations and arrays
The included reader selects the manifest for each view and resolves HDF5
references relative to the corresponding view directory.
```python
from pathlib import Path
import sys
repo = Path(root)
sys.path.insert(0, str(repo / "scripts"))
from read_sparc_droid import iter_annotations, load_arrays
annotation = next(iter_annotations(repo, view="right"))
print(annotation["annotation_id"])
print(annotation["source"])
print(annotation["task"]["instruction"])
print(annotation["object"]["initial"]["box_xyxy_pixels"])
arrays = load_arrays(
repo,
annotation,
view="right",
keys=[
"object_masks",
"object_mask_valid",
"robot_masks",
"robot_mask_valid",
"phase_mask_frame_indices",
"trajectory_source_episode_frame_indices",
],
)
print(arrays["object_masks"].shape) # phases, height, width
print(arrays["phase_mask_frame_indices"]) # trajectory frame indices
```
Command-line inspection and reference validation:
```bash
python scripts/read_sparc_droid.py "$root" --view left --limit 3 --show-arrays
python scripts/read_sparc_droid.py "$root" --verify
```
## Join back to DROID
Use these fields from `source`:
- `source_uuid`: original DROID trajectory UUID, when supplied by the source
conversion.
- `episode_index`: LeRobot global episode index.
- `trajectory_id`: loader-stable ID; for this conversion it is
`0/<episode_index>`.
- `camera_view`: exact LeRobot image feature annotated by this row.
Annotation frame indices are zero-based trajectory-local indices. To map them
unambiguously back to the source episode, load:
- `trajectory_source_episode_frame_indices`
- `trajectory_timestamps_seconds`
For example:
```python
frame = annotation["object"]["initial"]["frame_index"]
source_frame = int(arrays["trajectory_source_episode_frame_indices"][frame])
timestamp_s = float(arrays["trajectory_timestamps_seconds"][frame])
```
## JSON schema overview
The schema identifier is `sparc.annotation` version `2.0`.
- `annotation_id`: stable SHA-256 identity for dataset, trajectory, subtask,
temporal window, and camera view.
- `coordinates`: coordinate conventions. Boxes are pixel
`[x1, y1, x2, y2]`; masks align with the original image.
- `source`: dataset, trajectory, UUID, episode, subtask, camera, FPS, and source
mapping metadata.
- `window`: annotated interval and original image size.
- `task`: instruction, concise action, semantic object/location description,
and imperative phase descriptions.
- `object`: selected interacted-object boxes and intermediate track boxes.
- `selection`: SPARC ranking score, selected candidate, component scores, and
raw signals.
- `baselines`: detector-only selection for comparison.
- `robot`: RobotSeg provenance and fallback status.
- `arrays`: array manifest plus HDF5 shard/group reference.
`selection.score` is a within-example ranking score, **not a calibrated
probability** and not intended for threshold comparison across datasets.
## HDF5 arrays
Depending on the row, the referenced group contains:
| Array | Meaning |
|---|---|
| `object_masks` | interacted-object masks at phase keyframes |
| `object_mask_valid` | validity flag for each object mask |
| `robot_masks` | RobotSeg robot/gripper masks at phase keyframes |
| `robot_mask_valid` | validity flag for each robot mask |
| `phase_mask_frame_indices` | trajectory frame for each phase mask |
| `detection_object_mask` | object mask at the detection frame |
| `detection_robot_mask` | RobotSeg mask at the detection frame |
| `detection_frame_index` | trajectory-local detection frame |
| `centroid_traces` | per-candidate tracked centroid `(x, y)` traces |
| `centroid_trace_frame_indices` | frames corresponding to centroid traces |
| `trajectory_source_episode_frame_indices` | full trajectory-to-source frame map |
| `trajectory_timestamps_seconds` | source episode-relative timestamps |
The authoritative per-row inventory, shapes, dtypes, axes, and validity arrays
are recorded in `arrays.manifest`.
Keyframe point clouds were intentionally removed from this release. There are
no XYZ/UV point-cloud arrays. Masks, tracks, boxes, source mappings, and
timestamps remain available.
## Mask-to-frame alignment
```python
phase_names = [phase["type"] for phase in annotation["task"]["phases"]]
frames = arrays["phase_mask_frame_indices"]
valid = arrays["object_mask_valid"]
for name, frame, is_valid, mask in zip(
phase_names, frames, valid, arrays["object_masks"]
):
if is_valid:
# `mask` is aligned to the original frame at trajectory index `frame`.
print(name, int(frame), int(mask.sum()))
```
The detection mask is separate from the phase masks and uses
`detection_frame_index`.