Skip to content

fix(examples): resolve camera explicitly in egocentric contact_sheet enrichment - #253

Merged
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
NiranjanKumar001:fix/issue-234-egocentric-contact-sheet-multicam
Aug 29, 2026
Merged

kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
NiranjanKumar001:fix/issue-234-egocentric-contact-sheet-multicam

Conversation

@NiranjanKumar001

Copy link
Copy Markdown
Contributor

Fixes #234

just clearling it out until i come across some other issues which will be fun to work on.

What

contact_sheet in examples/egocentric/pipeline.py called
episode.frames(fps=1.0) without specifying a camera. On episodes with
more than one camera track, Episode._resolve_camera() raises
ValueError: episode has multiple cameras; pass one explicitly.

timestamp_regularity (line 30) and camera_health (line 35) in the
same file already resolved episode.cameras[0]. This change makes
contact_sheet consistent with them.

Validation

uv run ruff check --fix && uv run ruff format && uv run ty check
uv run pytest -q

…enrichment

episode.frames() without a camera raises ValueError when the episode has
more than one camera track.  contact_sheet was the only step in
examples/egocentric/pipeline.py that omitted the camera argument;
timestamp_regularity (line 30) and camera_health (line 35) already
resolved episode.cameras[0].  Passing camera=episode.cameras[0] makes
the example pipeline consistent and fixes the crash on multi-camera
recordings.

Regression test added in tests/test_enrichments.py verifying that an
enrichment resolving the camera explicitly completes without error on a
canonical two-camera episode.

Fixes Hebbian-Robotics#234
@NiranjanKumar001
NiranjanKumar001 marked this pull request as ready for review August 29, 2026 07:08
…shows

The test defined its own enrichment with the same shape, so reverting the fix
in examples/egocentric/pipeline.py left it green. It now loads the real
pipeline through import_pipeline_application; reverting either the camera
resolution or the new label turns contact_sheet into an ERROR.

Adds contact_sheet_camera, which was item 3 of Hebbian-Robotics#234: episode.cameras is
sorted, so cameras[0] is alphabetically first rather than the recorder's
primary, and a sheet that cannot say which camera it shows is a trap on any
multi-camera corpus.

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging. The fix is right, and I pushed a fixup on the test because it did not guard what it ships.

Validated on Linux: ruff check, ruff format --check, ty check, 1177 passed, 6 skipped.

Your test defined its own enrichment with the same shape, so it passed either way. I reverted examples/egocentric/pipeline.py back to episode.frames(fps=1.0) and ran your test:

11 passed

Green with the bug back in. The test proved that an enrichment calling frames(camera=..., fps=1.0) works, which was never in doubt; it could not see the file it was shipping alongside. That is the same shape as the python -m hflow test earlier this week, and it is worth naming because it is easy to write by accident: a test that mirrors the fix tests the mirror.

The fixup (082c104) loads the real pipeline through hflow.import_pipeline_application, the same way tests/test_stage_planning.py loads one. monkeypatch.chdir(tmp_path) keeps the example's DATA_ROOT (a relative path) inside the temp directory. Reverting either half of the change now turns contact_sheet into an ERROR:

revert the camera resolution   -> 1 failed
drop just the new label        -> 1 failed

Item 3 of #234 was missing, so the fixup adds it: contact_sheet_camera in the labels. episode.cameras is sorted, so cameras[0] is the alphabetically first camera rather than the one the recorder considered primary. On this two-camera fixture the sheet renders /top_cam/compressed while the spec declared wrist_cam first. A sheet that cannot say which camera it shows is a trap on any multi-camera corpus, and the assertion on that label is also what makes the test specific.

Thank you for finding this in the first place. It came out of pointing HFlow at real recordings, which keeps producing better material than reading the code does.

@kstonekuan
kstonekuan merged commit e944726 into Hebbian-Robotics:main Aug 29, 2026
5 checks passed
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.

[Bug]:examples/egocentric/pipeline.py: contact_sheet enrichment crashes on multi-camera episodes

2 participants