From d16ce21d47677748a3afbaedc17a78a98cda3b51 Mon Sep 17 00:00:00 2001 From: qingen Date: Wed, 16 Mar 2022 11:37:39 +0800 Subject: [PATCH] [wip][vec] update cluster of diarization, test=doc #1304 --- .../local => paddlespeech/vector/cluster}/diarization.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename {examples/ami/sd0/local => paddlespeech/vector/cluster}/diarization.py (99%) diff --git a/examples/ami/sd0/local/diarization.py b/paddlespeech/vector/cluster/diarization.py similarity index 99% rename from examples/ami/sd0/local/diarization.py rename to paddlespeech/vector/cluster/diarization.py index dd56b9a8..6432acb8 100644 --- a/examples/ami/sd0/local/diarization.py +++ b/paddlespeech/vector/cluster/diarization.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2022 SpeechBrain Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -359,7 +359,7 @@ class EmbeddingMeta: if segset is None: self.segset = numpy.empty(0, dtype="|O") - self.stats = numpy.array([], dtype=STAT_TYPE) + self.stats = numpy.array([], dtype=np.float64) else: self.segset = segset self.stats = stats @@ -631,7 +631,6 @@ class SpecClustUnorm: eig_vals_gap_list = [] for i in range(len(eig_vals) - 1): gap = float(eig_vals[i + 1]) - float(eig_vals[i]) - # eig_vals_gap_list.append(float(eig_vals[i + 1]) - float(eig_vals[i])) eig_vals_gap_list.append(gap) return eig_vals_gap_list @@ -658,7 +657,7 @@ class SpecCluster(SpectralClustering): self.affinity_matrix_ = 0.5 * (connectivity + connectivity.T) # Perform spectral clustering on affinity matrix - self.labels_ = spectral_clustering_sb( + self.labels_ = spectral_clustering( self.affinity_matrix_, n_clusters=self.n_clusters, ) return self