asahi417 commited on
Commit
b9362f0
·
1 Parent(s): ce597de
experiment_cache/.DS_Store CHANGED
Binary files a/experiment_cache/.DS_Store and b/experiment_cache/.DS_Store differ
 
experiment_speaker_verification.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import json
2
  import os
3
  from os.path import join as p_join
@@ -105,82 +106,39 @@ def cluster_embedding(model_name, dataset_name, label_name: str):
105
  ncol=3 if len(label2id) > 12 else 1)
106
  plt.savefig(figure_path, bbox_inches='tight', dpi=600)
107
 
108
- def analyze_embedding(model_name: str, dataset_name: str, n_shot: int = 5, n_cross_validation: int = 5):
109
- file_path = p_join("experiment_cache", "embeddings", f"{model_name}.{os.path.basename(dataset_name)}.json")
110
- assert os.path.exists(file_path)
111
- with open(file_path) as f:
112
- embeddings = [json.loads(i) for i in f.readlines()]
113
- df = pd.DataFrame(embeddings)
114
- process_time = df["process_time"].mean()
115
- df.groupby("speaker_ido")
116
- sorted(df["speaker_id"].unique())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
 
119
  if __name__ == '__main__':
120
- # get_embedding(MetaVoiceEmbedding, "meta_voice_se", "asahi417/voxceleb1-test-split", "test")
121
- # get_embedding(PyannoteEmbedding, "pyannote_se", "asahi417/voxceleb1-test-split", "test")
122
- # get_embedding(CLAPEmbedding, "clap_se", "asahi417/voxceleb1-test-split", "test")
123
- # get_embedding(CLAPGeneralEmbedding, "clap_general_se", "asahi417/voxceleb1-test-split", "test")
124
- # get_embedding(HuBERTBaseEmbedding, "hubert_base_se", "asahi417/voxceleb1-test-split", "test")
125
- # get_embedding(HuBERTLargeEmbedding, "hubert_large_se", "asahi417/voxceleb1-test-split", "test")
126
- # get_embedding(HuBERTXLEmbedding, "hubert_xl_se", "asahi417/voxceleb1-test-split", "test")
127
- get_embedding(W2VBERTEmbedding, "w2v_bert_se", "asahi417/voxceleb1-test-split", "test")
128
- # get_embedding(Wav2VecEmbedding, "wav2vec_se", "asahi417/voxceleb1-test-split", "test")
129
- # get_embedding(XLSR300MEmbedding, "xlsr_300m_se", "asahi417/voxceleb1-test-split", "test")
130
- # get_embedding(XLSR1BEmbedding, "xlsr_1b_se", "asahi417/voxceleb1-test-split", "test")
131
- # get_embedding(XLSR2BEmbedding, "xlsr_2b_se", "asahi417/voxceleb1-test-split", "test")
132
-
133
- # get_embedding(MetaVoiceEmbedding, "meta_voice_se", "ylacombe/expresso", "train")
134
- # get_embedding(PyannoteEmbedding, "pyannote_se", "ylacombe/expresso", "train")
135
- # get_embedding(CLAPEmbedding, "clap_se", "ylacombe/expresso", "train")
136
- # get_embedding(CLAPGeneralEmbedding, "clap_general_se", "ylacombe/expresso", "train")
137
- # get_embedding(HuBERTBaseEmbedding, "hubert_base_se", "ylacombe/expresso", "train")
138
- # get_embedding(HuBERTLargeEmbedding, "hubert_large_se", "ylacombe/expresso", "train")
139
- # get_embedding(HuBERTXLEmbedding, "hubert_xl_se", "ylacombe/expresso", "train")
140
- get_embedding(W2VBERTEmbedding, "w2v_bert_se", "ylacombe/expresso", "train")
141
- # get_embedding(Wav2VecEmbedding, "wav2vec_se", "ylacombe/expresso", "train")
142
- # get_embedding(XLSR300MEmbedding, "xlsr_300m_se", "ylacombe/expresso", "train")
143
- # get_embedding(XLSR1BEmbedding, "xlsr_1b_se", "ylacombe/expresso", "train")
144
- # get_embedding(XLSR2BEmbedding, "xlsr_2b_se", "ylacombe/expresso", "train")
145
-
146
- # cluster_embedding("meta_voice_se", "asahi417/voxceleb1-test-split", "speaker_id")
147
- # cluster_embedding("pyannote_se", "asahi417/voxceleb1-test-split", "speaker_id")
148
- # cluster_embedding("clap_se", "asahi417/voxceleb1-test-split", "speaker_id")
149
- # cluster_embedding("clap_general_se", "asahi417/voxceleb1-test-split", "speaker_id")
150
- # cluster_embedding("hubert_base_se", "asahi417/voxceleb1-test-split", "speaker_id")
151
- # cluster_embedding("hubert_large_se", "asahi417/voxceleb1-test-split", "speaker_id")
152
- # cluster_embedding("hubert_xl_se", "asahi417/voxceleb1-test-split", "speaker_id")
153
- cluster_embedding("w2v_bert_se", "asahi417/voxceleb1-test-split", "speaker_id")
154
- # cluster_embedding("wav2vec_se", "asahi417/voxceleb1-test-split", "speaker_id")
155
- # cluster_embedding("xlsr_300m_se", "asahi417/voxceleb1-test-split", "speaker_id")
156
- # cluster_embedding("xlsr_1b_se", "asahi417/voxceleb1-test-split", "speaker_id")
157
- # cluster_embedding("xlsr_2b_se", "asahi417/voxceleb1-test-split", "speaker_id")
158
-
159
- # cluster_embedding("meta_voice_se", "ylacombe/expresso", "speaker_id")
160
- # cluster_embedding("pyannote_se", "ylacombe/expresso", "speaker_id")
161
- # cluster_embedding("clap_se", "ylacombe/expresso", "speaker_id")
162
- # cluster_embedding("clap_general_se", "ylacombe/expresso", "speaker_id")
163
- # cluster_embedding("hubert_base_se", "ylacombe/expresso", "speaker_id")
164
- # cluster_embedding("hubert_large_se", "ylacombe/expresso", "speaker_id")
165
- # cluster_embedding("hubert_xl_se", "ylacombe/expresso", "speaker_id")
166
- cluster_embedding("w2v_bert_se", "ylacombe/expresso", "speaker_id")
167
- # cluster_embedding("wav2vec_se", "ylacombe/expresso", "speaker_id")
168
- # cluster_embedding("xlsr_300m_se", "ylacombe/expresso", "speaker_id")
169
- # cluster_embedding("xlsr_1b_se", "ylacombe/expresso", "speaker_id")
170
- # cluster_embedding("xlsr_2b_se", "ylacombe/expresso", "speaker_id")
171
-
172
- # cluster_embedding("meta_voice_se", "ylacombe/expresso", "style")
173
- # cluster_embedding("pyannote_se", "ylacombe/expresso", "style")
174
- # cluster_embedding("clap_se", "ylacombe/expresso", "style")
175
- # cluster_embedding("clap_general_se", "ylacombe/expresso", "style")
176
- # cluster_embedding("hubert_base_se", "ylacombe/expresso", "style")
177
- # cluster_embedding("hubert_large_se", "ylacombe/expresso", "style")
178
- # cluster_embedding("hubert_xl_se", "ylacombe/expresso", "style")
179
- cluster_embedding("w2v_bert_se", "ylacombe/expresso", "style")
180
- # cluster_embedding("wav2vec_se", "ylacombe/expresso", "style")
181
- # cluster_embedding("xlsr_300m_se", "ylacombe/expresso", "style")
182
- # cluster_embedding("xlsr_1b_se", "ylacombe/expresso", "style")
183
- # cluster_embedding("xlsr_2b_se", "ylacombe/expresso", "style")
184
 
185
 
186
 
 
1
+ import argparse
2
  import json
3
  import os
4
  from os.path import join as p_join
 
106
  ncol=3 if len(label2id) > 12 else 1)
107
  plt.savefig(figure_path, bbox_inches='tight', dpi=600)
108
 
109
+
110
+ def main(dataset_name, data_split, label_name):
111
+ get_embedding(MetaVoiceEmbedding, "meta_voice_se", dataset_name, data_split)
112
+ cluster_embedding("meta_voice_se", dataset_name, label_name)
113
+ get_embedding(PyannoteEmbedding, "pyannote_se", dataset_name, data_split)
114
+ cluster_embedding("pyannote_se", dataset_name, label_name)
115
+ get_embedding(CLAPEmbedding, "clap_se", dataset_name, data_split)
116
+ cluster_embedding("clap_se", dataset_name, label_name)
117
+ get_embedding(CLAPGeneralEmbedding, "clap_general_se", dataset_name, data_split)
118
+ cluster_embedding("clap_general_se", dataset_name, label_name)
119
+ get_embedding(HuBERTBaseEmbedding, "hubert_base_se", dataset_name, data_split)
120
+ cluster_embedding("hubert_base_se", dataset_name, label_name)
121
+ get_embedding(HuBERTXLEmbedding, "hubert_xl_se", dataset_name, data_split)
122
+ cluster_embedding("hubert_xl_se", dataset_name, label_name)
123
+ get_embedding(HuBERTLargeEmbedding, "hubert_large_se", dataset_name, data_split)
124
+ cluster_embedding("hubert_large_se", dataset_name, label_name)
125
+ get_embedding(Wav2VecEmbedding, "wav2vec_se", dataset_name, data_split)
126
+ cluster_embedding("wav2vec_se", dataset_name, label_name)
127
+ get_embedding(W2VBERTEmbedding, "w2v_bert_se", dataset_name, data_split)
128
+ cluster_embedding("w2v_bert_se", dataset_name, label_name)
129
+ get_embedding(XLSR300MEmbedding, "xlsr_300m_se", dataset_name, data_split)
130
+ cluster_embedding("xlsr_300m_se", dataset_name, label_name)
131
+ get_embedding(XLSR1BEmbedding, "xlsr_1b_se", dataset_name, data_split)
132
+ cluster_embedding("xlsr_1b_se", dataset_name, label_name)
133
+ get_embedding(XLSR2BEmbedding, "xlsr_2b_se", dataset_name, data_split)
134
+ cluster_embedding("xlsr_2b_se", dataset_name, label_name)
135
 
136
 
137
  if __name__ == '__main__':
138
+ # main("asahi417/voxceleb1-test-split", "test", "speaker_id")
139
+ # main("ylacombe/expresso", "train", "speaker_id")
140
+ # main("ylacombe/expresso", "train", "style")
141
+ main("asahi417/j-tube-speech", "test", "speaker_id")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
 
144