Adding sparse response map results on 300VW.

This commit is contained in:
Tadas Baltrusaitis
2017-08-11 11:04:36 -04:00
parent dfdf58d667
commit bfb9129b31
16 changed files with 132 additions and 36 deletions

View File

@@ -15,6 +15,8 @@ extra_dir = 'D:\Datasets\300VW_Dataset_2015_12_14\extra';
%% loading the patch experts and the PDM
[patches, pdm, clmParams, early_term_params] = Load_CECLM_general();
clmParams_orig = clmParams;
multi_view = true;
%% Select video
@@ -23,8 +25,11 @@ for i=1:numel(vid_locs)
vid = VideoReader(vid_locs{i});
bounding_boxes = bboxes{i};
preds = [];
n_frames = size(bounding_boxes,1);
preds = zeros(68,2,n_frames);
for f=1:n_frames
input_image = readFrame(vid);
@@ -50,6 +55,7 @@ for i=1:numel(vid_locs)
% have a multi-view version for initialization, otherwise use
% previous shape
if(reset && multi_view)
clmParams = clmParams_orig;
clmParams.window_size = [25,25; 23,23; 21,21; 21,21];
clmParams.numPatchIters = 4;
clmParams.startScale = 1;
@@ -61,21 +67,22 @@ for i=1:numel(vid_locs)
Fitting_from_bb_multi_hyp(input_image, [], bb, pdm, patches, clmParams, views, early_term_params);
else
clmParams = clmParams_orig;
clmParams.window_size = [23,23; 21,21; 19,19; 17,17];
clmParams.numPatchIters = 3;
clmParams.startScale = 2;
[shape,g_param,l_param,lhood,lmark_lhood,view_used] = Fitting_from_bb(input_image, [], bb, pdm, patches, clmParams, 'gparam', g_param, 'lparam', l_param);
end
preds = cat(3, preds, shape);
preds(:,:,f) = shape;
%% plot the result
imshow(input_image);
hold on;
plot(shape(:,1), shape(:,2), '.r');
% rectangle('Position', [bb(2), bb(1), bb(4), bb(3)]);
hold off;
drawnow expose
% imshow(input_image);
% hold on;
% plot(shape(:,1), shape(:,2), '.r');
% % rectangle('Position', [bb(2), bb(1), bb(4), bb(3)]);
% hold off;
% drawnow expose
end

View File

@@ -19,8 +19,9 @@ for i=1:numel(vid_locs)
vid = VideoReader(vid_locs{i});
bounding_boxes = bboxes{i};
preds = [];
n_frames = size(bounding_boxes,1);
preds = zeros(68,2,n_frames);
for f=1:n_frames
input_image = readFrame(vid);
@@ -63,7 +64,7 @@ for i=1:numel(vid_locs)
[shape,g_param,l_param,lhood,lmark_lhood,view_used] = Fitting_from_bb(input_image, [], bb, pdm, patches, clmParams, 'gparam', g_param, 'lparam', l_param);
end
preds = cat(3, preds, shape);
preds(:,:,f) = shape;
%% plot the result
imshow(input_image);

View File

@@ -0,0 +1,36 @@
function [ vid_locs, bboxes, gts_all, invalid_frames ] = CollectTrainData( db_root, bb_root, extra_dir )
%COLLECTTESTDATA Summary of this function goes here
% Detailed explanation goes here
% all_train = [1,2,3,4,7,9,10,11,13,15,16,17,18,19,20,22,25,27,28,29,31,33,34,35,37,39,41,43,44,46,47,48,49,53,57,59,112,113,115,119,120,123,138,143,144,160,204,205,223,225];
all_train = [1,2,3,4,7,9,10,11,13,15,16,17,18,19,20,22,25,27,29,31,33,34,35,37,39,41,43,44,46,47,48,49,53,57,59,112,113,115,119,120,123,138,143,144,160,204,205,223,225];
vid_locs = cell(numel(all_train),1);
bboxes = cell(numel(all_train),1);
gts_all = cell(numel(all_train),1);
invalid_frames = cell(numel(all_train),1);
for i=1:numel(all_train)
id = sprintf('%03d', all_train(i));
vid_locs{i} = [db_root '/', id, '/vid.avi'];
bboxes{i} = dlmread([bb_root, id, '_dets.txt'], ',');
%% Grab the ground truth
fps_all = dir([db_root, '/', id, '/annot/*.pts']);
gt_landmarks = zeros([68, 2, size(fps_all)]);
for k = 1:size(fps_all)
gt_landmarks_frame = dlmread([db_root, '/', id, '/annot/', fps_all(k).name], ' ', 'A4..B71');
gt_landmarks(:,:,k) = gt_landmarks_frame;
end
% Remove unreliable frames
if(exist([extra_dir, '/', num2str(all_train(i)), '.mat'], 'file'))
inv_frames = load([extra_dir, '/', num2str(all_train(i)), '.mat']);
gt_landmarks(:,:,int32(inv_frames.error)) = [];
invalid_frames{i} = inv_frames.error;
end
gts_all{i} = gt_landmarks;
end
end

View File

@@ -14,8 +14,8 @@ line_width = 6;
hold on;
load('results/ceclm_errors.mat');
[error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_1);
plot(error_x, error_y, 'r', 'DisplayName', 'CE-CLM', 'LineWidth',line_width);
% [error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_1);
% plot(error_x, error_y, 'r', 'DisplayName', 'CE-CLM', 'LineWidth',line_width);
load('results/cfss_errors.mat');
[error_x, error_y] = cummErrorCurve(cfss_error_49_cat_1);
@@ -28,10 +28,10 @@ plot(error_x, error_y, 'DisplayName', 'CLNF', 'LineWidth',line_width);
load('results/cfan_errors.mat');
[error_x, error_y] = cummErrorCurve(cfan_error_49_cat_1);
plot(error_x, error_y, 'DisplayName', 'CFAN', 'LineWidth',line_width);
load('results/iccr_errors.mat');
[error_x, error_y] = cummErrorCurve(iccr_error_49_cat_1);
plot(error_x, error_y, 'DisplayName', 'iCCR', 'LineWidth',line_width);
%
% load('results/iccr_errors.mat');
% [error_x, error_y] = cummErrorCurve(iccr_error_49_cat_1);
% plot(error_x, error_y, 'DisplayName', 'iCCR', 'LineWidth',line_width);
load('results/drmf_errors.mat');
[error_x, error_y] = cummErrorCurve(drmf_error_49_cat_1);
@@ -52,7 +52,7 @@ ax.FontSize = 50;
% Make sure CE-CLM is drawn on top
[error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_1);
plot(error_x, error_y, 'r', 'LineWidth',line_width);
plot(error_x, error_y, 'r', 'LineWidth',line_width, 'DisplayName', 'CE-CLM');
print -dpdf results/300VWres_49_cat1.pdf
@@ -73,8 +73,8 @@ line_width = 6;
hold on;
load('results/ceclm_errors.mat');
[error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_2);
plot(error_x, error_y, 'r', 'DisplayName', 'CE-CLM', 'LineWidth',line_width);
% [error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_2);
% plot(error_x, error_y, 'r', 'DisplayName', 'CE-CLM', 'LineWidth',line_width);
load('results/cfss_errors.mat');
[error_x, error_y] = cummErrorCurve(cfss_error_49_cat_2);
@@ -88,9 +88,9 @@ load('results/cfan_errors.mat');
[error_x, error_y] = cummErrorCurve(cfan_error_49_cat_2);
plot(error_x, error_y, 'DisplayName', 'CFAN', 'LineWidth',line_width);
load('results/iccr_errors.mat');
[error_x, error_y] = cummErrorCurve(iccr_error_49_cat_2);
plot(error_x, error_y, 'DisplayName', 'iCCR', 'LineWidth',line_width);
% load('results/iccr_errors.mat');
% [error_x, error_y] = cummErrorCurve(iccr_error_49_cat_2);
% plot(error_x, error_y, 'DisplayName', 'iCCR', 'LineWidth',line_width);
load('results/drmf_errors.mat');
[error_x, error_y] = cummErrorCurve(drmf_error_49_cat_2);
@@ -111,7 +111,7 @@ ax.FontSize = 50;
% Make sure CE-CLM is drawn on top
[error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_2);
plot(error_x, error_y, 'r', 'LineWidth',line_width);
plot(error_x, error_y, 'r', 'LineWidth',line_width, 'DisplayName', 'CE-CLM');
print -dpdf results/300VWres_49_cat2.pdf
@@ -130,10 +130,10 @@ axes1 = axes('Parent',figure1,'FontSize',40,'FontName','Helvetica');
line_width = 6;
hold on;
%
load('results/ceclm_errors.mat');
[error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_3);
plot(error_x, error_y, 'r', 'DisplayName', 'CE-CLM', 'LineWidth',line_width);
% [error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_3);
% plot(error_x, error_y, 'r', 'DisplayName', 'CE-CLM', 'LineWidth',line_width);
load('results/cfss_errors.mat');
[error_x, error_y] = cummErrorCurve(cfss_error_49_cat_3);
@@ -147,9 +147,9 @@ load('results/cfan_errors.mat');
[error_x, error_y] = cummErrorCurve(cfan_error_49_cat_3);
plot(error_x, error_y, 'DisplayName', 'CFAN', 'LineWidth',line_width);
load('results/iccr_errors.mat');
[error_x, error_y] = cummErrorCurve(iccr_error_49_cat_3);
plot(error_x, error_y, 'DisplayName', 'iCCR', 'LineWidth',line_width);
% load('results/iccr_errors.mat');
% [error_x, error_y] = cummErrorCurve(iccr_error_49_cat_3);
% plot(error_x, error_y, 'DisplayName', 'iCCR', 'LineWidth',line_width);
load('results/drmf_errors.mat');
[error_x, error_y] = cummErrorCurve(drmf_error_49_cat_3);
@@ -170,6 +170,6 @@ ax.FontSize = 50;
% Make sure CE-CLM is drawn on top
[error_x, error_y] = cummErrorCurve(ceclm_error_49_cat_3);
plot(error_x, error_y, 'r', 'LineWidth',line_width);
plot(error_x, error_y, 'r', 'LineWidth',line_width, 'DisplayName', 'CE-CLM');
print -dpdf results/300VWres_49_cat3.pdf

View File

@@ -1,3 +1,4 @@
clear
scrsz = get(0,'ScreenSize');

View File

@@ -13,7 +13,7 @@ labels = zeros(68,2,0);
% Load results
for i=cat_1
load(['CECLM_res_general_no_4/', num2str(i)]);
load(['CECLM_res_general/', num2str(i)]);
ceclm_preds = cat(3, ceclm_preds, preds);
labels = cat(3, labels, gt_landmarks);
@@ -40,7 +40,7 @@ labels = zeros(68,2,0);
% Load results
for i=cat_2
load(['CECLM_res_general_no_4/', num2str(i)]);
load(['CECLM_res_general/', num2str(i)]);
ceclm_preds = cat(3, ceclm_preds, preds);
labels = cat(3, labels, gt_landmarks);
@@ -66,7 +66,7 @@ labels = zeros(68,2,0);
% Load results
for i=cat_3
load(['CECLM_res_general_no_4/', num2str(i)]);
load(['CECLM_res_general/', num2str(i)]);
ceclm_preds = cat(3, ceclm_preds, preds);
labels = cat(3, labels, gt_landmarks);
@@ -86,7 +86,7 @@ ceclm_error_49_cat_3 = compute_error(labels, ceclm_preds);
ceclm_error_49_cat_3_auc = auc(ceclm_error_49_cat_3);
%% Save the results
save('results/ceclm_errors_no_4', 'ceclm_error_66_cat_1', 'ceclm_error_66_cat_2', 'ceclm_error_66_cat_3',...
save('results/ceclm_errors', 'ceclm_error_66_cat_1', 'ceclm_error_66_cat_2', 'ceclm_error_66_cat_3',...
'ceclm_error_49_cat_1', 'ceclm_error_49_cat_2', 'ceclm_error_49_cat_3',...
'ceclm_error_66_cat_1_auc', 'ceclm_error_66_cat_2_auc', 'ceclm_error_66_cat_3_auc',...
'ceclm_error_49_cat_1_auc', 'ceclm_error_49_cat_2_auc', 'ceclm_error_49_cat_3_auc');

View File

@@ -0,0 +1,37 @@
clear;
addpath(genpath('../'));
%% select database and load bb initializations
db_root = 'D:\Datasets\300VW_Dataset_2015_12_14\300VW_Dataset_2015_12_14/';
bb_root = 'C:\Users\tbaltrus\Documents\MTCNN_face_detection\code\codes\MTCNNv2/300VW_dets/';
extra_dir = 'D:\Datasets\300VW_Dataset_2015_12_14\extra';
[ vid_locs, bboxes_mtcnn, gts_all, invalid_frames ] = CollectTestData(db_root, bb_root, extra_dir);
bb_root = '../..//matlab_runners/Feature Point Experiments/300VW_face_dets/';
[ vid_locs, bboxes_hog, gts_all, invalid_frames ] = CollectTestData(db_root, bb_root, extra_dir);
%% Select video
for i=1:numel(vid_locs)
vid = VideoReader(vid_locs{i});
bounding_boxes_hog = bboxes_hog{i};
bounding_boxes_mtcnn = bboxes_mtcnn{i};
n_frames = size(bounding_boxes_hog,1);
for f=1:n_frames
input_image = readFrame(vid);
%% plot the result
imshow(input_image);
hold on;
bbox_hog = bounding_boxes_hog(f,:);
bbox_mtcnn = bounding_boxes_mtcnn(f,:);
rectangle('Position', bbox_hog, 'EdgeColor', 'r');
rectangle('Position', bbox_mtcnn, 'EdgeColor', 'g');
hold off;
drawnow expose
end
end

View File

@@ -0,0 +1,14 @@
function [ auc_out ] = auc( error_vec )
%AUC Summary of this function goes here
% Detailed explanation goes here
cutoff = 0.08;
[x,y] = cummErrorCurve(error_vec);
all_xs = x(x < cutoff);
all_ys = y(1:numel(all_xs));
auc_out = sum(all_ys) / numel(all_ys);
end

View File

@@ -8,4 +8,4 @@ DRMF 3.33 3.55 5.27
PO-CR 2.95 3.08 3.68
CFAN 3.17 3.72 4.94
------------------------------
CE-CLM 2.44 2.70 3.19
CE-CLM 2.44 2.71 3.20