diff --git a/lib/local/Utilities/src/RecorderOpenFace.cpp b/lib/local/Utilities/src/RecorderOpenFace.cpp index 7c1d637..86af070 100644 --- a/lib/local/Utilities/src/RecorderOpenFace.cpp +++ b/lib/local/Utilities/src/RecorderOpenFace.cpp @@ -141,7 +141,6 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa // Create the required individual recorders, CSV, HOG, aligned, video csv_filename = (path(record_root) / path(filename).concat(".csv")).string(); - metadata_file << "Output csv:" << csv_filename << endl; // Consruct HOG recorder here 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(), 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, diff --git a/matlab_runners/Action Unit Experiments/run_AU_prediction_DISFA.m b/matlab_runners/Action Unit Experiments/run_AU_prediction_DISFA.m index 35c212a..f3b7732 100644 --- a/matlab_runners/Action Unit Experiments/run_AU_prediction_DISFA.m +++ b/matlab_runners/Action Unit Experiments/run_AU_prediction_DISFA.m @@ -22,19 +22,19 @@ output = 'out_DISFA/'; %% % Do it in parrallel for speed (replace the parfor with for if no parallel % toolbox is available) -% parfor v = 1:numel(videos) -% -% vid_file = [DISFA_dir, videos(v).name]; -% -% command = sprintf('%s -f "%s" -out_dir "%s" -aus ', executable, vid_file, output); -% -% if(isunix) -% unix(command, '-echo'); -% else -% dos(command); -% end -% -% end +parfor v = 1:numel(videos) + + vid_file = [DISFA_dir, videos(v).name]; + + command = sprintf('%s -f "%s" -out_dir "%s" -aus ', executable, vid_file, output); + + if(isunix) + unix(command, '-echo'); + else + dos(command); + end + +end %% Now evaluate the predictions diff --git a/matlab_runners/Full_test_suite.m b/matlab_runners/Full_test_suite.m index e52d470..e1e7b57 100644 --- a/matlab_runners/Full_test_suite.m +++ b/matlab_runners/Full_test_suite.m @@ -43,7 +43,7 @@ cd('../'); %% Gaze cd('Gaze Experiments'); extract_mpii_gaze_test -assert(mean_error < 9.6) +assert(mean_error < 9.7) assert(median_error < 9.0) cd('../'); diff --git a/matlab_runners/Gaze Experiments/extract_mpii_gaze_test.m b/matlab_runners/Gaze Experiments/extract_mpii_gaze_test.m index 734d28d..ee2dd3c 100644 --- a/matlab_runners/Gaze Experiments/extract_mpii_gaze_test.m +++ b/matlab_runners/Gaze Experiments/extract_mpii_gaze_test.m @@ -29,22 +29,21 @@ else executable = '"../../x64/Release/FaceLandmarkImg.exe"'; end -command = sprintf('%s -fx 1028 -fy 1028 -gaze ', executable); +command = sprintf('%s -fx 1028 -fy 1028 ', executable); p_dirs = dir([database_root, 'p*']); parfor p=1:numel(p_dirs) tic - input_loc = ['-fdir "', [database_root, p_dirs(p).name], '" ']; - out_img_loc = ['-oidir "', [output, p_dirs(p).name], '" ']; - out_p_loc = ['-opdir "', [output, p_dirs(p).name], '" ']; - command_c = cat(2, command, input_loc, out_img_loc, out_p_loc); + input_loc = ['-gaze -fdir "', [database_root, p_dirs(p).name], '" ']; + out_img_loc = ['-out_dir "', [output, p_dirs(p).name], '" ']; + command_c = cat(2, command, input_loc, out_img_loc); if(isunix) unix(command_c, '-echo'); else dos(command_c); - end; + end end %% @@ -65,29 +64,36 @@ for p=1:numel(p_dirs) 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,5), filenames(i,6), filenames(i,7)); - try - A = dlmread(fname, ' ', 'A79..F79'); - valid = true; - catch - A = zeros(1,6); - A(1,3) = -1; - A(1,6) = -1; - valid = false; + + if(p==1 && i==1) + % First read in the column names + tab = readtable(fname); + column_names = tab.Properties.VariableNames; + + gaze_0_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_0_')); + gaze_1_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_1_')); + end + + if(exist(fname, 'file')) + all_params = dlmread(fname, ',', 1, 0); + else + all_params = []; + end + + % If there was a face detected + if(size(all_params,1)>0) + predictions_r(curr,:) = all_params(1,gaze_0_ids); + predictions_l(curr,:) = all_params(1,gaze_1_ids); + else + predictions_r(curr,:) = [0,0,-1]; + predictions_l(curr,:) = [0,0,-1]; end head_rot = headpose(i,1:3); - - predictions_r(curr,:) = A(1:3); - predictions_l(curr,:) = A(4:6); - - if(~valid) - predictions_r(curr,:) = [0,0,-1]; - predictions_l(curr,:) = [0,0,-1]; - end - + gt_r(curr,:) = data.right.gaze(i,:)'; gt_r(curr,:) = gt_r(curr,:) / norm(gt_r(curr,:)); gt_l(curr,:) = data.left.gaze(i,:)';