Skip to content

Commit

Permalink
first version
Browse files Browse the repository at this point in the history
  • Loading branch information
XU-TIANYANG committed Aug 2, 2019
1 parent 9743d66 commit 97821a8
Show file tree
Hide file tree
Showing 793 changed files with 132,296 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# GFS-DCF
Matlab implementation of ICCV2019 paper "Joint Group Feature Selection and Discriminative Filter Learning for Robust Visual Object Tracking"

GFS-DCF Matlab implementation of the ICCV2019 paper
"Joint Group Feature Selection and Discriminative Filter Learning for
Robust Visual Object Tracking"

Dependencies:
MatConvNet, PDollar Toolbox.
Please download the latest MatConvNet (http://www.vlfeat.org/matconvnet/)
in './tracker_exter/matconvnet'
(Set 'opts.enableGpu = true' in 'matconvnet/matlab/vl_compilenn.m')

Installation:
Run install.m file to compile the libraries and download networks.

Demo:
Run demo.m
53 changes: 53 additions & 0 deletions demo.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
%% Demo : "Joint Group Feature Selection and Discriminative Filter Learning
%% for Robust Visual Object Tracking"

%% Please run install.m first
close all;clear;clc;

% Add involved folders into MATLAB path.
setup_paths();

% Choose and load video information
base_path = 'tracker_seque'; % (or OTB / VOT root path)

video = choose_video(base_path);
video_path = [base_path '/' video];
[seq, gt_boxes] = load_video(video_path,video);

% Run tracker
results = run_GFSDCF(seq);

% Evaluate performance
pd_boxes = results.res;
thresholdSetOverlap = 0: 0.05 : 1;
success_num_overlap = zeros(1, numel(thresholdSetOverlap));
if numel(gt_boxes(1,:))>4
temp = zeros(size(gt_boxes,1),4);
for i = 1:size(gt_boxes,1)
bb8 = round(gt_boxes(i,:));
x1 = round(min(bb8(1:2:end)));
x2 = round(max(bb8(1:2:end)));
y1 = round(min(bb8(2:2:end)));
y2 = round(max(bb8(2:2:end)));
temp(i,:) = round([x1, y1, x2 - x1, y2 - y1]);
end
gt_boxes = temp;
end

thresholdSetPre = 0: 1 : 50;
success_num_pre = zeros(1, numel(thresholdSetPre));
res = calcRectInt(gt_boxes, pd_boxes);
p_gt = [gt_boxes(:,2),gt_boxes(:,1)]+([gt_boxes(:,4),gt_boxes(:,3)]-1)/2;
p_res = [pd_boxes(:,2),pd_boxes(:,1)]+([pd_boxes(:,4),pd_boxes(:,3)]-1)/2;
dis = sqrt(sum((p_gt-p_res).^2,2));
for t = 1: length(thresholdSetOverlap)
success_num_overlap(1, t) = sum(res > thresholdSetOverlap(t));
end
for t = 1: length(thresholdSetPre)
success_num_pre(1, t) = sum(dis <= thresholdSetPre(t));
end
Pre = success_num_pre(21) / size(gt_boxes, 1);
cur_AUC = mean(success_num_overlap) / size(gt_boxes, 1);
FPS_vid = results.fps;
display([video '----> ' 'Rank/Frames: ' num2str(results.rank_var) '/' num2str(size(gt_boxes, 1)) ', FPS: ' num2str(FPS_vid) ', AUC: ' num2str(cur_AUC) ', DP: ' num2str(Pre)]);
%gpuDevice([]);
70 changes: 70 additions & 0 deletions install.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
% Compile libraries, download network modles and demo sequences for GFS-DCF
[path_root, name, ext] = fileparts(mfilename('fullpath'));

% mtimesx
if exist('tracker_exter/mtimesx', 'dir') == 7
cd tracker_exter/mtimesx
mtimesx_build;
cd(path_root)
end

% PDollar toolbox
if exist('tracker_exter/pdollar_toolbox/external', 'dir') == 7
cd tracker_exter/pdollar_toolbox/external
toolboxCompile;
cd(path_root)
end

% matconvnet
if exist('tracker_exter/matconvnet/matlab', 'dir') == 7
cd tracker_exter/matconvnet/matlab
vl_compilenn; % enable/disable GPU based on your hardware
cd(path_root)

% donwload network
cd tracker_featu
mkdir offline_models
cd offline_models
if ~(exist('imagenet-resnet-50-dag.mat', 'file') == 2)
disp('Downloading the network "imagenet-resnet-50-dag.mat" from "http://www.vlfeat.org/matconvnet/models/imagenet-resnet-50-dag.mat"...')
urlwrite('http://www.vlfeat.org/matconvnet/models/imagenet-resnet-50-dag.mat', 'imagenet-resnet-50-dag.mat');
disp('Done!')
end
cd(path_root)
else
error('GFS-DCF : Matconvnet not found.')
end

% download demo sequences
if exist('tracker_seque', 'dir') == 0
mkdir tracker_seque
cd tracker_seque
else
cd tracker_seque
end
if exist('Biker', 'dir') == 0
disp('Downloading the demo sequence (1/2) "Biker" from "http://cvlab.hanyang.ac.kr/tracker_benchmark/seq/Biker.zip"...')
urlwrite('http://cvlab.hanyang.ac.kr/tracker_benchmark/seq/Biker.zip', 'Biker.zip');
unzip('Biker.zip');
rmdir('__MACOSX','s');
delete('Biker.zip');
disp('Done!')
end
if exist('bag', 'dir') == 0
mkdir bag
cd bag
mkdir color
cd color
disp('Downloading the demo sequence (2/2) "Bag" from "http://data.votchallenge.net/sequences/28b56d282ad4abeaaca820b1bebcab2f2aeb7a9a8b0da71f1103f7853a0add7e80ea7d6030892616d0ca0a639366418d3587c5e55bf759be91c4cfb514d53751.zip"...')
urlwrite('http://data.votchallenge.net/sequences/28b56d282ad4abeaaca820b1bebcab2f2aeb7a9a8b0da71f1103f7853a0add7e80ea7d6030892616d0ca0a639366418d3587c5e55bf759be91c4cfb514d53751.zip', 'bag.zip');
unzip('bag.zip');
delete('bag.zip');
cd ..
urlwrite('http://data.votchallenge.net/vot2018/main/bag.zip', 'anno.zip');
unzip('anno.zip');
delete('anno.zip');
cd ..
disp('Done!')
end
cd(path_root)

76 changes: 76 additions & 0 deletions run_GFSDCF.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
function results = run_GFSDCF(seq, res_path, bSaveImage, parameters)
% Set tracker parameters and run tracker
% Input : seq[structure](sequence information)
% Output : results[structure](tracking results)

% Tianyang Xu, Zhen-Hua Feng, Xiao-Jun Wu, Josef Kittler. Joint Group
% Feature Selection and Discriminative Filter Learning for Robust Visual Object
% Tracking. In ICCV 2019.

% [results] = OTBsettings(seq);
%% Set feature parameters
% HOG feature settings
hog_params.cell_size = 6;
hog_params.feature_is_deep = false;

% CN feature settings
cn_params.tablename = 'CNnorm';
cn_params.useForGray = false;
cn_params.cell_size = 4;
cn_params.feature_is_deep = false;

% IC feature settings
ic_params.tablename = 'intensityChannelNorm6';
ic_params.useForColor = false;
ic_params.cell_size = 4;
ic_params.feature_is_deep = false;

% CNN feature settings
dagnn_params.nn_name = 'imagenet-resnet-50-dag.mat';
dagnn_params.output_var = {'res4ex'};
dagnn_params.feature_is_deep = true;
dagnn_params.augment.blur = 1;
dagnn_params.augment.rotation = 1;
dagnn_params.augment.flip = 1;

params.t_features = {
struct('getFeature',@get_fhog,'fparams',hog_params),...
struct('getFeature',@get_table_feature, 'fparams',cn_params),...
struct('getFeature',@get_dagnn_layers, 'fparams',dagnn_params),...
struct('getFeature',@get_table_feature, 'fparams',ic_params),...
};

% Set [non-deep deep] parameters
params.learning_rate = [0.6 0.05]; % updating rate in each learning stage
params.channel_selection_rate = [0.9 0.075];% channel selection ratio
params.spatial_selection_rate = [0.1 0.9]; % spatial units selection ratio
params.output_sigma_factor = [1/16 1/4]; % desired label setting
params.lambda1 = 10; % lambda_1
params.lambda2 = 1; % lambda_2
params.lambda3 = [16 12]; % lambda_3
params.stability_factor = [0 0]; % robustness testing parameter

% Image sample parameters
params.search_area_scale = [3.8 4.2]; % search region
params.min_image_sample_size = [150^2 200^2];% minimal search region size
params.max_image_sample_size = [200^2 250^2];% maximal search region size

% Detection parameters
params.refinement_iterations = 1; % detection numbers
params.newton_iterations = 5; % subgrid localisation numbers

% Set scale parameters
params.number_of_scales = 7; % scale pyramid size
params.scale_step = 1.01; % scale step ratio

% Set GPU
params.use_gpu = true;
params.gpu_id = [];

% Initialisation
params.vis_res = 1; % visualisation results
params.vis_details = 1; % visualisation details for debug
params.seq = seq;

% Run tracker
[results] = tracker_main(params);
31 changes: 31 additions & 0 deletions setup_paths.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function setup_paths()
% Add involved folders into MATLAB path.

[pathstr, ~, ~] = fileparts(mfilename('fullpath'));

% Tracker implementation
addpath(genpath([pathstr '/tracker_imple/']));

% Utilities
addpath([pathstr '/tracker_utils/']);

% The feature extraction
addpath(genpath([pathstr '/tracker_featu/']));

% Matconvnet
addpath([pathstr '/tracker_exter/matconvnet/matlab/mex/']);
addpath([pathstr '/tracker_exter/matconvnet/matlab']);
addpath([pathstr '/tracker_exter/matconvnet/matlab/simplenn']);
vl_setupnn;

% PDollar toolbox
addpath(genpath([pathstr '/tracker_exter/pdollar_toolbox/channels']));

% Mtimesx
addpath([pathstr '/tracker_exter/mtimesx/']);

% mexResize
addpath([pathstr '/tracker_exter/mexResize/']);

% Networks and tables
addpath([pathstr '/tracker_featu/offline_models/']);
4 changes: 4 additions & 0 deletions tracker_exter/matconvnet/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto
*.vcxproj text merge=union eol=crlf
*.vcxproj.filters merge=union eol=crlf
*.sln text merge=union eol=crlf
45 changes: 45 additions & 0 deletions tracker_exter/matconvnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
*.xcodeproj/*xcuserdata*
*.xcodeproj/project.xcworkspace/*xcuserdata*
*.xcodeproj/project.xcworkspace/xcshareddata/
mex/*
mex
data
*.o
*.pyc
*~
index.html
matconvnet-*.tar.gz
local
contrib

# Documentation
doc/figures/svg/*.pdf
doc/figures/*.idraw
doc/.texpadtmp/*
doc/*.pdf
doc/.build

# Website
doc/site/docs/mfiles
doc/site/site
doc/site/.build
doc/site/theme/css/bootstrap.min.css
doc/site/theme/css/bootstrap.min.css.map
doc/site/theme/css/font-awesome.min.css
doc/site/theme/fonts/fontawesome-webfont.eot
doc/site/theme/fonts/fontawesome-webfont.svg
doc/site/theme/fonts/fontawesome-webfont.ttf
doc/site/theme/fonts/fontawesome-webfont.woff
doc/site/theme/fonts/fontawesome-webfont.woff2
doc/site/theme/js/bootstrap.min.js
doc/site/theme/js/jquery.min.js
doc/site/theme/js/jquery.min.map
doc/site/theme/js/npm.js

# Visual C
*.suo
*.user
*.sdf
*.opensdf
doc/figures/svg/*.idraw

Empty file.
Loading

0 comments on commit 97821a8

Please sign in to comment.