def decode_events(self, encoded):
'''Decode labeled events into (time, value) pairs
Parameters
----------
encoded : np.ndarray, shape=(n_frames, m)
Frame-level annotation encodings as produced by ``encode_events``.
Real-valued inputs are thresholded at 0.5.
Returns
-------
[(time, value)] : iterable of tuples
where `time` is the event time and `value` is an
np.ndarray, shape=(m,) of the encoded value at that time
'''
if np.isrealobj(encoded):
encoded = (encoded >= 0.5)
times = frames_to_time(np.arange(encoded.shape[0]),
sr=self.sr,
hop_length=self.hop_length)
return zip(times, encoded)
评论列表
文章目录