2016-05-24 22:51:18 +02:00
|
|
|
function [ labels, valid_ids, vid_ids ] = extract_SEMAINE_labels( SEMAINE_dir, recs, aus )
|
|
|
|
%EXTRACT_SEMAINE_LABELS Summary of this function goes here
|
|
|
|
% Detailed explanation goes here
|
|
|
|
|
|
|
|
% Get the right eaf file
|
|
|
|
|
|
|
|
aus_SEMAINE = [2 12 17 25 28 45];
|
|
|
|
|
|
|
|
inds_to_use = [];
|
|
|
|
|
|
|
|
for i=1:numel(aus)
|
|
|
|
|
|
|
|
inds_to_use = cat(1, inds_to_use, find(aus_SEMAINE == aus(i)));
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
labels = cell(numel(recs), 1);
|
|
|
|
valid_ids = cell(numel(recs), 1);
|
|
|
|
vid_ids = zeros(numel(recs), 2);
|
|
|
|
|
|
|
|
for i=1:numel(recs)
|
|
|
|
|
|
|
|
file = dir([SEMAINE_dir, '/', recs{i}, '/*.eaf']);
|
|
|
|
|
|
|
|
vid_ids(i,:) = dlmread([SEMAINE_dir, '/', recs{i}, '.txt'], ' ');
|
|
|
|
|
|
|
|
xml_file = [SEMAINE_dir, recs{i}, '\' file.name];
|
|
|
|
[root_xml, name_xml, ~] = fileparts(xml_file);
|
|
|
|
|
2017-01-04 23:32:38 +01:00
|
|
|
activations = ParseSEMAINEAnnotations([SEMAINE_dir, recs{i}, '/' file.name]);
|
|
|
|
|
2016-05-24 22:51:18 +02:00
|
|
|
if(size(activations,1) < vid_ids(i,2))
|
|
|
|
vid_ids(i,2) = size(activations,1);
|
|
|
|
if(vid_ids(i,2) > 2999)
|
|
|
|
vid_ids(i,1) = vid_ids(i,2) - 2999;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
labels{i} = activations(vid_ids(i,1)+1:vid_ids(i,2), 1 + inds_to_use);
|
|
|
|
|
|
|
|
% all indices in SEMAINE are valid
|
|
|
|
valid_ids{i} = ones(size(labels{i},1),1);
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|