Add functions to extract first frame labels from cliplabels#64
Conversation
|
I noticed that Matt had already generated startframe_labels.json but SWC and Allen had not, so we need to functionality to do this either locally or on s3. In general I will also add the script for copying data here, so will plan to update pyproject.toml with the boto installation. Just wanted to flag that in case you had other thoughts. |
|
Thanks for the PR @sharmishtaa ! I will make sure to take a look at this next week when I'm back from FENS. |
There was a problem hiding this comment.
Hey @sharmishtaa, finally found the time to take a proper look at this and left comments inline.
I think the main thing that's still unclear in my head is what sort of workflow do we want for generating startlabels.json files. I can see at least three alternatives:
- Data contributors extract
startlabels.jsonfiles themselves and include them at data submission stage. Then the files are already present at the scratch bucket. Your implementation is consistent with that workflow. - Data contributors just submit
clipabels.jsonfiles, and our upcoming script will auto-extractstartlabels.jsonfrom them at the time of moving data from one bucket to the other.
The direction this PR will go depends on that key decision.
I personally have a slight preference towards the 2nd option, because I think it's more robust to have our script auto-extract that information, rather than have every data contributor pre-generate startlabels.json (essentially duplicating data that's already present in cliplabels.json).
Let me know what you think.
Note that tests are currently missing for the two new public functions, but let's first settle on the right workflow/interface before we worry about that.
Let's keep the conversation going here. I'm happy to take another look at this when you need me to.
I don't think we can expect data contributors to extract the startframe themselves. But what I was unclear about was if we want to leave it as an option - for example Matt had generated his files already. But you bring up a good point about consistency and it will also be a good validation step to ensure that cliplabels.json conforms with what we expect before we copy it. So I'm good with option 2. |
|
Will separate out the s3 utils and will take a look at the other comments later this week. |
|
Hi @niksirbi - I made the changes to function names, outputs, error catching descriptions, docs, pyproject.toml and separated out the s3 utils. At the moment, I added utilities for just copying json files, but we will need one for generic copying of directories, which can be a separate ticket. |
niksirbi
left a comment
There was a problem hiding this comment.
Thanks for updating the PR @Sharmisthaa!
I added a few commits on top for some finishing touches—fixed linting errors, made sure that typing and docstrings are consistent and added a few more tests.
I also got rid of the boto3 availablity check: that would be useful if boto3 was an optional extra dependency, but we can safely assume its availability since it's now a core dependency.
The only significant behaviour I added was to also validate fie suffixes for output_path/uri: basically, output paths (and URIs) are also validated (if provided) to ensure that they end with startlabels.json (as the schema stipulates).
The only remaining task is to resolve the merge conflicts by rebasing. I am happy to take care of that; just wanted to check in that you are fine with the changes I made (any of them can be easily undone) before I undertake the rebasing (which will alter the git history).
|
Looks good to me. Please go ahead! |
Add extract_startlabels (local) and extract_startlabels_s3 (S3) to derive *_startlabels.json files from *_cliplabels.json, plus a dedicated s3.py module (parse_s3_uri, download/upload JSON helpers). Register the new public functions in the docs API index, add boto3 as a dependency, and add unit tests for the new functionality.
78dc661 to
e59c1e8
Compare
Adds two new functions to extract only the first frame's labels from cliplabels.json files:
Both functions read *_cliplabels.json files and create corresponding *_startlabels.json files containing only labels for frame id=0.
Before submitting a pull request (PR), please read the contributing guide.
Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)
Description
What is this PR
Why is this PR needed?
This PR addresses the first step in the issue #63 which is a script for copying benchmark data from the temporary location to the benchmark location.
What does this PR do?
This script adds a function forstripping the cliplabels file and creating a new file that only contains the first label of the frame which will be shared in the benchmark for the Test data.
References
#63
How has this PR been tested?
Please explain how any new code has been tested, and how you have ensured that no existing functionality has changed.
Is this a breaking change?
No
Does this PR require an update to the documentation?
If any features have changed, or have been added. Please explain how the
documentation has been updated.
Checklist: