-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetXYfromTrackList.m
40 lines (31 loc) · 1.36 KB
/
getXYfromTrackList.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function [X, y, frameTrackNums, frameUtterances, frameTimes] = ...
getXYfromTrackList(trackList, featureSpec)
% GETXYFROMTRACKLIST Features are stored in X, labels are stored in y.
% For frame i, frameTrackNums is the frame's track number relative to
% trackList. See GETXYFROMFILE for more information on frameUtterances and
% frameTimes. frameTrackNums is used in failure analysis only.
X = [];
y = [];
frameTrackNums = [];
frameUtterances = [];
frameTimes = [];
nTracks = size(trackList, 2);
for trackNum = 1:nTracks
track = trackList{trackNum};
fprintf('[%d/%d] Getting X and y for %s\n', trackNum, nTracks, ...
track.filename);
[dialogX, dialogY, dialogFrameUtterances, dialogFrameTimes] = ...
getXYfromFile(track.filename, featureSpec);
% skip this track if there are no useable annotations for it
if ~size(dialogX, 1)
continue
end
X = [X; dialogX]; % TODO appending is slow
y = [y; dialogY];
nFramesInDialog = size(dialogX, 1);
trackNumsToAppend = ones(nFramesInDialog, 1) * trackNum;
frameTrackNums = [frameTrackNums; trackNumsToAppend];
frameUtterances = [frameUtterances; dialogFrameUtterances];
frameTimes = [frameTimes; dialogFrameTimes];
end
end