Skip to content

dataforge: timing + shared hands/objects/meshes for the exoego ports - #314

Closed
pablo-rerun wants to merge 3 commits into
mainfrom
exoego/0-foundation
Closed

pablo-rerun wants to merge 3 commits into
mainfrom
exoego/0-foundation

Conversation

@pablo-rerun

Copy link
Copy Markdown
Collaborator

Branch: exoego/0-foundation → main (3 commits: 7514034, 7941b3e, c3f603c).

What and why

Seven simplecv exoego datasets (hocap first, then assembly101, umetrack, hot3d, aria_gen2_pilot, epfl, mamma) will port into dataforge. They all need three things that today live inside the SHOW3D modules or do not exist yet: conversion timing, a hands writer and an objects writer. This PR builds them once, moves SHOW3D onto them with no output change, and adds a layer comparator, so each dataset lane only writes a reader.

  • Timing. dataforge-convert writes one typed record per sequence to <output_root>/timing/convert.jsonl: stage seconds (fetch, transcode, write:<layer>), total, capture length, bytes per written layer, converter version (<schema>+<git sha>), host, skipped/error. dataforge-register writes timing/register.jsonl: seconds per layer, blueprint publish seconds, segment count, total. Converters time stages through an explicit DataforgeDataset.timer and report the capture length on it. No file is re-read for timing.
  • dataforge-register gains --catalog-name (register the same files under e.g. <dataset>-sample) and --sequences (register a subset). Default behaviour is unchanged.
  • Hands. Dense COCO-133 Points3DWithConfidence at /world/gt/coco133_xyz and shipped-2D coco133_uv, with the port-wide confidence rule in one function: a present joint keeps its shipped confidence, or 1.0 when the source ships none (explicit None); a missing joint or an uncovered slot is NaN with confidence 0.0. coco133_from_hands owns simplecv's assembly21_to_coco133 mapping and its derived slots (92/113 wrist-thumb CMC midpoints, 9/10 wrist copies; they carry the owning hand's confidence).
  • Objects. object_pose = every shipped (finite) transform through the canonical log_pose_track + dense confidence Scalars; object_mesh = static Asset3D + albedo_factor alpha that is opaque only where a pose exists and the confidence is above the dataset's threshold (rows only at transitions). strip_texture_transform stays: Rerun 0.38.1 still refuses GLBs that require KHR_texture_transform (pixel evidence).
  • Meshes. One per-frame Mesh3D batch writer (empty row where tracking is lost) for MANO and UmeTrack hands; skinning stays model-specific.
  • Comparator. tools/dev/compare_layers.py <a.rrd> <b.rrd> [--atol] [--ignore entity component] compares two recordings by entity, component and source clocks, independent of chunking; it reports every mismatch (first differing row and time, max float delta). The dataset lanes use it for simplecv parity at 1e-4 m.
  • Docs. docs/dataset-doc-template.md (Source · Raw inventory · Layers and entities · Differences from simplecv · Timing); README "Conventions for exoego ports"; the duplicated "layer rule" block is removed.

What moved where

From (main) To Notes
show3d_hands.py: COCO-133 3D/2D logging, per-hand confidence, joint angles dataforge/hands.py (log_keypoints3d, log_keypoints2d, log_hand_confidence, log_joint_angles, confidence_rule, coco133_from_hands, HAND_OF_SLOT) SHOW3D keeps only its reader and the UmeTrack landmark-order check
show3d_hands.py: wrist Transform3D rows (via FrameClock.send_sparse) logging_toolkit.log_pose_track (existing canonical pose writer) FrameClock.send_sparse removed
show3d_hands.py: per-frame hand Mesh3D batches dataforge/meshes.py (log_mesh_batch) skinning stays in SHOW3D
show3d_objects.py: pose rows + confidence; mesh albedo visibility dataforge/objects.py (log_object_pose, log_object_mesh) pose rows through log_pose_track; mesh visibility needs pose and confidence
show3d_mesh_source.py: strip_texture_transform dataforge/objects.py dated 0.38.1 evidence note lives here only
show3d_layers.py: root annotation_context() dataforge/logging_toolkit.py COCO-133 class 0 + ROI box classes 100-103, unchanged
(new) dataforge/timing.py (SequenceTimer, ConvertRecord, RegisterRecord, append_record, load_records)
(new) datasets/base.py: DataforgeDataset.timer, DataforgeDataset.targets() other converters inherit them, unchanged otherwise
(new) apis/convert.py: convert_one; apis/register.py: republish_blueprints, --catalog-name, --sequences
(new) apis/compare_layers.py + tools/dev/compare_layers.py
writing.py literal "1" writing.CONVERT_SCHEMA_VERSION shared by the recording property and the timing record

All shared writers take the same clock contract: keyword times_ns= / frame_indices=, like log_pose_track.

Proof

  • Gate: pixi run --frozen -e dataforge-dev gate on pablo-dl-server @ c3f603c: lint, typecheck (0 errors), deadcode clean; 230 unit and 123 integration tests passed (6 skipped: lamaria VRS absent). tests-golden: 56 passed, 8 skipped (same asset).
  • No behaviour change: two SHOW3D scenes (SPI102/keyboard_toss-away_83ef, LYA722/birdhousetoy_shaking_8eca) converted with this branch and with origin/main (34ee7f4). All 12 layer files (base, hand_pose, captions, object_pose, object_mesh, hand_mesh × 2) are equal with compare_layers --atol 0.0 (same entity paths, components, row counts and values; the SDK's build-time RecordingInfo:start_time is excluded). Logs on pablo-dl-server: /home/pablo/exoego-data/foundation/compare-fix-vs-main-atol0.log.
  • Timing sanity: the converter-reported capture_s (16.683333332 s birdhouse, 9.749999999 s keyboard) equals the value the earlier rrd re-read measured, exactly. Example record: /home/pablo/exoego-data/foundation/parity-fix/timing/convert.jsonl.

Thermo review consolidation

Two strict reviews (Fable 5.1: 12 findings; Codex gpt-6-astra xhigh: 3 findings) were merged into 12 items. All of them were applied, three in part. Full table: /tmp/fleet-artifacts/exoego-migration/runs/thermo-foundation-consolidated.md.

  • Applied: the canonical pose writer for wrists and object poses (blocker); no trust knob on object_pose; mesh visibility needs a pose; coco133_from_hands; compare_layers without asserts; an explicit timer in place of the ambient ContextVar and no rrd re-read for the capture length; one clock contract; register clean-up; annotation_context moved; keypoint-writer nits; generic load_records; one KHR note.
  • Not applied, with reasons: (1) changing convert() to return a ConvertResult on all six datasets. Five of those converters are outside this lane, the change would touch about 40 test call sites, and the output would not change. The explicit DataforgeDataset.timer gives the ports the same contract. (2) Deleting file_stamps. It is the only generic way to learn which files the five non-reporting converters wrote. (3) Adding confidence colours to the 2D keypoints. That would change the SHOW3D hand_pose output. (4) Lifting a shared Clock class. It waits for the first port that needs it, because it touches msd.

Gate: dataforge-dev gate on pablo-dl-server @ c3f603c

…yer comparator; SHOW3D moves onto them

Foundation for the simplecv exoego ports (wave 0).

- dataforge/hands.py: dense COCO-133 Points3DWithConfidence at /world/gt/coco133_xyz,
  shipped-2D coco133_uv, per-hand confidence, joint angles, wrists, root AnnotationContext.
  confidence=None means the source ships none (present joints 1.0); missing joints and
  uncovered slots are NaN with confidence 0.0.
- dataforge/objects.py: sparse object_pose transforms + confidence, object_mesh static
  Asset3D with transition-only albedo visibility; trust threshold is a parameter.
  strip_texture_transform moves here (Rerun 0.38.1 still rejects KHR_texture_transform).
- dataforge/meshes.py: per-batch Mesh3D with empty rows for untrusted frames.
- dataforge/timing.py + apis/convert.py/register.py: per-sequence stage timers, typed
  JSONL records in <output_root>/timing/{convert,register}.jsonl; register gains
  --catalog-name and --sequences.
- apis/compare_layers.py + tools/dev/compare_layers.py: chunk-independent layer comparison.
- SHOW3D uses the shared writers and records fetch/transcode/write:<layer> stages.
- docs: dataset-doc-template.md, README exoego-port conventions, duplicate layer-rule block removed.

No behaviour change: both reference SHOW3D scenes (keyboard, birdhouse), converted by main
and by this branch, compare equal on all 6 layers at atol=0.
…code

- hands: 3D and 2D writers share confidence_rule (present = shipped or 1.0,
  missing = NaN + 0.0); SHOW3D drops its own non-finite masking, which the
  writer already applies.
- objects: visibility rows built only for non-empty tracks (no empty-array
  fallback); index lists on one line.
- SHOW3D objects: mm->m scaling vectorised once; mesh threshold uses
  DEFAULT_CONFIDENCE instead of a literal 0.5; annotated locals.
- timing: SequenceTimer.add shared by stage() and record(); append_record is a
  locked buffered write instead of a raw os.write loop.
- convert: output root hoisted out of the loop; file_stamps() replaces three
  copies of the (mtime_ns, size) expression; records built with keywords
  (register too).
- log_cameras futures back to a comprehension; leftover blank lines removed;
  test imports hoisted to module level.

No output change: lint, typecheck, deadcode, 226 unit and 123 integration
tests pass; all six SHOW3D layers of two scenes equal main's at atol 0.
… visibility

Consolidated fixes from the two strict reviews (Fable 5.1 + Codex xhigh).

- hands: log_wrist deleted; SHOW3D wrists and object poses go through
  logging_toolkit.log_pose_track. New coco133_from_hands + HAND_OF_SLOT own
  the two-hand -> COCO-133 mapping and derived-slot confidence (9/10, 92/113);
  both SHOW3D loops call it. log_keypoints2d builds its own path from rig/cam;
  float64 hand confidence; joint angles as a FixedSizeListArray.
- objects: log_object_pose has no trust knob (missing pose = non-finite
  transform); log_object_mesh needs a pose AND confidence above the threshold.
- shared writers (hands/objects/meshes) take keyword times_ns/frame_indices,
  like log_pose_track. annotation_context moves to logging_toolkit.
- timing: the ambient ContextVar timer, stage()/record() and the capture_span
  rrd re-read are gone. DataforgeDataset.timer is an explicit SequenceTimer that
  dataforge-convert installs per sequence; converters report stages and
  capture_s on it (SHOW3D from its frame clock). DataforgeDataset.targets(),
  convert_one(), generic load_records(path, cls).
- register: catalog_name variable; republish_blueprints extracted and timed
  on its own; layer_s holds layers only.
- compare_layers: no asserts; compare_layers returns a Comparison (track count
  + mismatches), main prints and exits "<n> mismatch(es)".

No output change: gate (lint, typecheck, deadcode, 230 unit, 123 integration)
and 56 golden tests pass; all six SHOW3D layers of two scenes equal main's at
atol 0; capture_s matches the old re-read values exactly.
@pablo-rerun

Copy link
Copy Markdown
Collaborator Author

Replaced by the re-cut review stack: #327 + #328. Same work, consolidated (shared code moved into dataforge/simplecv, projectaria-tools removed) and cut by responsibility; each dataset PR proves its sample outputs bit-identical. Review guide: https://pablos-4800gt.ilish-ruler.ts.net:8768/exoego-migration/review-guide.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants