mir_eval icon indicating copy to clipboard operation
mir_eval copied to clipboard

return indices of adjusted intervals

Open georgid opened this issue 8 years ago • 4 comments

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.

georgid avatar Nov 08 '16 16:11 georgid

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?

craffel avatar Nov 08 '16 19:11 craffel

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

bmcfee avatar Nov 08 '16 19:11 bmcfee

@georgid

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

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

craffel avatar Mar 03 '17 18:03 craffel

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?

georgid avatar Mar 14 '17 16:03 georgid