Error using fread Invalid file identifier in Microsoft MSR ToolKit

2 次查看(过去 30 天)
I am getting the following error while using Microsoft MSR ToolBox
Error using fread
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in htkread (line 8)
nframes = fread(fid, 1, 'int32'); % number of frames
Error in DebugCode (line 13)
data{ix} = htkread(filenames{ix});
The code of functions where the errors arise are:
function gmm = mapAdapt(dataList, ubmFilename, tau, config, gmmFilename)
......
.
if ischar(dataList) || iscellstr(dataList),
dataList = load_data(dataList);
end
if ~iscell(dataList),
error('Oops! dataList should be a cell array!');
end
nfiles = length(dataList);
.
..
.......
end
*****************************************************************************
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)
% reads features with HTK format
%
% Omid Sadjadi <s.omid.sadjadi@gmail.com>
% Microsoft Research, Conversational Systems Research Center
fid = fopen(filename, 'rb', 'ieee-be');
nframes = fread(fid, 1, 'int32'); % number of frames %%ERROR
frate = fread(fid, 1, 'int32'); % frame rate in 100 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.txt is a file with 6300 entries like
htkfiles\fadg0_si1279.htk
htkfiles\fadg0_si1909.htk
htkfiles\fadg0_si649.htk
htkfiles\fadg0_sx109.htk
htkfiles\fadg0_sx19.htk
htkfiles\fadg0_sx199.htk
htkfiles\fadg0_sx289.htk
htkfiles\fadg0_sx379.htk
htkfiles\faem0_sa1.htk
htkfiles\faem0_sa2.htk
htkfiles\faem0_si1392.htk
htkfiles\faem0_si2022.htk
htkfiles\faem0_si762.htk
htkfiles\faem0_sx132.htk
htkfiles\faem0_sx222.htk
htkfiles\faem0_sx312.htk
htkfiles\faem0_sx402.htk
htkfiles\faem0_sx42.htk
htkfiles\fajw0_sa1.htk
htkfiles\fajw0_sa2.htk
htkfiles\fajw0_si1263.htk
htkfiles\fajw0_si1893.htk

采纳的回答

Walter Roberson
Walter Roberson 2016-11-23
One or more of the files named in that list do not exist relative to your current directory.
The code
fid = fopen(filename, 'rb', 'ieee-be');
would be better as
[fid, message] = fopen(filename, 'rb', 'ieee-be');
if fid < 0
error('Failed to open file "%s" because "%s", filename, message);
end
  3 个评论
Vinay H
Vinay H 2018-5-29
编辑:Walter Roberson 2018-6-6
How did you get dataList. I downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=52279 and it does not have database to train. Please let me know how you got database.
Sonal Joshi
Sonal Joshi 2018-7-21
Its a bit late, but in case you are still stuck, here is the answer. You will need to prepare the dataList according to your data. The format is:
path_to_features\speaker1_utterance1.htk
path_to_features\speaker2_utterance2.htk
.
.
The one I have put above is for TIMIT database ( https://catalog.ldc.upenn.edu/ldc93s1 ) which is a paid database that can be purchased from LDC.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Historical Contests 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by