msaf/algorithms/olda/segmenter.py
def processFlat(self):
        """Main process for flat segmentation.
        Returns
        -------
        est_idxs : np.array(N)
            Estimated times for the segment boundaries in frame indeces.
        est_labels : np.array(N-1)
            Estimated labels for the segments.
        """
        # Preprocess to obtain features and duration
        F, dur = features(self.file_struct, self.annot_beats, self.framesync)

        try:
            # Load and apply transform
            W = load_transform(self.config["transform"])
            F = W.dot(F)

            # Get Segments
            kmin, kmax = get_num_segs(dur)
            est_idxs = get_segments(F, kmin=kmin, kmax=kmax)
        except:
            # The audio file is too short, only beginning and end
            logging.warning("Audio file too short! "
                            "Only start and end boundaries.")
            est_idxs = [0, F.shape[1] - 1]

        # Make sure that the first and last boundaries are included
        assert est_idxs[0] == 0 and est_idxs[-1] == F.shape[1] - 1

        # Empty labels
        est_labels = np.ones(len(est_idxs) - 1) * -1

        # Post process estimations
        est_idxs, est_labels = self._postprocess(est_idxs, est_labels)

        return est_idxs, est_labels
def processFlat(self):
        """Main process for flat segmentation.
        Returns
        -------
        est_idxs : np.array(N)
            Estimated times for the segment boundaries in frame indeces.
        est_labels : np.array(N-1)
            Estimated labels for the segments.
        """
        # Preprocess to obtain features and duration
        F, dur = features(self.file_struct, self.annot_beats, self.framesync)

        try:
            # Load and apply transform
            W = load_transform(self.config["transform"])
            F = W.dot(F)

            # Get Segments
            kmin, kmax = get_num_segs(dur)
            est_idxs = get_segments(F, kmin=kmin, kmax=kmax)
        except:
            # The audio file is too short, only beginning and end
            logging.warning("Audio file too short! "
                            "Only start and end boundaries.")
            est_idxs = [0, F.shape[1] - 1]

        # Make sure that the first and last boundaries are included
        assert est_idxs[0] == 0 and est_idxs[-1] == F.shape[1] - 1

        # Empty labels
        est_labels = np.ones(len(est_idxs) - 1) * -1

        # Post process estimations
        est_idxs, est_labels = self._postprocess(est_idxs, est_labels)

        return est_idxs, est_labels
def processFlat ( self ) : # Preprocess to obtain features and duration F , dur = features ( self . file_struct , self . annot_beats , self . framesync ) try : # Load and apply transform W = load_transform ( self . config [ "transform" ] ) F = W . dot ( F ) # Get Segments kmin , kmax = get_num_segs ( dur ) est_idxs = get_segments ( F , kmin = kmin , kmax = kmax ) except : # The audio file is too short, only beginning and end logging . warning ( "Audio file too short! " "Only start and end boundaries." ) est_idxs = [ 0 , F . shape [ 1 ] - 1 ] # Make sure that the first and last boundaries are included assert est_idxs [ 0 ] == 0 and est_idxs [ - 1 ] == F . shape [ 1 ] - 1 # Empty labels est_labels = np . ones ( len ( est_idxs ) - 1 ) * - 1 # Post process estimations est_idxs , est_labels = self . _postprocess ( est_idxs , est_labels ) return est_idxs , est_labels
Main process for flat segmentation.
        Returns
        -------
        est_idxs : np.array(N)
            Estimated times for the segment boundaries in frame indeces.
        est_labels : np.array(N-1)
            Estimated labels for the segments.
Main process for flat segmentation . Returns ------- est_idxs : np . array ( N ) Estimated times for the segment boundaries in frame indeces . est_labels : np . array ( N - 1 ) Estimated labels for the segments .