Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anthony Larcher
evALLIES
Commits
4119c573
Commit
4119c573
authored
Jun 09, 2021
by
Anthony Larcher
Browse files
debug
parent
0f6a9bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
lium_baseline/system.py
View file @
4119c573
...
...
@@ -228,6 +228,7 @@ def extract_vectors(current_diar, root_folder, model_cfg, show, model=None):
elif
model_cfg
[
"model"
][
"type"
]
==
"lium_xv"
:
current_im
=
current_diar
.
id_map
()
# 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):
sample_rate
=
16000
,
mixed_precision
=
False
)
current_vec
=
current_vec_per_segment
.
mean_stat_per_model
()
return
current_vec
,
current_vec_per_segment
current_vec_per_cluster
=
current_vec_per_segment
.
mean_stat_per_model
()
#current_vec_per_cluster.norm_stat1()
#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
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment