Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending annotations by adding units #59

Merged
merged 12 commits into from
May 27, 2021

Conversation

magdalenafuentes
Copy link
Collaborator

Following the discussion in #58 I think we should follow ideas in mirdata and add units to the annotations, so they become "reusable", e.g. we use the same annotation type for annotations with azimuth in degrees or radians by simply indicating the units.

Note that I introduced the units some default values, in particular for confidence_unit="binary", labels_unit="open" and intervals_unit="s". I think this is correct for all datasets that we have now but please keep this in mind when reviewing the code because it could introduce silent bugs. If you prefer I can make the units mandatory but that means having to modify all tests and loaders.

@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #59 (9c5a667) into master (57594bb) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #59      +/-   ##
==========================================
+ Coverage   96.90%   96.93%   +0.03%     
==========================================
  Files          16       16              
  Lines        1294     1307      +13     
==========================================
+ Hits         1254     1267      +13     
  Misses         40       40              

@magdalenafuentes
Copy link
Collaborator Author

@iranroman once we merge this you can start with #58

@magdalenafuentes magdalenafuentes added this to the Release 0.1.0 milestone May 25, 2021
Copy link
Contributor

@justinsalamon justinsalamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magdalenafuentes nice work! Added some comments, happy to discuss to iron out quickly. tnx!

soundata/annotations.py Outdated Show resolved Hide resolved
soundata/annotations.py Outdated Show resolved Hide resolved
soundata/annotations.py Outdated Show resolved Hide resolved
Comment on lines 78 to 80
intervals_unit="s",
labels_unit="open",
confidence_unit="binary",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry that if these values have defaults people will miss/ignore them and that will leads to bugs (e.g. dataset annotated in milliseconds but the interval unit is set to s.

@magdalenafuentes thoughts about not having default values here and forcing the user to set them explicitly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree.. If we enforce it then we have to edit all the loaders. I'm ok doing that because we don't have as many loaders yet, but in the future it would be nice to think of a way of introducing changes without having to manually edit all files. I haven't really found a workaround for it..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you raise a good point (about updating loaders). But hopefully the API (especially for mandatory fields) doesn't change very often (changing mandatory fields would be a breaking change so ideally we avoid it as much as possible), so I don't anticipate us having to make these updates very often at least.

If you're OK with it, I would vote for making these mandatory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on making them mandatory. About the breaking change, I super agree, but the changes I'm talking about are not always breaking changes, we can break things under the hood without the user noting and those usually need an update of loaders, which is not ideal. Anyway, just dropping that idea here so we keep it in mind for the future, let's see if we can come up with a strategy to avoid those

soundata/annotations.py Outdated Show resolved Hide resolved
tests/test_annotations.py Show resolved Hide resolved
tests/test_annotations.py Outdated Show resolved Hide resolved
@magdalenafuentes
Copy link
Collaborator Author

magdalenafuentes commented May 27, 2021

@justinsalamon I made the changes we discussed, let me know how it looks. Also, I added a commit with a proposal to change the MultiAnnotator class: I changed labels -> annotations to be more general, so now the class has the fields annotations and annotators

Copy link
Contributor

@justinsalamon justinsalamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magdalenafuentes looks awesome. mentioned a couple of tiny nits. 🚀

soundata/annotations.py Outdated Show resolved Hide resolved
soundata/annotations.py Outdated Show resolved Hide resolved
soundata/annotations.py Show resolved Hide resolved
soundata/annotations.py Show resolved Hide resolved
@justinsalamon
Copy link
Contributor

Be sure to bump the version after you merge and make a new release :)

@magdalenafuentes magdalenafuentes merged commit f8988b3 into master May 27, 2021
@magdalenafuentes magdalenafuentes deleted the fuentes/annotations_extensions branch February 6, 2024 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants