我尝试使用MSR Identity toolkit运行演示人员验证演示人。然而,在训练UBM步骤后它留下了错误。错误如下。看起来fopen
返回-1
并导致错误fread
。我无法理解为什么它无法阅读filenames
。我无法附加代码,因为它涉及许多功能。我希望熟悉这个工具包的人可以帮助我。
Error using fread
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in htkread (line 7)
nframes = fread(fid, 1, 'int32'); % number of frames
Error in mapAdapt>load_data (line 107)
data{ix} = htkread(filenames{ix});
Error in mapAdapt (line 52)
dataList = load_data(dataList);
Error in demo_gmm_ubm (line 69)
gmm_models{spk} = mapAdapt(spk_files, ubm, map_tau, config);
导致错误的部分代码如下:
function data = load_data(datalist)
% load all data into memory
if ~iscellstr(datalist)
fid = fopen(datalist, 'rt');
filenames = textscan(fid, '%s');
fclose(fid);
filenames = filenames{1};
else
filenames = datalist;
end
nfiles = size(filenames, 1);
data = cell(nfiles, 1);
for ix = 1 : nfiles,
data{ix} = htkread(filenames{ix});
end
function [data, frate, feakind] = htkread(filename)
% read features with HTK format (uncompressed)
fid = fopen(filename, 'r','b'); %ERROR HERE
nframes = fread(fid, 1, 'int32'); % number of frames
frate = fread(fid, 1, 'int32'); % frame rate in nano-seconds unit
nbytes = fread(fid, 1, 'short'); % number of bytes per feature value
feakind = fread(fid, 1, 'short'); % 9 is USER
ndim = nbytes / 4; % feature dimension (4 bytes per value)
data = fread(fid, [ndim, nframes], 'float');
fclose(fid);
datalist
包含:
'features\fadg0_sa2.htk'
'features\fadg0_si1279.htk'
'features\fadg0_si1909.htk'
'features\fadg0_si649.htk'
'features\fadg0_sx109.htk'
'features\fadg0_sx19.htk'
'features\fadg0_sx199.htk'
'features\fadg0_sx289.htk'
'features\fadg0_sx379.htk'
答案 0 :(得分:0)
幸运的是,我毫无疑问地使用了MSR Identity Toolkit。
我在htkread.m中的内容如下:
...
fid = fopen(文件名,' rb',' ieee-be');
nframes = fread(fid,1,' int32'); %帧数
...
您遇到的错误可能来自:
big-endian / little-endian问题
您缺少* .htk功能
* .htk采用其他格式
的问候,
撬
答案 1 :(得分:0)
你的fid是否会返回负值?如果是,请尝试指定dataList =' ubm.lst&#39 ;;在代码中