Commit 4119c573 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

debug

parent 0f6a9bdf
...@@ -228,6 +228,7 @@ def extract_vectors(current_diar, root_folder, model_cfg, show, model=None): ...@@ -228,6 +228,7 @@ def extract_vectors(current_diar, root_folder, model_cfg, show, model=None):
elif model_cfg["model"]["type"] == "lium_xv": elif model_cfg["model"]["type"] == "lium_xv":
current_im = current_diar.id_map() current_im = current_diar.id_map()
# current_im.write(f"{file_path}/{show}.idmap.h5") # current_im.write(f"{file_path}/{show}.idmap.h5")
...@@ -242,9 +243,31 @@ def extract_vectors(current_diar, root_folder, model_cfg, show, model=None): ...@@ -242,9 +243,31 @@ def extract_vectors(current_diar, root_folder, model_cfg, show, model=None):
sample_rate=16000, sample_rate=16000,
mixed_precision=False) mixed_precision=False)
current_vec = current_vec_per_segment.mean_stat_per_model() current_vec_per_cluster = current_vec_per_segment.mean_stat_per_model()
#current_vec_per_cluster.norm_stat1()
return current_vec, current_vec_per_segment #current_vec_per_cluster= sidekit.nnet.xvector.extract_embeddings_per_speaker(idmap_name=current_im,
# model_filename=xtractor_name,
# data_root_name=f"{root_folder}/wav/",
# device=torch.device("cuda"),
# num_thread=5)
print(f"nombre de segments: {current_vec_per_segment.stat1.shape}, nombre de locuteurs: {current_vec_per_cluster.stat1.shape}")
#diar_seg=copy.deepcopy(diar)
#for i in range(len(diar_seg)):
# diar_seg[i]["cluster"]="tmp_"+str(i)
#current_im = diar_seg.id_map()
#current_im.start = current_im.start * 160
#current_im.stop = current_im.stop * 160
#if os.path.exists(f"{file_path}/{out_file_name}_seg.idmap.h5"):
# os.remove(f"{file_path}/{out_file_name}_seg.idmap.h5")
#current_im.write(f"{file_path}/{out_file_name}_seg.idmap.h5")
#current_vec_per_seg= sidekit.nnet.xvector.extract_embeddings_per_speaker(idmap_name=f"{file_path}/{out_file_name}_seg.idmap.h5",
# model_filename=f"{model_cfg['model_dir']}/best_xtractor.pt",
# data_root_name=f"{model_cfg['wav_dir']}",
# device=torch.device("cuda"),
# transform_pipeline=model_cfg["model"]["vectors"]["xvectors"]["transforms"],
# num_thread=5)
return current_vec_per_cluster, current_vec_per_segment
def perform_second_seg(model, def perform_second_seg(model,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment