Add files using upload-large-folder tool
Browse files- README.md +208 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000003.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000006.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000012.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000016.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000020.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000023.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000027.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000030.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000031.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000032.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000036.h5 +3 -0
- data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000040.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000000.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000001.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000002.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000003.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000004.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000005.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000007.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000008.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000009.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000010.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000011.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000012.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000013.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000014.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000015.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000016.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000017.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000019.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000020.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000021.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000022.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000024.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000025.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000026.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000027.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000028.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000029.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000031.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000033.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000034.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000035.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000037.h5 +3 -0
- data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000038.h5 +3 -0
- metadata/release.json +52 -0
- requirements.txt +3 -0
- scripts/__pycache__/read_sparc_droid.cpython-312.pyc +0 -0
- scripts/read_sparc_droid.py +148 -0
README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: SPARC DROID Annotations
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- robotics
|
| 7 |
+
- robot-learning
|
| 8 |
+
- droid
|
| 9 |
+
- object-tracking
|
| 10 |
+
- segmentation
|
| 11 |
+
- hdf5
|
| 12 |
+
task_categories:
|
| 13 |
+
- object-detection
|
| 14 |
+
- image-segmentation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# SPARC DROID annotations
|
| 18 |
+
|
| 19 |
+
Private SPARC annotations for the public DROID LeRobot-v3 conversion. This
|
| 20 |
+
repository contains annotations only. It does **not** redistribute DROID
|
| 21 |
+
images, videos, actions, or robot states; obtain the source dataset separately.
|
| 22 |
+
|
| 23 |
+
Each JSONL row describes one interaction subtask from one camera view. Dense
|
| 24 |
+
arrays live in HDF5 sidecars referenced by that row. All coordinates, masks,
|
| 25 |
+
and frame indices refer to the original uncropped, unresized DROID camera
|
| 26 |
+
frames.
|
| 27 |
+
|
| 28 |
+
## Release contents
|
| 29 |
+
|
| 30 |
+
| View | Camera key | Annotation rows | Source episodes covered | Manifest |
|
| 31 |
+
|---|---|---:|---:|---|
|
| 32 |
+
| left | `observation.images.left_external` | 63,887 | 52,599 / 53,282 (98.72%) | eight `annotations_node*.jsonl` files |
|
| 33 |
+
| right | `observation.images.right_external` | 64,249 | 52,930 / 53,282 (99.34%) | `annotations.jsonl` |
|
| 34 |
+
|
| 35 |
+
The total release contains **128,136 unique annotation rows**. One source
|
| 36 |
+
episode may contain multiple subtasks, so annotation count and episode count
|
| 37 |
+
are intentionally different.
|
| 38 |
+
|
| 39 |
+
The right manifest is already consolidated. Node manifests are not included
|
| 40 |
+
for that view, preventing accidental double counting. The left node manifests
|
| 41 |
+
are disjoint and should all be read.
|
| 42 |
+
|
| 43 |
+
## Download
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
from huggingface_hub import snapshot_download
|
| 47 |
+
|
| 48 |
+
root = snapshot_download(
|
| 49 |
+
repo_id="irl-kit/sparc-droid-annotations",
|
| 50 |
+
repo_type="dataset",
|
| 51 |
+
token=True, # uses your cached HF token
|
| 52 |
+
)
|
| 53 |
+
print(root)
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Dependencies for the examples:
|
| 57 |
+
|
| 58 |
+
```bash
|
| 59 |
+
pip install huggingface_hub h5py numpy
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Read annotations and arrays
|
| 63 |
+
|
| 64 |
+
The included reader selects the correct manifest layout for each view and
|
| 65 |
+
resolves HDF5 references relative to the corresponding view directory.
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from pathlib import Path
|
| 69 |
+
import sys
|
| 70 |
+
|
| 71 |
+
repo = Path(root)
|
| 72 |
+
sys.path.insert(0, str(repo / "scripts"))
|
| 73 |
+
|
| 74 |
+
from read_sparc_droid import iter_annotations, load_arrays
|
| 75 |
+
|
| 76 |
+
annotation = next(iter_annotations(repo, view="right"))
|
| 77 |
+
print(annotation["annotation_id"])
|
| 78 |
+
print(annotation["source"])
|
| 79 |
+
print(annotation["task"]["instruction"])
|
| 80 |
+
print(annotation["object"]["initial"]["box_xyxy_pixels"])
|
| 81 |
+
|
| 82 |
+
arrays = load_arrays(
|
| 83 |
+
repo,
|
| 84 |
+
annotation,
|
| 85 |
+
view="right",
|
| 86 |
+
keys=[
|
| 87 |
+
"object_masks",
|
| 88 |
+
"object_mask_valid",
|
| 89 |
+
"robot_masks",
|
| 90 |
+
"robot_mask_valid",
|
| 91 |
+
"phase_mask_frame_indices",
|
| 92 |
+
"trajectory_source_episode_frame_indices",
|
| 93 |
+
],
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
print(arrays["object_masks"].shape) # phases, height, width
|
| 97 |
+
print(arrays["phase_mask_frame_indices"]) # trajectory frame indices
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
Command-line inspection and reference validation:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
python scripts/read_sparc_droid.py "$root" --view left --limit 3 --show-arrays
|
| 104 |
+
python scripts/read_sparc_droid.py "$root" --verify
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
## Join back to DROID
|
| 108 |
+
|
| 109 |
+
Use these fields from `source`:
|
| 110 |
+
|
| 111 |
+
- `source_uuid`: original DROID trajectory UUID, when supplied by the source
|
| 112 |
+
conversion.
|
| 113 |
+
- `episode_index`: LeRobot global episode index.
|
| 114 |
+
- `trajectory_id`: loader-stable ID; for this conversion it is
|
| 115 |
+
`0/<episode_index>`.
|
| 116 |
+
- `camera_view`: exact LeRobot image feature annotated by this row.
|
| 117 |
+
|
| 118 |
+
Annotation frame indices are zero-based trajectory-local indices. To map them
|
| 119 |
+
unambiguously back to the source episode, load:
|
| 120 |
+
|
| 121 |
+
- `trajectory_source_episode_frame_indices`
|
| 122 |
+
- `trajectory_timestamps_seconds`
|
| 123 |
+
|
| 124 |
+
For example:
|
| 125 |
+
|
| 126 |
+
```python
|
| 127 |
+
frame = annotation["object"]["initial"]["frame_index"]
|
| 128 |
+
source_frame = int(arrays["trajectory_source_episode_frame_indices"][frame])
|
| 129 |
+
timestamp_s = float(arrays["trajectory_timestamps_seconds"][frame])
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
## JSON schema overview
|
| 133 |
+
|
| 134 |
+
The schema identifier is `sparc.annotation` version `2.0`.
|
| 135 |
+
|
| 136 |
+
- `annotation_id`: stable SHA-256 identity for dataset, trajectory, subtask,
|
| 137 |
+
temporal window, and camera view.
|
| 138 |
+
- `coordinates`: coordinate conventions. Boxes are pixel
|
| 139 |
+
`[x1, y1, x2, y2]`; masks align with the original image.
|
| 140 |
+
- `source`: dataset, trajectory, UUID, episode, subtask, camera, FPS, and source
|
| 141 |
+
mapping metadata.
|
| 142 |
+
- `window`: annotated interval and original image size.
|
| 143 |
+
- `task`: instruction, concise action, semantic object/location description,
|
| 144 |
+
and imperative phase descriptions.
|
| 145 |
+
- `object`: selected interacted-object boxes and intermediate track boxes.
|
| 146 |
+
- `selection`: SPARC ranking score, selected candidate, component scores, and
|
| 147 |
+
raw signals.
|
| 148 |
+
- `baselines`: detector-only selection for comparison.
|
| 149 |
+
- `robot`: RobotSeg provenance and fallback status.
|
| 150 |
+
- `arrays`: array manifest plus HDF5 shard/group reference.
|
| 151 |
+
|
| 152 |
+
`selection.score` is a within-example ranking score, **not a calibrated
|
| 153 |
+
probability** and not intended for threshold comparison across datasets.
|
| 154 |
+
|
| 155 |
+
## HDF5 arrays
|
| 156 |
+
|
| 157 |
+
Depending on the row, the referenced group contains:
|
| 158 |
+
|
| 159 |
+
| Array | Meaning |
|
| 160 |
+
|---|---|
|
| 161 |
+
| `object_masks` | interacted-object masks at phase keyframes |
|
| 162 |
+
| `object_mask_valid` | validity flag for each object mask |
|
| 163 |
+
| `robot_masks` | RobotSeg robot/gripper masks at phase keyframes |
|
| 164 |
+
| `robot_mask_valid` | validity flag for each robot mask |
|
| 165 |
+
| `phase_mask_frame_indices` | trajectory frame for each phase mask |
|
| 166 |
+
| `detection_object_mask` | object mask at the detection frame |
|
| 167 |
+
| `detection_robot_mask` | RobotSeg mask at the detection frame |
|
| 168 |
+
| `detection_frame_index` | trajectory-local detection frame |
|
| 169 |
+
| `centroid_traces` | per-candidate tracked centroid `(x, y)` traces |
|
| 170 |
+
| `centroid_trace_frame_indices` | frames corresponding to centroid traces |
|
| 171 |
+
| `trajectory_source_episode_frame_indices` | full trajectory-to-source frame map |
|
| 172 |
+
| `trajectory_timestamps_seconds` | source episode-relative timestamps |
|
| 173 |
+
|
| 174 |
+
The authoritative per-row inventory, shapes, dtypes, axes, and validity arrays
|
| 175 |
+
are recorded in `arrays.manifest`.
|
| 176 |
+
|
| 177 |
+
Keyframe point clouds were intentionally removed from this release. There are
|
| 178 |
+
no XYZ/UV point-cloud arrays. Masks, tracks, boxes, source mappings, and
|
| 179 |
+
timestamps remain available.
|
| 180 |
+
|
| 181 |
+
## Mask-to-frame alignment
|
| 182 |
+
|
| 183 |
+
```python
|
| 184 |
+
phase_names = [phase["type"] for phase in annotation["task"]["phases"]]
|
| 185 |
+
frames = arrays["phase_mask_frame_indices"]
|
| 186 |
+
valid = arrays["object_mask_valid"]
|
| 187 |
+
|
| 188 |
+
for name, frame, is_valid, mask in zip(
|
| 189 |
+
phase_names, frames, valid, arrays["object_masks"]
|
| 190 |
+
):
|
| 191 |
+
if is_valid:
|
| 192 |
+
# `mask` is aligned to the original frame at trajectory index `frame`.
|
| 193 |
+
print(name, int(frame), int(mask.sum()))
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
The detection mask is separate from the phase masks and uses
|
| 197 |
+
`detection_frame_index`.
|
| 198 |
+
|
| 199 |
+
## Known coverage gaps
|
| 200 |
+
|
| 201 |
+
The source conversion has 53,282 episodes. Missing rows include semantic-cache
|
| 202 |
+
phase-key mismatches, clips with fewer than six usable frames, a small number
|
| 203 |
+
of detector/SAM failures, and an interrupted tail in the left-camera run.
|
| 204 |
+
Existing records and all JSON-to-HDF5 references were validated before upload;
|
| 205 |
+
there are no duplicate annotation IDs or partially emitted cached subtasks.
|
| 206 |
+
|
| 207 |
+
See `metadata/release.json` for exact counts and byte sizes.
|
| 208 |
+
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000003.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:099b9c17e39b6337b941fc8ed5dfe8b2ba1753a9defeec8a90f76a66c81af0e3
|
| 3 |
+
size 10621007
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000006.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0414c90ae02bb1707d77b120a8b3a1961edb85752c4d3797baca812fb34da4b
|
| 3 |
+
size 13997580
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000012.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d78440bcf2cce927bd5347336d92a6115cd9e58c7507e8fa2702dc5d38a3277
|
| 3 |
+
size 12189278
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000016.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e3cea88c04db791d0769a0b7a40fd21758107698dd0f0a42e8333ae4c13042a
|
| 3 |
+
size 13085116
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000020.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de06685e9feaf6504a38366584bb7dbab0d220d9ac31862891fd8cc87cef3a88
|
| 3 |
+
size 10692130
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000023.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:98facebf4d5fb7d280f9632b0e3aa486dd20c0a24a9976f22c85ed9690a6ddae
|
| 3 |
+
size 18338365
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000027.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0bf13a877b0768781e86c5dab99968ea6cc250468b5c68a54d78b1effcf91d19
|
| 3 |
+
size 11148881
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000030.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:84bec7b8b2ad8cbfe4511907f7fae4562928271ab125faf8c8cfbe2f7f3af965
|
| 3 |
+
size 12016449
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000031.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9789b8b8947d95c24ae22e5d3d238c467fb4e36ff4ef8ba2c462e28863206cae
|
| 3 |
+
size 12400901
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000032.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:becc324838e67aa5d78f31be7f3225e058eb1da4bf04414de0cb904899bd285b
|
| 3 |
+
size 12397410
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000036.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7471082298fbea7581588a9d6ae15adf585a4c80ac41c085bb4180bc856cdcd6
|
| 3 |
+
size 12961893
|
data/droid_lerobot_right/annotations_node0_artifacts/annotation-artifacts-000040.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81942345670eda865790c9742b88e3afe552f726da47a719454e7de4eedf31c3
|
| 3 |
+
size 11590728
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000000.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b9666ff1681b8b846b55e253a823a1b142a95f39c221552d823cd0a563c12746
|
| 3 |
+
size 13031990
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000001.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d9db5e8452226a4161c370b0664897da82011baf86639604f387e5c5ad933c40
|
| 3 |
+
size 13634584
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000002.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7efeeda0232449d1ffd3867a041c6117c3a0b906111f54c23e37051b208da6ce
|
| 3 |
+
size 14913450
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000003.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81fee895a0cdf6ca31448c0ebfca74d141eef08c8b4887094218572baf3a1cb4
|
| 3 |
+
size 15250920
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000004.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f480cd319d7a80b40fddde9f441d2189593bcf2e6d67456d83aebc16b915977e
|
| 3 |
+
size 17436649
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000005.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9bb460bf102332d1687686dd7577a596d316b00df23289cfb2643e4b36430d2f
|
| 3 |
+
size 16263821
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000007.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99fa19fa7943d8bdffb118e17a0285b13548cc6aa8932be90900028110553899
|
| 3 |
+
size 14821562
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000008.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d33909d8242ba7d66bb5040a20b1ed10a154baf5417442150c3701b33fabfade
|
| 3 |
+
size 12917290
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000009.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07d70467b74eca8e61141b71727716d0f6638d51b11e2a2a511ffc6c03adf941
|
| 3 |
+
size 10602642
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000010.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e770076ddcaa44b2e37c3140aacab7bfecb88f33786c6559fe77550ef48fba03
|
| 3 |
+
size 10014530
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000011.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02455180566cd792a5ef61746a721598c15f0675638aa6e4dfbb09f2edf96c0c
|
| 3 |
+
size 11330617
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000012.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3b7ec4fc41a0436c4708ef3debef4606531a7d79e4a3fc112de41c7b0b5ba18
|
| 3 |
+
size 12491206
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000013.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:343fd02b625427a1424c67242a38c739f1cfa76a0ff27aa65c135e6be0f8c0c8
|
| 3 |
+
size 13109960
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000014.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3c738cac1dab32001d65ed2dcd2d0c3f6bd921221c7c4fc27e1bc9c94877923
|
| 3 |
+
size 12203991
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000015.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c73a76e154133f89f2342a64ea2e2660f3e6b93d3a8507bd8f4c09b319de5dc1
|
| 3 |
+
size 11416136
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000016.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a6a87f9b03284c7677ef414f1a2270ad1ee8d389358ced2b7e1ad351f58639e4
|
| 3 |
+
size 10470605
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000017.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a8f57bd5d43b2f723399feab9e41176537f09affe6fbbf4d88c808b256ec570
|
| 3 |
+
size 11981414
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000019.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7c9be3e0728816ab8be29add541c631c677e647aec8b6d624fb8d9585aa57dd
|
| 3 |
+
size 19754590
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000020.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ebb291e7f092ccac77fb1fc09a2162a07e3e70fa433b93c1a0ab1b2b2bb152a7
|
| 3 |
+
size 16255319
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000021.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8989d404cffbc5e2cbbd25c30714e49a065a3b5caece0ed85d6d79fe44e24997
|
| 3 |
+
size 14632803
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000022.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7db0a45e0655c1c671c6e278726e1db492b89167fbe3fe0be86158814cf7093b
|
| 3 |
+
size 12558649
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000024.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02ae01b16d683d83fb1e4d9e063a779dd2ec83c7c0a0de30424abffbfae44838
|
| 3 |
+
size 11501536
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000025.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9fd90a0ab9a66f6a7aa60958f47ad35ba473e325db27e523c6bc288a7ca2dade
|
| 3 |
+
size 11720155
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000026.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a16dc2105e8d1437c554463a57079ad659ec871699fa79e400ed3664dbacf1c5
|
| 3 |
+
size 11659762
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000027.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9683bf52c5e54725f2fca6cb8ebf6177a68b35e31c8f7f1c293ecd0cd00531d0
|
| 3 |
+
size 11555582
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000028.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:259fb7019fec7dade8e1c130a0d193a3281da41c519d71aa30fd70df582cd4db
|
| 3 |
+
size 12280865
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000029.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:116289b99a9d1d426eab306a3b2b4c74a322b825ecef891233621e80b6f86f5d
|
| 3 |
+
size 11829093
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000031.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:76e9cb1f1c583ecc59f533885f6515d8f55d5b30c388fb75041695197273eeaf
|
| 3 |
+
size 12829873
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000033.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e881d0261367610bf0404a2f81125ebb5ae0703aa540b1631e2ec2bd023d7971
|
| 3 |
+
size 12028585
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000034.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c5407e000651d3dbf091dea60907165b1b09f8a432ea15618bf7c94a300c03d1
|
| 3 |
+
size 11678628
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000035.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:01a59ef2379b91d30189f513173bca5f705152c6f0e2df691fe81b2128306863
|
| 3 |
+
size 12596989
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000037.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cba8b9493c959ff8e2e94d927b72c14f25ca6e90804f19ec396be35e5ab8d274
|
| 3 |
+
size 12067576
|
data/droid_lerobot_right/annotations_node5_artifacts/annotation-artifacts-000038.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ebcf3bef906f1d567e0fdad93d8d14538a0045d46b9e33d450a000234e61a86b
|
| 3 |
+
size 9308579
|
metadata/release.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "SPARC DROID Annotations",
|
| 3 |
+
"schema": {
|
| 4 |
+
"name": "sparc.annotation",
|
| 5 |
+
"version": "2.0"
|
| 6 |
+
},
|
| 7 |
+
"created_utc": "2026-08-31",
|
| 8 |
+
"source": {
|
| 9 |
+
"dataset": "DROID",
|
| 10 |
+
"format": "LeRobot v3 conversion",
|
| 11 |
+
"total_episodes": 53282,
|
| 12 |
+
"source_media_included": false
|
| 13 |
+
},
|
| 14 |
+
"views": {
|
| 15 |
+
"left": {
|
| 16 |
+
"dataset_id": "droid_lerobot",
|
| 17 |
+
"camera_view": "observation.images.left_external",
|
| 18 |
+
"annotation_rows": 63887,
|
| 19 |
+
"unique_trajectories": 52599,
|
| 20 |
+
"coverage_fraction": 0.987181,
|
| 21 |
+
"jsonl_files": 8,
|
| 22 |
+
"jsonl_bytes": 476979398,
|
| 23 |
+
"hdf5_files": 207,
|
| 24 |
+
"hdf5_bytes": 3019583455
|
| 25 |
+
},
|
| 26 |
+
"right": {
|
| 27 |
+
"dataset_id": "droid_lerobot_right",
|
| 28 |
+
"camera_view": "observation.images.right_external",
|
| 29 |
+
"annotation_rows": 64249,
|
| 30 |
+
"unique_trajectories": 52930,
|
| 31 |
+
"coverage_fraction": 0.993394,
|
| 32 |
+
"jsonl_files": 1,
|
| 33 |
+
"jsonl_bytes": 480473878,
|
| 34 |
+
"hdf5_files": 253,
|
| 35 |
+
"hdf5_bytes": 3315355682
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"totals": {
|
| 39 |
+
"annotation_rows": 128136,
|
| 40 |
+
"hdf5_files": 460,
|
| 41 |
+
"hdf5_bytes": 6334939137,
|
| 42 |
+
"jsonl_bytes": 957453276
|
| 43 |
+
},
|
| 44 |
+
"pointcloud_arrays_included": false,
|
| 45 |
+
"validation": {
|
| 46 |
+
"duplicate_annotation_ids": 0,
|
| 47 |
+
"invalid_json_rows": 0,
|
| 48 |
+
"missing_hdf5_references": 0,
|
| 49 |
+
"partially_emitted_cached_subtasks": 0
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
h5py>=3.10
|
| 2 |
+
huggingface_hub>=0.28
|
| 3 |
+
numpy>=1.26
|
scripts/__pycache__/read_sparc_droid.cpython-312.pyc
ADDED
|
Binary file (8.32 kB). View file
|
|
|
scripts/read_sparc_droid.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Read and validate the SPARC DROID JSONL + HDF5 release."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
from contextlib import ExitStack
|
| 8 |
+
import json
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
from typing import Iterable, Iterator, Mapping, Sequence
|
| 11 |
+
|
| 12 |
+
import h5py
|
| 13 |
+
import numpy as np
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
VIEW_DIRS = {
|
| 17 |
+
"left": "droid_lerobot_left",
|
| 18 |
+
"right": "droid_lerobot_right",
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def view_root(repo_root: str | Path, view: str) -> Path:
|
| 23 |
+
try:
|
| 24 |
+
dirname = VIEW_DIRS[view]
|
| 25 |
+
except KeyError as exc:
|
| 26 |
+
raise ValueError(f"view must be one of {sorted(VIEW_DIRS)}, got {view!r}") from exc
|
| 27 |
+
root = Path(repo_root) / "data" / dirname
|
| 28 |
+
if not root.is_dir():
|
| 29 |
+
raise FileNotFoundError(root)
|
| 30 |
+
return root
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def manifest_paths(repo_root: str | Path, view: str) -> list[Path]:
|
| 34 |
+
"""Return a non-duplicating manifest list for a camera view."""
|
| 35 |
+
root = view_root(repo_root, view)
|
| 36 |
+
consolidated = root / "annotations.jsonl"
|
| 37 |
+
if consolidated.is_file():
|
| 38 |
+
return [consolidated]
|
| 39 |
+
nodes = sorted(root.glob("annotations_node*.jsonl"))
|
| 40 |
+
if not nodes:
|
| 41 |
+
raise FileNotFoundError(f"No annotation manifests found under {root}")
|
| 42 |
+
return nodes
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def iter_annotations(repo_root: str | Path, view: str) -> Iterator[dict]:
|
| 46 |
+
for manifest in manifest_paths(repo_root, view):
|
| 47 |
+
with manifest.open("r", encoding="utf-8") as stream:
|
| 48 |
+
for line_number, line in enumerate(stream, 1):
|
| 49 |
+
if not line.strip():
|
| 50 |
+
continue
|
| 51 |
+
try:
|
| 52 |
+
yield json.loads(line)
|
| 53 |
+
except json.JSONDecodeError as exc:
|
| 54 |
+
raise ValueError(f"Invalid JSON at {manifest}:{line_number}") from exc
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def storage_reference(repo_root: str | Path, annotation: Mapping, view: str) -> tuple[Path, str]:
|
| 58 |
+
arrays = annotation.get("arrays") or {}
|
| 59 |
+
storage = arrays.get("storage") or {}
|
| 60 |
+
if "path" not in storage or "group" not in storage:
|
| 61 |
+
raise KeyError(f"Annotation {annotation.get('annotation_id')} has no HDF5 storage reference")
|
| 62 |
+
shard = view_root(repo_root, view) / storage["path"]
|
| 63 |
+
return shard, storage["group"]
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def load_arrays(
|
| 67 |
+
repo_root: str | Path,
|
| 68 |
+
annotation: Mapping,
|
| 69 |
+
view: str,
|
| 70 |
+
keys: Sequence[str] | None = None,
|
| 71 |
+
) -> dict[str, np.ndarray]:
|
| 72 |
+
"""Load selected arrays, copying them out before closing the HDF5 file."""
|
| 73 |
+
shard, group_name = storage_reference(repo_root, annotation, view)
|
| 74 |
+
with h5py.File(shard, "r") as handle:
|
| 75 |
+
if group_name not in handle:
|
| 76 |
+
raise KeyError(f"Missing group {group_name!r} in {shard}")
|
| 77 |
+
group = handle[group_name]
|
| 78 |
+
selected = list(group.keys()) if keys is None else list(keys)
|
| 79 |
+
missing = [key for key in selected if key not in group]
|
| 80 |
+
if missing:
|
| 81 |
+
raise KeyError(f"Arrays absent from {group_name}: {missing}")
|
| 82 |
+
return {key: np.asarray(group[key]) for key in selected}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def verify(repo_root: str | Path, views: Iterable[str] = ("left", "right")) -> dict:
|
| 86 |
+
"""Validate IDs and every JSON-to-HDF5 path/group reference."""
|
| 87 |
+
result = {}
|
| 88 |
+
for view in views:
|
| 89 |
+
annotation_ids: set[str] = set()
|
| 90 |
+
trajectory_ids: set[str] = set()
|
| 91 |
+
rows = 0
|
| 92 |
+
with ExitStack() as stack:
|
| 93 |
+
handles: dict[Path, h5py.File] = {}
|
| 94 |
+
for annotation in iter_annotations(repo_root, view):
|
| 95 |
+
rows += 1
|
| 96 |
+
annotation_id = str(annotation["annotation_id"])
|
| 97 |
+
if annotation_id in annotation_ids:
|
| 98 |
+
raise ValueError(f"Duplicate annotation_id in {view}: {annotation_id}")
|
| 99 |
+
annotation_ids.add(annotation_id)
|
| 100 |
+
trajectory_ids.add(str(annotation["source"]["trajectory_id"]))
|
| 101 |
+
shard, group_name = storage_reference(repo_root, annotation, view)
|
| 102 |
+
if not shard.is_file():
|
| 103 |
+
raise FileNotFoundError(shard)
|
| 104 |
+
if shard not in handles:
|
| 105 |
+
handles[shard] = stack.enter_context(h5py.File(shard, "r"))
|
| 106 |
+
if group_name not in handles[shard]:
|
| 107 |
+
raise KeyError(f"Missing group {group_name!r} in {shard}")
|
| 108 |
+
result[view] = {
|
| 109 |
+
"annotation_rows": rows,
|
| 110 |
+
"unique_annotation_ids": len(annotation_ids),
|
| 111 |
+
"unique_trajectories": len(trajectory_ids),
|
| 112 |
+
}
|
| 113 |
+
return result
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def main() -> None:
|
| 117 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 118 |
+
parser.add_argument("repo_root", type=Path)
|
| 119 |
+
parser.add_argument("--view", choices=sorted(VIEW_DIRS), default="right")
|
| 120 |
+
parser.add_argument("--limit", type=int, default=3)
|
| 121 |
+
parser.add_argument("--show-arrays", action="store_true")
|
| 122 |
+
parser.add_argument("--verify", action="store_true")
|
| 123 |
+
args = parser.parse_args()
|
| 124 |
+
|
| 125 |
+
if args.verify:
|
| 126 |
+
print(json.dumps(verify(args.repo_root), indent=2, sort_keys=True))
|
| 127 |
+
return
|
| 128 |
+
|
| 129 |
+
for index, annotation in enumerate(iter_annotations(args.repo_root, args.view)):
|
| 130 |
+
if index >= args.limit:
|
| 131 |
+
break
|
| 132 |
+
summary = {
|
| 133 |
+
"annotation_id": annotation["annotation_id"],
|
| 134 |
+
"trajectory_id": annotation["source"]["trajectory_id"],
|
| 135 |
+
"source_uuid": annotation["source"].get("source_uuid"),
|
| 136 |
+
"subtask_index": annotation["source"]["subtask_index"],
|
| 137 |
+
"instruction": annotation["task"]["instruction"],
|
| 138 |
+
"selection_score": annotation["selection"]["score"],
|
| 139 |
+
}
|
| 140 |
+
print(json.dumps(summary, indent=2, ensure_ascii=False))
|
| 141 |
+
if args.show_arrays:
|
| 142 |
+
arrays = load_arrays(args.repo_root, annotation, args.view)
|
| 143 |
+
print({key: {"shape": value.shape, "dtype": str(value.dtype)} for key, value in arrays.items()})
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
if __name__ == "__main__":
|
| 147 |
+
main()
|
| 148 |
+
|