A number of small fixes, renamings and corrections.

This commit is contained in:
Tadas Baltrusaitis 2016-07-31 16:31:17 -04:00
parent 35f1967176
commit 51ae195124
14 changed files with 61 additions and 54 deletions

View file

@ -66,5 +66,5 @@ script:
- make -j2 - make -j2
- ../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q - ../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q
- ../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -ov multi_face.avi -q - ../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -ov multi_face.avi -q
- ../build/bin/FeatureExtraction -rigid -verbose -f "../videos/1815_01_008_tony_blair.avi" -ov blair.avi -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_test.avi -hogalign hog_test.dat -q - ../build/bin/FeatureExtraction -f "../videos/1815_01_008_tony_blair.avi" -ov blair.avi -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_test.avi -hogalign hog_test.dat -q
- ../build/bin/FaceLandmarkVid -f "../videos/1815_01_008_tony_blair.avi" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" -q - ../build/bin/FaceLandmarkVid -f "../videos/1815_01_008_tony_blair.avi" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" -q

View file

@ -23,5 +23,5 @@ test_script:
- cmd: dir - cmd: dir
- cmd: if exist "../videos" (FaceLandmarkImg.exe -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) else (FaceLandmarkImg.exe -fdir "../../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) - cmd: if exist "../videos" (FaceLandmarkImg.exe -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) else (FaceLandmarkImg.exe -fdir "../../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q)
- cmd: if exist "../videos" (FaceLandmarkVidMulti.exe -f ../videos/multi_face.avi -ov multi_face.avi -q) else (FaceLandmarkVidMulti.exe -f ../../videos/multi_face.avi -ov multi_face.avi -q) - cmd: if exist "../videos" (FaceLandmarkVidMulti.exe -f ../videos/multi_face.avi -ov multi_face.avi -q) else (FaceLandmarkVidMulti.exe -f ../../videos/multi_face.avi -ov multi_face.avi -q)
- cmd: if exist "../videos" (FeatureExtraction.exe -rigid -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_track.avi -hogalign hog_test.dat -q) else (FeatureExtraction.exe -rigid -f "../../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_track.avi -hogalign hog_test.dat -q) - cmd: if exist "../videos" (FeatureExtraction.exe -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_track.avi -hogalign hog_test.dat -q) else (FeatureExtraction.exe -f "../../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_track.avi -hogalign hog_test.dat -q)
- cmd: if exist "../videos" (FaceLandmarkVid.exe -f "../videos/1815_01_008_tony_blair.avi" -ov track.avi -q) else (FaceLandmarkVid.exe -f "../../videos/1815_01_008_tony_blair.avi" -ov track.avi -q) - cmd: if exist "../videos" (FaceLandmarkVid.exe -f "../videos/1815_01_008_tony_blair.avi" -ov track.avi -q) else (FaceLandmarkVid.exe -f "../../videos/1815_01_008_tony_blair.avi" -ov track.avi -q)

View file

@ -153,9 +153,8 @@ void create_directory(string output_path)
} }
void get_output_feature_params(vector<string> &output_similarity_aligned, vector<string> &output_hog_aligned_files, double &similarity_scale, void get_output_feature_params(vector<string> &output_similarity_aligned, vector<string> &output_hog_aligned_files, double &similarity_scale,
int &similarity_size, bool &grayscale, bool &rigid, bool& verbose, bool& dynamic, int &similarity_size, bool &grayscale, bool& verbose, bool& dynamic, bool &output_2D_landmarks, bool &output_3D_landmarks,
bool &output_2D_landmarks, bool &output_3D_landmarks, bool &output_model_params, bool &output_pose, bool &output_AUs, bool &output_gaze, bool &output_model_params, bool &output_pose, bool &output_AUs, bool &output_gaze, vector<string> &arguments);
vector<string> &arguments);
void get_image_input_output_params_feats(vector<vector<string> > &input_image_files, bool& as_video, vector<string> &arguments); void get_image_input_output_params_feats(vector<vector<string> > &input_image_files, bool& as_video, vector<string> &arguments);
@ -305,7 +304,6 @@ int main (int argc, char **argv)
int sim_size = 112; int sim_size = 112;
bool grayscale = false; bool grayscale = false;
bool video_output = false; bool video_output = false;
bool rigid = false;
bool dynamic = true; // Indicates if a dynamic AU model should be used (dynamic is useful if the video is long enough to include neutral expressions) bool dynamic = true; // Indicates if a dynamic AU model should be used (dynamic is useful if the video is long enough to include neutral expressions)
int num_hog_rows; int num_hog_rows;
int num_hog_cols; int num_hog_cols;
@ -319,7 +317,7 @@ int main (int argc, char **argv)
bool output_AUs = true; bool output_AUs = true;
bool output_gaze = true; bool output_gaze = true;
get_output_feature_params(output_similarity_align, output_hog_align_files, sim_scale, sim_size, grayscale, rigid, verbose, dynamic, get_output_feature_params(output_similarity_align, output_hog_align_files, sim_scale, sim_size, grayscale, verbose, dynamic,
output_2D_landmarks, output_3D_landmarks, output_model_params, output_pose, output_AUs, output_gaze, arguments); output_2D_landmarks, output_3D_landmarks, output_model_params, output_pose, output_AUs, output_gaze, arguments);
// Used for image masking // Used for image masking
@ -1022,7 +1020,7 @@ void outputAllFeatures(std::ofstream* output_file, bool output_2D_landmarks, boo
void get_output_feature_params(vector<string> &output_similarity_aligned, vector<string> &output_hog_aligned_files, double &similarity_scale, void get_output_feature_params(vector<string> &output_similarity_aligned, vector<string> &output_hog_aligned_files, double &similarity_scale,
int &similarity_size, bool &grayscale, bool &rigid, bool& verbose, bool& dynamic, int &similarity_size, bool &grayscale, bool& verbose, bool& dynamic,
bool &output_2D_landmarks, bool &output_3D_landmarks, bool &output_model_params, bool &output_pose, bool &output_AUs, bool &output_gaze, bool &output_2D_landmarks, bool &output_3D_landmarks, bool &output_model_params, bool &output_pose, bool &output_AUs, bool &output_gaze,
vector<string> &arguments) vector<string> &arguments)
{ {
@ -1036,7 +1034,6 @@ void get_output_feature_params(vector<string> &output_similarity_aligned, vector
valid[i] = true; valid[i] = true;
} }
string input_root = "";
string output_root = ""; string output_root = "";
// By default the model is dynamic // By default the model is dynamic
@ -1047,15 +1044,9 @@ void get_output_feature_params(vector<string> &output_similarity_aligned, vector
{ {
if (arguments[i].compare("-root") == 0) if (arguments[i].compare("-root") == 0)
{ {
input_root = arguments[i + 1];
output_root = arguments[i + 1]; output_root = arguments[i + 1];
i++; i++;
} }
if (arguments[i].compare("-inroot") == 0)
{
input_root = arguments[i + 1];
i++;
}
if (arguments[i].compare("-outroot") == 0) if (arguments[i].compare("-outroot") == 0)
{ {
output_root = arguments[i + 1]; output_root = arguments[i + 1];
@ -1085,10 +1076,6 @@ void get_output_feature_params(vector<string> &output_similarity_aligned, vector
{ {
verbose = true; verbose = true;
} }
else if (arguments[i].compare("-rigid") == 0)
{
rigid = true;
}
else if (arguments[i].compare("-au_static") == 0) else if (arguments[i].compare("-au_static") == 0)
{ {
dynamic = false; dynamic = false;

View file

@ -76,8 +76,8 @@ namespace LandmarkDetector
//============================================================================================= //=============================================================================================
// Helper functions for parsing the inputs // Helper functions for parsing the inputs
//============================================================================================= //=============================================================================================
void get_video_input_output_params(vector<string> &input_video_file, vector<string> &depth_dir, void get_video_input_output_params(vector<string> &input_video_file, vector<string> &depth_dir, vector<string> &output_files,
vector<string> &output_files, vector<string> &output_video_files, bool& world_coordinates_pose, vector<string> &arguments); vector<string> &output_video_files, bool& world_coordinates_pose, vector<string> &arguments);
void get_camera_params(int &device, float &fx, float &fy, float &cx, float &cy, vector<string> &arguments); void get_camera_params(int &device, float &fx, float &fy, float &cx, float &cy, vector<string> &arguments);

View file

@ -115,8 +115,8 @@ void create_directories(string output_path)
} }
// Extracting the following command line arguments -f, -fd, -op, -of, -ov (and possible ordered repetitions) // Extracting the following command line arguments -f, -fd, -op, -of, -ov (and possible ordered repetitions)
void get_video_input_output_params(vector<string> &input_video_files, vector<string> &depth_dirs, void get_video_input_output_params(vector<string> &input_video_files, vector<string> &depth_dirs, vector<string> &output_files,
vector<string> &output_files, vector<string> &output_video_files, bool& world_coordinates_pose, vector<string> &arguments) vector<string> &output_video_files, bool& world_coordinates_pose, vector<string> &arguments)
{ {
bool* valid = new bool[arguments.size()]; bool* valid = new bool[arguments.size()];
@ -128,14 +128,26 @@ void get_video_input_output_params(vector<string> &input_video_files, vector<str
// By default use rotation with respect to camera (not world coordinates) // By default use rotation with respect to camera (not world coordinates)
world_coordinates_pose = false; world_coordinates_pose = false;
string root = ""; string input_root = "";
string output_root = "";
// First check if there is a root argument (so that videos and outputs could be defined more easilly) // 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) for(size_t i = 0; i < arguments.size(); ++i)
{ {
if (arguments[i].compare("-root") == 0) if (arguments[i].compare("-root") == 0)
{ {
root = arguments[i + 1]; input_root = arguments[i + 1];
// Do not discard root as it might be used in other later steps output_root = arguments[i + 1];
i++;
}
if (arguments[i].compare("-inroot") == 0)
{
input_root = arguments[i + 1];
i++;
}
if (arguments[i].compare("-outroot") == 0)
{
output_root = arguments[i + 1];
i++; i++;
} }
} }
@ -144,30 +156,30 @@ void get_video_input_output_params(vector<string> &input_video_files, vector<str
{ {
if (arguments[i].compare("-f") == 0) if (arguments[i].compare("-f") == 0)
{ {
input_video_files.push_back(root + arguments[i + 1]); input_video_files.push_back(input_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;
} }
else if (arguments[i].compare("-fd") == 0) else if (arguments[i].compare("-fd") == 0)
{ {
depth_dirs.push_back(root + arguments[i + 1]); depth_dirs.push_back(input_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;
} }
else if (arguments[i].compare("-of") == 0) else if (arguments[i].compare("-of") == 0)
{ {
output_files.push_back(root + arguments[i + 1]); output_files.push_back(output_root + arguments[i + 1]);
create_directory_from_file(root + arguments[i + 1]); create_directory_from_file(output_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;
} }
else if (arguments[i].compare("-ov") == 0) else if (arguments[i].compare("-ov") == 0)
{ {
output_video_files.push_back(root + arguments[i + 1]); output_video_files.push_back(output_root + arguments[i + 1]);
create_directory_from_file(root + arguments[i + 1]); create_directory_from_file(output_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;

View file

@ -20,7 +20,7 @@ parfor f1=1:numel(devel_recs)
f1_dir = devel_recs{f1}; f1_dir = devel_recs{f1};
command = [executable, ' -fx 800 -fy 800 -rigid -q -no2Dfp -no3Dfp -noMparams -noPose -noGaze ']; command = [executable, ' -fx 800 -fy 800 -q -no2Dfp -no3Dfp -noMparams -noPose -noGaze '];
curr_vid = [SEMAINE_dir, f1_dir, '/', vid_file.name]; curr_vid = [SEMAINE_dir, f1_dir, '/', vid_file.name];

View file

@ -1,4 +1,4 @@
clm_exe = '"../../x64/Release/FeatureExtraction.exe"'; executable = '"../../x64/Release/FeatureExtraction.exe"';
output = './output_features_seq/'; output = './output_features_seq/';
@ -10,8 +10,7 @@ in_dirs = {'../../image_sequence'};
% some parameters % some parameters
verbose = true; verbose = true;
command = clm_exe; command = executable;
command = cat(2, command, ' -rigid ');
% Remove for a speedup % Remove for a speedup
command = cat(2, command, ' -verbose '); command = cat(2, command, ' -verbose ');

View file

@ -1,4 +1,4 @@
clm_exe = '"../../x64/Release/FeatureExtraction.exe"'; executable = '"../../x64/Release/FeatureExtraction.exe"';
output = './output_features_vid/'; output = './output_features_vid/';
@ -10,8 +10,7 @@ in_files = dir('../../videos/1815_01_008_tony_blair.avi');
% some parameters % some parameters
verbose = true; verbose = true;
command = clm_exe; command = executable;
command = cat(2, command, ' -rigid ');
% Remove for a speedup % Remove for a speedup
command = cat(2, command, ' -verbose '); command = cat(2, command, ' -verbose ');

View file

@ -1,6 +1,6 @@
clear clear
clm_exe = '"../../x64/Release/FaceLandmarkImg.exe"'; executable = '"../../x64/Release/FaceLandmarkImg.exe"';
in_dir = '../../videos/'; in_dir = '../../videos/';
out_dir = './demo_img/'; out_dir = './demo_img/';
@ -22,7 +22,7 @@ model = 'model/main_clnf_general.txt';
% Trained on in-the-wild % Trained on in-the-wild
%model = 'model/main_clnf_wild.txt'; %model = 'model/main_clnf_wild.txt';
command = clm_exe; command = executable;
command = cat(2, command, [' -fdir "' in_dir '"']); command = cat(2, command, [' -fdir "' in_dir '"']);

View file

@ -1,4 +1,4 @@
clm_exe = '"../../x64/Release/FaceLandmarkVidMulti.exe"'; executable = '"../../x64/Release/FaceLandmarkVidMulti.exe"';
output = './demo_vid/'; output = './demo_vid/';
@ -20,7 +20,7 @@ model = 'model/main_clnf_general.txt';
% Trained on in-the-wild % Trained on in-the-wild
%model = 'model/main_clnf_wild.txt'; %model = 'model/main_clnf_wild.txt';
command = clm_exe; command = executable;
command = cat(2, command, [' -mloc "', model, '"']); command = cat(2, command, [' -mloc "', model, '"']);
% add all videos to single argument list (so as not to load the model anew % add all videos to single argument list (so as not to load the model anew
% for every video) % for every video)

View file

@ -1,4 +1,4 @@
clm_exe = '"../../x64/Release/FaceLandmarkVid.exe"'; executable = '"../../x64/Release/FaceLandmarkVid.exe"';
output = './demo_vid/'; output = './demo_vid/';
@ -21,7 +21,7 @@ model = 'model/main_clnf_general.txt';
% Trained on in-the-wild % Trained on in-the-wild
%model = 'model/main_clnf_wild.txt'; %model = 'model/main_clnf_wild.txt';
command = clm_exe; command = executable;
command = cat(2, command, [' -mloc "', model, '"']); command = cat(2, command, [' -mloc "', model, '"']);
% add all videos to single argument list (so as not to load the model anew % add all videos to single argument list (so as not to load the model anew
% for every video) % for every video)

View file

@ -1,4 +1,4 @@
function [meanError, all_rot_preds, all_rot_gts, all_errors, rels_all] = calcBUerror(resDir, gtDir) function [meanError, all_rot_preds, all_rot_gts, all_errors, rels_all, seq_ids] = calcBUerror(resDir, gtDir)
seqNames = {'jam1','jam2','jam3','jam4','jam5','jam6','jam7','jam8','jam9', ... seqNames = {'jam1','jam2','jam3','jam4','jam5','jam6','jam7','jam8','jam9', ...
'jim1','jim2','jim3','jim4','jim5','jim6','jim7','jim8','jim9', ... 'jim1','jim2','jim3','jim4','jim5','jim6','jim7','jim8','jim9', ...
@ -12,6 +12,8 @@ rot = cell(1,numel(seqNames));
rotg = cell(1,numel(seqNames)); rotg = cell(1,numel(seqNames));
rels_all = []; rels_all = [];
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} '.txt'], '%f, %f, %f, %f, %f, %f, %f, %f, %f, %f', 'headerlines', 1);
@ -54,7 +56,7 @@ for i = 1:numel(seqNames)
rotMeanErr(i,:) = mean(abs((rot{i}(:,:)-rotg{i}(:,:)))); rotMeanErr(i,:) = mean(abs((rot{i}(:,:)-rotg{i}(:,:))));
rotRMS(i,:) = sqrt(mean(((rot{i}(:,:)-rotg{i}(:,:))).^2)); rotRMS(i,:) = sqrt(mean(((rot{i}(:,:)-rotg{i}(:,:))).^2));
seq_ids = cat(1, seq_ids, repmat(seqNames(i), size(rot{i},1), 1));
end end
allRot = cell2mat(rot'); allRot = cell2mat(rot');
allRotg = cell2mat(rotg'); allRotg = cell2mat(rotg');

View file

@ -1,4 +1,4 @@
function [meanError, all_rot_preds, all_rot_gts, meanErrors, all_errors, rels_all] = calcBiwiError(resDir, gtDir) function [meanError, all_rot_preds, all_rot_gts, meanErrors, all_errors, rels_all, seq_ids] = calcBiwiError(resDir, gtDir)
seqNames = {'01','02','03','04','05','06','07','08','09', ... seqNames = {'01','02','03','04','05','06','07','08','09', ...
'10', '11','12','13','14','15','16','17','18','19', ... '10', '11','12','13','14','15','16','17','18','19', ...
@ -10,7 +10,8 @@ rot = cell(1,numel(seqNames));
rotg = cell(1,numel(seqNames)); rotg = cell(1,numel(seqNames));
rels_all = []; rels_all = [];
tic; seq_ids = {};
for i=1:numel(seqNames) for i=1:numel(seqNames)
posesGround = load ([gtDir '/' seqNames{i} '/groundTruthPose.txt']); posesGround = load ([gtDir '/' seqNames{i} '/groundTruthPose.txt']);
@ -49,6 +50,9 @@ for i=1:numel(seqNames)
rotMeanErr(i,:) = mean(abs((rot{i}(:,:)-rotg{i}(:,:)))); rotMeanErr(i,:) = mean(abs((rot{i}(:,:)-rotg{i}(:,:))));
rotRMS(i,:) = sqrt(mean(((rot{i}(:,:)-rotg{i}(:,:))).^2)); rotRMS(i,:) = sqrt(mean(((rot{i}(:,:)-rotg{i}(:,:))).^2));
seq_ids = cat(1, seq_ids, repmat(seqNames(i), size(rot{i},1), 1));
end end
%% %%
meanErrors = rotMeanErr; meanErrors = rotMeanErr;

View file

@ -1,4 +1,4 @@
function [meanError, all_rot_preds, all_rot_gts, meanErrors, all_errors, rels_all] = calcIctError(resDir, gtDir) function [meanError, all_rot_preds, all_rot_gts, meanErrors, all_errors, rels_all, seq_ids] = calcIctError(resDir, gtDir)
%CALCICTERROR Summary of this function goes here %CALCICTERROR Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
@ -13,6 +13,8 @@ function [meanError, all_rot_preds, all_rot_gts, meanErrors, all_errors, rels_al
rels_all = []; rels_all = [];
seq_ids = {};
for i = 1:numel(sequences) for i = 1:numel(sequences)
[~, name,~] = fileparts(sequences(i).name); [~, name,~] = fileparts(sequences(i).name);
@ -54,6 +56,8 @@ function [meanError, all_rot_preds, all_rot_gts, meanErrors, all_errors, rels_al
rotMeanErr(i,:) = mean(abs((rot{i}(:,:)-rotg{i}(:,:)))); rotMeanErr(i,:) = mean(abs((rot{i}(:,:)-rotg{i}(:,:))));
rotRMS(i,:) = sqrt(mean(((rot{i}(:,:)-rotg{i}(:,:))).^2)); rotRMS(i,:) = sqrt(mean(((rot{i}(:,:)-rotg{i}(:,:))).^2));
seq_ids = cat(1, seq_ids, repmat({[name 'ict']}, size(rot{i},1), 1));
end end
allRot = cell2mat(rot'); allRot = cell2mat(rot');
allRotg = cell2mat(rotg'); allRotg = cell2mat(rotg');