Closed niksirbi closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.67%. Comparing base (
a30e796
) to head (2551b30
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks a lot @lochhh! I like your suggestion to use the pose file names as keys, it indeed simplifies things a lot. I will give it a try.
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Thanks a lot @lochhh! I like your suggestion to use the pose file names as keys, it indeed simplifies things a lot. I will give it a try.
I've implemented this and it works! I've added this as an "EDIT" to the PR's description.
Description
What is this PR
Why is this PR needed? Having video files, and/or frames extracted from those videos, associated with existing sample pose files will greatly facilitate the development and debugging of GUIs, because it would allow us to plot trajectories over a meaningful background, define ROIs etc. See all the issues linked in References.
What does this PR do?
It overhauls the
sample_data.py
module to allow for the fetching of videos and/or frames alongside the fetching of pose files. All the changes were done in conjunction with changes to the data repository on GIN and should be interpreted together.Changes to the data repository:
metadata.yaml
. I added new metadata fields, to express the association between pose datasets and videos/frames. Here's an example entry:get_sha256_hashes.py
which will iterate over all files inposes
,videos
, andframes
and write the results to txt files (poses_hashes.txt
,videos_hashes.txt
,frames_hashes.txt
). It doesn't go all the way to fully automate the generation of metadata.yaml entries, but it is an improvement on previous practices.Changes to the code repository (this PR):
sample_data.py
module now exposes 3 public functions:list_datasets()
: returns the filenames of the sample pose files (the one in theposes
folder)fetch_dataset_paths(filename)
: given a filename of a valid pose dataset (one that the above function returns), return a dict of 3 local paths, with keys "poses", "video", "frame". If video or frame is missing, their value is None.fetch_dataset(filename
) : given a filename of a valid pose dataset (one thatlist_datasets()
returns), callsfetch_dataset_paths(filename)
and proceed to load the "poses" into a movement dataset. The "video" and "frame" paths do not get loaded (for now), they are simply stored as dataset attributes.This is the function we expect to be most used, and the updated docs reflect that.
References
Closes #38. Closes #121 because the syntax is much less awkward now (with fewer redundancies), and I think there is no longer a clear need for rewriting the
sample_data.py
module into a class.Facilitates #105, #49, #50, #48, #164.
How has this PR been tested?
Updated existing tests in
test_sample_data.py
.Is this a breaking change?
Yes, the API for fetching sample datasets has changed. This PR need to be merged ahead of any others, because the changes to the GIN data repository have broken CI, and it will remain broken until this is merged.
Does this PR require an update to the documentation?
Yes, I've updated the relevant sections of the docs.
Checklist:
EDIT 2024-05-07
Following @lochhh 's suggestion, the
metadata.yaml
has been reformatted as a dict of dicts, using the pose file names as top-level dict keys:This simplifies the logic inside
sample_data.py
quite a bit!