vak.transforms.frame_labels.functional.to_labels#

vak.transforms.frame_labels.functional.to_labels(frame_labels: ndarray, labelmap: dict) str[source]#

Convert vector of frame labels to a string, one character for each continuous segment.

Allows for converting output of network from a label for each frame to one label for each continuous segment, in order to compute string-based metrics like edit distance.

Parameters:
  • frame_labels (numpy.ndarray) – A vector where each element represents a label for a frame, either a single sample in audio or a single time bin from a spectrogram. Typically, the output of a neural network.

  • labelmap (dict) – That maps string labels to integers. The mapping is inverted to convert back to string labels.

Returns:

labels – The label at the onset of each continuous segment in frame_labels, mapped back to string labels in labelmap.

Return type:

str