Commit 795baf42 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

debug xvector extraction on a sliding window

parent 2edd99d1
......@@ -314,7 +314,7 @@ class TrainingMonitor():
"""
# TODO
self.logger.critical(f"***Validation metrics - Cross validation accuracy = {self.val_acc[-1]} %, EER = {self.val_eer[-1] * 100} %")
self.logger.critical(f"***Test metrics - Test EER = {self.test_eer[-1] * 100} %")
#self.logger.critical(f"***Test metrics - Test EER = {self.test_eer[-1] * 100} %")
def display_final(self):
"""
......@@ -1673,7 +1673,7 @@ def cross_validation(model, validation_loader, device, validation_shape, tar_ind
return (100. * accuracy.cpu().numpy() / validation_shape[0],
loss.cpu().numpy() / ((batch_idx + 1) * batch_size),
equal_error_rate)
return 0, 0, 0
#return 0, 0, 0
def extract_embeddings(idmap_name,
......@@ -1715,6 +1715,7 @@ def extract_embeddings(idmap_name,
checkpoint = torch.load(model_filename, map_location=device)
speaker_number = checkpoint["speaker_number"]
model_opts = checkpoint["model_archi"]
model_opts["embedding_size"] = 256
model = Xtractor(speaker_number,
model_archi=model_opts["model_type"],
loss=model_opts["loss"]["type"],
......@@ -1770,11 +1771,11 @@ def extract_embeddings(idmap_name,
for td in tmp_data:
_, vec = model(x=td.to(device), is_eval=True, norm_embedding=norm_embeddings)
embed.append(vec.detach().cpu())
modelset.extend(mod * data.shape[0])
segset.extend(seg * data.shape[0])
if sliding_window:
starts.extend(numpy.arange(start, start + data.shape[0] * win_shift, win_shift))
tmp_start = numpy.arange(0, data.shape[0] * win_shift, win_shift)
starts.extend(tmp_start * sample_rate + start.detach().cpu().numpy())
else:
starts.append(start)
......
Markdown is supported
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