vak.transforms.frame_labels.functional.from_segments#

vak.transforms.frame_labels.functional.from_segments(labels_int: ndarray, onsets_s: ndarray, offsets_s: ndarray, time_bins: ndarray, unlabeled_label: int = 0) ndarray[source]#

Make a vector of labels for a vector of frames, given labeled segments in the form of onset times, offset times, and segment labels.

Parameters:
  • labels_int (list, numpy.ndarray) – A list or array of labels from the annotation for a vocalization, mapped to integers

  • onsets_s (numpy.ndarray) – 1-d vector of floats, segment onsets in seconds.

  • offsets_s (numpy.ndarray) – 1-d vector of floats, segment offsets in seconds.

  • time_bins (numpy.ndarray) – 1-d vector of floats, time in seconds for center of each time bin of a spectrogram.

  • unlabeled_label (int) – Label assigned to frames that do not have labels associated with them. Default is 0.

Returns:

frame_labels – same length as time_bins, with each element a label for each time bin

Return type:

numpy.ndarray