Commit 0f6a9bdf authored by Anthony Larcher's avatar Anthony Larcher
Browse files

cleaning

parent fe8e0dd1
...@@ -84,7 +84,7 @@ def init_clustering(init_diar, cep, model_cfg, vad_type="none"): ...@@ -84,7 +84,7 @@ def init_clustering(init_diar, cep, model_cfg, vad_type="none"):
""" """
# Bic_lin is only applied when starting from a VAD segmentation or from UEM # Bic_lin is only applied when starting from a VAD segmentation or from UEM
if model_cfg["model"]["vad"]["type"] != "reference": if vad_type != "reference":
output_diar = bic_linear_segmentation(init_diar, cep, model_cfg) output_diar = bic_linear_segmentation(init_diar, cep, model_cfg)
else: else:
output_diar = init_diar output_diar = init_diar
...@@ -94,7 +94,7 @@ def init_clustering(init_diar, cep, model_cfg, vad_type="none"): ...@@ -94,7 +94,7 @@ def init_clustering(init_diar, cep, model_cfg, vad_type="none"):
output_diar = cluster.perform() output_diar = cluster.perform()
# Viterbi devoding is only applied when starting from a VAD segmentation or from scratch # Viterbi devoding is only applied when starting from a VAD segmentation or from scratch
if model_cfg["model"]["vad"]["type"] != "reference": if vad_type != "reference":
output_diar = s4d.viterbi.viterbi_decoding(cep, output_diar, model_cfg['first_seg']['thr_vit']) output_diar = s4d.viterbi.viterbi_decoding(cep, output_diar, model_cfg['first_seg']['thr_vit'])
return output_diar return output_diar
...@@ -135,14 +135,15 @@ def vec2link_xv(model_cfg, xv_vec, current_diar): ...@@ -135,14 +135,15 @@ def vec2link_xv(model_cfg, xv_vec, current_diar):
check_missing=False) check_missing=False)
# Use 2 gaussian to shift the scores # Use 2 gaussian to shift the scores
if scores.modelset.shape[0] > 2: #if scores.modelset.shape[0] > 2:
th_w = customize_threshold(scores, th_w) # th_w = customize_threshold(scores, th_w)
scores.scoremat = 0.5 * (scores.scoremat + scores.scoremat.transpose()) scores.scoremat = 0.5 * (scores.scoremat + scores.scoremat.transpose())
# Make the cluster names consistent # Make the cluster names consistent
for idx in range(len(scores.modelset)): for idx in range(len(scores.modelset)):
scores.modelset[idx] = current_diar[idx]["cluster"] #scores.modelset[idx] = current_diar[idx]["cluster"]
scores.modelset[idx] = xv_vec.modelset[idx]
###################################################################################### ######################################################################################
# MODIFIED AS WE NOW USE COSINE SIMILARITIES # MODIFIED AS WE NOW USE COSINE SIMILARITIES
...@@ -305,8 +306,8 @@ def perform_second_seg(model, ...@@ -305,8 +306,8 @@ def perform_second_seg(model,
scores.scoremat = 0.5 * (scores.scoremat + scores.scoremat.transpose()) scores.scoremat = 0.5 * (scores.scoremat + scores.scoremat.transpose())
# Calibration # Calibration
if scores.modelset.shape[0] > 2: #if scores.modelset.shape[0] > 2:
th_w = customize_threshold(scores, th_w) # th_w = customize_threshold(scores, th_w)
# Run HAC clustering # Run HAC clustering
print(f"Avant HAC : len(diar)= {len(initial_diar.unique('cluster'))}, min et max scores: {scores.scoremat.min()} et {scores.scoremat.max()}, th = {th_w}") print(f"Avant HAC : len(diar)= {len(initial_diar.unique('cluster'))}, min et max scores: {scores.scoremat.min()} et {scores.scoremat.max()}, th = {th_w}")
...@@ -794,7 +795,6 @@ def allies_init_seg(model, model_cfg, show, data_folder, verbose=False): ...@@ -794,7 +795,6 @@ def allies_init_seg(model, model_cfg, show, data_folder, verbose=False):
init_diar.pad(15) init_diar.pad(15)
init_diar.pack(25) init_diar.pack(25)
init_diar.pack(25)
# Run the first pass of segmentation # Run the first pass of segmentation
logger.info("\t* run 1st clustering") logger.info("\t* run 1st clustering")
......
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