diff --git a/examples/ami/sd0/local/ami_prepare.py b/examples/ami/sd0/local/ami_prepare.py index d03810a7..01582dbd 100644 --- a/examples/ami/sd0/local/ami_prepare.py +++ b/examples/ami/sd0/local/ami_prepare.py @@ -17,11 +17,8 @@ Data preparation. Download: http://groups.inf.ed.ac.uk/ami/download/ Prepares metadata files (JSON) from manual annotations "segments/" using RTTM format (Oracle VAD). - -Authors - * qingenz123@126.com (Qingen ZHAO) 2022 - """ + import argparse import glob import json diff --git a/examples/ami/sd0/local/ami_splits.py b/examples/ami/sd0/local/ami_splits.py index 010638a3..a8bc5dc8 100644 --- a/examples/ami/sd0/local/ami_splits.py +++ b/examples/ami/sd0/local/ami_splits.py @@ -15,10 +15,6 @@ AMI corpus contained 100 hours of meeting recording. This script returns the standard train, dev and eval split for AMI corpus. For more information on dataset please refer to http://groups.inf.ed.ac.uk/ami/corpus/datasets.shtml - -Authors - * qingenz123@126.com (Qingen ZHAO) 2022 - """ ALLOWED_OPTIONS = ["scenario_only", "full_corpus", "full_corpus_asr"] diff --git a/examples/ami/sd0/local/dataio.py b/examples/ami/sd0/local/dataio.py index f7fe8815..4ff76bd5 100644 --- a/examples/ami/sd0/local/dataio.py +++ b/examples/ami/sd0/local/dataio.py @@ -13,10 +13,6 @@ # limitations under the License. """ Data reading and writing. - -Authors - * qingenz123@126.com (Qingen ZHAO) 2022 - """ import os import pickle diff --git a/examples/ami/sd0/local/diarization.py b/examples/ami/sd0/local/diarization.py index 863cff4a..dd56b9a8 100644 --- a/examples/ami/sd0/local/diarization.py +++ b/examples/ami/sd0/local/diarization.py @@ -15,10 +15,6 @@ This script contains basic functions used for speaker diarization. This script has an optional dependency on open source sklearn library. A few sklearn functions are modified in this script as per requirement. - -Authors - * qingenz123@126.com (Qingen ZHAO) 2022 - """ import argparse @@ -377,7 +373,7 @@ class EmbeddingMeta: self.stats = (self.stats.transpose() / vect_norm).transpose() -class Spec_Clust_unorm: +class SpecClustUnorm: """ This class implements the spectral clustering with unnormalized affinity matrix. Useful when affinity matrix is based on cosine similarities. @@ -390,7 +386,7 @@ class Spec_Clust_unorm: Example ------- >>> import diarization as diar - >>> clust = diar.Spec_Clust_unorm(min_num_spkrs=2, max_num_spkrs=10) + >>> clust = diar.SpecClustUnorm(min_num_spkrs=2, max_num_spkrs=10) >>> emb = [[ 2.1, 3.1, 4.1, 4.2, 3.1], ... [ 2.2, 3.1, 4.2, 4.2, 3.2], ... [ 2.0, 3.0, 4.0, 4.1, 3.0], @@ -586,7 +582,7 @@ class Spec_Clust_unorm: if k_oracle is not None: num_of_spk = k_oracle else: - lambda_gap_list = self.getEigenGaps(lambdas[1:self.max_num_spkrs]) + lambda_gap_list = self.get_eigen_gaps(lambdas[1:self.max_num_spkrs]) num_of_spk = (np.argmax( lambda_gap_list[:min(self.max_num_spkrs, len(lambda_gap_list))]) @@ -617,7 +613,7 @@ class Spec_Clust_unorm: """ _, self.labels_, _ = k_means(emb, k) - def getEigenGaps(self, eig_vals): + def get_eigen_gaps(self, eig_vals): """ Returns the difference (gaps) between the Eigen values. @@ -641,7 +637,7 @@ class Spec_Clust_unorm: return eig_vals_gap_list -class Spec_Cluster(SpectralClustering): +class SpecCluster(SpectralClustering): def perform_sc(self, X, n_neighbors=10): """ Performs spectral clustering using sklearn on embeddings. @@ -969,12 +965,12 @@ def do_spec_clustering(diary_obj, out_rttm_file, rec_id, k, pval, affinity_type, """ if affinity_type == "cos": - clust_obj = Spec_Clust_unorm(min_num_spkrs=2, max_num_spkrs=10) + clust_obj = SpecClustUnorm(min_num_spkrs=2, max_num_spkrs=10) k_oracle = k # use it only when oracle num of speakers clust_obj.do_spec_clust(diary_obj.stats, k_oracle, pval) labels = clust_obj.labels_ else: - clust_obj = Spec_Cluster( + clust_obj = SpecCluster( n_clusters=k, assign_labels="kmeans", random_state=1234,