saveVAD.lua 1.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
--[[This software purpose is to train convolutional neural networks for voice presentation attack detection.

Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
Written by Hannah Muckenhirn <hannah.muckenhirn@idiap.ch>,

This file is part of CNN-voice-PAD.

CNN-voice-PAD is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.

CNN-voice-PAD is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with CNN-voice-PAD. If not, see <http://www.gnu.org/licenses/>.--]]

Hannah MUCKENHIRN's avatar
Hannah MUCKENHIRN committed
20
-- use: torch saveVAD.lua listfile_real listfile_attack outputfile
Hannah MUCKENHIRN's avatar
Hannah MUCKENHIRN committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

vad_table={}
for l in io.lines(arg[1]) do
    local t={} ; i=1
    for str in string.gmatch(l, "([^ ]+)") do
                t[i] = tonumber(str)
                i = i + 1
    end
    data=torch.Tensor(t)
	table.insert(vad_table, data:squeeze())
end


for l in io.lines(arg[2]) do
    local t={} ; i=1
    for str in string.gmatch(l, "([^ ]+)") do
                t[i] = tonumber(str)
                i = i + 1
    end
    data=torch.Tensor(t)
    table.insert(vad_table, data:squeeze())
end

torch.save(arg[3],vad_table)