Adapting AU processing scripts with the new interface.

This commit is contained in:
Tadas Baltrusaitis 2018-02-07 20:37:43 +00:00
parent 3dc07457a6
commit fb0f59c7ab
4 changed files with 40 additions and 57 deletions

View File

@ -1,12 +1,15 @@
clear
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"';
if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
else
features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end
find_BP4D;
BP4D_dir = [BP4D_dir '\..\BP4D-training\'];
bp4d_dirs = train_recs;
out_loc = [BP4D_dir '\..\processed_data\train\'];
out_loc = 'E:\datasets\face_datasets_processed\bp4d\train';
parfor f1=1:numel(bp4d_dirs)
@ -20,19 +23,12 @@ parfor f1=1:numel(bp4d_dirs)
for f2=1:numel(bp4d_2_dirs)
f2_dir = bp4d_2_dirs(f2).name;
if(isdir([BP4D_dir, bp4d_dirs{f1}]))
command = features_exe;
curr_vid = [BP4D_dir, f1_dir, '/', f2_dir, '/'];
name = [f1_dir '_' f2_dir];
output_file = [out_loc name '/'];
output_hog = [out_loc name '.hog'];
output_params = [out_loc name '.params.txt'];
command = cat(2, command, [' -fx 2000 -fy 2000 -rigid -q -asvid -fdir "' curr_vid '" -simalign "' output_file '" -simscale 0.7 -simsize 112']);
command = cat(2, command, [' -hogalign "' output_hog '"']);
command = cat(2, command, [' -of "' output_params '" -no2Dfp -no3Dfp -noAUs -noPose -noGaze']);
command = sprintf('%s -fx 2000 -fy 2000 -fdir "%s" -out_dir "%s" -of %s -hogalign -pdmparams', features_exe, curr_vid, out_loc, name);
dos(command);
end
end
@ -40,7 +36,7 @@ parfor f1=1:numel(bp4d_dirs)
end
bp4d_dirs = devel_recs;
out_loc = [BP4D_dir '\..\processed_data\devel\'];
out_loc = 'E:\datasets\face_datasets_processed\bp4d\devel';
parfor f1=1:numel(bp4d_dirs)
if(isdir([BP4D_dir, bp4d_dirs{f1}]))
@ -53,20 +49,13 @@ parfor f1=1:numel(bp4d_dirs)
for f2=1:numel(bp4d_2_dirs)
f2_dir = bp4d_2_dirs(f2).name;
if(isdir([BP4D_dir, bp4d_dirs{f1}]))
command = features_exe;
curr_vid = [BP4D_dir, f1_dir, '/', f2_dir, '/'];
name = [f1_dir '_' f2_dir];
output_file = [out_loc name '/'];
output_hog = [out_loc name '.hog'];
output_params = [out_loc name '.params.txt'];
command = cat(2, command, [' -fx 2000 -fy 2000 -rigid -q -asvid -fdir "' curr_vid '" -simalign "' output_file '" -simscale 0.7 -simsize 112']);
command = cat(2, command, [' -hogalign "' output_hog '"']);
command = cat(2, command, [' -of "' output_params '" -no2Dfp -no3Dfp -noAUs -noPose -noGaze']);
command = sprintf('%s -fx 2000 -fy 2000 -fdir "%s" -out_dir "%s" -of %s -hogalign -pdmparams', features_exe, curr_vid, out_loc, name);
dos(command);
end
end
end

View File

@ -1,31 +1,29 @@
clear
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"';
if(isunix)
executable = '"..\..\../build/bin/FaceLandmarkImg"';
else
executable = '"..\..\../x64/Release/FaceLandmarkImg.exe"';
end
bosph_loc = 'D:\Datasets\Bosphorus\BosphorusDB\BosphorusDB/';
find_Bosphorus;
out_loc = 'D:\Datasets\face_datasets/';
out_loc = 'E:\datasets\face_datasets_processed/bosph';
Bosphorus_dir = [Bosphorus_dir, 'BosphorusDB/BosphorusDB/'];
% Go two levels deep
bosph_dirs = dir([bosph_loc, '/bs*']);
bosph_dirs = dir([Bosphorus_dir, 'bs*']);
for f1=1:numel(bosph_dirs)
parfor f1=1:numel(bosph_dirs)
name = [bosph_dirs(f1).name];
command = executable;
curr_vids = dir([bosph_loc, '/' name, '/*.png']);
input_dir = [Bosphorus_dir, bosph_dirs(f1).name];
command = cat(2, command, [' -fdir "' input_dir '" -out_dir "' out_loc '"']);
command = cat(2, command, ' -multi_view 1 -wild -pdmparams -hogalign');
parfor i=1:numel(curr_vids)
command = features_exe;
input_file = [bosph_loc, '/' name '/', curr_vids(i).name];
[~, curr_name, ~] = fileparts(curr_vids(i).name);
output_file = [out_loc, '/hog_aligned_rigid_b/', curr_name, '/'];
output_hog = [out_loc, '/hog_aligned_rigid_b/',curr_name '.hog'];
output_params = [out_loc, '/model_params_b/', curr_name '.txt'];
command = cat(2, command, [' -rigid -f "' input_file '" -simalign "' output_file '" -simscale 0.7 -simsize 112 ']);
command = cat(2, command, [' -hogalign "' output_hog '"' ' -of "' output_params ]);
command = cat(2, command, ['" -no2Dfp -no3Dfp -noAUs -noPose -noGaze -q ']);
if(isunix)
unix(command, '-echo')
else
dos(command);
end

View File

@ -1,10 +1,12 @@
clear
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"';
if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
else
features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end
ck_loc = 'E:\Datasets\ck+\cohn-kanade-images\';
ck_loc = 'D:\Datasets\ck+\cohn-kanade-images\';
out_loc = 'D:\datasets\face_datasets/hog_aligned_rigid\';
out_loc_params = 'D:\datasets\face_datasets/clm_params\';
out_loc = 'E:\datasets\face_datasets_processed/ck+';
% Go two levels deep
ck_dirs = dir(ck_loc);
@ -21,19 +23,11 @@ parfor f1=1:numel(ck_dirs)
continue;
end
command = features_exe;
curr_vid = [ck_loc, ck_dirs(f1).name, '/', ck_dirs_level_2(f2).name];
name = [ck_dirs(f1).name, '_', ck_dirs_level_2(f2).name];
output_file = [out_loc name '/'];
output_hog = [out_loc name '.hog'];
output_params = [out_loc_params name '.txt'];
command = cat(2, command, [' -rigid -asvid -fdir "' curr_vid '" -simalign "' output_file '" -simscale 0.7 -simsize 112 -g -q ']);
command = cat(2, command, [' -hogalign "' output_hog, '"' ]);
command = sprintf('%s -fdir "%s" -out_dir "%s" -of %s -hogalign -pdmparams', features_exe, curr_vid, out_loc, name);
dos(command);

View File

@ -1,5 +1,7 @@
if(exist('D:/Datasets/Bosphorus/', 'file'))
Bosphorus_dir = 'D:\Datasets\Bosphorus/';
elseif(exist('E:/datasets/Bosphorus/', 'file'))
Bosphorus_dir = 'E:\datasets\Bosphorus/';
else
fprintf('Bosphorus dataset location not found (or not defined)\n');
end