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

@ -1,61 +1,26 @@
% Biwi dataset experiment
features_exe = '"..\..\..\x64\Release\FeatureExtraction.exe"';
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/';
if(isunix)
features_exe = '"../../../build/bin/FeatureExtraction"';
else
fprintf('DISFA not found\n');
features_exe = '"../../../x64/Release/FeatureExtraction.exe"';
end
output = [DISFA_loc, '/aligned_rigid/'];
output_hog_root = [DISFA_loc '/hog_aligned_rigid/'];
output_params_root = [DISFA_loc '/model_params/'];
find_DISFA;
DISFA_loc_1 = [DISFA_loc, 'Videos_LeftCamera/'];
DISFA_loc_2 = [DISFA_loc, 'Video_RightCamera/'];
output_dir = 'E:\datasets\face_datasets_processed\disfa';
if(~exist(output, 'dir'))
mkdir(output);
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 = [DISFA_dir, 'Videos_LeftCamera/'];
DISFA_loc_2 = [DISFA_dir, 'Video_RightCamera/'];
disfa_loc_1_files = dir([DISFA_loc_1, '/*.avi']);
disfa_loc_2_files = dir([DISFA_loc_2, '/*.avi']);
%%
tic;
parfor i=1:numel(disfa_loc_1_files)
command = features_exe;
input_file = [DISFA_loc_1 disfa_loc_1_files(i).name];
[~,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']);
command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
dos(command);
end
@ -63,22 +28,7 @@ end
%%
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;

View file

@ -1,41 +1,32 @@
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\';
out_loc_params = 'D:\Datasets\face_datasets\model_params\';
find_FERA2011;
output_dir = 'E:\datasets\face_datasets_processed\fera2011';
% Go two levels deep
fera_dirs = dir(fera_loc);
fera_dirs = fera_dirs(3:end);
fera_dirs = dir([FERA2011_dir, '/train*']);
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);
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];
[~,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']);
command = sprintf('%s -f "%s" -out_dir "%s" -hogalign -pdmparams', features_exe, input_file, output_dir );
dos(command);

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;
% Go two levels deep
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)
@ -18,21 +22,11 @@ parfor f1=1:numel(semaine_dirs)
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);
end
end
end
@ -51,19 +45,10 @@ parfor f1=1:numel(semaine_dirs)
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);
end

View file

@ -1,40 +1,34 @@
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/';
out_loc = 'D:\Datasets\face_datasets/';
find_UNBC;
UNBC_dir = [UNBC_dir, '/images/'];
output_dir = 'E:\datasets\face_datasets_processed\unbc';
% Go two levels deep
unbc_dirs = dir(unbc_loc);
unbc_dirs = dir(UNBC_dir);
unbc_dirs = unbc_dirs(3:end);
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);
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;
end
command = features_exe;
curr_vid = [unbc_loc, unbc_dirs(f1).name, '/', unbc_dirs_level_2(f2).name];
input_dir = [UNBC_dir, 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 '/'];
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']);
command = sprintf('%s -fdir "%s" -out_dir "%s" -of %s -hogalign -pdmparams -verbose', features_exe, input_dir, output_dir, name );
dos(command);

View file

@ -1,6 +1,7 @@
if(exist('D:\Datasets\fera/au_training', 'file'))
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
fprintf('FERA2011 location not found (or not defined)\n');
end

View file

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