diff --git a/matlab_version/AU_training/data extraction/extract_features_BP4D.m b/matlab_version/AU_training/data extraction/extract_features_BP4D.m index 305b29b..28c3702 100644 --- a/matlab_version/AU_training/data extraction/extract_features_BP4D.m +++ b/matlab_version/AU_training/data extraction/extract_features_BP4D.m @@ -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 diff --git a/matlab_version/AU_training/data extraction/extract_features_Bosphorus.m b/matlab_version/AU_training/data extraction/extract_features_Bosphorus.m index 832feef..fcbbfd1 100644 --- a/matlab_version/AU_training/data extraction/extract_features_Bosphorus.m +++ b/matlab_version/AU_training/data extraction/extract_features_Bosphorus.m @@ -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 diff --git a/matlab_version/AU_training/data extraction/extract_features_CK.m b/matlab_version/AU_training/data extraction/extract_features_CK.m index a61d0fc..02bd06c 100644 --- a/matlab_version/AU_training/data extraction/extract_features_CK.m +++ b/matlab_version/AU_training/data extraction/extract_features_CK.m @@ -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); diff --git a/matlab_version/AU_training/data extraction/find_Bosphorus.m b/matlab_version/AU_training/data extraction/find_Bosphorus.m index 39c101e..86d6bbd 100644 --- a/matlab_version/AU_training/data extraction/find_Bosphorus.m +++ b/matlab_version/AU_training/data extraction/find_Bosphorus.m @@ -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