diff options
Diffstat (limited to 'htk_io/init.lua')
-rw-r--r-- | htk_io/init.lua | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/htk_io/init.lua b/htk_io/init.lua index 27ece6e..af1f740 100644 --- a/htk_io/init.lua +++ b/htk_io/init.lua @@ -1,4 +1,5 @@ require 'libhtkio' +require 'speech_utils' local TNetReader = nerv.class("nerv.TNetReader", "nerv.DataReader") function TNetReader:__init(global_conf, reader_conf) @@ -32,26 +33,15 @@ function TNetReader:get_data() local step = frm_ext * 2 + 1 -- read HTK feature local feat_utter = self.feat_repo:cur_utter(self.debug) - -- expand the feature - local expanded = self.gconf.cumat_type(feat_utter:nrow(), feat_utter:ncol() * step) - expanded:expand_frm(self.gconf.cumat_type.new_from_host(feat_utter), frm_ext) - -- rearrange the feature (``transpose'' operation in TNet) - local rearranged = expanded:create() - rearranged:rearrange_frm(expanded, step) - -- prepare for transf - local input = {rearranged} - local output = {rearranged:create()} - -- do transf - self.global_transf:init(input[1]:nrow()) - self.global_transf:propagate(input, output) - -- trim frames - expanded = self.gconf.mmat_type(output[1]:nrow() - frm_ext * 2, output[1]:ncol()) - output[1]:copy_toh(expanded, frm_ext, feat_utter:nrow() - frm_ext) - res[self.feat_id] = expanded + -- global transf + local transformed = nerv.speech_utils.global_transf(feat_utter, + self.global_transf, frm_ext, self.gconf) + + res[self.feat_id] = transformed -- add corresponding labels for id, repo in pairs(self.lab_repo) do local lab_utter = repo:get_utter(self.feat_repo, - expanded:nrow(), + transformed:nrow(), self.debug) res[id] = lab_utter end |