otb能在matlab2014下运行,将孪生网络SiamFC跟踪算法加入到OTB benchmark_v1.0中【新手记录】...

SiameseFC: Luca Bertinetto, Jack Valmadre, João F. Henriques, Andrea Vedaldi, Philip H.S. Torr. "Fully-Convolutional Siamese Networks for Object Tracking." ECCV workshop (2016).

吴毅老师的【OTB benchmark】,只能在windows下运行,mac和linux无缘咯。

我已经尽我所能写的尽量详细了。

相关下载

将孪生网络用于跟踪,2016年发表在ECCV上的文章。

项目主页在这里。论文下载在这里。

GitHub源码下载

OTB benchmark下载链接,所需要的测试序列也从这个网站上下载。

下载算法源码

从Github上将整个算法克隆下来,按照github上这部分对源码进行修改。安装需要的环境。

138e6e21c86a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

Tracking only

注意到需要的环境了嘛!!!

GPU

CUDA drivers

cuDNN

Matlab

MatCovNet(v1.0-beta20)

要注意版本匹配的问题:

通过在matlab中输入gpuDevice()的输出,可以了解自己GPU的情况,下载对应的cuda版本。

cuda版本对应了matlab版本:

我的配置是matlab R2016a + Visual Studio 2013 + cuda7.5 + cuDnn v5.1.这个版本是完全对应正确的,可以工作。

138e6e21c86a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

cuda-matlab版本对应

matlab官方文件也指出可以使用更新版本的cuda,需要自己配置。

将下载好的源码文件夹改名为SiamFC,放到【benchmark v_1.0】-->【trackers】

138e6e21c86a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

SiamFC放置位置

下载matconvnet v_1.0-beta20后,解压为matconvnet放到SiamFC,下载的模型【2016-8-17.net.mat】放到【SiamFC】-->【net

s】下。

138e6e21c86a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

模型位置

MATLAB编译

matlab中输入命令顺序在下面:

>>> cd SiamFC

>>> adddpath matlab

>>> mex -setup C++

>>> vl_compilenn('enableGpu',true)

matlab里面会有这样的显示:

138e6e21c86a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

mex编译

我在运行第四步命令之后出现下面的警告:

138e6e21c86a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

警告

不过没有关系,编译继续,而且最后还会成功的!只要版本对了。我的GPU很弱,GEFORCE 710M 笔记本。所以得用低版本的cuda。

运行SiamFC需要做的修改

一、 按照github上作者的要求改之后,再做下面的修改。

将【SiamFC】-->【tracking】下的run_tracker.m文件复制到【SiamFC】下,并重命名为SiamFC.m。

修改后SiamFC.m中的内容:

function results = run_SiamFC(seq, res_path, bSaveImage)

% RUN_TRACKER is the external function of the tracker - does initialization and calls tracker.m

addpath(genpath('./tracking/'));

startup;

%% Parameters that should have no effect on the result.

params.video = seq.path;

params.visualization = false;

params.gpus = 1;

%% Parameters that should be recorded.

% params.foo = 'blah';

if bSaveImage

imwrite(frame2im(getframe(gcf)),[res_path num2str(frame) '.jpg']);

end

%% Call the main tracking function

bboxes = tracker(params);

seq.res = bboxes;

results.res = bboxes;

result.type = 'rect';

end

上面文件的文件最后四行是为了让benchmark找到tracker的结果。

第二个修改文件,tracking文件夹下的tracker.m的第55行

[imgFiles, targetPosition, targetSize] = load_video_info( p.video);

第三个需要修改的文件:load_video_info.m

% -------------------------------------------------------------------------------------------------

function [imgs, pos, target_sz] = load_video_info(video_path)

%LOAD_VOT_VIDEO_INFO

% Loads all the relevant information for the video in the given path:

% the list of image files (cell array of strings), initial position

% (1x2), target size (1x2), the ground truth information for precision

% calculations (Nx4, for N frames), and the path where the images are

% located. The ordering of coordinates and sizes is always [y, x].

%

% Joao F. Henriques, 2014

% http://www.isr.uc.pt/~henriques/

% -------------------------------------------------------------------------------------------------

%full path to the video's files

% panchen

% if base_path(end) ~= '/' && base_path(end) ~= '\',

% base_path(end+1) = '/';

% end

% video_path = [base_path video];

%load ground truth from text file

ground_truth = csvread([video_path 'groundtruth_rect.txt']);

region = ground_truth(1, :);

[cx, cy, w, h] = get_axis_aligned_BB(region);

pos = [cy cx]; % centre of the bounding box

target_sz = [h w];

%load all jpg files in the folder

img_files = dir([video_path '*.jpg']);

assert(~isempty(img_files), 'No image files to load.')

img_files = sort({img_files.name});

%eliminate frame 0 if it exists, since frames should only start at 1

img_files(strcmp('00000000.jpg', img_files)) = [];

img_files = strcat(video_path, img_files);

% read all frames at once

imgs = vl_imreadjpeg(img_files,'numThreads', 12);

end

需要将下载好的数据中的groundtruth_rect.txt文件放到/img文件夹下面。

这个视频序列比较特别,CarScale视频序列的groundtruth_rect文件需要注意,SiamFC读不出来,需要将文件里的tab转换为‘,’。

数据准备,benckmark中的修改

utils文件夹下面有两个文件需要修改,关于使用的tracker和测试序列。

configSeqs.m

configTrackers.m

一、configSeqs.m

设置测试序列的访问路径,绝对路径。

function seqs=configSeqs

seqIVT={struct('name','Skater','path','C:\benchmark\Skater\img\','startFrame',1,'endFrame',160,'nz',4,'ext','jpg','init_rect', [0,0,0,0]),...

struct('name','Jump','path','C:\benchmark\Jump\img\','startFrame',1,'endFrame',122,'nz',4,'ext','jpg','init_rect', [0,0,0,0])};

seqs = seqIVT;

注意 startFrame和 endFrame都要作相应修改。

二、configTrackers.m

function trackers=configTrackers

trackers1={struct('name','SiamFC','namePaper','SiamFC')};

trackers = trackers1

到这里应该就差不多了,我就可以成功运行了。现在记录下来觉得好像没改什么东西,但是真的很辛苦的,都是一点点debug,看变量数据结构,一步步的运行才知道了问题出在哪里,真的是各种问题!一定要好好记录一下,如果能再对需要的人有帮助就好啦。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值