Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you calculate 3dpck? #11

Open
cyxcyx559 opened this issue Jun 15, 2022 · 7 comments
Open

How do you calculate 3dpck? #11

cyxcyx559 opened this issue Jun 15, 2022 · 7 comments

Comments

@cyxcyx559
Copy link

There is no place in the code to calculate 3dpck, can you describe in detail how pck is calculated?

@hongsukchoi
Copy link
Owner

@hongsukchoi
Copy link
Owner

hongsukchoi commented Jun 15, 2022

for your convenience, I show you the part of codes, which can be downloaded from above links

function [pck_table, auc_table] = mpii_compute_3d_pck(error_data, joint_groups, output_base_path)

%Input
%error_data is a struct array of type mpii_3d_error
%The struct zcarries information about the name of the method as well as an
%nj x 1 x nf matrix with the joint errors.
%joint_groups is an ng x 2 cell, where ng is the number of groups. It
%carries the name of the group as well as the indices of the joints that
%belong to the group.

%If the error_data array has multiple inputs, there are additional
%comparative AUC plots output per joint in addition to the individual ones.
ng = size(joint_groups,1);


pck_curve_array = cell(length(error_data), ng+1); %Contains the PCK results per joint group, per error_data cell
pck_array = cell(length(error_data), ng+1); %Contains the AUC results per joint group
auc_array = cell(length(error_data), ng+1); %Contains the AUC results per joint group
%thresh = 0:5:200;
thresh = 0:5:150;
pck_thresh = 150;


for i = 1:length(error_data)
    joint_count = 0;
    nf = size(error_data(i).error,3);
     for j = 1:ng
         for ti =1:length(thresh)
             t = thresh(ti);
             pck_curve_array{i,j} = [pck_curve_array{i,j}, sum(sum(error_data(i).error(joint_groups{j,2},1,:) < t, 3),1) / (length(joint_groups{j,2}) *nf)];
         end
         
         joint_count = joint_count + length(joint_groups{j,2});
         if(isempty(pck_curve_array{i,ng+1}))
             pck_curve_array{i,ng+1} = pck_curve_array{i,j} * length(joint_groups{j,2});
         else
             pck_curve_array{i,ng+1} = pck_curve_array{i,ng+1} + pck_curve_array{i,j} * length(joint_groups{j,2});
         end
         auc_array{i,j} = 100* sum(pck_curve_array{i,j}(:))/ length(thresh);
         pck_array{i,j} = 100* sum(sum(error_data(i).error(joint_groups{j,2},1,:) < pck_thresh, 3),1) / (length(joint_groups{j,2}) *nf);
         if(isempty(pck_array{i,ng+1}))
             pck_array{i,ng+1} = pck_array{i,j} * length(joint_groups{j,2});
         else
             pck_array{i,ng+1} = pck_array{i,ng+1} + pck_array{i,j} * length(joint_groups{j,2});
         end
     end
     pck_array{i,ng+1} = pck_array{i,ng+1} / joint_count;
     pck_curve_array{i,ng+1} = pck_curve_array{i,ng+1} / joint_count;
     auc_array{i,ng+1} = 100* sum(pck_curve_array{i,ng+1}(:))/ length(thresh);
end
         
pck_table = cell(length(error_data)+1, ng+2);
pck_table{1,ng+2} = 'Total';
for i = 1:length(error_data)
    pck_table{1+i,1} = error_data(i).method;
end
for i = 1:ng
    pck_table{1,i+1} = joint_groups{i,1};
end
auc_table = pck_table;
auc_table(2:end,2:end) = auc_array;
pck_table(2:end,2:end) = pck_array;


if(~isempty(output_base_path))
%Generate and save plots to output_path
%First generate individual plots from each row of the pck_curve_array
colormap default;

for i = 1:length(error_data)
    all_plot = [];
    for j = 1:ng+1
        figure(1);
        cla;
        plot(thresh,pck_curve_array{i,j},'LineWidth',2);
        all_plot = [all_plot; pck_curve_array{i,j}];
        axis([0 150 0 1]);
        title([pck_table{1,j+1} '  PCK150mm']);
        output_dir = [output_base_path filesep error_data(i).method];
        if(exist(output_dir,'dir') ~= 7)
            mkdir(output_dir);
        end
        saveas(gcf,[output_dir filesep pck_table{1,j+1}], 'fig');
        saveas(gcf,[output_dir filesep pck_table{1,j+1}], 'svg');
        saveas(gcf,[output_dir filesep pck_table{1,j+1}], 'png');
        
    end
    figure(2);
    cla;
    plot(thresh,all_plot,'LineWidth',2);
    axis([0 150 0 1]);
    hold off;
    legend(pck_table(1,2:end));
    saveas(gcf,[output_dir filesep 'All'], 'fig');
    saveas(gcf,[output_dir filesep 'All'], 'svg');
    saveas(gcf,[output_dir filesep 'All'], 'png');
end
end

end
%Then group the plots by methods 
``

@cyxcyx559
Copy link
Author

cyxcyx559 commented Jun 16, 2022 via email

@hongsukchoi
Copy link
Owner

hongsukchoi commented Jun 16, 2022

edit. 2022.07.06
I accidentally wrote MPVPE as MPJPE..
MPVPE = PVE. Personally I like MPVPE, since it is consistent expression with MPJPE.

Yes, MPJPE = PVE. Personally I like MPJPE, since it is consistent expression with MPJPE. It is just calculating the euclidean distance between vertices. Metric is milimeters. Actually MPVPE code is provide in this repo

@xljh0520
Copy link

Hi, did you reproduce the result on MuPoTs?

@zhLawliet
Copy link

@hongsukchoi @xljh0520 have you reproduced the result on MuPoTs?

@xljh0520
Copy link

xljh0520 commented Nov 9, 2022

No, I didn't achieve the annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants