Пример #1
0
    def apply(self, wav):
        """Computes distance between sliding windows embeddings

        Parameter
        ---------
        wav : str
            Path to wav audio file

        Returns
        -------
        predictions : SlidingWindowFeature
        """

        from pyannote.algorithms.stats.gaussian import Gaussian

        current_file = {'uri': wav, 'medium': {'wav': wav}}
        t, left, right = next(self.from_file(current_file))

        y = []
        for xL, xR in zip(left, right):
            gL = Gaussian(covariance_type=self.covariance_type).fit(xL)
            gR = Gaussian(covariance_type=self.covariance_type).fit(xR)
            y.append(gL.bic(gR, penalty_coef=0)[0])

        y = np.array(y)

        window = SlidingWindow(duration=2 * self.duration,
                               step=self.step,
                               start=0.)
        return SlidingWindowFeature(y, window)
Пример #2
0
    def apply(self, current_file):
        """Computes BIC distance between sliding windows

        Parameter
        ---------
        current_file : dict

        Returns
        -------
        predictions : SlidingWindowFeature
        """

        from pyannote.algorithms.stats.gaussian import Gaussian

        t, left, right = next(self.from_file(current_file))

        y = []
        for xL, xR in zip(left, right):
            gL = Gaussian(covariance_type=self.covariance_type).fit(xL)
            gR = Gaussian(covariance_type=self.covariance_type).fit(xR)
            y.append(gL.bic(gR, penalty_coef=0)[0])

        y = np.array(y)

        window = SlidingWindow(duration=2 * self.duration,
                               step=self.step,
                               start=0.)
        return SlidingWindowFeature(y, window)