Adapting all the feature extraction code.

This commit is contained in:
Tadas Baltrusaitis 2018-02-08 19:44:51 +00:00
parent 8692b5f9a8
commit 89d9647a85
7 changed files with 56 additions and 134 deletions

View file

@ -14,7 +14,7 @@ Bosphorus_dir = [Bosphorus_dir, 'BosphorusDB/BosphorusDB/'];
bosph_dirs = dir([Bosphorus_dir, 'bs*']); bosph_dirs = dir([Bosphorus_dir, 'bs*']);
parfor f1=1:numel(bosph_dirs) parfor f1=1:numel(bosph_dirs)
command = executable; command = executable;
input_dir = [Bosphorus_dir, bosph_dirs(f1).name]; input_dir = [Bosphorus_dir, bosph_dirs(f1).name];

View file

@ -1,84 +1,34 @@
% Biwi dataset experiment % Biwi dataset experiment
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"'; if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
if(exist('D:/Databases/DISFA/', 'dir'))
DISFA_loc = 'D:/Databases/DISFA/';
elseif(exist('D:/Datasets/DISFA/', 'dir'))
DISFA_loc = 'D:/Datasets/DISFA/';
elseif(exist('E:/datasets/DISFA/', 'dir'))
DISFA_loc = 'E:/datasets/DISFA/';
elseif(exist('C:/tadas/DISFA', 'dir'))
DISFA_loc = 'C:/tadas/DISFA/';
elseif(exist('D:\datasets\face_datasets\DISFA/', 'dir'))
DISFA_loc = 'D:\datasets\face_datasets\DISFA/';
else else
fprintf('DISFA not found\n'); features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end end
output = [DISFA_loc, '/aligned_rigid/']; find_DISFA;
output_hog_root = [DISFA_loc '/hog_aligned_rigid/'];
output_params_root = [DISFA_loc '/model_params/'];
DISFA_loc_1 = [DISFA_loc, 'Videos_LeftCamera/']; output_dir = 'E:\datasets\face_datasets_processed\disfa';
DISFA_loc_2 = [DISFA_loc, 'Video_RightCamera/'];
if(~exist(output, 'dir')) DISFA_loc_1 = [DISFA_dir, 'Videos_LeftCamera/'];
mkdir(output); DISFA_loc_2 = [DISFA_dir, 'Video_RightCamera/'];
end
if(~exist(output_hog_root, 'dir'))
mkdir(output_hog_root);
end
if(~exist(output_params_root, 'dir'))
mkdir(output_params_root);
end
disfa_loc_1_files = dir([DISFA_loc_1, '/*.avi']); disfa_loc_1_files = dir([DISFA_loc_1, '/*.avi']);
disfa_loc_2_files = dir([DISFA_loc_2, '/*.avi']); disfa_loc_2_files = dir([DISFA_loc_2, '/*.avi']);
%% %%
tic;
parfor i=1:numel(disfa_loc_1_files) parfor i=1:numel(disfa_loc_1_files)
command = features_exe;
input_file = [DISFA_loc_1 disfa_loc_1_files(i).name]; input_file = [DISFA_loc_1 disfa_loc_1_files(i).name];
command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
[~,name,~] = fileparts(disfa_loc_1_files(i).name);
output_file = [output name '/'];
output_hog = [output_hog_root name '.hog'];
output_params = [output_params_root '/' 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 '"' ]);
command = cat(2, command, [' -of "' output_params '" -no2Dfp -no3Dfp -noAUs -noPose -noGaze -q']);
dos(command); dos(command);
end end
%% %%
parfor i=1:numel(disfa_loc_2_files) parfor i=1:numel(disfa_loc_2_files)
command = features_exe; input_file = [DISFA_loc_2 disfa_loc_1_files(i).name];
command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
input_file = [DISFA_loc_2 disfa_loc_2_files(i).name];
[~,name,~] = fileparts(disfa_loc_2_files(i).name);
output_file = [output name '/'];
output_hog = [output_hog_root name '.hog'];
output_params = [output_params_root '/' 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 '"']);
command = cat(2, command, [' -of "' output_params '" -no2Dfp -no3Dfp -noAUs -noPose -noGaze -q']);
dos(command);
end
timeTaken = toc; end

View file

@ -1,42 +1,33 @@
clear clear
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"';
fera_loc = 'D:\Datasets\fera\'; if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
else
features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end
out_loc = 'D:\Datasets\face_datasets\hog_aligned_rigid\'; find_FERA2011;
out_loc_params = 'D:\Datasets\face_datasets\model_params\';
output_dir = 'E:\datasets\face_datasets_processed\fera2011';
% Go two levels deep % Go two levels deep
fera_dirs = dir(fera_loc); fera_dirs = dir([FERA2011_dir, '/train*']);
fera_dirs = fera_dirs(3:end);
for f1=1:numel(fera_dirs) parfor f1=1:numel(fera_dirs)
fera_dirs_level_2 = dir([fera_loc, fera_dirs(f1).name]); fera_dirs_level_2 = dir([FERA2011_dir, fera_dirs(f1).name]);
fera_dirs_level_2 = fera_dirs_level_2(3:end); fera_dirs_level_2 = fera_dirs_level_2(3:end);
for f2=1:numel(fera_dirs_level_2) for f2=1:numel(fera_dirs_level_2)
vid_files = dir([fera_loc, fera_dirs(f1).name, '/', fera_dirs_level_2(f2).name, '/*.avi']); vid_files = dir([FERA2011_dir, fera_dirs(f1).name, '/', fera_dirs_level_2(f2).name, '/*.avi']);
parfor v=1:numel(vid_files) for v=1:numel(vid_files)
command = features_exe; input_file = [FERA2011_dir, fera_dirs(f1).name, '/', fera_dirs_level_2(f2).name, '/', vid_files(v).name];
curr_vid = [fera_loc, fera_dirs(f1).name, '/', fera_dirs_level_2(f2).name, '/', vid_files(v).name]; command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
[~,name,~] = fileparts(curr_vid);
output_file = [out_loc fera_dirs(f1).name '_' name '/'];
output_hog = [out_loc fera_dirs(f1).name '_' name '.hog'];
output_params = [out_loc_params fera_dirs(f1).name '_' name '.txt'];
command = cat(2, command, [' -rigid -f "' 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 -q']);
dos(command); dos(command);
end end

View file

@ -1,12 +1,16 @@
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"'; if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
else
features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end
find_SEMAINE; find_SEMAINE;
% Go two levels deep % Go two levels deep
semaine_dirs = train_recs; semaine_dirs = train_recs;
out_loc = [SEMAINE_dir, '../processed_data/train/']; output_dir = 'E:\datasets\face_datasets_processed\semaine';
parfor f1=1:numel(semaine_dirs) parfor f1=1:numel(semaine_dirs)
@ -18,21 +22,11 @@ parfor f1=1:numel(semaine_dirs)
for v=1:numel(vid_files) for v=1:numel(vid_files)
command = features_exe; input_file = [SEMAINE_dir, f1_dir, '/', vid_files(v).name];
curr_vid = [SEMAINE_dir, f1_dir, '/', vid_files(v).name]; command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
name = f1_dir;
output_file = [out_loc name '/'];
output_hog = [out_loc name '.hog'];
output_params = [out_loc name '.params.txt'];
command = cat(2, command, [' -rigid -f "' 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 -q']);
dos(command); dos(command);
end end
end end
end end
@ -51,19 +45,10 @@ parfor f1=1:numel(semaine_dirs)
for v=1:numel(vid_files) for v=1:numel(vid_files)
command = features_exe; input_file = [SEMAINE_dir, f1_dir, '/', vid_files(v).name];
curr_vid = [SEMAINE_dir, f1_dir, '/', vid_files(v).name]; command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
name = f1_dir;
output_file = [out_loc name '/'];
output_hog = [out_loc name '.hog'];
output_params = [out_loc name '.params.txt'];
command = cat(2, command, [' -rigid -f "' 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 -q']);
dos(command); dos(command);
end end

View file

@ -1,41 +1,35 @@
clear clear
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"'; if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
else
features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end
unbc_loc = 'D:\Datasets\UNBC\Images/'; find_UNBC;
UNBC_dir = [UNBC_dir, '/images/'];
out_loc = 'D:\Datasets\face_datasets/'; output_dir = 'E:\datasets\face_datasets_processed\unbc';
% Go two levels deep % Go two levels deep
unbc_dirs = dir(unbc_loc); unbc_dirs = dir(UNBC_dir);
unbc_dirs = unbc_dirs(3:end); unbc_dirs = unbc_dirs(3:end);
parfor f1=1:numel(unbc_dirs) parfor f1=1:numel(unbc_dirs)
unbc_dirs_level_2 = dir([unbc_loc, unbc_dirs(f1).name]); unbc_dirs_level_2 = dir([UNBC_dir, unbc_dirs(f1).name]);
unbc_dirs_level_2 = unbc_dirs_level_2(3:end); unbc_dirs_level_2 = unbc_dirs_level_2(3:end);
for f2=1:numel(unbc_dirs_level_2) for f2=1:numel(unbc_dirs_level_2)
if(~isdir([unbc_loc, unbc_dirs(f1).name, '/', unbc_dirs_level_2(f2).name])) if(~isdir([UNBC_dir, unbc_dirs(f1).name, '/', unbc_dirs_level_2(f2).name]))
continue; continue;
end end
command = features_exe; input_dir = [UNBC_dir, unbc_dirs(f1).name, '/', unbc_dirs_level_2(f2).name];
curr_vid = [unbc_loc, unbc_dirs(f1).name, '/', unbc_dirs_level_2(f2).name];
name = [unbc_dirs(f1).name, '_', unbc_dirs_level_2(f2).name]; name = [unbc_dirs(f1).name, '_', unbc_dirs_level_2(f2).name];
output_file = [out_loc, '/hog_aligned_rigid/', name '/']; command = sprintf('%s -fdir "%s" -out_dir "%s" -of %s -hogalign -pdmparams -verbose', features_exe, input_dir, output_dir, name );
output_hog = [out_loc, '/hog_aligned_rigid/', name '.hog'];
output_params = [out_loc, '/model_params/', name '.txt'];
command = cat(2, command, [' -rigid -asvid -fdir "' curr_vid '" -simalign "' output_file '" -simscale 0.7 -simsize 112 -g']);
command = cat(2, command, [' -hogalign "' output_hog '"']);
command = cat(2, command, [' -of "' output_params '" -no2Dfp -no3Dfp -noAUs -noPose -noGaze -q']);
dos(command); dos(command);
end end

View file

@ -1,6 +1,7 @@
if(exist('D:\Datasets\fera/au_training', 'file')) if(exist('D:\Datasets\fera/au_training', 'file'))
FERA2011_dir = 'D:\Datasets\fera/au_training/'; FERA2011_dir = 'D:\Datasets\fera/au_training/';
hog_data_dir = 'D:\Datasets\face_datasets\hog_aligned_rigid/'; elseif(exist('E:\Datasets\fera/au_training', 'file'))
FERA2011_dir = 'E:\Datasets\fera/au_training/';
else else
fprintf('FERA2011 location not found (or not defined)\n'); fprintf('FERA2011 location not found (or not defined)\n');
end end

View file

@ -1,6 +1,7 @@
if(exist('D:\Datasets\UNBC/', 'file')) if(exist('D:\Datasets\UNBC/', 'file'))
UNBC_dir = 'D:\Datasets\UNBC/'; UNBC_dir = 'E:\Datasets\UNBC/';
hog_data_dir = 'D:\Datasets\face_datasets\hog_aligned_rigid'; elseif(exist('E:\Datasets\UNBC/', 'file'))
UNBC_dir = 'E:\Datasets\UNBC/';
else else
fprintf('UNBC location not found (or not defined)\n'); fprintf('UNBC location not found (or not defined)\n');
end end