WIP: Tracked segmentation masks I/O via Zarr and Dask#936
Draft
egoistpizza wants to merge 3 commits intoneuroinformatics-unit:mainfrom
Draft
WIP: Tracked segmentation masks I/O via Zarr and Dask#936egoistpizza wants to merge 3 commits intoneuroinformatics-unit:mainfrom
egoistpizza wants to merge 3 commits intoneuroinformatics-unit:mainfrom
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
What is this PR
Why is this PR needed?
As tracking models like SAM 2 and OCTRON become more widely used, there is a growing need to handle dense segmentation masks alongside standard bounding boxes. However, loading high-resolution instance masks directly into memory creates severe RAM bottlenecks. A memory-efficient, lossless approach is needed to bring this data into the
movementecosystem.What does this PR do?
This is a draft PR to lay the early architectural groundwork for a hybrid I/O approach, following up on recent community discussions. It introduces two main components to
movement.io:load_octron_bboxes: A CSV loader that handles standard bounding box coordinates but includes anextra_data_varstoggle. This allows users to selectively load heavy metrics (like eccentricity or solidity) only when explicitly required.load_masks_from_zarr: A loader that lazily references instance masks usingdask.array. It casts the data to boolean and structures it into anxarray.DataArraywith(time, individuals, x, y)dimensions.References
extra_data_varsand lazy loading architectural decisions.How has this PR been tested?
I wrote a local mock script to simulate an OCTRON CSV and a dummy Zarr array. This confirms the behavior we discussed on Zulip (specifically "Option 2"): the
extra_data_varsappend correctly, and the masks remain as lazy boolean Dask arrays without blowing up the RAM.Click to see the test script and output
test_poc.pyOutput:
(Note: Formal pytest suites will be added as the implementation matures).
Is this a breaking change?
No. This is purely additive and introduces new experimental loaders to the
movement.iomodule without altering the existingDeepLabCutorSLEAPpipelines.Does this PR require an update to the documentation?
Yes. Once the architecture is finalized, the I/O tutorials will need updates to show users how to utilize the
extra_data_varsargument and how to work with the lazy Dask mask arrays.Checklist: