File size: 6,469 Bytes
8648e1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60df906
8648e1c
 
 
 
 
 
 
 
 
 
 
4baac50
8648e1c
 
 
 
 
 
4baac50
 
 
8648e1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4baac50
 
8648e1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
---
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`.