Skip to content

Add MultiAnnotator class - #515

Merged
magdalenafuentes merged 14 commits into
masterfrom
fuentes/multiple_annotators
Aug 1, 2025
Merged

Add MultiAnnotator class#515
magdalenafuentes merged 14 commits into
masterfrom
fuentes/multiple_annotators

Conversation

@magdalenafuentes

@magdalenafuentes magdalenafuentes commented Jun 3, 2021

Copy link
Copy Markdown
Collaborator

This PR adds the MultiAnnotator class to group annotations of same track by different annotators in a smooth and clear way.

IMPORTANT: this PR deprecates the API for the salami loader, but is still compatible to it.

@codecov

codecov Bot commented Jun 3, 2021

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (1d72c32) to head (74f0fd7).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #515   +/-   ##
=======================================
  Coverage   97.05%   97.06%           
=======================================
  Files          68       68           
  Lines        7363     7383   +20     
=======================================
+ Hits         7146     7166   +20     
  Misses        217      217           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nkundiushuti nkundiushuti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe add something to the contributing documentation?

Comment thread mirdata/annotations.py Outdated
Comment thread mirdata/annotations.py
array_like (array-like): object to validate
expected_type (type): expected type, either list or np.ndarray
expected_dtype (type): expected dtype
check_child (bool): if True, checks if all elements of array are children of expected_dtype

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what happens if there are multiple children with different expected dtypes (e.g a beat annotation with ints for the beat positions and floats for the time stamps?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

here we're only checking if the list is composed of BeatData, ChordData, etc. The checks within the annotation type are done for each annotation type independently

Comment thread mirdata/datasets/salami.py
Comment thread mirdata/annotations.py Outdated
Comment thread mirdata/annotations.py
Comment thread mirdata/annotations.py Outdated
annotations (list): list of annotations (e.g. [annotations.BeatData, annotations.ChordData]
"""

def __init__(self, annotators, annotations) -> None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think these two inputs would be better as a single dictionary:
{ 'annotator-id': Annotation }

same with how it's stored, self.annotations = {'annotator1': ... , 'annotator2', ...}
because it will make it easier to look up a specific dictionary instead of having to look for matching indexes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I tried this out and noticed that some tracks have the same annotator id for different annotations in the same track (which might be a bit weird actually... but it's there :/). Also the sintax gets a bit messy, since I have to iterate in the keys each time I want to access an annotation because the annotator id changes from track to track. So I changed back to what was before for now. Let me know what you think

Comment thread mirdata/annotations.py Outdated
Comment thread mirdata/annotations.py

@nkundiushuti nkundiushuti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this looks great! thanks, @magdalenafuentes !

@magdalenafuentes

Copy link
Copy Markdown
Collaborator Author

Will wait for @rabitt to see if she has any other comments/edits. Otherwise @nkundiushuti or @rabitt feel free to merge since I will be offline starting today!

@magdalenafuentes
magdalenafuentes merged commit 72e7a1e into master Aug 1, 2025
12 checks passed
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.

3 participants