PSPNet
PSPNet copied to clipboard
Error in eval_acc.m : Matrix dimensions must agree.
I have an error when I run eval_all.m, some codes as flows:
case 'VOC2012'
isVal = true; %evaluation on testset
step = 364; %364=1456/4
data_root = '/home/simon/DEEPLEARNING/DATASETS/VOCdevkit/VOC2012/Test';
eval_list = 'samplelist/VOC2012_test.txt';
save_root = 'mc_result/VOC2012/test/pspnet101_473/';
model_weights = 'model/pspnet101_VOC2012.caffemodel';
model_deploy = 'prototxt/pspnet101_VOC2012_473.prototxt';
fea_cha = 21;
base_size = 512;
crop_size = 473;
data_class = 'objectName21.mat';
data_colormap = 'colormapvoc.mat';
because I have some result pictures, so some codes are commented.
%parfor i = 1:gpu_num %change 'parfor' to 'for' if singe GPU testing is used
% eval_sub(data_name,data_root,eval_list,model_weights,model_deploy,fea_cha,base_size,crop_size,data_class,data_colormap, is_save_feat,save_gray_folder,save_color_folder,save_feat_folder,gpu_id_array(i),index_array(i),step,skipsize,scale_array,mean_r,mean_g,mean_b);
% end
if(isVal)
eval_acc(data_name,data_root,eval_list,save_gray_folder,data_class,fea_cha);
end
run eval_all.m and the erros happened:
Matrix dimensions must agree.
Error in intersectionAndUnion (line 14)
imPred = imPred.*uint16(imLab>0);
Error in eval_acc (line 55)
[area_intersection(:,cnt), area_union(:,cnt)] = intersectionAndUnion(imPred, imAnno, numClass);
Error in eval_all (line 75)
eval_acc(data_name,data_root,eval_list,save_gray_folder,data_class,fea_cha);
before that, I have fixed an error in eval_acc.m:
strPred = strsplit(str{1},'/');
strPred = strPred{end};
if(strcmp(data_name,'cityscapes'))
strPred = strrep(strPred,'gtFine_labelTrainIds','leftImg8bit');
end
filePred = fullfile(pathPred, strPred);
fileAnno = fullfile(pathAnno, str{1});
I dont know what to do, could any body help me ? Thanks!
i had the same issue, I applied rgb2gray to imAnno before doing the IoU then the error is gone. But I'm getting very bad result, not sure if I was doing the right thing
First step would be to put break points before the erroneous line, and check the outputs of size(imPred) and size(imLab).