feat: added from_idtracker to generate bbox annotations from idtracker.ai (#8)#150
Open
GauravSRC wants to merge 3 commits into
Open
feat: added from_idtracker to generate bbox annotations from idtracker.ai (#8)#150GauravSRC wants to merge 3 commits into
GauravSRC wants to merge 3 commits into
Conversation
ad97a58 to
6813fcf
Compare
for more information, see https://pre-commit.ci
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.
Closes #8
Summary
Adds
ethology/io/annotations/load_idtracker.pywith a public functionfrom_idtrackerthat converts idtracker.ai output files into a validethologybounding box annotationsxr.Datasetthat can be reviewedby a human and then exported with the existing
save_bboxes.to_COCO_file.New files
ethology/io/annotations/load_idtracker.pyfrom_idtracker+ two private helperstests\test_unit\test_io_annotations\test_load_idtracker.pyHow it works
Inputs
trajectories_path.npypath(n_frames, n_animals, 2)frame_indiceslist[int]bbox_size(width, height)blobs_collection_pathisNoneblobs_collection_path.pklpathimages_dirOutput --
xr.Datasetvalidated byValidBboxAnnotationsDataset:position(image_id, space, id)-- centroid (x, y) in pixelsshape(image_id, space, id)-- (width, height) in pixelscategory(image_id, id)-- 1-based animal identityFrames where an animal is undetected (NaN centroid in trajectories / no
blob with matching identity) produce NaN in
position/shapeand-1incategory, consistent with the NaN-padding convention usedthroughout the rest of the codebase.
Testing
All tests use synthetic
numpyarrays andunittest.mock.MagicMockblobs -- no external test-data files or network access are needed.
Checklist
load_bboxes.py@_check_output(ValidBboxAnnotationsDataset)