summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--htk_io/init.lua7
-rw-r--r--kaldi_io/init.lua15
-rw-r--r--speech_utils/init.lua6
3 files changed, 9 insertions, 19 deletions
diff --git a/htk_io/init.lua b/htk_io/init.lua
index c4dfff9..b836e15 100644
--- a/htk_io/init.lua
+++ b/htk_io/init.lua
@@ -6,7 +6,6 @@ function TNetReader:__init(global_conf, reader_conf)
self.feat_id = reader_conf.id
self.frm_ext = reader_conf.frm_ext
self.gconf = global_conf
- self.global_transf = reader_conf.global_transf
self.debug = global_conf.debug
if self.debug == nil then
self.debug = false
@@ -31,12 +30,6 @@ function TNetReader:get_data()
local res = {}
-- read HTK feature
local feat_utter = self.feat_repo:cur_utter(self.debug)
- -- global transf
- if self.global_transf ~= nil then
- feat_utter = nerv.speech_utils.global_transf(feat_utter,
- self.global_transf, self.frm_ext,
- self.frm_ext, self.gconf)
- end
res[self.feat_id] = feat_utter
-- add corresponding labels
for id, repo in pairs(self.lab_repo) do
diff --git a/kaldi_io/init.lua b/kaldi_io/init.lua
index a1496c4..930705e 100644
--- a/kaldi_io/init.lua
+++ b/kaldi_io/init.lua
@@ -6,7 +6,6 @@ function KaldiReader:__init(global_conf, reader_conf)
self.feat_id = reader_conf.id
self.frm_ext = reader_conf.frm_ext
self.gconf = global_conf
- self.global_transf = reader_conf.global_transf
self.debug = global_conf.debug
if self.debug == nil then
self.debug = false
@@ -39,28 +38,26 @@ function KaldiReader:get_data()
-- read Kaldi feature
local feat_utter = self.feat_repo:cur_utter(self.debug)
-- global transf
- local transformed = nerv.speech_utils.global_transf(feat_utter,
- self.global_transf, self.frm_ext, 0, self.gconf)
- res[self.feat_id] = transformed
+ res[self.feat_id] = feat_utter
-- add corresponding labels
for id, repo in pairs(self.lab_repo) do
local lab_utter = repo:get_utter(self.feat_repo,
- transformed:nrow(),
+ feat_utter:nrow(),
self.debug)
res[id] = lab_utter
end
-- add corresponding lookup features
for id, repo in pairs(self.lookup_repo) do
local lookup_utter = repo:get_utter(self.feat_repo,
- transformed:nrow(),
+ feat_utter:nrow(),
self.debug)
local nrow = lookup_utter:nrow()
- if nrow < transformed:nrow() then
+ if nrow < feat_utter:nrow() then
-- repeat the last frame
- local nlu = lookup_utter:create(transformed:nrow())
+ local nlu = lookup_utter:create(feat_utter:nrow())
nlu:copy_from(lookup_utter, 0, nrow)
row = nlu[nrow - 1]
- for i = 0, transformed:nrow() - nrow - 1 do
+ for i = 0, feat_utter:nrow() - nrow - 1 do
nlu:copy_from(nlu, nrow - 1, nrow, nrow + i)
end
lookup_utter = nlu
diff --git a/speech_utils/init.lua b/speech_utils/init.lua
index a2d1dc9..7d5651f 100644
--- a/speech_utils/init.lua
+++ b/speech_utils/init.lua
@@ -3,7 +3,7 @@ nerv.speech_utils = {}
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)
+-- feat_utter = gconf.cumat_type.new_from_host(feat_utter)
if frm_ext ~= nil and frm_ext > 0 then
local step = frm_ext * 2 + 1
-- expand the feature
@@ -26,8 +26,8 @@ function nerv.speech_utils.global_transf(feat_utter, global_transf,
global_transf:init(input[1]:nrow())
global_transf:propagate(input, output)
-- trim frames
- 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)
+ expanded = gconf.cumat_type(output[1]:nrow() - frm_trim * 2, output[1]:ncol())
+ expanded:copy_fromd(output[1], frm_trim, feat_utter:nrow() - frm_trim)
collectgarbage("collect")
return expanded
end