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

return indices of adjusted intervals #229

Open
georgid opened this issue Nov 8, 2016 · 4 comments
Open

return indices of adjusted intervals #229

georgid opened this issue Nov 8, 2016 · 4 comments

Comments

@georgid
Copy link

georgid commented Nov 8, 2016

I request an additional output of mir_eval.util.adjust_intervals():
idx_start: int
the idx in the parameter intervals of the returned new_intervals[0]
idx_end: int
the idx in the parameter intervals of the returned new_intervals[-1]

This could be useful when marking intervals of interest in a large file for later usage.

@craffel
Copy link
Collaborator

craffel commented Nov 8, 2016

Seems reasonable, but changing the output pattern of the function will break backwards compatibility, so can't be taken lightly. In particular, if there is scarce interest in this, I would suggest instead having users implement a custom function based on adjust_intervals as needed. @bmcfee any thoughts?

This could be useful when marking intervals of interest in a large file for later usage.

Can you give me a more specific example?

@bmcfee
Copy link
Collaborator

bmcfee commented Nov 8, 2016

I don't think I understand the suggested modification. Can you provide an example input and output of the proposed behavior?

@craffel
Copy link
Collaborator

craffel commented Mar 3, 2017

@georgid

Can you provide an example input and output of the proposed behavior?

If not or all is ok, we will close the issue.

@georgid
Copy link
Author

georgid commented Mar 14, 2017

very sorry for the slow responses.
Better idea for the return format is to return one additional entry in the tuple:

indices_intervals: nd.array shape(new_intervals.shape[0],1)
  the indices of the intervals as ordered in the input intervals, which are returned 

Not to break backwards compatibility, one can do boolean parameter, return_indices and set it to false by default, no?

Example:

intervals = np.array([[0,10], [10,20], [20,30], [30,40]])
(new_intervals, labels, indices_intervals) = mir_eval.util.adjust_intervals(intervals, labels=None, t_min=5,t_max=15, return_indices=True)
indices_intervals = (array([[ 5, 10], [10, 15]]), None, [0,1])

I have a file with annotations of lyrics lines. I need to work with particular segment of the song, for which I have the t_min and t_max. I would like to pick up only the relevant lines for that segment. The only way to take their content (lyrics) is by their ordered indices in the original file.

Or maybe there is a better function, which could do that?

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

No branches or pull requests

3 participants