Repository navigation
Conversation
f2a9094 to
50b007f
Compare
3b5d6fa to
0f9397b
Compare
nathanhhughes
left a comment
There was a problem hiding this comment.
At a high-level, it would be nice if this ended up in the hydra python bindings / package instead of at the top-level directory (and used imageio for reading images instead of a mix of PIL and a random opencv flavor). I would be okay with making it so that it's possible to pip install hydra and just having hydra warn on import that the bindings aren't built (but also I have it set up now that the python bindings are available when you source your colcon workspace so you might not actually need to). Neither of these are super necessary though.
Will tag Multy as a reviewer to take a second look, but this probably doesn't need a super careful review
Importing hydra_python without _hydra_bindings (pip install without a Hydra build, HYDRA_ENABLE_PYTHON=OFF) warns once (BindingsNotBuiltWarning, BINDINGS_ERROR keeps the reason) instead of failing, so pure-python subpackages work on their own. A top-level (pip / scikit-build) build that cannot find hydra skips the bindings target with a CMake warning instead of failing. colcon builds are unchanged.
hydra_python.image_store: one SQLite index (store.sqlite, schema_version 1) per robot process with frames, observations, track bindings, node aliases and calibrations; ImageStore (read-only, multi-store) and ImageStoreWriter. Image headers / masks are read with imageio.
PNG/JPEG through imageio (the archive colour PNG holds Hydra's RGB Mat in OpenCV's BGR file order and is swapped back). Depth EXR through a small numpy reader for the encodings InputData::save writes (none / RLE / ZIP): no imageio backend reads EXR out of the box; other encodings fall back to imageio's opencv plugin.
Builds/updates a store from keyframe archives, Khronos track logs, track_bindings.json and merges.json: keyframes and observation frames, kept/not-kept observations, track bindings, node aliases and agent-node anchors. Idempotent and additive; rows of other writers (EXTERNAL_TRACK_BASE) are kept.
click group image-store under the hydra CLI (index, check, info, export), also python -m hydra_python.image_store. check: structural checks (+ anchors / bound nodes against a scene graph); export: one folder of images and metadata per node.
… the C++ writers Archives and track logs are encoded as the C++ writers do (OpenCV, test-only dependency); data/real_cpp holds files written by the Hydra/Khronos gtests. Also covers: no OpenCV and no bindings needed, the EXR fallback, the hydra CLI entry.
0f9397b to
dd8dbbe
Compare
|
Thanks! I did both:
History is rebuilt as clean commits on |
dd8dbbe to
14acd17
Compare
MultyXu
left a comment
There was a problem hiding this comment.
LGTM! I think to me the functionality make sense.
|
Last quick comment: I like openexr as a depth format (it helped with saving float32 images if I remember correctly), but also okay with switching the serialization to tiff if it makes this simpler (idk if it's that important to make that switch now, but would save us in rebuilding image stores later) |
Hydra (#199) and Khronos (MIT-SPARK/Khronos#48) only log plain files.
hydra_python.image_storebuilds one SQLite store per robot from those files, after the run or on first open, and serves the read API.What this does
InputDataarchives (<keyframes>/<ts>.zip), Khronos track logs (<tracks>/<id>/track.json+ kept images),frontend/track_bindings.json,backend/merges.json, frontend/backenddsg.json(agent nodes). Contract:image_store/FORMAT.md.ImageStore.open(run)indexes a run that was never indexed, and re-indexes when the raw files changed (fingerprint in meta, under a lock file).hydra image-store index RUNdoes it explicitly. Re-indexing is additive. An unreadable archive is skipped with one warning and read again only when its mtime or size changes. Track ids fromEXTERNAL_TRACK_BASE(1 << 40) up belong to other writers and are never touched.frames.kind0). Observations go on the keyframe of the same sensor and stamp, else on an observation frame (kind2). Readers reject any other kind value with a clear error.anchor_T_bodycomes from odometry, andframe_posecomposes it with the optimized agent pose, so poses follow loop closures.observations(node)follows merges. Alsoframes_for_agent,agent_frame,frames,frame_pose,calib,mask,canonical,members,unbound_tracks,descriptor(s).schema_version1.Review notes addressed
hydra/python/src/hydra_python/image_store/, with README and FORMAT next to it.hydra/python/tests/image_store/.HYDRA_ENABLE_PYTHON=ON) and the scikit-build wheel both ship the directory as is,schema.sqlincluded.hydra_pythondependencies.imageio.v3.InputData::savewrites (none / RLE / ZIP). No imageio backend reads EXR out of the box (the opencv plugin needsOPENCV_IO_ENABLE_OPENEXRbefore cv2 is imported; freeimage needs a binary download).input_data_io.cppdoes.import hydra_pythonwithout_hydra_bindingswarns once (BindingsNotBuiltWarning;hydra_python.BINDINGS_ERRORholds the reason) and skips the binding-dependent modules.hydraskips the_hydra_bindingstarget instead of failing.Commits
feat(hydra_python): import without the compiled bindingsfeat(image_store): store reader/writer, codecs and the store schemafeat(image_store): read Hydra InputData keyframe archivesfeat(image_store): indexer for Hydra/Khronos image logsfeat(image_store): hydra image-store CLI, check and exporttest(image_store): store, indexer and CLI tests, including files from the C++ writersdocs(image_store): README and the image log formatTests
cd hydra/python && python -m pytest tests/image_store: 85 passed.hydra image-storeentry.tests/image_store/data/real_cppholds files written by the Hydra/Khronos gtests themselves (regenerate.sh).pre-commitpasses.pip install --no-deps hydra/in a clean venv without Hydra: the CMake warning is printed, the wheel containshydra_python/image_store(withschema.sql), andimport hydra_python.image_storeworks with the warning.Evidence
Indexing the same raw Penn runs (Spot, courtyard) with the v1 package and with this one:
check --dsgpasses.Live 60 s and 300 s windows match the earlier runs (numbers in the follow-up notes). Earlier evidence for the format (9 full sessions, LC windows, reprojection) is unchanged, since the store content is identical.
Notes
hydra image-store tail, which indexes live from Hydra's event logs.Related PRs