From 681e6b9b584106181b69e6863c6579c99c390659 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 24 Nov 2017 07:47:50 +0000 Subject: [PATCH] Work on image experiments using the new interface. --- .../Feature Point Experiments/Run_OF_on_images.m | 12 ++++++++++-- .../run_OpenFace_feature_point_tests_300W.m | 16 ---------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/matlab_runners/Feature Point Experiments/Run_OF_on_images.m b/matlab_runners/Feature Point Experiments/Run_OF_on_images.m index 939fe1d..a187839 100644 --- a/matlab_runners/Feature Point Experiments/Run_OF_on_images.m +++ b/matlab_runners/Feature Point Experiments/Run_OF_on_images.m @@ -49,7 +49,7 @@ command = sprintf("%s -mloc %s -multi_view %s -2Dfp -tracked ", executable, mode % TODO just landmarks + BBoxes tic -for i=1:numel(dataset_dirs) +parfor i=1:numel(dataset_dirs) command_c = sprintf('%s -fdir "%s" -bboxdir "%s" -out_dir "%s" -wild ',... command, dataset_dirs{i}, dataset_dirs{i}, output_loc); @@ -83,6 +83,12 @@ shapes = zeros(68,2,num_imgs); curr = 0; +% work out which columns in the csv file are relevant +tab = readtable([landmark_det_dir, landmark_dets(1).name]); +column_names = tab.Properties.VariableNames; +landmark_inds_x = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'x_')); +landmark_inds_y = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'y_')); + for i=1:numel(dirs) @@ -94,7 +100,9 @@ for i=1:numel(dirs) gt_landmarks = dlmread([dirs{i}, gt_labels(g).name], ' ', 'A4..B71'); % find the corresponding detection - landmark_det = dlmread([landmark_det_dir, gt_labels(g).name], ' ', 'A4..B71'); + all_params = dlmread([landmark_det_dir, landmark_dets(g).name], ',', 1, 0); + + landmark_det = [all_params(landmark_inds_x); all_params(landmark_inds_y)]'; labels(:,:,curr) = gt_landmarks; diff --git a/matlab_runners/Feature Point Experiments/run_OpenFace_feature_point_tests_300W.m b/matlab_runners/Feature Point Experiments/run_OpenFace_feature_point_tests_300W.m index b997f55..5a36baa 100644 --- a/matlab_runners/Feature Point Experiments/run_OpenFace_feature_point_tests_300W.m +++ b/matlab_runners/Feature Point Experiments/run_OpenFace_feature_point_tests_300W.m @@ -15,34 +15,18 @@ end %% Run using CLNF in the wild model out_clnf = [curr_dir '/out_wild_clnf_wild/']; -if(~exist(out_clnf, 'file')) - mkdir(out_clnf); -end - [err_clnf_wild, err_no_out_clnf_wild] = Run_OF_on_images(out_clnf, database_root, 'use_afw', 'use_lfpw', 'use_ibug', 'use_helen', 'verbose', 'model', 'model/main_clnf_wild.txt', 'multi_view', 1); %% Run using SVR model out_svr = [curr_dir '/out_wild_svr_wild/']; -if(~exist(out_svr, 'file')) - mkdir(out_svr); -end - [err_svr_wild, err_no_out_svr_wild] = Run_OF_on_images(out_svr, database_root, 'use_afw', 'use_lfpw', 'use_ibug', 'use_helen', 'verbose', 'model', 'model/main_clm_wild.txt', 'multi_view', 1); %% Run using general CLNF model out_clnf = [curr_dir '/out_wild_clnf/']; -if(~exist(out_clnf, 'file')) - mkdir(out_clnf); -end - [err_clnf, err_no_out_clnf] = Run_OF_on_images(out_clnf, database_root, 'use_afw', 'use_lfpw', 'use_ibug', 'use_helen', 'verbose', 'model', 'model/main_clnf_general.txt', 'multi_view', 1); %% Run using SVR model out_svr = [curr_dir '/out_wild_svr/']; -if(~exist(out_svr, 'file')) - mkdir(out_svr); -end - [err_svr, err_no_out_svr] = Run_OF_on_images(out_svr, database_root, 'use_afw', 'use_lfpw', 'use_ibug', 'use_helen', 'verbose', 'model', 'model/main_clm_general.txt', 'multi_view', 1); %%