From c177a7549bd90670af4b29fa813ddea32cfe0f78 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 13 Aug 2015 15:57:58 +0800 Subject: add frm_trim option to global_transf --- htk_io/init.lua | 3 ++- speech_utils/init.lua | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htk_io/init.lua b/htk_io/init.lua index af92140..c4dfff9 100644 --- a/htk_io/init.lua +++ b/htk_io/init.lua @@ -34,7 +34,8 @@ function TNetReader:get_data() -- global transf if self.global_transf ~= nil then feat_utter = nerv.speech_utils.global_transf(feat_utter, - self.global_transf, self.frm_ext, self.gconf) + self.global_transf, self.frm_ext, + self.frm_ext, self.gconf) end res[self.feat_id] = feat_utter -- add corresponding labels diff --git a/speech_utils/init.lua b/speech_utils/init.lua index 3d1a470..9690e71 100644 --- a/speech_utils/init.lua +++ b/speech_utils/init.lua @@ -1,6 +1,7 @@ nerv.speech_utils = {} -function nerv.speech_utils.global_transf(feat_utter, global_transf, frm_ext, gconf) +function nerv.speech_utils.global_transf(feat_utter, global_transf, + frm_ext, frm_trim, gconf) local rearranged feat_utter = gconf.cumat_type.new_from_host(feat_utter) if frm_ext > 0 then @@ -21,8 +22,8 @@ function nerv.speech_utils.global_transf(feat_utter, global_transf, frm_ext, gco global_transf:init(input[1]:nrow()) global_transf:propagate(input, output) -- trim frames - expanded = gconf.mmat_type(output[1]:nrow() - frm_ext * 2, output[1]:ncol()) - output[1]:copy_toh(expanded, frm_ext, feat_utter:nrow() - frm_ext) + expanded = gconf.mmat_type(output[1]:nrow() - frm_trim * 2, output[1]:ncol()) + output[1]:copy_toh(expanded, frm_trim, feat_utter:nrow() - frm_trim) collectgarbage("collect") return expanded end -- cgit v1.2.3-70-g09d2