vak.transforms.frame_labels.functional.to_boundary_times¶
- vak.transforms.frame_labels.functional.to_boundary_times(frame_labels: LongTensor, frame_times: FloatTensor, padval: float = -100.0) FloatTensor[source]¶
Convert a 1-dimensional tensor of integer frame labels to a tensor of float boundary times.
- Parameters:
frame_labels (torch.LongTensor) – Vector of class labels for each frame.
frame_times (torch.FloatTensor) – The time for each frame, e.g., the vector of bin center times that is computed for a spectrogram.
Notes
By convention, this function places a boundary at the first frame of any continuous run of a single integer class. E.g.,
``` [0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1, 0, 0]
^ ^ ^ ^ ^ ^ ^
` (where carets (``^) indicate boundaries). In other words, the start index of any segment is considered a boundary.