Working on experiments with the new interface, almost there.
This commit is contained in:
parent
1f3d4e941d
commit
f071e61fc7
4 changed files with 47 additions and 39 deletions
|
@ -141,7 +141,6 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
|
||||||
|
|
||||||
// Create the required individual recorders, CSV, HOG, aligned, video
|
// Create the required individual recorders, CSV, HOG, aligned, video
|
||||||
csv_filename = (path(record_root) / path(filename).concat(".csv")).string();
|
csv_filename = (path(record_root) / path(filename).concat(".csv")).string();
|
||||||
metadata_file << "Output csv:" << csv_filename << endl;
|
|
||||||
|
|
||||||
// Consruct HOG recorder here
|
// Consruct HOG recorder here
|
||||||
if(params.outputHOG())
|
if(params.outputHOG())
|
||||||
|
@ -239,6 +238,9 @@ void RecorderOpenFace::WriteObservation()
|
||||||
|
|
||||||
csv_recorder.Open(csv_filename, params.isSequence(), params.output2DLandmarks(), params.output3DLandmarks(), params.outputPDMParams(), params.outputPose(),
|
csv_recorder.Open(csv_filename, params.isSequence(), params.output2DLandmarks(), params.output3DLandmarks(), params.outputPDMParams(), params.outputPose(),
|
||||||
params.outputAUs(), params.outputGaze(), num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg);
|
params.outputAUs(), params.outputGaze(), num_face_landmarks, num_model_modes, num_eye_landmarks, au_names_class, au_names_reg);
|
||||||
|
|
||||||
|
metadata_file << "Output csv:" << csv_filename << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->csv_recorder.WriteLine(observation_count, timestamp, landmark_detection_success,
|
this->csv_recorder.WriteLine(observation_count, timestamp, landmark_detection_success,
|
||||||
|
|
|
@ -22,19 +22,19 @@ output = 'out_DISFA/';
|
||||||
%%
|
%%
|
||||||
% Do it in parrallel for speed (replace the parfor with for if no parallel
|
% Do it in parrallel for speed (replace the parfor with for if no parallel
|
||||||
% toolbox is available)
|
% toolbox is available)
|
||||||
% parfor v = 1:numel(videos)
|
parfor v = 1:numel(videos)
|
||||||
%
|
|
||||||
% vid_file = [DISFA_dir, videos(v).name];
|
vid_file = [DISFA_dir, videos(v).name];
|
||||||
%
|
|
||||||
% command = sprintf('%s -f "%s" -out_dir "%s" -aus ', executable, vid_file, output);
|
command = sprintf('%s -f "%s" -out_dir "%s" -aus ', executable, vid_file, output);
|
||||||
%
|
|
||||||
% if(isunix)
|
if(isunix)
|
||||||
% unix(command, '-echo');
|
unix(command, '-echo');
|
||||||
% else
|
else
|
||||||
% dos(command);
|
dos(command);
|
||||||
% end
|
end
|
||||||
%
|
|
||||||
% end
|
end
|
||||||
|
|
||||||
%% Now evaluate the predictions
|
%% Now evaluate the predictions
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ cd('../');
|
||||||
%% Gaze
|
%% Gaze
|
||||||
cd('Gaze Experiments');
|
cd('Gaze Experiments');
|
||||||
extract_mpii_gaze_test
|
extract_mpii_gaze_test
|
||||||
assert(mean_error < 9.6)
|
assert(mean_error < 9.7)
|
||||||
assert(median_error < 9.0)
|
assert(median_error < 9.0)
|
||||||
cd('../');
|
cd('../');
|
||||||
|
|
||||||
|
|
|
@ -29,22 +29,21 @@ else
|
||||||
executable = '"../../x64/Release/FaceLandmarkImg.exe"';
|
executable = '"../../x64/Release/FaceLandmarkImg.exe"';
|
||||||
end
|
end
|
||||||
|
|
||||||
command = sprintf('%s -fx 1028 -fy 1028 -gaze ', executable);
|
command = sprintf('%s -fx 1028 -fy 1028 ', executable);
|
||||||
p_dirs = dir([database_root, 'p*']);
|
p_dirs = dir([database_root, 'p*']);
|
||||||
|
|
||||||
parfor p=1:numel(p_dirs)
|
parfor p=1:numel(p_dirs)
|
||||||
tic
|
tic
|
||||||
|
|
||||||
input_loc = ['-fdir "', [database_root, p_dirs(p).name], '" '];
|
input_loc = ['-gaze -fdir "', [database_root, p_dirs(p).name], '" '];
|
||||||
out_img_loc = ['-oidir "', [output, p_dirs(p).name], '" '];
|
out_img_loc = ['-out_dir "', [output, p_dirs(p).name], '" '];
|
||||||
out_p_loc = ['-opdir "', [output, p_dirs(p).name], '" '];
|
command_c = cat(2, command, input_loc, out_img_loc);
|
||||||
command_c = cat(2, command, input_loc, out_img_loc, out_p_loc);
|
|
||||||
|
|
||||||
if(isunix)
|
if(isunix)
|
||||||
unix(command_c, '-echo');
|
unix(command_c, '-echo');
|
||||||
else
|
else
|
||||||
dos(command_c);
|
dos(command_c);
|
||||||
end;
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
%%
|
%%
|
||||||
|
@ -65,29 +64,36 @@ for p=1:numel(p_dirs)
|
||||||
|
|
||||||
for i=1:size(filenames, 1)
|
for i=1:size(filenames, 1)
|
||||||
|
|
||||||
fname = sprintf('%s/%s/%d_%d_%d_%d_%d_%d_%d_det_0.pose', output, p_dirs(p).name,...
|
fname = sprintf('%s/%s/%d_%d_%d_%d_%d_%d_%d.csv', output, p_dirs(p).name,...
|
||||||
filenames(i,1), filenames(i,2), filenames(i,3), filenames(i,4),...
|
filenames(i,1), filenames(i,2), filenames(i,3), filenames(i,4),...
|
||||||
filenames(i,5), filenames(i,6), filenames(i,7));
|
filenames(i,5), filenames(i,6), filenames(i,7));
|
||||||
try
|
|
||||||
A = dlmread(fname, ' ', 'A79..F79');
|
if(p==1 && i==1)
|
||||||
valid = true;
|
% First read in the column names
|
||||||
catch
|
tab = readtable(fname);
|
||||||
A = zeros(1,6);
|
column_names = tab.Properties.VariableNames;
|
||||||
A(1,3) = -1;
|
|
||||||
A(1,6) = -1;
|
gaze_0_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_0_'));
|
||||||
valid = false;
|
gaze_1_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_1_'));
|
||||||
end
|
end
|
||||||
|
|
||||||
head_rot = headpose(i,1:3);
|
if(exist(fname, 'file'))
|
||||||
|
all_params = dlmread(fname, ',', 1, 0);
|
||||||
|
else
|
||||||
|
all_params = [];
|
||||||
|
end
|
||||||
|
|
||||||
predictions_r(curr,:) = A(1:3);
|
% If there was a face detected
|
||||||
predictions_l(curr,:) = A(4:6);
|
if(size(all_params,1)>0)
|
||||||
|
predictions_r(curr,:) = all_params(1,gaze_0_ids);
|
||||||
if(~valid)
|
predictions_l(curr,:) = all_params(1,gaze_1_ids);
|
||||||
|
else
|
||||||
predictions_r(curr,:) = [0,0,-1];
|
predictions_r(curr,:) = [0,0,-1];
|
||||||
predictions_l(curr,:) = [0,0,-1];
|
predictions_l(curr,:) = [0,0,-1];
|
||||||
end
|
end
|
||||||
|
|
||||||
|
head_rot = headpose(i,1:3);
|
||||||
|
|
||||||
gt_r(curr,:) = data.right.gaze(i,:)';
|
gt_r(curr,:) = data.right.gaze(i,:)';
|
||||||
gt_r(curr,:) = gt_r(curr,:) / norm(gt_r(curr,:));
|
gt_r(curr,:) = gt_r(curr,:) / norm(gt_r(curr,:));
|
||||||
gt_l(curr,:) = data.left.gaze(i,:)';
|
gt_l(curr,:) = data.left.gaze(i,:)';
|
||||||
|
|
Loading…
Reference in a new issue