晨曦葫芦
2021-10-06 23:41
采纳率: 0%
浏览 45

OTB perfPlot.m运行错误:

用perfPlot.m进行自己跟踪结果的评估,已经将默认的OTB2013改为了OTB100,results文件夹中的results_SRE_CVPR13和results_TRE_CVPR13改为了自己的跟踪mat数据,configTrackers.m也进行了修改。运行时文件genPerfMat报错:

未定义函数或变量 'results'。
出错 genPerfMat (line 52)
idxNum = length(results);
代码如下:

function genPerfMat(seqs, trackers, evalType, nameTrkAll, perfMatPath)

pathAnno = './anno/';
numTrk = length(trackers);

thresholdSetOverlap = 0:0.05:1;
thresholdSetError = 0:50;

switch evalType
    case 'SRE'
        rpAll=['.\results\results_SRE_CVPR13\'];
    case {'TRE', 'OPE'}
        rpAll=['.\results\results_TRE_CVPR13\'];
end

for idxSeq=1:length(seqs)
    s = seqs{idxSeq};
    
    s.len = s.endFrame - s.startFrame + 1;
    s.s_frames = cell(s.len,1);
    nz    = strcat('%0',num2str(s.nz),'d'); %number of zeros in the name of image
    for i=1:s.len
        image_no = s.startFrame + (i-1);
        id = sprintf(nz,image_no);
        s.s_frames{i} = strcat(s.path,id,'.',s.ext);
    end
    
    rect_anno = dlmread([pathAnno s.name '.txt']);
    numSeg = 20;
    [subSeqs, subAnno]=splitSeqTRE(s,numSeg,rect_anno);
    
    nameAll=[];
    for idxTrk=1:numTrk
        
        t = trackers{idxTrk};
                 %load([rpAll s.name '_' t.name '.mat'], 'results','coverage','errCenter');
        
        load([rpAll s.name '_' t.name '.mat'])
        disp([s.name ' ' t.name]);
        
        aveCoverageAll=[];
        aveErrCenterAll=[];
        errCvgAccAvgAll = 0;
        errCntAccAvgAll = 0;
        errCoverageAll = 0;
        errCenterAll = 0;
        
        lenALL = 0;
        
        switch evalType
            case 'SRE'
                idxNum = length(results);
                anno=subAnno{1};
            case 'TRE'
                idxNum = length(results);
            case 'OPE'
                idxNum = 1;
                anno=subAnno{1};
        end
        
        successNumOverlap = zeros(idxNum,length(thresholdSetOverlap));
        successNumErr = zeros(idxNum,length(thresholdSetError));
        
        for idx = 1:idxNum
            
            res = results{idx};
            
            if strcmp(evalType, 'TRE')
                anno=subAnno{idx};
            end
            
            len = size(anno,1);
            
            if isempty(res.res)
                break;
            end
            
            if ~isfield(res,'type')&&isfield(res,'transformType')
                res.type = res.transformType;
                res.res = res.res';
            end
            
            [aveCoverage, aveErrCenter, errCoverage, errCenter] = calcSeqErrRobust(res, anno);
            
            for tIdx=1:length(thresholdSetOverlap)
                successNumOverlap(idx,tIdx) = sum(errCoverage >thresholdSetOverlap(tIdx));
            end
            
            for tIdx=1:length(thresholdSetError)
                successNumErr(idx,tIdx) = sum(errCenter <= thresholdSetError(tIdx));
            end
            
            lenALL = lenALL + len;
            
        end
        
        
        if strcmp(evalType, 'OPE')
            aveSuccessRatePlot(idxTrk, idxSeq,:) = successNumOverlap/(lenALL+eps);
            aveSuccessRatePlotErr(idxTrk, idxSeq,:) = successNumErr/(lenALL+eps);
        else
            aveSuccessRatePlot(idxTrk, idxSeq,:) = sum(successNumOverlap)/(lenALL+eps);
            aveSuccessRatePlotErr(idxTrk, idxSeq,:) = sum(successNumErr)/(lenALL+eps);
        end
        
    end
end
%
dataName1=[perfMatPath 'aveSuccessRatePlot_' num2str(numTrk) 'alg_overlap_' evalType '.mat'];
save(dataName1,'aveSuccessRatePlot','nameTrkAll');

dataName2=[perfMatPath 'aveSuccessRatePlot_' num2str(numTrk) 'alg_error_' evalType '.mat'];
aveSuccessRatePlot = aveSuccessRatePlotErr;
save(dataName2,'aveSuccessRatePlot','nameTrkAll');


使用默认的代码运行configTrackers.m是没有问题的。请问这个results是如何定义的,我这里面应该怎么修改呢?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • 技术专家团-Joel 2021-10-07 13:48

    你好,你的
    %load([rpAll s.name '_' t.name '.mat'], 'results','coverage','errCenter');
    这句话被注释了,里面就有results。所以你需要检查你的load进来的数据是不是有这个results,没有的话,看别人的程序肯定是有的。自己琢磨一下

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题