From 77a237796515093989cb2654ed0dc7a8cf580413 Mon Sep 17 00:00:00 2001 From: Albert Aparicio Date: Tue, 18 Apr 2017 17:53:09 +0200 Subject: [PATCH] Fix computation of speaker indexes in unscale_prediction --- tfglib/seq2seq_datatable.py | 2 ++ tfglib/seq2seq_normalize.py | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tfglib/seq2seq_datatable.py b/tfglib/seq2seq_datatable.py index fdb731c..65c18f4 100644 --- a/tfglib/seq2seq_datatable.py +++ b/tfglib/seq2seq_datatable.py @@ -9,6 +9,7 @@ import h5py import numpy as np from keras.utils.np_utils import to_categorical + from tfglib.construct_table import parse_file from tfglib.seq2seq_normalize import mask_data from tfglib.utils import kronecker_delta, sliding_window @@ -300,6 +301,7 @@ def seq2seq_build_file_table(self, source_dir, src_index, target_dir, zero_pad_params(self.max_seq_length, 'trg', trg_eos_flag) ), axis=1) + # TODO Return basename with sequence(s) return source_params, source_mask, target_params, target_mask def seq2seq_construct_datatable(self): diff --git a/tfglib/seq2seq_normalize.py b/tfglib/seq2seq_normalize.py index 61d5e01..4b58e73 100644 --- a/tfglib/seq2seq_normalize.py +++ b/tfglib/seq2seq_normalize.py @@ -42,9 +42,7 @@ def maxmin_scaling( def unscale_prediction(src_matrix, src_mask, scaled_pred, max_mat, min_mat): src_masked_data = mask_data(src_matrix, src_mask) - src_spk_index = np.argmax(np.ma.argmax( - src_masked_data[:, 44:54], axis=0, fill_value=0 - )) + src_spk_index = int(src_masked_data[0, 44]) src_spk_max = max_mat[src_spk_index, :] src_spk_min = min_mat[src_spk_index, :]