diff --git a/matlab_version/experiments_300VW/CECLM_300VW_general.m b/matlab_version/experiments_300VW/CECLM_300VW_general.m index 465cd851..b34b1090 100644 --- a/matlab_version/experiments_300VW/CECLM_300VW_general.m +++ b/matlab_version/experiments_300VW/CECLM_300VW_general.m @@ -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 diff --git a/matlab_version/experiments_300VW/CECLM_300VW_menpo.m b/matlab_version/experiments_300VW/CECLM_300VW_menpo.m index 8cd45b05..abd48fb6 100644 --- a/matlab_version/experiments_300VW/CECLM_300VW_menpo.m +++ b/matlab_version/experiments_300VW/CECLM_300VW_menpo.m @@ -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); diff --git a/matlab_version/experiments_300VW/CollectTrainData.m b/matlab_version/experiments_300VW/CollectTrainData.m new file mode 100644 index 00000000..6c69b239 --- /dev/null +++ b/matlab_version/experiments_300VW/CollectTrainData.m @@ -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 + diff --git a/matlab_version/experiments_300VW/Display_300VW_results_49.m b/matlab_version/experiments_300VW/Display_300VW_results_49.m index 518a5ba5..3527e147 100644 --- a/matlab_version/experiments_300VW/Display_300VW_results_49.m +++ b/matlab_version/experiments_300VW/Display_300VW_results_49.m @@ -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 diff --git a/matlab_version/experiments_300VW/Display_300VW_results_66.m b/matlab_version/experiments_300VW/Display_300VW_results_66.m index aa246d56..44160457 100644 --- a/matlab_version/experiments_300VW/Display_300VW_results_66.m +++ b/matlab_version/experiments_300VW/Display_300VW_results_66.m @@ -1,3 +1,4 @@ + clear scrsz = get(0,'ScreenSize'); diff --git a/matlab_version/experiments_300VW/Generate_ceclm_results.m b/matlab_version/experiments_300VW/Generate_ceclm_results.m index f04f712a..a80f2ec6 100644 --- a/matlab_version/experiments_300VW/Generate_ceclm_results.m +++ b/matlab_version/experiments_300VW/Generate_ceclm_results.m @@ -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'); diff --git a/matlab_version/experiments_300VW/Visualize_bboxes.m b/matlab_version/experiments_300VW/Visualize_bboxes.m new file mode 100644 index 00000000..d9cd4373 --- /dev/null +++ b/matlab_version/experiments_300VW/Visualize_bboxes.m @@ -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 \ No newline at end of file diff --git a/matlab_version/experiments_300VW/auc.m b/matlab_version/experiments_300VW/auc.m new file mode 100644 index 00000000..6cd9cf3e --- /dev/null +++ b/matlab_version/experiments_300VW/auc.m @@ -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 + diff --git a/matlab_version/experiments_300VW/results/300VW_49.txt b/matlab_version/experiments_300VW/results/300VW_49.txt index 1b853a37..9e488df7 100644 --- a/matlab_version/experiments_300VW/results/300VW_49.txt +++ b/matlab_version/experiments_300VW/results/300VW_49.txt @@ -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 diff --git a/matlab_version/experiments_300VW/results/300VWres_49_cat1.pdf b/matlab_version/experiments_300VW/results/300VWres_49_cat1.pdf index df802c3d..0f2f9b3b 100644 Binary files a/matlab_version/experiments_300VW/results/300VWres_49_cat1.pdf and b/matlab_version/experiments_300VW/results/300VWres_49_cat1.pdf differ diff --git a/matlab_version/experiments_300VW/results/300VWres_49_cat2.pdf b/matlab_version/experiments_300VW/results/300VWres_49_cat2.pdf index 07c72965..2ff336a4 100644 Binary files a/matlab_version/experiments_300VW/results/300VWres_49_cat2.pdf and b/matlab_version/experiments_300VW/results/300VWres_49_cat2.pdf differ diff --git a/matlab_version/experiments_300VW/results/300VWres_49_cat3.pdf b/matlab_version/experiments_300VW/results/300VWres_49_cat3.pdf index f6611d71..9fcf865e 100644 Binary files a/matlab_version/experiments_300VW/results/300VWres_49_cat3.pdf and b/matlab_version/experiments_300VW/results/300VWres_49_cat3.pdf differ diff --git a/matlab_version/experiments_300VW/results/300VWres_66_cat1.pdf b/matlab_version/experiments_300VW/results/300VWres_66_cat1.pdf index b2abdb5b..0fd158af 100644 Binary files a/matlab_version/experiments_300VW/results/300VWres_66_cat1.pdf and b/matlab_version/experiments_300VW/results/300VWres_66_cat1.pdf differ diff --git a/matlab_version/experiments_300VW/results/300VWres_66_cat2.pdf b/matlab_version/experiments_300VW/results/300VWres_66_cat2.pdf index 01ca31ad..93831406 100644 Binary files a/matlab_version/experiments_300VW/results/300VWres_66_cat2.pdf and b/matlab_version/experiments_300VW/results/300VWres_66_cat2.pdf differ diff --git a/matlab_version/experiments_300VW/results/300VWres_66_cat3.pdf b/matlab_version/experiments_300VW/results/300VWres_66_cat3.pdf index 3293984c..ad6036f1 100644 Binary files a/matlab_version/experiments_300VW/results/300VWres_66_cat3.pdf and b/matlab_version/experiments_300VW/results/300VWres_66_cat3.pdf differ diff --git a/matlab_version/experiments_300VW/results/ceclm_errors.mat b/matlab_version/experiments_300VW/results/ceclm_errors.mat index 585849e1..30d18b57 100644 Binary files a/matlab_version/experiments_300VW/results/ceclm_errors.mat and b/matlab_version/experiments_300VW/results/ceclm_errors.mat differ