DISFA adaptation.
This commit is contained in:
parent
7dfb247b53
commit
4da2d185c9
46 changed files with 50 additions and 36 deletions
|
@ -23,7 +23,7 @@ function [geom_data, valid_ids] = Read_geom_files(users, hog_data_dir)
|
|||
if(i == 1)
|
||||
tab = readtable(geom_file);
|
||||
column_names = tab.Properties.VariableNames;
|
||||
valid_ind = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'valid'));
|
||||
valid_ind = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'success'));
|
||||
shape_inds = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'p_'));
|
||||
end
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function [geom_data, valid_ids] = Read_geom_files_dynamic(users, hog_data_dir)
|
|||
if(i == 1)
|
||||
tab = readtable(geom_file);
|
||||
column_names = tab.Properties.VariableNames;
|
||||
valid_ind = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'valid'));
|
||||
valid_ind = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'success'));
|
||||
shape_inds = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'p_'));
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,13 +1,11 @@
|
|||
function [data_train, labels_train, data_test, labels_test, raw_test, PC, means_norm, stds_norm, vid_ids_test, success_test] = ...
|
||||
Prepare_HOG_AU_data_generic(train_users, test_users, au_train, rest_aus, hog_data_dir)
|
||||
Prepare_HOG_AU_data_generic(train_users, test_users, au_train, rest_aus, root, features_dir)
|
||||
|
||||
%% This should be a separate function?
|
||||
|
||||
input_train_label_files = cell(numel(train_users),1);
|
||||
input_test_label_files = cell(numel(test_users),1);
|
||||
|
||||
root = [hog_data_dir, '/../'];
|
||||
|
||||
% This is for loading the labels
|
||||
for i=1:numel(train_users)
|
||||
input_train_label_files{i} = [root, '/ActionUnit_Labels/', train_users{i}, '/', train_users{i}];
|
||||
|
@ -19,12 +17,12 @@ for i=1:numel(test_users)
|
|||
end
|
||||
|
||||
% First extracting the labels
|
||||
[train_geom_data] = Read_geom_files(train_users, hog_data_dir);
|
||||
[test_geom_data] = Read_geom_files(test_users, hog_data_dir);
|
||||
[train_geom_data] = Read_geom_files(train_users, features_dir);
|
||||
[test_geom_data] = Read_geom_files(test_users, features_dir);
|
||||
|
||||
% Reading in the HOG data
|
||||
[train_data, tracked_inds_hog, vid_ids_train] = Read_HOG_files(train_users, hog_data_dir);
|
||||
[test_data, success_test, vid_ids_test] = Read_HOG_files(test_users, hog_data_dir);
|
||||
[train_data, tracked_inds_hog, vid_ids_train] = Read_HOG_files(train_users, features_dir);
|
||||
[test_data, success_test, vid_ids_test] = Read_HOG_files(test_users, features_dir);
|
||||
|
||||
train_data = cat(2, train_data, train_geom_data);
|
||||
raw_test = cat(2, test_data, test_geom_data);
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
function [data_train, labels_train, data_test, labels_test, raw_test, PC, means_norm, stds_norm, vid_ids_test, success_test] = ...
|
||||
Prepare_HOG_AU_data_generic_dynamic(train_users, test_users, au_train, rest_aus, hog_data_dir)
|
||||
Prepare_HOG_AU_data_generic_dynamic(train_users, test_users, au_train, rest_aus, root, features_dir)
|
||||
|
||||
%% This should be a separate function?
|
||||
|
||||
input_train_label_files = cell(numel(train_users),1);
|
||||
input_test_label_files = cell(numel(test_users),1);
|
||||
|
||||
root = [hog_data_dir, '/../'];
|
||||
|
||||
% This is for loading the labels
|
||||
for i=1:numel(train_users)
|
||||
input_train_label_files{i} = [root, '/ActionUnit_Labels/', train_users{i}, '/', train_users{i}];
|
||||
|
@ -19,12 +17,12 @@ for i=1:numel(test_users)
|
|||
end
|
||||
|
||||
% First extracting the labels
|
||||
[train_geom_data] = Read_geom_files_dynamic(train_users, hog_data_dir);
|
||||
[test_geom_data] = Read_geom_files_dynamic(test_users, hog_data_dir);
|
||||
[train_geom_data] = Read_geom_files_dynamic(train_users, features_dir);
|
||||
[test_geom_data] = Read_geom_files_dynamic(test_users, features_dir);
|
||||
|
||||
% Reading in the HOG data
|
||||
[train_data, tracked_inds_hog, vid_ids_train] = Read_HOG_files_dynamic(train_users, hog_data_dir);
|
||||
[test_data, success_test, vid_ids_test] = Read_HOG_files_dynamic(test_users, hog_data_dir);
|
||||
[train_data, tracked_inds_hog, vid_ids_train] = Read_HOG_files_dynamic(train_users, features_dir);
|
||||
[test_data, success_test, vid_ids_test] = Read_HOG_files_dynamic(test_users, features_dir);
|
||||
|
||||
train_data = cat(2, train_data, train_geom_data);
|
||||
raw_test = cat(2, test_data, test_geom_data);
|
||||
|
|
|
@ -6,14 +6,23 @@ function [geom_data] = Read_geom_files(users, hog_data_dir)
|
|||
|
||||
for i=1:numel(users)
|
||||
|
||||
geom_file = [hog_data_dir, '/../model_params/LeftVideo' users{i} '_comp.txt'];
|
||||
geom_file = [hog_data_dir, 'LeftVideo' users{i} '_comp.csv'];
|
||||
|
||||
res = dlmread(geom_file, ',', 1, 0);
|
||||
valid = logical(res(:,4));
|
||||
|
||||
%res_rot = res(:,6:8);
|
||||
|
||||
res = res(:,11:end);
|
||||
if(i == 1)
|
||||
tab = readtable(geom_file);
|
||||
column_names = tab.Properties.VariableNames;
|
||||
valid_ind = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'success'));
|
||||
shape_inds = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'p_'));
|
||||
end
|
||||
|
||||
res = dlmread(geom_file, ',', 1, 0);
|
||||
|
||||
% Check the confidence of detection
|
||||
valid = logical(res(:, valid_ind));
|
||||
res = res(:, shape_inds);
|
||||
|
||||
% Do not consider global parameters
|
||||
res = res(:, 7:end);
|
||||
|
||||
actual_locs = res * V';
|
||||
res = cat(2, actual_locs, res);
|
||||
|
|
|
@ -6,15 +6,24 @@ function [geom_data] = Read_geom_files_dynamic(users, hog_data_dir)
|
|||
|
||||
for i=1:numel(users)
|
||||
|
||||
geom_file = [hog_data_dir, '/../model_params/LeftVideo' users{i} '_comp.txt'];
|
||||
|
||||
res = dlmread(geom_file, ',', 1, 0);
|
||||
valid = logical(res(:,4));
|
||||
|
||||
%res_rot = res(:,6:8);
|
||||
|
||||
res = res(:,11:end);
|
||||
geom_file = [hog_data_dir, 'LeftVideo' users{i} '_comp.csv'];
|
||||
|
||||
if(i == 1)
|
||||
tab = readtable(geom_file);
|
||||
column_names = tab.Properties.VariableNames;
|
||||
valid_ind = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'success'));
|
||||
shape_inds = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'p_'));
|
||||
end
|
||||
|
||||
res = dlmread(geom_file, ',', 1, 0);
|
||||
|
||||
% Check the confidence of detection
|
||||
valid = logical(res(:, valid_ind));
|
||||
res = res(:, shape_inds);
|
||||
|
||||
% Do not consider global parameters
|
||||
res = res(:, 7:end);
|
||||
|
||||
actual_locs = res * V';
|
||||
res = cat(2, actual_locs, res);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ for a=1:numel(aus)
|
|||
[users_train, users_valid] = get_balanced_fold(DISFA_dir, users, au, 1/3, 1);
|
||||
|
||||
% need to split the rest
|
||||
[train_samples, train_labels, valid_samples, valid_labels, ~, PC, means, scaling, valid_ids, valid_success] = Prepare_HOG_AU_data_generic_dynamic(users_train, users_valid, au, rest_aus, hog_data_dir);
|
||||
[train_samples, train_labels, valid_samples, valid_labels, ~, PC, means, scaling, valid_ids, valid_success] = Prepare_HOG_AU_data_generic_dynamic(users_train, users_valid, au, rest_aus, DISFA_dir, hog_data_dir);
|
||||
|
||||
train_labels(train_labels > 1) = 1;
|
||||
valid_labels(valid_labels > 1) = 1;
|
||||
|
|
|
@ -30,7 +30,7 @@ for a=1:numel(aus)
|
|||
[users_train, users_valid] = get_balanced_fold(DISFA_dir, users, au, 1/3, 1);
|
||||
|
||||
% need to split the rest
|
||||
[train_samples, train_labels, valid_samples, valid_labels, ~, PC, means, scaling, valid_ids, valid_success] = Prepare_HOG_AU_data_generic(users_train, users_valid, au, rest_aus, hog_data_dir);
|
||||
[train_samples, train_labels, valid_samples, valid_labels, ~, PC, means, scaling, valid_ids, valid_success] = Prepare_HOG_AU_data_generic(users_train, users_valid, au, rest_aus, DISFA_dir, hog_data_dir);
|
||||
|
||||
train_labels(train_labels > 1) = 1;
|
||||
valid_labels(valid_labels > 1) = 1;
|
||||
|
|
|
@ -36,7 +36,7 @@ for a=1:numel(aus)
|
|||
rest_aus = setdiff(all_aus, au);
|
||||
|
||||
% load the training and testing data for the current fold
|
||||
[~, ~, test_samples, test_labels, ~, ~, ~, ~, test_ids, test_success] = Prepare_HOG_AU_data_generic_dynamic({}, test_folds{t}, au, rest_aus, hog_data_dir);
|
||||
[~, ~, test_samples, test_labels, ~, ~, ~, ~, test_ids, test_success] = Prepare_HOG_AU_data_generic_dynamic({}, test_folds{t}, au, rest_aus, DISFA_dir, hog_data_dir);
|
||||
|
||||
% create the training and validation data
|
||||
users_train = setdiff(users, unique(test_ids));
|
||||
|
@ -44,7 +44,7 @@ for a=1:numel(aus)
|
|||
[users_train, users_valid] = get_balanced_fold(DISFA_dir, users_train, au, 1/4, 1);
|
||||
|
||||
% need to split the rest
|
||||
[train_samples, train_labels, valid_samples, valid_labels, ~, PC, means, scaling, valid_ids, valid_success] = Prepare_HOG_AU_data_generic_dynamic(users_train, users_valid, au, rest_aus, hog_data_dir);
|
||||
[train_samples, train_labels, valid_samples, valid_labels, ~, PC, means, scaling, valid_ids, valid_success] = Prepare_HOG_AU_data_generic_dynamic(users_train, users_valid, au, rest_aus, DISFA_dir, hog_data_dir);
|
||||
|
||||
train_samples = sparse(train_samples);
|
||||
valid_samples = sparse(valid_samples);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -24,7 +24,7 @@ else
|
|||
fprintf('DISFA location not found (or not defined)\n');
|
||||
end
|
||||
|
||||
hog_data_dir = [DISFA_dir, '/hog_aligned_rigid/'];
|
||||
hog_data_dir = 'E:\datasets\face_datasets_processed\disfa/';
|
||||
|
||||
users = {'SN001';
|
||||
'SN002';
|
||||
|
|
Loading…
Reference in a new issue