-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_tracker.m
54 lines (38 loc) · 1.68 KB
/
run_tracker.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%error('Note: you need to compile the Matconvnet according to Readme.txt, and then comment the FIRST line in run_HDT.m')
run('./matconvnet/matlab/vl_setupnn.m')
% path to the folder with VOT sequences
base_path = '/media/cjh/datasets/tracking/OTB100/';
% choose name of the VOT sequence
sequence_name = choose_video(base_path);
images_folder = [base_path sequence_name '/img/'];
pathAnno = [base_path sequence_name '/groundtruth_rect.txt'];
pathModel = '/media/cjh/cvpaper/git/models/imagenet-vgg-verydeep-19.mat';
show_visualization = 1;
images = dir(fullfile(images_folder,'*.jpg'));
len = size(images,1);
img_files = cell(len,1);
for i = 1:len
img_files{i} = [images_folder images(i).name];
end
rect_anno = dlmread(pathAnno);
% rect_anno: nx4 matrix, storing gt bounding box in the form of [left top width height]
init_rect = rect_anno(1,:);
target_sz = [init_rect(4), init_rect(3)];
pos = [init_rect(2), init_rect(1)] + floor(target_sz/2);
% extra area surrounding the target
padding = struct('generic', 2.2, 'large', 1, 'height', 0.4);
lambda = 1e-4; %regularization
output_sigma_factor = 0.1; %spatial bandwidth (proportional to target)
interp_factor = 0.01;
cell_size = 4;
bSaveImage = 0;
[positions] = tracker_ensemble(img_files, pos, target_sz, ...
padding, lambda, output_sigma_factor, interp_factor, ...
cell_size, show_visualization, rect_anno, bSaveImage, pathModel);
% save results
rects = [positions(:,2) - target_sz(2)/2, positions(:,1) - target_sz(1)/2];
rects(:,3) = target_sz(2);
rects(:,4) = target_sz(1);
res.type = 'rect';
res.res = rects;
results=res;