Work on experiments and experiment scripts, together with recording parameters.
This commit is contained in:
parent
ac96608bfd
commit
0e428cca45
5 changed files with 151 additions and 20 deletions
140
lib/local/Recorder/src/RecorderOpenFaceParameters.cpp
Normal file
140
lib/local/Recorder/src/RecorderOpenFaceParameters.cpp
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2017, Tadas Baltrusaitis, all rights reserved.
|
||||||
|
//
|
||||||
|
// ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY
|
||||||
|
//
|
||||||
|
// BY USING OR DOWNLOADING THE SOFTWARE, YOU ARE AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT.
|
||||||
|
// IF YOU DO NOT AGREE WITH THESE TERMS, YOU MAY NOT USE OR DOWNLOAD THE SOFTWARE.
|
||||||
|
//
|
||||||
|
// License can be found in OpenFace-license.txt
|
||||||
|
//
|
||||||
|
// * Any publications arising from the use of this software, including but
|
||||||
|
// not limited to academic journal and conference publications, technical
|
||||||
|
// reports and manuals, must cite at least one of the following works:
|
||||||
|
//
|
||||||
|
// OpenFace: an open source facial behavior analysis toolkit
|
||||||
|
// Tadas Baltrušaitis, Peter Robinson, and Louis-Philippe Morency
|
||||||
|
// in IEEE Winter Conference on Applications of Computer Vision, 2016
|
||||||
|
//
|
||||||
|
// Rendering of Eyes for Eye-Shape Registration and Gaze Estimation
|
||||||
|
// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling
|
||||||
|
// in IEEE International. Conference on Computer Vision (ICCV), 2015
|
||||||
|
//
|
||||||
|
// Cross-dataset learning and person-speci?c normalisation for automatic Action Unit detection
|
||||||
|
// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson
|
||||||
|
// in Facial Expression Recognition and Analysis Challenge,
|
||||||
|
// IEEE International Conference on Automatic Face and Gesture Recognition, 2015
|
||||||
|
//
|
||||||
|
// Constrained Local Neural Fields for robust facial landmark detection in the wild.
|
||||||
|
// Tadas Baltrušaitis, Peter Robinson, and Louis-Philippe Morency.
|
||||||
|
// in IEEE Int. Conference on Computer Vision Workshops, 300 Faces in-the-Wild Challenge, 2013.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RecorderOpenFaceParameters.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
using namespace Recorder;
|
||||||
|
|
||||||
|
RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector<std::string> &arguments, double fps_vid_out, std::string output_codec)
|
||||||
|
{
|
||||||
|
|
||||||
|
string separator = string(1, boost::filesystem::path::preferred_separator);
|
||||||
|
|
||||||
|
this->fps_vid_out = fps_vid_out;
|
||||||
|
this->output_codec = output_codec;
|
||||||
|
|
||||||
|
// First check if there is a root argument (so that videos and outputs could be defined more easilly)
|
||||||
|
for (size_t i = 0; i < arguments.size(); ++i)
|
||||||
|
{
|
||||||
|
if (arguments[i].compare("-root") == 0)
|
||||||
|
{
|
||||||
|
output_root = arguments[i + 1] + separator;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (arguments[i].compare("-outroot") == 0)
|
||||||
|
{
|
||||||
|
output_root = arguments[i + 1] + separator;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool output_set = false;
|
||||||
|
|
||||||
|
output_2D_landmarks = false;
|
||||||
|
output_3D_landmarks = false;
|
||||||
|
output_model_params = false;
|
||||||
|
output_pose = false;
|
||||||
|
output_AUs = false;
|
||||||
|
output_gaze = false;
|
||||||
|
output_hog = false;
|
||||||
|
output_tracked_video = false;
|
||||||
|
output_aligned_faces = false;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < arguments.size(); ++i)
|
||||||
|
{
|
||||||
|
if (arguments[i].compare("-simalign") == 0)
|
||||||
|
{
|
||||||
|
output_aligned_faces = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-hogalign") == 0)
|
||||||
|
{
|
||||||
|
output_hog = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-2Dfp") == 0)
|
||||||
|
{
|
||||||
|
output_2D_landmarks = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-3Dfp") == 0)
|
||||||
|
{
|
||||||
|
output_3D_landmarks = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-pdmparams") == 0)
|
||||||
|
{
|
||||||
|
output_model_params = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-pose") == 0)
|
||||||
|
{
|
||||||
|
output_pose = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-aus") == 0)
|
||||||
|
{
|
||||||
|
output_AUs = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-gaze") == 0)
|
||||||
|
{
|
||||||
|
output_gaze = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
else if (arguments[i].compare("-tracked") == 0)
|
||||||
|
{
|
||||||
|
output_tracked_video = true;
|
||||||
|
output_set = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output everything if nothing has been set
|
||||||
|
|
||||||
|
if (!output_set)
|
||||||
|
{
|
||||||
|
output_2D_landmarks = true;
|
||||||
|
output_3D_landmarks = true;
|
||||||
|
output_model_params = true;
|
||||||
|
output_pose = true;
|
||||||
|
output_AUs = true;
|
||||||
|
output_gaze = true;
|
||||||
|
output_hog = true;
|
||||||
|
output_tracked_video = true;
|
||||||
|
output_aligned_faces = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ seq_ids = {};
|
||||||
|
|
||||||
for i = 1:numel(seqNames)
|
for i = 1:numel(seqNames)
|
||||||
|
|
||||||
[frame t, rels, sc tx ty tz rx ry rz] = textread([resDir seqNames{i} '.txt'], '%f, %f, %f, %f, %f, %f, %f, %f, %f, %f', 'headerlines', 1);
|
[frame t, rels, sc tx ty tz rx ry rz] = textread([resDir seqNames{i} '.csv'], '%f, %f, %f, %f, %f, %f, %f, %f, %f, %f', 'headerlines', 1);
|
||||||
posesGround = load ([gtDir seqNames{i} '.dat']);
|
posesGround = load ([gtDir seqNames{i} '.dat']);
|
||||||
|
|
||||||
% the reliabilities of head pose
|
% the reliabilities of head pose
|
||||||
|
|
|
@ -44,7 +44,7 @@ for i=3 + offset:numTogether:numel(dbSeqDir)
|
||||||
command = cat(2, command, [' -ov "' outputVideo '"']);
|
command = cat(2, command, [' -ov "' outputVideo '"']);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
command = cat(2, command, [' -fx 505 -fy 505 -cx 320 -cy 240 -no2Dfp -no3Dfp -noMparams -noAUs -noGaze -vis-track ']);
|
command = cat(2, command, [' -fx 505 -fy 505 -cx 320 -cy 240 -pose -vis-track ']);
|
||||||
|
|
||||||
if(any(strcmp('model', varargin)))
|
if(any(strcmp('model', varargin)))
|
||||||
command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']);
|
command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']);
|
||||||
|
|
|
@ -17,10 +17,6 @@ function [output_dir] = run_bu_experiment(bu_dir, verbose, varargin)
|
||||||
command = executable;
|
command = executable;
|
||||||
command = cat(2, command, [' -inroot ' '"' bu_dir '/"']);
|
command = cat(2, command, [' -inroot ' '"' bu_dir '/"']);
|
||||||
|
|
||||||
% BU dataset orientation is in terms of camera plane, instruct the
|
|
||||||
% tracker to output it in that format
|
|
||||||
command = cat(2, command, [' -cp ']);
|
|
||||||
|
|
||||||
% deal with edge cases
|
% deal with edge cases
|
||||||
if(numTogether + i > numel(buFiles))
|
if(numTogether + i > numel(buFiles))
|
||||||
numTogether = numel(buFiles) - i + 1;
|
numTogether = numel(buFiles) - i + 1;
|
||||||
|
@ -28,20 +24,15 @@ function [output_dir] = run_bu_experiment(bu_dir, verbose, varargin)
|
||||||
|
|
||||||
for n=0:numTogether-1
|
for n=0:numTogether-1
|
||||||
inputFile = [buFiles(n+i).name];
|
inputFile = [buFiles(n+i).name];
|
||||||
[~, name, ~] = fileparts(inputFile);
|
command = cat(2, command, [' -f "' inputFile '" -of "' output_dir '"']);
|
||||||
|
end
|
||||||
|
|
||||||
% where to output results
|
% Only outputing the pose (-pose)
|
||||||
outputFile = [output_dir name '.txt'];
|
command = cat(2, command, ' -fx 500 -fy 500 -cx 160 -cy 120 -pose -vis-track ');
|
||||||
|
|
||||||
command = cat(2, command, [' -f "' inputFile '" -of "' outputFile '"']);
|
|
||||||
|
|
||||||
if(verbose)
|
if(verbose)
|
||||||
outputVideo = ['"' output_dir name '.avi' '"'];
|
command = cat(2, command, [' -tracked ' outputVideo]);
|
||||||
command = cat(2, command, [' -ov ' outputVideo]);
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
command = cat(2, command, ' -fx 500 -fy 500 -cx 160 -cy 120 -no2Dfp -no3Dfp -noMparams -noAUs -noGaze -vis-track ');
|
|
||||||
|
|
||||||
if(any(strcmp('model', varargin)))
|
if(any(strcmp('model', varargin)))
|
||||||
command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']);
|
command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']);
|
||||||
|
|
|
@ -18,7 +18,7 @@ numTogether = 10;
|
||||||
|
|
||||||
for i=3:numTogether:numel(dbSeqDir)
|
for i=3:numTogether:numel(dbSeqDir)
|
||||||
|
|
||||||
command = [executable ' -fx 535 -fy 536 -cx 327 -cy 241 -no2Dfp -no3Dfp -noMparams -noAUs -noGaze -vis-track '];
|
command = [executable ' -fx 535 -fy 536 -cx 327 -cy 241 -pose -vis-track '];
|
||||||
|
|
||||||
command = cat(2, command, [' -inroot ' '"' rootDir '/"']);
|
command = cat(2, command, [' -inroot ' '"' rootDir '/"']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue