msaf/utils.py
def remove_empty_segments(times, labels):
    """Removes empty segments if needed."""
    assert len(times) - 1 == len(labels)
    inters = times_to_intervals(times)
    new_inters = []
    new_labels = []
    for inter, label in zip(inters, labels):
        if inter[0] < inter[1]:
            new_inters.append(inter)
            new_labels.append(label)
    return intervals_to_times(np.asarray(new_inters)), new_labels
def remove_empty_segments(times, labels):
    assert len(times) - 1 == len(labels)
    inters = times_to_intervals(times)
    new_inters = []
    new_labels = []
    for inter, label in zip(inters, labels):
        if inter[0] < inter[1]:
            new_inters.append(inter)
            new_labels.append(label)
    return intervals_to_times(np.asarray(new_inters)), new_labels
def remove_empty_segments ( times , labels ) : assert len ( times ) - 1 == len ( labels ) inters = times_to_intervals ( times ) new_inters = [ ] new_labels = [ ] for inter , label in zip ( inters , labels ) : if inter [ 0 ] < inter [ 1 ] : new_inters . append ( inter ) new_labels . append ( label ) return intervals_to_times ( np . asarray ( new_inters ) ) , new_labels
Removes empty segments if needed.
Removes empty segments if needed .