vak.transforms.frame_labels.functional#

Functional forms of transformations related to frame labels, i.e., vectors where each element represents a label for a frame, either a single sample in audio or a single time bin from a spectrogram.

This module is structured as followed: - from_segments: transform to get frame labels from annotations - to_labels: transform to get back just string labels from frame labels,

used to evaluate a model

  • to_segments: transform to get back segment onsets, offsets, and labels from frame labels. Inverse of from_segments.

  • post-processing transforms that can be used to “clean up” a vector of frame labels - to_inds_list: helper function used to find segments in a vector of frame labels - remove_short_segments: remove any segment less than a minimum duration - take_majority_vote: take a “majority vote” within each segment bounded by the “unlabeled” label,

    and apply the most “popular” label within each segment to all timebins in that segment

    • postprocess: combines remove_short_segments and take_majority_vote in one transform

Functions

from_segments(labels_int, onsets_s, ...[, ...])

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

postprocess(frame_labels, timebin_dur[, ...])

Apply post-processing transformations to a vector of frame labels.

remove_short_segments(frame_labels, ...[, ...])

Remove segments from vector of frame labels that are shorter than a specified duration.

take_majority_vote(frame_labels, ...)

Transform segments containing multiple labels into segments with a single label by taking a "majority vote", i.e. assign all frames in the segment the most frequently occurring label in the segment.

to_inds_list(frame_labels[, unlabeled_label])

Given a vector of frame labels, returns a list of indexing vectors, one for each labeled segment in the vector.

to_labels(frame_labels, labelmap)

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

to_segments(frame_labels, labelmap, frame_times)

Convert a vector of frame labels into segments in the form of onset indices, offset indices, and labels.