├── .gitignore ├── TACF_Demo.m ├── UAV123_utils ├── choose_video_UAV.m ├── configSeqs.m ├── load_video_info_UAV123.m ├── load_video_information.m └── precision_plot_save.m ├── external_libs ├── gradientMex.mexw64 ├── imResampleMex.cpp ├── imResampleMex.mexa64 ├── imResampleMex.mexw64 ├── mexResize.mexw64 ├── mtimesx │ ├── license.txt │ ├── mtimesx.c │ ├── mtimesx.m │ ├── mtimesx.mexa64 │ ├── mtimesx.mexw64 │ ├── mtimesx_RealTimesReal.c │ ├── mtimesx_build.m │ ├── mtimesx_sparse.m │ ├── mtimesx_test_ddequal.m │ ├── mtimesx_test_ddspeed.m │ ├── mtimesx_test_dsequal.m │ ├── mtimesx_test_dsspeed.m │ ├── mtimesx_test_nd.m │ ├── mtimesx_test_sdequal.m │ ├── mtimesx_test_sdspeed.m │ ├── mtimesx_test_ssequal.m │ └── mtimesx_test_ssspeed.m ├── opencv_core242.dll └── opencv_imgproc242.dll ├── feature_extraction ├── fhog.m ├── get_cn.m ├── get_deep.m ├── get_feature_map.m ├── get_features.m ├── get_fhog.m ├── get_gray.m ├── get_handcrafted.m ├── get_saliency.m ├── im2c.m ├── imResample.m ├── initial_net.m └── w2c.mat ├── implementation ├── initialization │ └── initializeAllAreas.m ├── scale_filter │ ├── affparam2geom.m │ ├── affparam2mat.m │ ├── affparaminv.m │ ├── affwarpimg.m │ ├── gaussian_correlation_scale_single.m │ ├── getScalePatch.m │ ├── getScaleSubwindow.m │ ├── getScaleSubwindow_v1.m │ ├── scale_adaptation_init.m │ ├── scale_search.m │ ├── scale_update_model.m │ └── warpimg.m ├── tracker.m ├── tran_filter │ ├── adaptive_weight.m │ ├── computeHistogram.m │ ├── cropFilterResponse.m │ ├── floor_odd.m │ ├── gaussianResponse.m │ ├── gaussian_correlation.m │ ├── gaussian_correlation_v2.m │ ├── getCenterLikelihood.m │ ├── getColourMap.m │ ├── getP.m │ ├── getSubwindow.m │ ├── linear_correlation.m │ ├── mergeResponses.m │ ├── myHann.m │ ├── polynomial_correlation.m │ ├── predict_position.m │ ├── sigmoid_correlation.m │ ├── updateHistModel.m │ └── update_model.m └── tri_attention │ ├── context_attention │ └── calPMER.m │ ├── dimension_attention │ ├── localmax_nonmaxsup2d.m │ └── normalize_img.m │ └── position_attention │ ├── pos_attention.m │ └── pos_pre.m ├── readme.md ├── results ├── overlap_OPE_UAV123.png └── overlap_OPE_UAVDT.png ├── run_TACF.m ├── seq ├── anno │ └── wakeboard7.txt └── data_seq │ └── wakeboard7 │ ├── 000001.jpg │ ├── 000002.jpg │ ├── 000003.jpg │ ├── 000004.jpg │ ├── 000005.jpg │ ├── 000006.jpg │ ├── 000007.jpg │ ├── 000008.jpg │ ├── 000009.jpg │ ├── 000010.jpg │ ├── 000011.jpg │ ├── 000012.jpg │ ├── 000013.jpg │ ├── 000014.jpg │ ├── 000015.jpg │ ├── 000016.jpg │ ├── 000017.jpg │ ├── 000018.jpg │ ├── 000019.jpg │ ├── 000020.jpg │ ├── 000021.jpg │ ├── 000022.jpg │ ├── 000023.jpg │ ├── 000024.jpg │ ├── 000025.jpg │ ├── 000026.jpg │ ├── 000027.jpg │ ├── 000028.jpg │ ├── 000029.jpg │ ├── 000030.jpg │ ├── 000031.jpg │ ├── 000032.jpg │ ├── 000033.jpg │ ├── 000034.jpg │ ├── 000035.jpg │ ├── 000036.jpg │ ├── 000037.jpg │ ├── 000038.jpg │ ├── 000039.jpg │ ├── 000040.jpg │ ├── 000041.jpg │ ├── 000042.jpg │ ├── 000043.jpg │ ├── 000044.jpg │ ├── 000045.jpg │ ├── 000046.jpg │ ├── 000047.jpg │ ├── 000048.jpg │ ├── 000049.jpg │ ├── 000050.jpg │ ├── 000051.jpg │ ├── 000052.jpg │ ├── 000053.jpg │ ├── 000054.jpg │ ├── 000055.jpg │ ├── 000056.jpg │ ├── 000057.jpg │ ├── 000058.jpg │ ├── 000059.jpg │ ├── 000060.jpg │ ├── 000061.jpg │ ├── 000062.jpg │ ├── 000063.jpg │ ├── 000064.jpg │ ├── 000065.jpg │ ├── 000066.jpg │ └── 000067.jpg └── setup_paths.m /.gitignore: -------------------------------------------------------------------------------- 1 | external_libs/matconvnet/ 2 | model/ 3 | Test*/ 4 | archive/ 5 | *.asv -------------------------------------------------------------------------------- /TACF_Demo.m: -------------------------------------------------------------------------------- 1 | function TACF_Demo(~) 2 | close all; 3 | clear; 4 | clc; 5 | 6 | %% **Need to change** 7 | type_of_assessment = 'UAV123_10fps'; 8 | tracker_name = 'TACF'; 9 | %% Load video information 10 | addpath(genpath('./UAV123_utils/')); 11 | seq = load_video_information(type_of_assessment); 12 | 13 | % main function 14 | result = run_TACF(seq); 15 | 16 | % save results 17 | results = cell(1,1); 18 | results{1} = result; 19 | results{1}.len = seq.len; 20 | results{1}.startFrame = seq.st_frame; 21 | results{1}.annoBegin = seq.st_frame; 22 | 23 | % save results to specified folder 24 | save_dir = '.\Test_one_seq\'; 25 | save_res_dir = [save_dir, tracker_name, '_results\']; 26 | save_pic_dir = [save_res_dir, 'res_picture\']; 27 | if ~exist(save_res_dir, 'dir') 28 | mkdir(save_res_dir); 29 | mkdir(save_pic_dir); 30 | end 31 | save([save_res_dir, seq.video_name, '_', tracker_name], 'results'); 32 | 33 | % plot precision figure 34 | show_visualization = 1; 35 | precision_plot_save(results{1}.res, seq.ground_truth, seq.video_name, save_pic_dir, show_visualization); -------------------------------------------------------------------------------- /UAV123_utils/choose_video_UAV.m: -------------------------------------------------------------------------------- 1 | function video_name = choose_video_UAV(base_path) 2 | %CHOOSE_VIDEO 3 | % Allows the user to choose a video (groundtruth.txt in the given path). 4 | % 5 | % Joao F. Henriques, 2014 6 | % http://www.isr.uc.pt/~henriques/ 7 | % 8 | % Modified by Fuling Lin (fuling.lin@outlook.com) 9 | % 10 | %process path to make sure it's uniform 11 | if ispc(), base_path = strrep(base_path, '\', '/'); end 12 | if base_path(end) ~= '/', base_path(end+1) = '/'; end 13 | 14 | %list all sub-folders 15 | dirOutput = dir(fullfile(base_path, '*.txt')); 16 | contents = {dirOutput.name}'; 17 | names = {}; 18 | for k = 1:numel(contents), 19 | name = contents{k}(1:end-4); 20 | names{end+1} = name; 21 | end 22 | 23 | %=================================================================== 24 | % uncomment following scripts if you test on the entire benchmark 25 | % names(strcmpi('Jogging', names)) = []; 26 | % names(end+1:end+2) = {'Jogging.1', 'Jogging.2'}; 27 | % 28 | % names(strcmpi('Skating2', names)) = []; 29 | % names(end+1:end+2) = {'Skating2.1', 'Skating2.2'}; 30 | %=================================================================== 31 | 32 | %no sub-folders found 33 | if isempty(names), video_name = []; return; end 34 | 35 | %choice GUI 36 | choice = listdlg('ListString',names, 'Name','Choose video', 'SelectionMode','single'); 37 | 38 | if isempty(choice), %user cancelled 39 | video_name = []; 40 | else 41 | video_name = names{choice}; 42 | end 43 | 44 | end 45 | 46 | -------------------------------------------------------------------------------- /UAV123_utils/configSeqs.m: -------------------------------------------------------------------------------- 1 | function seqs=configSeqs(database_folder, type) 2 | dataSet = database_folder; 3 | 4 | switch type 5 | case 'UAV123_20L' 6 | seqs = {struct('name','bike1','path',[dataSet '\bike1\'],'startFrame',1,'endFrame',3085,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 7 | struct('name','bird1','path',[dataSet '\bird1\'],'startFrame',1,'endFrame',2437,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 8 | struct('name','car1','path',[dataSet '\car1\'],'startFrame',1,'endFrame',2629,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 9 | struct('name','car3','path',[dataSet '\car3\'],'startFrame',1,'endFrame',1717,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 10 | struct('name','car6','path',[dataSet '\car6\'],'startFrame',1,'endFrame',4861,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 11 | struct('name','car8','path',[dataSet '\car8\'],'startFrame',1,'endFrame',2575,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 12 | struct('name','car9','path',[dataSet '\car9\'],'startFrame',1,'endFrame',1879,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 13 | struct('name','car16','path',[dataSet '\car16\'],'startFrame',1,'endFrame',1993,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 14 | struct('name','group1','path',[dataSet '\group1\'],'startFrame',1,'endFrame',4873,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 15 | struct('name','group2','path',[dataSet '\group2\'],'startFrame',1,'endFrame',2683,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 16 | struct('name','group3','path',[dataSet '\group3\'],'startFrame',1,'endFrame',5527,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 17 | struct('name','person2','path',[dataSet '\person2\'],'startFrame',1,'endFrame',2623,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 18 | struct('name','person4','path',[dataSet '\person4\'],'startFrame',1,'endFrame',2743,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 19 | struct('name','person5','path',[dataSet '\person5\'],'startFrame',1,'endFrame',2101,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 20 | struct('name','person7','path',[dataSet '\person7\'],'startFrame',1,'endFrame',2065,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 21 | struct('name','person14','path',[dataSet '\person14\'],'startFrame',1,'endFrame',2923,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 22 | struct('name','person17','path',[dataSet '\person17\'],'startFrame',1,'endFrame',2347,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 23 | struct('name','person19','path',[dataSet '\person19\'],'startFrame',1,'endFrame',4357,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 24 | struct('name','person20','path',[dataSet '\person20\'],'startFrame',1,'endFrame',1783,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 25 | struct('name','uav1','path',[dataSet '\uav1\'],'startFrame',1,'endFrame',3469,'nz',6,'ext','jpg','init_rect', [0,0,0,0])}; 26 | case 'UAV123' 27 | seqs = {struct('name','bike1','path',[dataSet '\bike1\'],'startFrame',1,'endFrame',3085,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 28 | struct('name','bike2','path',[dataSet '\bike2\'],'startFrame',1,'endFrame',553,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 29 | struct('name','bike3','path',[dataSet '\bike3\'],'startFrame',1,'endFrame',433,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 30 | struct('name','bird1_1','path',[dataSet '\bird1\'],'startFrame',1,'endFrame',253,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 31 | struct('name','bird1_2','path',[dataSet '\bird1\'],'startFrame',775,'endFrame',1477,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 32 | struct('name','bird1_3','path',[dataSet '\bird1\'],'startFrame',1573,'endFrame',2437,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 33 | struct('name','boat1','path',[dataSet '\boat1\'],'startFrame',1,'endFrame',901,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 34 | struct('name','boat2','path',[dataSet '\boat2\'],'startFrame',1,'endFrame',799,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 35 | struct('name','boat3','path',[dataSet '\boat3\'],'startFrame',1,'endFrame',901,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 36 | struct('name','boat4','path',[dataSet '\boat4\'],'startFrame',1,'endFrame',553,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 37 | struct('name','boat5','path',[dataSet '\boat5\'],'startFrame',1,'endFrame',505,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 38 | struct('name','boat6','path',[dataSet '\boat6\'],'startFrame',1,'endFrame',805,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 39 | struct('name','boat7','path',[dataSet '\boat7\'],'startFrame',1,'endFrame',535,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 40 | struct('name','boat8','path',[dataSet '\boat8\'],'startFrame',1,'endFrame',685,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 41 | struct('name','boat9','path',[dataSet '\boat9\'],'startFrame',1,'endFrame',1399,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 42 | struct('name','building1','path',[dataSet '\building1\'],'startFrame',1,'endFrame',469,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 43 | struct('name','building2','path',[dataSet '\building2\'],'startFrame',1,'endFrame',577,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 44 | struct('name','building3','path',[dataSet '\building3\'],'startFrame',1,'endFrame',829,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 45 | struct('name','building4','path',[dataSet '\building4\'],'startFrame',1,'endFrame',787,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 46 | struct('name','building5','path',[dataSet '\building5\'],'startFrame',1,'endFrame',481,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 47 | struct('name','car1_1','path',[dataSet '\car1\'],'startFrame',1,'endFrame',751,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 48 | struct('name','car1_2','path',[dataSet '\car1\'],'startFrame',751,'endFrame',1627,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 49 | struct('name','car1_3','path',[dataSet '\car1\'],'startFrame',1627,'endFrame',2629,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 50 | struct('name','car2','path',[dataSet '\car2\'],'startFrame',1,'endFrame',1321,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 51 | struct('name','car3','path',[dataSet '\car3\'],'startFrame',1,'endFrame',1717,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 52 | struct('name','car4','path',[dataSet '\car4\'],'startFrame',1,'endFrame',1345,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 53 | struct('name','car5','path',[dataSet '\car5\'],'startFrame',1,'endFrame',745,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 54 | struct('name','car6_1','path',[dataSet '\car6\'],'startFrame',1,'endFrame',487,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 55 | struct('name','car6_2','path',[dataSet '\car6\'],'startFrame',487,'endFrame',1807,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 56 | struct('name','car6_3','path',[dataSet '\car6\'],'startFrame',1807,'endFrame',2953,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 57 | struct('name','car6_4','path',[dataSet '\car6\'],'startFrame',2953,'endFrame',3925,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 58 | struct('name','car6_5','path',[dataSet '\car6\'],'startFrame',3925,'endFrame',4861,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 59 | struct('name','car7','path',[dataSet '\car7\'],'startFrame',1,'endFrame',1033,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 60 | struct('name','car8_1','path',[dataSet '\car8\'],'startFrame',1,'endFrame',1357,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 61 | struct('name','car8_2','path',[dataSet '\car8\'],'startFrame',1357,'endFrame',2575,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 62 | struct('name','car9','path',[dataSet '\car9\'],'startFrame',1,'endFrame',1879,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 63 | struct('name','car10','path',[dataSet '\car10\'],'startFrame',1,'endFrame',1405,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 64 | struct('name','car11','path',[dataSet '\car11\'],'startFrame',1,'endFrame',337,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 65 | struct('name','car12','path',[dataSet '\car12\'],'startFrame',1,'endFrame',499,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 66 | struct('name','car13','path',[dataSet '\car13\'],'startFrame',1,'endFrame',415,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 67 | struct('name','car14','path',[dataSet '\car14\'],'startFrame',1,'endFrame',1327,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 68 | struct('name','car15','path',[dataSet '\car15\'],'startFrame',1,'endFrame',469,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 69 | struct('name','car16_1','path',[dataSet '\car16\'],'startFrame',1,'endFrame',415,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 70 | struct('name','car16_2','path',[dataSet '\car16\'],'startFrame',415,'endFrame',1993,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 71 | struct('name','car17','path',[dataSet '\car17\'],'startFrame',1,'endFrame',1057,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 72 | struct('name','car18','path',[dataSet '\car18\'],'startFrame',1,'endFrame',1207,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 73 | struct('name','group1_1','path',[dataSet '\group1\'],'startFrame',1,'endFrame',1333,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 74 | struct('name','group1_2','path',[dataSet '\group1\'],'startFrame',1333,'endFrame',2515,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 75 | struct('name','group1_3','path',[dataSet '\group1\'],'startFrame',2515,'endFrame',3925,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 76 | struct('name','group1_4','path',[dataSet '\group1\'],'startFrame',3925,'endFrame',4873,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 77 | struct('name','group2_1','path',[dataSet '\group2\'],'startFrame',1,'endFrame',907,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 78 | struct('name','group2_2','path',[dataSet '\group2\'],'startFrame',907,'endFrame',1771,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 79 | struct('name','group2_3','path',[dataSet '\group2\'],'startFrame',1771,'endFrame',2683,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 80 | struct('name','group3_1','path',[dataSet '\group3\'],'startFrame',1,'endFrame',1567,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 81 | struct('name','group3_2','path',[dataSet '\group3\'],'startFrame',1567,'endFrame',2827,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 82 | struct('name','group3_3','path',[dataSet '\group3\'],'startFrame',2827,'endFrame',4369,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 83 | struct('name','group3_4','path',[dataSet '\group3\'],'startFrame',4369,'endFrame',5527,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 84 | struct('name','person1','path',[dataSet '\person1\'],'startFrame',1,'endFrame',799,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 85 | struct('name','person2_1','path',[dataSet '\person2\'],'startFrame',1,'endFrame',1189,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 86 | struct('name','person2_2','path',[dataSet '\person2\'],'startFrame',1189,'endFrame',2623,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 87 | struct('name','person3','path',[dataSet '\person3\'],'startFrame',1,'endFrame',643,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 88 | struct('name','person4_1','path',[dataSet '\person4\'],'startFrame',1,'endFrame',1501,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 89 | struct('name','person4_2','path',[dataSet '\person4\'],'startFrame',1501,'endFrame',2743,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 90 | struct('name','person5_1','path',[dataSet '\person5\'],'startFrame',1,'endFrame',877,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 91 | struct('name','person5_2','path',[dataSet '\person5\'],'startFrame',877,'endFrame',2101,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 92 | struct('name','person6','path',[dataSet '\person6\'],'startFrame',1,'endFrame',901,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 93 | struct('name','person7_1','path',[dataSet '\person7\'],'startFrame',1,'endFrame',1249,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 94 | struct('name','person7_2','path',[dataSet '\person7\'],'startFrame',1249,'endFrame',2065,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 95 | struct('name','person8_1','path',[dataSet '\person8\'],'startFrame',1,'endFrame',1075,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 96 | struct('name','person8_2','path',[dataSet '\person8\'],'startFrame',1075,'endFrame',1525,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 97 | struct('name','person9','path',[dataSet '\person9\'],'startFrame',1,'endFrame',661,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 98 | struct('name','person10','path',[dataSet '\person10\'],'startFrame',1,'endFrame',1021,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 99 | struct('name','person11','path',[dataSet '\person11\'],'startFrame',1,'endFrame',721,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 100 | struct('name','person12_1','path',[dataSet '\person12\'],'startFrame',1,'endFrame',601,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 101 | struct('name','person12_2','path',[dataSet '\person12\'],'startFrame',601,'endFrame',1621,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 102 | struct('name','person13','path',[dataSet '\person13\'],'startFrame',1,'endFrame',883,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 103 | struct('name','person14_1','path',[dataSet '\person14\'],'startFrame',1,'endFrame',847,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 104 | struct('name','person14_2','path',[dataSet '\person14\'],'startFrame',847,'endFrame',1813,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 105 | struct('name','person14_3','path',[dataSet '\person14\'],'startFrame',1813,'endFrame',2923,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 106 | struct('name','person15','path',[dataSet '\person15\'],'startFrame',1,'endFrame',1339,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 107 | struct('name','person16','path',[dataSet '\person16\'],'startFrame',1,'endFrame',1147,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 108 | struct('name','person17_1','path',[dataSet '\person17\'],'startFrame',1,'endFrame',1501,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 109 | struct('name','person17_2','path',[dataSet '\person17\'],'startFrame',1501,'endFrame',2347,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 110 | struct('name','person18','path',[dataSet '\person18\'],'startFrame',1,'endFrame',1393,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 111 | struct('name','person19_1','path',[dataSet '\person19\'],'startFrame',1,'endFrame',1243,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 112 | struct('name','person19_2','path',[dataSet '\person19\'],'startFrame',1243,'endFrame',2791,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 113 | struct('name','person19_3','path',[dataSet '\person19\'],'startFrame',2791,'endFrame',4357,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 114 | struct('name','person20','path',[dataSet '\person20\'],'startFrame',1,'endFrame',1783,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 115 | struct('name','person21','path',[dataSet '\person21\'],'startFrame',1,'endFrame',487,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 116 | struct('name','person22','path',[dataSet '\person22\'],'startFrame',1,'endFrame',199,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 117 | struct('name','person23','path',[dataSet '\person23\'],'startFrame',1,'endFrame',397,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 118 | struct('name','truck1','path',[dataSet '\truck1\'],'startFrame',1,'endFrame',463,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 119 | struct('name','truck2','path',[dataSet '\truck2\'],'startFrame',1,'endFrame',385,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 120 | struct('name','truck3','path',[dataSet '\truck3\'],'startFrame',1,'endFrame',535,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 121 | struct('name','truck4_1','path',[dataSet '\truck4\'],'startFrame',1,'endFrame',577,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 122 | struct('name','truck4_2','path',[dataSet '\truck4\'],'startFrame',577,'endFrame',1261,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 123 | struct('name','uav1_1','path',[dataSet '\uav1\'],'startFrame',1,'endFrame',1555,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 124 | struct('name','uav1_2','path',[dataSet '\uav1\'],'startFrame',1555,'endFrame',2377,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 125 | struct('name','uav1_3','path',[dataSet '\uav1\'],'startFrame',2473,'endFrame',3469,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 126 | struct('name','uav2','path',[dataSet '\uav2\'],'startFrame',1,'endFrame',133,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 127 | struct('name','uav3','path',[dataSet '\uav3\'],'startFrame',1,'endFrame',265,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 128 | struct('name','uav4','path',[dataSet '\uav4\'],'startFrame',1,'endFrame',157,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 129 | struct('name','uav5','path',[dataSet '\uav5\'],'startFrame',1,'endFrame',139,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 130 | struct('name','uav6','path',[dataSet '\uav6\'],'startFrame',1,'endFrame',109,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 131 | struct('name','uav7','path',[dataSet '\uav7\'],'startFrame',1,'endFrame',373,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 132 | struct('name','uav8','path',[dataSet '\uav8\'],'startFrame',1,'endFrame',301,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 133 | struct('name','wakeboard1','path',[dataSet '\wakeboard1\'],'startFrame',1,'endFrame',421,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 134 | struct('name','wakeboard2','path',[dataSet '\wakeboard2\'],'startFrame',1,'endFrame',733,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 135 | struct('name','wakeboard3','path',[dataSet '\wakeboard3\'],'startFrame',1,'endFrame',823,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 136 | struct('name','wakeboard4','path',[dataSet '\wakeboard4\'],'startFrame',1,'endFrame',697,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 137 | struct('name','wakeboard5','path',[dataSet '\wakeboard5\'],'startFrame',1,'endFrame',1675,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 138 | struct('name','wakeboard6','path',[dataSet '\wakeboard6\'],'startFrame',1,'endFrame',1165,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 139 | struct('name','wakeboard7','path',[dataSet '\wakeboard7\'],'startFrame',1,'endFrame',199,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 140 | struct('name','wakeboard8','path',[dataSet '\wakeboard8\'],'startFrame',1,'endFrame',1543,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 141 | struct('name','wakeboard9','path',[dataSet '\wakeboard9\'],'startFrame',1,'endFrame',355,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 142 | struct('name','wakeboard10','path',[dataSet '\wakeboard10\'],'startFrame',1,'endFrame',469,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 143 | struct('name','car1_s','path',[dataSet '\car1_s\'],'startFrame',1,'endFrame',1475,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 144 | struct('name','car2_s','path',[dataSet '\car2_s\'],'startFrame',1,'endFrame',320,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 145 | struct('name','car3_s','path',[dataSet '\car3_s\'],'startFrame',1,'endFrame',1300,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 146 | struct('name','car4_s','path',[dataSet '\car4_s\'],'startFrame',1,'endFrame',830,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 147 | struct('name','person1_s','path',[dataSet '\person1_s\'],'startFrame',1,'endFrame',1600,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 148 | struct('name','person2_s','path',[dataSet '\person2_s\'],'startFrame',1,'endFrame',250,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 149 | struct('name','person3_s','path',[dataSet '\person3_s\'],'startFrame',1,'endFrame',505,'nz',6,'ext','jpg','init_rect', [0,0,0,0])}; 150 | case 'UAV123_10fps' 151 | seqs = { 152 | struct('name','bike1','path',[dataSet '\bike1\'],'startFrame',1,'endFrame',1029,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 153 | struct('name','bike2','path',[dataSet '\bike2\'],'startFrame',1,'endFrame',185,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 154 | struct('name','bike3','path',[dataSet '\bike3\'],'startFrame',1,'endFrame',145,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 155 | struct('name','bird1_1','path',[dataSet '\bird1\'],'startFrame',1,'endFrame',85,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 156 | struct('name','bird1_2','path',[dataSet '\bird1\'],'startFrame',259,'endFrame',493,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 157 | struct('name','bird1_3','path',[dataSet '\bird1\'],'startFrame',525,'endFrame',813,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 158 | struct('name','boat1','path',[dataSet '\boat1\'],'startFrame',1,'endFrame',301,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 159 | struct('name','boat2','path',[dataSet '\boat2\'],'startFrame',1,'endFrame',267,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 160 | struct('name','boat3','path',[dataSet '\boat3\'],'startFrame',1,'endFrame',301,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 161 | struct('name','boat4','path',[dataSet '\boat4\'],'startFrame',1,'endFrame',185,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 162 | struct('name','boat5','path',[dataSet '\boat5\'],'startFrame',1,'endFrame',169,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 163 | struct('name','boat6','path',[dataSet '\boat6\'],'startFrame',1,'endFrame',269,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 164 | struct('name','boat7','path',[dataSet '\boat7\'],'startFrame',1,'endFrame',179,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 165 | struct('name','boat8','path',[dataSet '\boat8\'],'startFrame',1,'endFrame',229,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 166 | struct('name','boat9','path',[dataSet '\boat9\'],'startFrame',1,'endFrame',467,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 167 | struct('name','building1','path',[dataSet '\building1\'],'startFrame',1,'endFrame',157,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 168 | struct('name','building2','path',[dataSet '\building2\'],'startFrame',1,'endFrame',193,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 169 | struct('name','building3','path',[dataSet '\building3\'],'startFrame',1,'endFrame',277,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 170 | struct('name','building4','path',[dataSet '\building4\'],'startFrame',1,'endFrame',263,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 171 | struct('name','building5','path',[dataSet '\building5\'],'startFrame',1,'endFrame',161,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 172 | struct('name','car1_1','path',[dataSet '\car1\'],'startFrame',1,'endFrame',251,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 173 | struct('name','car1_2','path',[dataSet '\car1\'],'startFrame',251,'endFrame',543,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 174 | struct('name','car1_3','path',[dataSet '\car1\'],'startFrame',543,'endFrame',877,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 175 | struct('name','car2','path',[dataSet '\car2\'],'startFrame',1,'endFrame',441,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 176 | struct('name','car3','path',[dataSet '\car3\'],'startFrame',1,'endFrame',573,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 177 | struct('name','car4','path',[dataSet '\car4\'],'startFrame',1,'endFrame',449,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 178 | struct('name','car5','path',[dataSet '\car5\'],'startFrame',1,'endFrame',249,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 179 | struct('name','car6_1','path',[dataSet '\car6\'],'startFrame',1,'endFrame',163,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 180 | struct('name','car6_2','path',[dataSet '\car6\'],'startFrame',163,'endFrame',603,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 181 | struct('name','car6_3','path',[dataSet '\car6\'],'startFrame',603,'endFrame',985,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 182 | struct('name','car6_4','path',[dataSet '\car6\'],'startFrame',985,'endFrame',1309,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 183 | struct('name','car6_5','path',[dataSet '\car6\'],'startFrame',1309,'endFrame',1621,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 184 | struct('name','car7','path',[dataSet '\car7\'],'startFrame',1,'endFrame',345,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 185 | struct('name','car8_1','path',[dataSet '\car8\'],'startFrame',1,'endFrame',453,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 186 | struct('name','car8_2','path',[dataSet '\car8\'],'startFrame',453,'endFrame',859,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 187 | struct('name','car9','path',[dataSet '\car9\'],'startFrame',1,'endFrame',627,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 188 | struct('name','car10','path',[dataSet '\car10\'],'startFrame',1,'endFrame',469,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 189 | struct('name','car11','path',[dataSet '\car11\'],'startFrame',1,'endFrame',113,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 190 | struct('name','car12','path',[dataSet '\car12\'],'startFrame',1,'endFrame',167,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 191 | struct('name','car13','path',[dataSet '\car13\'],'startFrame',1,'endFrame',139,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 192 | struct('name','car14','path',[dataSet '\car14\'],'startFrame',1,'endFrame',443,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 193 | struct('name','car15','path',[dataSet '\car15\'],'startFrame',1,'endFrame',157,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 194 | struct('name','car16_1','path',[dataSet '\car16\'],'startFrame',1,'endFrame',139,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 195 | struct('name','car16_2','path',[dataSet '\car16\'],'startFrame',139,'endFrame',665,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 196 | struct('name','car17','path',[dataSet '\car17\'],'startFrame',1,'endFrame',353,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 197 | struct('name','car18','path',[dataSet '\car18\'],'startFrame',1,'endFrame',403,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 198 | struct('name','group1_1','path',[dataSet '\group1\'],'startFrame',1,'endFrame',445,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 199 | struct('name','group1_2','path',[dataSet '\group1\'],'startFrame',445,'endFrame',839,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 200 | struct('name','group1_3','path',[dataSet '\group1\'],'startFrame',839,'endFrame',1309,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 201 | struct('name','group1_4','path',[dataSet '\group1\'],'startFrame',1309,'endFrame',1625,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 202 | struct('name','group2_1','path',[dataSet '\group2\'],'startFrame',1,'endFrame',303,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 203 | struct('name','group2_2','path',[dataSet '\group2\'],'startFrame',303,'endFrame',591,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 204 | struct('name','group2_3','path',[dataSet '\group2\'],'startFrame',591,'endFrame',895,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 205 | struct('name','group3_1','path',[dataSet '\group3\'],'startFrame',1,'endFrame',523,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 206 | struct('name','group3_2','path',[dataSet '\group3\'],'startFrame',523,'endFrame',943,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 207 | struct('name','group3_3','path',[dataSet '\group3\'],'startFrame',943,'endFrame',1457,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 208 | struct('name','group3_4','path',[dataSet '\group3\'],'startFrame',1457,'endFrame',1843,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 209 | struct('name','person1','path',[dataSet '\person1\'],'startFrame',1,'endFrame',267,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 210 | struct('name','person2_1','path',[dataSet '\person2\'],'startFrame',1,'endFrame',397,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 211 | struct('name','person2_2','path',[dataSet '\person2\'],'startFrame',397,'endFrame',875,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 212 | struct('name','person3','path',[dataSet '\person3\'],'startFrame',1,'endFrame',215,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 213 | struct('name','person4_1','path',[dataSet '\person4\'],'startFrame',1,'endFrame',501,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 214 | struct('name','person4_2','path',[dataSet '\person4\'],'startFrame',501,'endFrame',915,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 215 | struct('name','person5_1','path',[dataSet '\person5\'],'startFrame',1,'endFrame',293,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 216 | struct('name','person5_2','path',[dataSet '\person5\'],'startFrame',293,'endFrame',701,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 217 | struct('name','person6','path',[dataSet '\person6\'],'startFrame',1,'endFrame',301,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 218 | struct('name','person7_1','path',[dataSet '\person7\'],'startFrame',1,'endFrame',417,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 219 | struct('name','person7_2','path',[dataSet '\person7\'],'startFrame',417,'endFrame',689,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 220 | struct('name','person8_1','path',[dataSet '\person8\'],'startFrame',1,'endFrame',359,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 221 | struct('name','person8_2','path',[dataSet '\person8\'],'startFrame',359,'endFrame',509,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 222 | struct('name','person9','path',[dataSet '\person9\'],'startFrame',1,'endFrame',221,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 223 | struct('name','person10','path',[dataSet '\person10\'],'startFrame',1,'endFrame',341,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 224 | struct('name','person11','path',[dataSet '\person11\'],'startFrame',1,'endFrame',241,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 225 | struct('name','person12_1','path',[dataSet '\person12\'],'startFrame',1,'endFrame',201,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 226 | struct('name','person12_2','path',[dataSet '\person12\'],'startFrame',201,'endFrame',541,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 227 | struct('name','person13','path',[dataSet '\person13\'],'startFrame',1,'endFrame',295,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 228 | struct('name','person14_1','path',[dataSet '\person14\'],'startFrame',1,'endFrame',283,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 229 | struct('name','person14_2','path',[dataSet '\person14\'],'startFrame',283,'endFrame',605,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 230 | struct('name','person14_3','path',[dataSet '\person14\'],'startFrame',605,'endFrame',975,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 231 | struct('name','person15','path',[dataSet '\person15\'],'startFrame',1,'endFrame',447,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 232 | struct('name','person16','path',[dataSet '\person16\'],'startFrame',1,'endFrame',383,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 233 | struct('name','person17_1','path',[dataSet '\person17\'],'startFrame',1,'endFrame',501,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 234 | struct('name','person17_2','path',[dataSet '\person17\'],'startFrame',501,'endFrame',783,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 235 | struct('name','person18','path',[dataSet '\person18\'],'startFrame',1,'endFrame',465,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 236 | struct('name','person19_1','path',[dataSet '\person19\'],'startFrame',1,'endFrame',415,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 237 | struct('name','person19_2','path',[dataSet '\person19\'],'startFrame',415,'endFrame',931,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 238 | struct('name','person19_3','path',[dataSet '\person19\'],'startFrame',931,'endFrame',1453,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 239 | struct('name','person20','path',[dataSet '\person20\'],'startFrame',1,'endFrame',595,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 240 | struct('name','person21','path',[dataSet '\person21\'],'startFrame',1,'endFrame',163,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 241 | struct('name','person22','path',[dataSet '\person22\'],'startFrame',1,'endFrame',67,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 242 | struct('name','person23','path',[dataSet '\person23\'],'startFrame',1,'endFrame',133,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 243 | struct('name','truck1','path',[dataSet '\truck1\'],'startFrame',1,'endFrame',155,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 244 | struct('name','truck2','path',[dataSet '\truck2\'],'startFrame',1,'endFrame',129,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 245 | struct('name','truck3','path',[dataSet '\truck3\'],'startFrame',1,'endFrame',179,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 246 | struct('name','truck4_1','path',[dataSet '\truck4\'],'startFrame',1,'endFrame',193,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 247 | struct('name','truck4_2','path',[dataSet '\truck4\'],'startFrame',193,'endFrame',421,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 248 | struct('name','uav1_1','path',[dataSet '\uav1\'],'startFrame',1,'endFrame',519,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 249 | struct('name','uav1_2','path',[dataSet '\uav1\'],'startFrame',519,'endFrame',793,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 250 | struct('name','uav1_3','path',[dataSet '\uav1\'],'startFrame',825,'endFrame',1157,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 251 | struct('name','uav2','path',[dataSet '\uav2\'],'startFrame',1,'endFrame',45,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 252 | struct('name','uav3','path',[dataSet '\uav3\'],'startFrame',1,'endFrame',89,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 253 | struct('name','uav4','path',[dataSet '\uav4\'],'startFrame',1,'endFrame',53,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 254 | struct('name','uav5','path',[dataSet '\uav5\'],'startFrame',1,'endFrame',47,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 255 | struct('name','uav6','path',[dataSet '\uav6\'],'startFrame',1,'endFrame',37,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 256 | struct('name','uav7','path',[dataSet '\uav7\'],'startFrame',1,'endFrame',125,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 257 | struct('name','uav8','path',[dataSet '\uav8\'],'startFrame',1,'endFrame',101,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 258 | struct('name','wakeboard1','path',[dataSet '\wakeboard1\'],'startFrame',1,'endFrame',141,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 259 | struct('name','wakeboard2','path',[dataSet '\wakeboard2\'],'startFrame',1,'endFrame',245,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 260 | struct('name','wakeboard3','path',[dataSet '\wakeboard3\'],'startFrame',1,'endFrame',275,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 261 | struct('name','wakeboard4','path',[dataSet '\wakeboard4\'],'startFrame',1,'endFrame',233,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 262 | struct('name','wakeboard5','path',[dataSet '\wakeboard5\'],'startFrame',1,'endFrame',559,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 263 | struct('name','wakeboard6','path',[dataSet '\wakeboard6\'],'startFrame',1,'endFrame',389,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 264 | struct('name','wakeboard7','path',[dataSet '\wakeboard7\'],'startFrame',1,'endFrame',67,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 265 | struct('name','wakeboard8','path',[dataSet '\wakeboard8\'],'startFrame',1,'endFrame',515,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 266 | struct('name','wakeboard9','path',[dataSet '\wakeboard9\'],'startFrame',1,'endFrame',119,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 267 | struct('name','wakeboard10','path',[dataSet '\wakeboard10\'],'startFrame',1,'endFrame',157,'nz',6,'ext','jpg','init_rect',[0,0,0,0]),... 268 | struct('name','car1_s','path',[dataSet '\car1_s\'],'startFrame',1,'endFrame',492,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 269 | struct('name','car2_s','path',[dataSet '\car2_s\'],'startFrame',1,'endFrame',107,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 270 | struct('name','car3_s','path',[dataSet '\car3_s\'],'startFrame',1,'endFrame',434,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 271 | struct('name','car4_s','path',[dataSet '\car4_s\'],'startFrame',1,'endFrame',277,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 272 | struct('name','person1_s','path',[dataSet '\person1_s\'],'startFrame',1,'endFrame',534,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 273 | struct('name','person2_s','path',[dataSet '\person2_s\'],'startFrame',1,'endFrame',84,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 274 | struct('name','person3_s','path',[dataSet '\person3_s\'],'startFrame',1,'endFrame',169,'nz',6,'ext','jpg','init_rect', [0,0,0,0]),... 275 | }; 276 | end 277 | -------------------------------------------------------------------------------- /UAV123_utils/load_video_info_UAV123.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/UAV123_utils/load_video_info_UAV123.m -------------------------------------------------------------------------------- /UAV123_utils/load_video_information.m: -------------------------------------------------------------------------------- 1 | function seq = load_video_information(type) 2 | 3 | switch type 4 | case 'UAV123_10fps' 5 | database_folder = 'seq\data_seq'; 6 | ground_truth_folder = 'seq\anno'; 7 | video_name = choose_video_UAV(ground_truth_folder); 8 | seq = load_video_info_UAV123(video_name, database_folder, ground_truth_folder, type); 9 | seq.video_name = video_name; 10 | end -------------------------------------------------------------------------------- /UAV123_utils/precision_plot_save.m: -------------------------------------------------------------------------------- 1 | function precisions = precision_plot_save(positions, ground_truth, title, savedir, show) 2 | 3 | %PRECISION_PLOT 4 | % Calculates precision for a series of distance thresholds (percentage of 5 | % frames where the distance to the ground truth is within the threshold). 6 | % The results are shown in a new figure if SHOW is true. 7 | % 8 | % Accepts positions and ground truth as Nx2 matrices (for N frames), and 9 | % a title string. 10 | % 11 | % Joao F. Henriques, 2014 12 | % http://www.isr.uc.pt/~henriques/ 13 | 14 | 15 | max_threshold = 50; %used for graphs in the paper 16 | 17 | 18 | precisions = zeros(max_threshold, 1); 19 | 20 | if size(positions,1) ~= size(ground_truth,1) 21 | % fprintf('%12s - Number of ground truth frames does not match number of tracked frames.\n', title) 22 | 23 | %just ignore any extra frames, in either results or ground truth 24 | n = min(size(positions,1), size(ground_truth,1)); 25 | positions(n+1:end,:) = []; 26 | ground_truth(n+1:end,:) = []; 27 | end 28 | 29 | % calculate distances to ground truth over all frames 30 | distances = sqrt((positions(:,1) - ground_truth(:,1)).^2 + ... 31 | (positions(:,2) - ground_truth(:,2)).^2); 32 | distances(isnan(distances)) = []; 33 | 34 | % compute precisions 35 | for p = 1:max_threshold 36 | precisions(p) = nnz(distances <= p) / numel(distances); 37 | end 38 | 39 | % plot the precisions 40 | if show == 1 41 | han = figure('Name',['Precisions - ' title]); 42 | set(han,'DefaultFigureVisible','on'); 43 | plot(precisions, 'k-', 'LineWidth',2); 44 | xlabel('Threshold'), ylabel('Precision'); 45 | saveas(han,[savedir, title,'.png']); 46 | else 47 | han = figure('Name',['Precisions - ' title]); 48 | set(han,'DefaultFigureVisible','off'); 49 | plot(precisions, 'k-', 'LineWidth',2); 50 | xlabel('Threshold'), ylabel('Precision'); 51 | saveas(han,[savedir, title,'.png']); 52 | end 53 | 54 | end 55 | 56 | -------------------------------------------------------------------------------- /external_libs/gradientMex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/external_libs/gradientMex.mexw64 -------------------------------------------------------------------------------- /external_libs/imResampleMex.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Piotr's Computer Vision Matlab Toolbox Version 3.00 3 | * Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] 4 | * Licensed under the Simplified BSD License [see external/bsd.txt] 5 | *******************************************************************************/ 6 | #include "wrappers.hpp" 7 | #include "string.h" 8 | #include 9 | #include 10 | #include "sse.hpp" 11 | typedef unsigned char uchar; 12 | 13 | // compute interpolation values for single column for resapling 14 | template void resampleCoef( int ha, int hb, int &n, int *&yas, 15 | int *&ybs, T *&wts, int bd[2], int pad=0 ) 16 | { 17 | const T s = T(hb)/T(ha), sInv = 1/s; T wt, wt0=T(1e-3)*s; 18 | bool ds=ha>hb; int nMax; bd[0]=bd[1]=0; 19 | if(ds) { n=0; nMax=ha+(pad>2 ? pad : 2)*hb; } else { n=nMax=hb; } 20 | // initialize memory 21 | wts = (T*)alMalloc(nMax*sizeof(T),16); 22 | yas = (int*)alMalloc(nMax*sizeof(int),16); 23 | ybs = (int*)alMalloc(nMax*sizeof(int),16); 24 | if( ds ) for( int yb=0; ybwt0 && ya>=0) { ybs[n]=yb; yas[n]=ya; wts[n]=wt; n++; n1++; W+=wt; } 31 | } 32 | if(W>1) for( int i=0; ibd[0]) bd[0]=n1; 34 | while( n1=0 && ya=ha-1) { ya=ha-1; bd[1]++; } 40 | ybs[yb]=yb; yas[yb]=ya; wts[yb]=wt; 41 | } 42 | } 43 | 44 | // resample A using bilinear interpolation and and store result in B 45 | template 46 | void resample( T *A, T *B, int ha, int hb, int wa, int wb, int d, T r ) { 47 | int hn, wn, x, x1, y, z, xa, xb, ya; T *A0, *A1, *A2, *A3, *B0, wt, wt1; 48 | T *C = (T*) alMalloc((ha+4)*sizeof(T),16); for(y=ha; y( wa, wb, wn, xas, xbs, xwts, xbd, 0 ); 53 | resampleCoef( ha, hb, hn, yas, ybs, ywts, ybd, 4 ); 54 | if( wa==2*wb ) r/=2; if( wa==3*wb ) r/=3; if( wa==4*wb ) r/=4; 55 | r/=T(1+1e-6); for( y=0; y C) 66 | #define FORs(X) if(sse) for(; ywb ) { 78 | int m=1; while( x1+m=4) { FORs(ADD(U(0),U(1),U(2),U(3))); FORr(V(0)+V(1)+V(2)+V(3)); } 86 | #undef U 87 | #undef V 88 | for( int x0=4; x0=wb-xbd[1]; x1++; 95 | if(xBd) memcpy(C,A0,ha*sizeof(T)); 96 | if(!xBd) FORs(ADD(MUL(LDu(Af0[y]),SET(wtf)),MUL(LDu(Af1[y]),SET(wt1f)))); 97 | if(!xBd) FORr( A0[y]*wt + A1[y]*wt1 ); 98 | } 99 | #undef FORs 100 | #undef FORr 101 | // resample along y direction (B -> C) 102 | if( ha==hb*2 ) { 103 | T r2 = r/2; int k=((~((size_t) B0) + 1) & 15)/4; y=0; 104 | for( ; yhb ) { 113 | y=0; 114 | //if( sse && ybd[0]<=4 ) for(; y4) for(; y1 ) mexErrMsgTxt("One output expected."); 141 | nDims=mxGetNumberOfDimensions(prhs[0]); id=mxGetClassID(prhs[0]); 142 | ns = (int*) mxGetDimensions(prhs[0]); nCh=(nDims==2) ? 1 : ns[2]; 143 | if( (nDims!=2 && nDims!=3) || 144 | (id!=mxSINGLE_CLASS && id!=mxDOUBLE_CLASS && id!=mxUINT8_CLASS) ) 145 | mexErrMsgTxt("A should be 2D or 3D single, double or uint8 array."); 146 | ms[0]=(int)mxGetScalar(prhs[1]); ms[1]=(int)mxGetScalar(prhs[2]); ms[2]=nCh; 147 | if( ms[0]<=0 || ms[1]<=0 ) mexErrMsgTxt("downsampling factor too small."); 148 | nrm=(double)mxGetScalar(prhs[3]); 149 | 150 | // create output array 151 | plhs[0] = mxCreateNumericArray(3, (const mwSize*) ms, id, mxREAL); 152 | n=ns[0]*ns[1]*nCh; m=ms[0]*ms[1]*nCh; 153 | 154 | // perform resampling (w appropriate type) 155 | A=mxGetData(prhs[0]); B=mxGetData(plhs[0]); 156 | if( id==mxDOUBLE_CLASS ) { 157 | resample((double*)A, (double*)B, ns[0], ms[0], ns[1], ms[1], nCh, nrm); 158 | } else if( id==mxSINGLE_CLASS ) { 159 | resample((float*)A, (float*)B, ns[0], ms[0], ns[1], ms[1], nCh, float(nrm)); 160 | } else if( id==mxUINT8_CLASS ) { 161 | float *A1 = (float*) mxMalloc(n*sizeof(float)); 162 | float *B1 = (float*) mxCalloc(m,sizeof(float)); 163 | for(int i=0; i 1.00, Initial Release 66 | % 2010/Feb/15 --> 1.10, Fixed largearrardims typo to largeArrayDims 67 | % 2010/Oct/04 --> 1.40, Updated support for OpenMP compiling 68 | % 69 | %************************************************************************** 70 | 71 | function mtimesx_build(x) 72 | disp(' '); 73 | disp('... Build routine for mtimesx'); 74 | 75 | TRUE = 1; 76 | FALSE = 0; 77 | 78 | %\ 79 | % Check for number of inputs & outputs 80 | %/ 81 | 82 | noopenmp = FALSE; 83 | if( nargin == 1 ) 84 | if( isequal(upper(x),'NOOPENMP') ) 85 | noopenmp = TRUE; 86 | else 87 | error('Invalid input.'); 88 | end 89 | elseif( nargin ~= 0 ) 90 | error('Too many inputs. Expected none.'); 91 | end 92 | if( nargout ~= 0 ) 93 | error('Too many outputs. Expected none.'); 94 | end 95 | 96 | %\ 97 | % Check for non-PC 98 | %/ 99 | 100 | disp('... Checking for PC'); 101 | try 102 | % ispc does not appear in MATLAB 5.3 103 | pc = ispc ; 104 | catch 105 | % if ispc fails, assume we are on a Windows PC if it's not unix 106 | pc = ~isunix ; 107 | end 108 | 109 | if( ~pc ) 110 | disp('building linux version'); 111 | mex('mtimesx.c','-DDEFINEUNIX','-largeArrayDims','-lmwblas'); 112 | return; 113 | end 114 | 115 | %\ 116 | % Check to see that mtimesx.c source code is present 117 | %/ 118 | 119 | disp('... Finding path of mtimesx C source code files'); 120 | try 121 | mname = mfilename('fullpath'); 122 | catch 123 | mname = mfilename; 124 | end 125 | cname = [mname(1:end-6) '.c']; 126 | if( isempty(dir(cname)) ) 127 | disp('Cannot find the file mtimesx.c in the same directory as the'); 128 | disp('file mtimesx_build.m. Please ensure that they are in the same'); 129 | disp('directory and try again. The following file was not found:'); 130 | disp(' '); 131 | disp(cname); 132 | disp(' '); 133 | error('Unable to compile mtimesx.c'); 134 | end 135 | disp(['... Found file mtimesx.c in ' cname]); 136 | 137 | %\ 138 | % Check to see that mtimesx_RealTimesReal.c source code is present 139 | %/ 140 | 141 | rname = [mname(1:end-13) 'mtimesx_RealTimesReal.c']; 142 | if( isempty(dir(rname)) ) 143 | disp('Cannot find the file mtimesx_RealTimesReal.c in the same'); 144 | disp('directory as the file mtimesx_build.m. Please ensure that'); 145 | disp('they are in the same directory and try again. The'); 146 | disp('following file was not found:'); 147 | disp(' '); 148 | disp(rname); 149 | disp(' '); 150 | error('Unable to compile mtimesx.c'); 151 | end 152 | disp(['... Found file mtimesx_RealTimesReal.c in ' rname]); 153 | 154 | %\ 155 | % Open the current mexopts.bat file 156 | %/ 157 | 158 | matlab_ver = version('-release'); 159 | if str2num(matlab_ver(1:4)) >= 2014 160 | mexopts = [prefdir '\mex_C++_win64.xml']; 161 | else 162 | mexopts = [prefdir '\mexopts.bat']; 163 | end 164 | fid = fopen(mexopts); 165 | if( fid == -1 ) 166 | error('A C/C++ compiler has not been selected with mex -setup'); 167 | end 168 | disp(['... Opened the mexopts.bat file in ' mexopts]); 169 | disp('... Reading the mexopts.bat file to find the compiler and options used.'); 170 | 171 | %\ 172 | % Check for the correct compiler selected. 173 | %/ 174 | 175 | ok_cl = FALSE; 176 | ok_lcc = FALSE; 177 | omp_option = ''; 178 | compiler = '(unknown)'; 179 | compilername = ''; 180 | while( TRUE ) 181 | tline = fgets(fid); 182 | if( isequal(tline,-1) ) 183 | break; 184 | else 185 | if( isempty(compilername) ) 186 | y = findstr(tline,'OPTS.BAT'); 187 | if( ~isempty(y) ) 188 | x = findstr(tline,'rem '); 189 | if( ~isempty(x) ) 190 | compilername = tline(x+4:y-1); 191 | end 192 | end 193 | end 194 | x = findstr(tline,'COMPILER=lcc'); 195 | if( ~isempty(x) ) 196 | ok_lcc = TRUE; 197 | libdir = 'lcc'; 198 | compiler = 'LCC'; 199 | disp(['... ' compiler ' is the selected compiler']); 200 | break; 201 | end 202 | x = findstr(tline,'COMPILER=cl'); 203 | if( ~isempty(x) ) 204 | ok_cl = TRUE; 205 | libdir = 'microsoft'; 206 | compiler = ['Microsoft_' compilername '_cl']; 207 | omp_option = ' /openmp'; 208 | disp(['... ' compiler ' is the selected compiler']); 209 | break; 210 | end 211 | x = findstr(tline,'COMPILER=bcc32'); 212 | if( ~isempty(x) ) 213 | ok_cl = TRUE; 214 | libdir = 'microsoft'; 215 | compiler = ['Borland_' compilername '_bcc32']; 216 | disp(['... ' compiler ' is the selected compiler']); 217 | disp('... Assuming that Borland will link with Microsoft libraries'); 218 | break; 219 | end 220 | x = findstr(tline,'COMPILER=icl'); 221 | if( ~isempty(x) ) 222 | ok_cl = TRUE; 223 | if( pc ) 224 | omp_option = ' -Qopenmp'; 225 | else 226 | omp_option = ' -openmp'; 227 | end 228 | libdir = 'microsoft'; 229 | compiler = ['Intel_' compilername '_icl']; 230 | disp(['... ' compiler ' is the selected compiler']); 231 | disp('... Assuming that Intel will link with Microsoft libraries'); 232 | break; 233 | end 234 | x = findstr(tline,'COMPILER=wc1386'); 235 | if( ~isempty(x) ) 236 | ok_cl = TRUE; 237 | libdir = 'microsoft'; 238 | compiler = ['Watcom_' compilername '_wc1386']; 239 | disp(['... ' compiler ' is the selected compiler']); 240 | disp('... Assuming that Watcom will link with Microsoft libraries'); 241 | break; 242 | end 243 | x = findstr(tline,'COMPILER=gcc'); 244 | if( ~isempty(x) ) 245 | ok_cl = TRUE; 246 | libdir = 'microsoft'; 247 | omp_option = ' -fopenmp'; 248 | compiler = 'GCC'; 249 | disp(['... ' compiler ' is the selected compiler']); 250 | disp('... Assuming that GCC will link with Microsoft libraries'); 251 | break; 252 | end 253 | end 254 | end 255 | fclose(fid); 256 | 257 | %\ 258 | % MS Visual C/C++ or lcc compiler has not been selected 259 | %/ 260 | 261 | if( ~(ok_cl | ok_lcc) ) 262 | warning('... Supported C/C++ compiler has not been selected with mex -setup'); 263 | warning('... Assuming that Selected Compiler will link with Microsoft libraries'); 264 | warning('... Continuing at risk ...'); 265 | libdir = 'microsoft'; 266 | end 267 | 268 | %\ 269 | % If an OpenMP supported compiler is potentially present, make sure that the 270 | % necessary compile option is present in the mexopts.bat file on the COMPFLAGS 271 | % line. If necessary, build a new mexopts.bat file with the correct option 272 | % added to the COMPFLAGS line. 273 | %/ 274 | 275 | while( TRUE ) 276 | ok_openmp = FALSE; 277 | ok_compflags = FALSE; 278 | xname = ''; 279 | if( isempty(omp_option) ) 280 | disp('... OpenMP compiler not detected ... you may want to check this website:'); 281 | disp(' http://openmp.org/wp/openmp-compilers/'); 282 | elseif( noopenmp ) 283 | disp(['... OpenMP compiler potentially detected, but not checking for ''' omp_option ''' compile option']); 284 | else 285 | disp('... OpenMP compiler potentially detected'); 286 | disp(['... Checking to see that the ''' omp_option ''' compile option is present']); 287 | fid = fopen(mexopts); 288 | while( TRUE ) 289 | tline = fgets(fid); 290 | if( isequal(tline,-1) ) 291 | break; 292 | else 293 | x = findstr(tline,'set COMPFLAGS'); 294 | if( ~isempty(x) ) 295 | ok_compflags = TRUE; 296 | x = findstr(tline,omp_option); 297 | if( ~isempty(x) ) 298 | ok_openmp = TRUE; 299 | end 300 | break; 301 | end 302 | end 303 | end 304 | fclose(fid); 305 | if( ~ok_compflags ) 306 | warning(['... COMPFLAGS line not found ... ''' omp_option ''' will not be added.']); 307 | elseif( ~ok_openmp ) 308 | disp(['... The ''' omp_option ''' compile option is not present ... adding it']); 309 | xname = [mname(1:end-6) '_mexopts.bat']; 310 | disp(['... Creating custom options file ' xname ' with the ''' omp_option ''' option added.']); 311 | fid = fopen(mexopts); 312 | fidx = fopen(xname,'w'); 313 | if( fidx == -1 ) 314 | xname = ''; 315 | warning(['... Unable to create custom mexopts.bat file ... ''' omp_option ''' will not be added']); 316 | else 317 | while( TRUE ) 318 | tline = fgets(fid); 319 | if( isequal(tline,-1) ) 320 | break; 321 | else 322 | x = findstr(tline,'set COMPFLAGS'); 323 | if( ~isempty(x) ) 324 | n = numel(tline); 325 | e = n; 326 | while( tline(e) < 32 ) 327 | e = e - 1; 328 | end 329 | tline = [tline(1:e) omp_option tline(e+1:n)]; 330 | end 331 | fwrite(fidx,tline); 332 | end 333 | end 334 | fclose(fidx); 335 | end 336 | fclose(fid); 337 | end 338 | end 339 | 340 | %\ 341 | % Construct full file name of libmwblas.lib and libmwlapack.lib. Note that 342 | % not all versions have both files. Earlier versions only had the lapack 343 | % file, which contained both blas and lapack routines. 344 | %/ 345 | 346 | comp = computer; 347 | mext = mexext; 348 | lc = length(comp); 349 | lm = length(mext); 350 | cbits = comp(max(1:lc-1):lc); 351 | mbits = mext(max(1:lm-1):lm); 352 | if( isequal(cbits,'64') | isequal(mbits,'64') ) 353 | compdir = 'win64'; 354 | largearraydims = '-largeArrayDims'; 355 | else 356 | compdir = 'win32'; 357 | largearraydims = ''; 358 | end 359 | 360 | lib_blas = [matlabroot '\extern\lib\' compdir '\' libdir '\libmwblas.lib']; 361 | d = dir(lib_blas); 362 | if( isempty(d) ) 363 | disp('... BLAS library file not found, so linking with the LAPACK library'); 364 | lib_blas = [matlabroot '\extern\lib\' compdir '\' libdir '\libmwlapack.lib']; 365 | end 366 | disp(['... Using BLAS library lib_blas = ''' lib_blas '''']); 367 | 368 | %\ 369 | % Save old directory and change to source code directory 370 | %/ 371 | 372 | cdold = cd; 373 | if( length(mname) > 13 ) 374 | cd(mname(1:end-13)); 375 | end 376 | 377 | %\ 378 | % Do the compile 379 | %/ 380 | 381 | disp('... Now attempting to compile ...'); 382 | disp(' '); 383 | try 384 | if( isunix ) 385 | if( isempty(largearraydims) ) 386 | if( isempty(xname) ) 387 | disp(['mex(''-DDEFINEUNIX'',''' cname ''',lib_blas,''-DCOMPILER=' compiler ''')']); 388 | disp(' '); 389 | mex('-DDEFINEUNIX',cname,lib_blas,['-DCOMPILER=' compiler]); 390 | else 391 | disp(['mex(''-f'',''' xname ''',''-DDEFINEUNIX'',''' cname ''',lib_blas,''-DCOMPILER=' compiler ''')']); 392 | disp(' '); 393 | mex('-f',xname,'-DDEFINEUNIX',cname,lib_blas,['-DCOMPILER=' compiler]); 394 | end 395 | else 396 | if( isempty(xname) ) 397 | disp(['mex(''-DDEFINEUNIX'',''' cname ''',''' largearraydims ''',lib_blas,''-DCOMPILER=' compiler ''')']); 398 | disp(' '); 399 | mex('-DDEFINEUNIX',largearraydims,cname,lib_blas,['-DCOMPILER=' compiler]); 400 | else 401 | disp(['mex(''-f'',''' xname ''',''-DDEFINEUNIX'',''' cname ''',''' largearraydims ''',lib_blas,''-DCOMPILER=' compiler ''')']); 402 | disp(' '); 403 | mex('-f',xname,'-DDEFINEUNIX',largearraydims,cname,lib_blas,['-DCOMPILER=' compiler]); 404 | end 405 | end 406 | else 407 | if( isempty(largearraydims) ) 408 | if( isempty(xname) ) 409 | disp(['mex(''' cname ''',lib_blas,''-DCOMPILER=' compiler ''')']); 410 | disp(' '); 411 | mex(cname,lib_blas,['-DCOMPILER=' compiler]); 412 | else 413 | disp(['mex(''-f'',''' xname ''',''' cname ''',lib_blas,''-DCOMPILER=' compiler ''')']); 414 | disp(' '); 415 | mex('-f',xname,cname,lib_blas,['-DCOMPILER=' compiler]); 416 | end 417 | else 418 | if( isempty(xname) ) 419 | disp(['mex(''' cname ''',''' largearraydims ''',lib_blas,''-DCOMPILER=' compiler ''')']); 420 | disp(' '); 421 | mex(cname,largearraydims,lib_blas,['-DCOMPILER=' compiler]); 422 | else 423 | disp(['mex(''-f'',''' xname ''',''' cname ''',''' largearraydims ''',lib_blas,''-DCOMPILER=' compiler ''')']); 424 | disp(' '); 425 | mex('-f',xname,cname,largearraydims,lib_blas,['-DCOMPILER=' compiler]); 426 | end 427 | end 428 | end 429 | disp('... mex mtimesx.c build completed ... you may now use mtimesx.'); 430 | disp(' '); 431 | mtimesx; 432 | break; 433 | catch 434 | if( noopenmp ) 435 | cd(cdold); 436 | disp(' '); 437 | disp('... Well, *that* didn''t work either!'); 438 | disp(' '); 439 | disp('The mex command failed. This may be because you have already run'); 440 | disp('mex -setup and selected a non-C compiler, such as Fortran. If this'); 441 | disp('is the case, then rerun mex -setup and select a C/C++ compiler.'); 442 | disp(' '); 443 | error('Unable to compile mtimesx.c'); 444 | else 445 | disp(' '); 446 | disp('... Well, *that* didn''t work ...'); 447 | disp(' '); 448 | if( isequal(omp_option,' /openmp') ) 449 | disp('This may be because an OpenMP compile option was added that the'); 450 | disp('compiler did not like. For example, the Standard versions of the'); 451 | disp('Microsoft C/C++ compilers do not support OpenMP, only the'); 452 | disp('Professional versions do. Attempting to compile again but this'); 453 | disp(['time will not add the ''' omp_option ''' option.']) 454 | else 455 | disp('This may be because an OpenMP compile option was added that the'); 456 | disp('compiler did not like. Attempting to compile again, but this time'); 457 | disp(['will not add the ''' omp_option ''' option.']) 458 | end 459 | disp(' '); 460 | noopenmp = TRUE; 461 | end 462 | end 463 | end 464 | 465 | %\ 466 | % Restore old directory 467 | %/ 468 | 469 | cd(cdold); 470 | 471 | return 472 | end 473 | -------------------------------------------------------------------------------- /external_libs/mtimesx/mtimesx_sparse.m: -------------------------------------------------------------------------------- 1 | % mtimesx_sparse does sparse matrix multiply of two inputs 2 | %****************************************************************************** 3 | % 4 | % MATLAB (R) is a trademark of The Mathworks (R) Corporation 5 | % 6 | % Function: mtimesx_sparse 7 | % Filename: mtimesx_sparse.m 8 | % Programmer: James Tursa 9 | % Version: 1.00 10 | % Date: September 27, 2009 11 | % Copyright: (c) 2009 by James Tursa, All Rights Reserved 12 | % 13 | % This code uses the BSD License: 14 | % 15 | % Redistribution and use in source and binary forms, with or without 16 | % modification, are permitted provided that the following conditions are 17 | % met: 18 | % 19 | % * Redistributions of source code must retain the above copyright 20 | % notice, this list of conditions and the following disclaimer. 21 | % * Redistributions in binary form must reproduce the above copyright 22 | % notice, this list of conditions and the following disclaimer in 23 | % the documentation and/or other materials provided with the distribution 24 | % 25 | % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | % ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | % LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | % POSSIBILITY OF SUCH DAMAGE. 36 | % 37 | %-- 38 | % 39 | % mtimesx_sparse is a helper function for mtimesx and is not intended to be called 40 | % directly by the user. 41 | % 42 | % --------------------------------------------------------------------------------------------------------------------------------- 43 | 44 | function result = mtimesx_sparse(a,transa,b,transb) 45 | if( transa == 'N' ) 46 | if( transb == 'N' ) 47 | result = a * b; 48 | elseif( transb == 'G' ) 49 | result = a * conj(b); 50 | elseif( transb == 'T' ) 51 | result = a * b.'; 52 | else 53 | result = a * b'; 54 | end 55 | elseif( transa == 'G' ) 56 | if( transb == 'N' ) 57 | result = conj(a) * b; 58 | elseif( transb == 'G' ) 59 | result = conj(a) * conj(b); 60 | elseif( transb == 'T' ) 61 | result = conj(a) * b.'; 62 | else 63 | result = conj(a) * b'; 64 | end 65 | elseif( transa == 'T' ) 66 | if( transb == 'N' ) 67 | result = a.' * b; 68 | elseif( transb == 'G' ) 69 | result = a.' * conj(b); 70 | elseif( transb == 'T' ) 71 | result = a.' * b.'; 72 | else 73 | result = a.' * b'; 74 | end 75 | else 76 | if( transb == 'N' ) 77 | result = a' * b; 78 | elseif( transb == 'G' ) 79 | result = a' * conj(b); 80 | elseif( transb == 'T' ) 81 | result = a' * b.'; 82 | else 83 | result = a' * b'; 84 | end 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /external_libs/mtimesx/mtimesx_test_nd.m: -------------------------------------------------------------------------------- 1 | % Test routine for mtimesx, multi-dimensional speed and equality to MATLAB 2 | %****************************************************************************** 3 | % 4 | % MATLAB (R) is a trademark of The Mathworks (R) Corporation 5 | % 6 | % Function: mtimesx_test_nd 7 | % Filename: mtimesx_test_nd.m 8 | % Programmer: James Tursa 9 | % Version: 1.40 10 | % Date: October 4, 2010 11 | % Copyright: (c) 2009,2010 by James Tursa, All Rights Reserved 12 | % 13 | % This code uses the BSD License: 14 | % 15 | % Redistribution and use in source and binary forms, with or without 16 | % modification, are permitted provided that the following conditions are 17 | % met: 18 | % 19 | % * Redistributions of source code must retain the above copyright 20 | % notice, this list of conditions and the following disclaimer. 21 | % * Redistributions in binary form must reproduce the above copyright 22 | % notice, this list of conditions and the following disclaimer in 23 | % the documentation and/or other materials provided with the distribution 24 | % 25 | % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | % AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | % ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | % LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | % SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | % INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | % CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | % ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | % POSSIBILITY OF SUCH DAMAGE. 36 | % 37 | % Syntax: 38 | % 39 | % A = mtimesx_test_nd % default n=4 is used 40 | % A = mtimesx_test_nd(n) 41 | % 42 | % where n = number of repetitions (should be 4 <= n <= 100) 43 | % 44 | % Output: 45 | % 46 | % Prints out speed and equality test results. 47 | % A = cell array with tabled results. 48 | % 49 | % 2010/Oct/04 --> 1.40, Added OpenMP support for custom code 50 | % Expanded sparse * single and sparse * nD support 51 | % 52 | %-------------------------------------------------------------------------- 53 | 54 | function Cr = mtimesx_test_nd(n) 55 | mtimesx; % load the mex routine into memory 56 | if( nargin == 0 ) 57 | n = 4; 58 | else 59 | n = floor(n); 60 | if( ~(n >= 4 && n <= 100) ) 61 | n = 4; 62 | end 63 | end 64 | cn = sprintf('%g',n); 65 | 66 | disp(' '); 67 | disp('MTIMESX multi-dimensional equality and speed tests'); 68 | disp('--------------------------------------------------'); 69 | disp(' '); 70 | disp('(M x K) * ( K x N) equality tests, SPEED mode, M,K,N <= 4'); 71 | trans = 'NGTC'; 72 | cmpx = {'real ','cmpx '}; 73 | mtimesx('speed'); 74 | smallok = true; 75 | for m=1:4 76 | for k=1:4 77 | for n=1:4 78 | for transa=1:4 79 | if( transa <= 2 ) 80 | ma = m; 81 | ka = k; 82 | else 83 | ma = k; 84 | ka = m; 85 | end 86 | for transb=1:4 87 | if( transb <= 2 ) 88 | kb = k; 89 | nb = n; 90 | else 91 | kb = n; 92 | nb = k; 93 | end 94 | for cmplxa=1:2 95 | if( cmplxa == 1 ) 96 | A = floor(rand(ma,ka)*100+1); 97 | else 98 | A = floor(rand(ma,ka)*100+1) + floor(rand(ma,ka)*100+1)*1i; 99 | end 100 | for cmplxb=1:2 101 | if( cmplxb == 1 ) 102 | B = floor(rand(kb,nb)*100+1); 103 | else 104 | B = floor(rand(kb,nb)*100+1) + floor(rand(kb,nb)*100+1)*1i; 105 | end 106 | Cm = mtimesx_sparse(A,trans(transa),B,trans(transb)); 107 | Cx = mtimesx(A,trans(transa),B,trans(transb)); 108 | if( isequal(Cm,Cx) ) 109 | disp(['(' cmpx{cmplxa} num2str(m) ' x ' num2str(k) ')' trans(transa) ... 110 | ' * (' cmpx{cmplxb} num2str(k) ' x ' num2str(n) ')' trans(transb) ' EQUAL']); 111 | else 112 | disp(['(' cmpx{cmplxa} num2str(m) ' x ' num2str(k) ')' trans(transa) ... 113 | ' * (' cmpx{cmplxb} num2str(k) ' x ' num2str(n) ')' trans(transb) ' NOT EQUAL']); 114 | smallok = false; 115 | end 116 | end 117 | end 118 | end 119 | end 120 | end 121 | end 122 | end 123 | 124 | if( mtimesx('openmp') ) 125 | disp(' '); 126 | disp('(M x K) * ( K x N) equality tests, SPEEDOMP mode, M,K,N <= 4'); 127 | mtimesx('speedomp'); 128 | smallokomp = true; 129 | for m=1:4 130 | for k=1:4 131 | for n=1:4 132 | for transa=1:4 133 | if( transa <= 2 ) 134 | ma = m; 135 | ka = k; 136 | else 137 | ma = k; 138 | ka = m; 139 | end 140 | for transb=1:4 141 | if( transb <= 2 ) 142 | kb = k; 143 | nb = n; 144 | else 145 | kb = n; 146 | nb = k; 147 | end 148 | for cmplxa=1:2 149 | if( cmplxa == 1 ) 150 | A = floor(rand(ma,ka)*100+1); 151 | else 152 | A = floor(rand(ma,ka)*100+1) + floor(rand(ma,ka)*100+1)*1i; 153 | end 154 | A = reshape(repmat(A,1000,1),ma,ka,1000); 155 | for cmplxb=1:2 156 | if( cmplxb == 1 ) 157 | B = floor(rand(kb,nb)*100+1); 158 | else 159 | B = floor(rand(kb,nb)*100+1) + floor(rand(kb,nb)*100+1)*1i; 160 | end 161 | B = reshape(repmat(B,1000,1),kb,nb,1000); 162 | Cm = mtimesx_sparse(A(:,:,1),trans(transa),B(:,:,1),trans(transb)); 163 | Cx = mtimesx(A,trans(transa),B,trans(transb)); 164 | if( isequal(Cm,Cx(:,:,1)) ) 165 | disp(['(' cmpx{cmplxa} num2str(m) ' x ' num2str(k) ')' trans(transa) ... 166 | ' * (' cmpx{cmplxb} num2str(k) ' x ' num2str(n) ')' trans(transb) ' EQUAL']); 167 | else 168 | disp(['(' cmpx{cmplxa} num2str(m) ' x ' num2str(k) ')' trans(transa) ... 169 | ' * (' cmpx{cmplxb} num2str(k) ' x ' num2str(n) ')' trans(transb) ' NOT EQUAL']); 170 | smallokomp = false; 171 | end 172 | end 173 | end 174 | end 175 | end 176 | end 177 | end 178 | end 179 | end 180 | 181 | disp(' '); 182 | if( smallok ) 183 | disp('All small matrix multiplies are OK in SPEED mode'); 184 | else 185 | disp('ERROR --> One or more of the small matrix multiplies was not equal in SPEED mode'); 186 | end 187 | if( mtimesx('openmp') ) 188 | if( smallokomp ) 189 | disp('All small matrix multiplies are OK in SPEEDOMP mode'); 190 | else 191 | disp('ERROR --> One or more of the small matrix multiplies was not equal in SPEEDOMP mode'); 192 | end 193 | end 194 | 195 | disp(' '); 196 | disp(['mtimesx multi-dimensional test routine using ' cn ' repetitions']); 197 | 198 | if( mtimesx('OPENMP') ) 199 | topm = 6; 200 | else 201 | topm = 4; 202 | end 203 | Cr = cell(6,topm+1); 204 | Cr{1,1} = 'All operands real'; 205 | 206 | for m=2:topm+1 207 | if( m == 2 ) 208 | mtimesx('BLAS'); 209 | elseif( m == 3 ) 210 | mtimesx('LOOPS'); 211 | elseif( m == 4 ) 212 | mtimesx('MATLAB'); 213 | elseif( m == 5 ) 214 | mtimesx('SPEED'); 215 | elseif( m == 6 ) 216 | mtimesx('LOOPSOMP'); 217 | else 218 | mtimesx('SPEEDOMP'); 219 | end 220 | Cr{1,m} = mtimesx; 221 | 222 | disp(' '); 223 | disp('--------------------------------------------------------------'); 224 | disp('--------------------------------------------------------------'); 225 | disp(' '); 226 | disp(['MTIMESX mode: ' mtimesx]); 227 | disp(' '); 228 | disp('(real 3x5x1x4x3x2x1x8) * (real 5x7x3x1x3x2x5) example'); 229 | Cr{2,1} = '(3x5xND) *(5x7xND)'; 230 | A = rand(3,5,1,4,3,2,1,8); 231 | B = rand(5,7,3,1,3,2,5); 232 | % mtimes 233 | tm = zeros(1,n); 234 | for k=1:n 235 | clear Cm 236 | A(1) = 2*A(1); 237 | B(1) = 2*B(1); 238 | tic 239 | Cm = zeros(3,7,3,4,3,2,5,8); 240 | for k1=1:3 241 | for k2=1:4 242 | for k3=1:3 243 | for k4=1:2 244 | for k5=1:5 245 | for k6=1:8 246 | Cm(:,:,k1,k2,k3,k4,k5,k6) = A(:,:,1,k2,k3,k4,1,k6) * B(:,:,k1,1,k3,k4,k5); 247 | end 248 | end 249 | end 250 | end 251 | end 252 | end 253 | tm(k) = toc; 254 | end 255 | % mtimesx 256 | tx = zeros(1,n); 257 | for k=1:n 258 | clear Cx 259 | tic 260 | Cx = mtimesx(A,B); 261 | tx(k) = toc; 262 | end 263 | % results 264 | tm = median(tm); 265 | tx = median(tx); 266 | if( tx < tm ) 267 | faster = sprintf('%7.1f',100*(tm)/tx-100); 268 | slower = ''; 269 | else 270 | faster = sprintf('%7.1f',-(100*(tx)/tm-100)); 271 | slower = ' (i.e., slower)'; 272 | end 273 | Cr{2,m} = faster; 274 | disp(' '); 275 | disp(['mtimes Elapsed time ' num2str(tm) ' seconds.']); 276 | disp(['MTIMESX Elapsed time ' num2str(tx) ' seconds.']); 277 | disp(['MTIMESX ' mtimesx ' mode is ' faster '% faster than MATLAB mtimes' slower]) 278 | if( isequal(Cx,Cm) ) 279 | disp(['MTIMESX ' mtimesx ' mode result matches mtimes: EQUAL']) 280 | else 281 | dx = max(abs(Cx(:)-Cm(:))); 282 | disp(['MTIMESX ' mtimesx ' mode result does not match mtimes: NOT EQUAL , max diff = ' num2str(dx)]) 283 | end 284 | 285 | disp(' '); 286 | disp('--------------------------------------------------------------'); 287 | disp('(real 3x3x1000000) * (real 3x3x1000000) example'); 288 | Cr{3,1} = '(3x3xN) *(3x3xN)'; 289 | A = rand(3,3,1000000); 290 | B = rand(3,3,1000000); 291 | % mtimes 292 | tm = zeros(1,n); 293 | for k=1:n 294 | clear Cm 295 | A(1) = 2*A(1); 296 | B(1) = 2*B(1); 297 | tic 298 | Cm = zeros(3,3,1000000); 299 | for k1=1:1000000 300 | Cm(:,:,k1) = A(:,:,k1) * B(:,:,k1); 301 | end 302 | tm(k) = toc; 303 | end 304 | % mtimesx 305 | tx = zeros(1,n); 306 | for k=1:n 307 | clear Cx 308 | tic 309 | Cx = mtimesx(A,B); 310 | tx(k) = toc; 311 | end 312 | % results 313 | tm = median(tm); 314 | tx = median(tx); 315 | if( tx < tm ) 316 | faster = sprintf('%7.1f',100*(tm)/tx-100); 317 | slower = ''; 318 | else 319 | faster = sprintf('%7.1f',-(100*(tx)/tm-100)); 320 | slower = ' (i.e., slower)'; 321 | end 322 | Cr{3,m} = faster; 323 | disp(' '); 324 | disp(['mtimes Elapsed time ' num2str(tm) ' seconds.']); 325 | disp(['MTIMESX Elapsed time ' num2str(tx) ' seconds.']); 326 | disp(['MTIMESX ' mtimesx ' mode is ' faster '% faster than MATLAB mtimes' slower]) 327 | if( isequal(Cx,Cm) ) 328 | disp(['MTIMESX ' mtimesx ' mode result matches mtimes: EQUAL']) 329 | else 330 | dx = max(abs(Cx(:)-Cm(:))); 331 | disp(['MTIMESX ' mtimesx ' mode result does not match mtimes: NOT EQUAL , max diff = ' num2str(dx)]) 332 | end 333 | 334 | disp(' '); 335 | disp('--------------------------------------------------------------'); 336 | disp('(real 2x2x2000000) * (real 2x2x2000000) example'); 337 | Cr{4,1} = '(2x2xN) *(2x2xN)'; 338 | A = rand(2,2,2000000); 339 | B = rand(2,2,2000000); 340 | % mtimes 341 | tm = zeros(1,n); 342 | for k=1:n 343 | clear Cm 344 | A(1) = 2*A(1); 345 | B(1) = 2*B(1); 346 | tic 347 | Cm = zeros(2,2,2000000); 348 | for k1=1:2000000 349 | Cm(:,:,k1) = A(:,:,k1) * B(:,:,k1); 350 | end 351 | tm(k) = toc; 352 | end 353 | % mtimesx 354 | tx = zeros(1,n); 355 | for k=1:n 356 | clear Cx 357 | tic 358 | Cx = mtimesx(A,B); 359 | tx(k) = toc; 360 | end 361 | % results 362 | tm = median(tm); 363 | tx = median(tx); 364 | if( tx < tm ) 365 | faster = sprintf('%7.1f',100*(tm)/tx-100); 366 | slower = ''; 367 | else 368 | faster = sprintf('%7.1f',-(100*(tx)/tm-100)); 369 | slower = ' (i.e., slower)'; 370 | end 371 | Cr{4,m} = faster; 372 | disp(' '); 373 | disp(['mtimes Elapsed time ' num2str(tm) ' seconds.']); 374 | disp(['MTIMESX Elapsed time ' num2str(tx) ' seconds.']); 375 | disp(['MTIMESX ' mtimesx ' mode is ' faster '% faster than MATLAB mtimes' slower]) 376 | if( isequal(Cx,Cm) ) 377 | disp(['MTIMESX ' mtimesx ' mode result matches mtimes: EQUAL']) 378 | else 379 | dx = max(abs(Cx(:)-Cm(:))); 380 | disp(['MTIMESX ' mtimesx ' mode result does not match mtimes: NOT EQUAL , max diff = ' num2str(dx)]) 381 | end 382 | 383 | disp(' '); 384 | disp('--------------------------------------------------------------'); 385 | disp('(real 2x2x2000000) * (real 1x1x2000000) example'); 386 | Cr{5,1} = '(2x2xN) *(1x1xN)'; 387 | A = rand(2,2,2000000); 388 | B = rand(1,1,2000000); 389 | % mtimes 390 | tm = zeros(1,n); 391 | for k=1:n 392 | clear Cm 393 | A(1) = 2*A(1); 394 | B(1) = 2*B(1); 395 | tic 396 | Cm = zeros(2,2,2000000); 397 | for k1=1:2000000 398 | Cm(:,:,k1) = A(:,:,k1) * B(:,:,k1); 399 | end 400 | tm(k) = toc; 401 | end 402 | % mtimesx 403 | tx = zeros(1,n); 404 | for k=1:n 405 | clear Cx 406 | tic 407 | Cx = mtimesx(A,B); 408 | tx(k) = toc; 409 | end 410 | % results 411 | tm = median(tm); 412 | tx = median(tx); 413 | if( tx < tm ) 414 | faster = sprintf('%7.1f',100*(tm)/tx-100); 415 | slower = ''; 416 | else 417 | faster = sprintf('%7.1f',-(100*(tx)/tm-100)); 418 | slower = ' (i.e., slower)'; 419 | end 420 | Cr{5,m} = faster; 421 | disp(' '); 422 | disp(['mtimes Elapsed time ' num2str(tm) ' seconds.']); 423 | disp(['MTIMESX Elapsed time ' num2str(tx) ' seconds.']); 424 | disp(['MTIMESX ' mtimesx ' mode is ' faster '% faster than MATLAB mtimes' slower]) 425 | if( isequal(Cx,Cm) ) 426 | disp(['MTIMESX ' mtimesx ' mode result matches mtimes: EQUAL']) 427 | else 428 | dx = max(abs(Cx(:)-Cm(:))); 429 | disp(['MTIMESX ' mtimesx ' mode result does not match mtimes: NOT EQUAL , max diff = ' num2str(dx)]) 430 | end 431 | 432 | try 433 | bsxfun(@times,1,1); 434 | Cr{6,1} = 'above vs bsxfun'; 435 | A = rand(2,2,2000000); 436 | B = rand(1,1,2000000); 437 | % bsxfun 438 | tm = zeros(1,n); 439 | for k=1:n 440 | clear Cm 441 | A(1) = 2*A(1); 442 | B(1) = 2*B(1); 443 | tic 444 | Cm = bsxfun(@times,A,B); 445 | tm(k) = toc; 446 | end 447 | % mtimesx 448 | tx = zeros(1,n); 449 | for k=1:n 450 | clear Cx 451 | tic 452 | Cx = mtimesx(A,B); 453 | tx(k) = toc; 454 | end 455 | % results 456 | tm = median(tm); 457 | tx = median(tx); 458 | if( tx < tm ) 459 | faster = sprintf('%7.1f',100*(tm)/tx-100); 460 | slower = ''; 461 | else 462 | faster = sprintf('%7.1f',-(100*(tx)/tm-100)); 463 | slower = ' (i.e., slower)'; 464 | end 465 | Cr{6,m} = faster; 466 | disp(' '); 467 | disp(['bsxfun Elapsed time ' num2str(tm) ' seconds.']); 468 | disp(['MTIMESX Elapsed time ' num2str(tx) ' seconds.']); 469 | disp(['MTIMESX ' mtimesx ' mode is ' faster '% faster than MATLAB bsxfun with @times' slower]) 470 | if( isequal(Cx,Cm) ) 471 | disp(['MTIMESX ' mtimesx ' mode result matches bsxfun with @times: EQUAL']) 472 | else 473 | dx = max(abs(Cx(:)-Cm(:))); 474 | disp(['MTIMESX ' mtimesx ' mode result does not match bsxfun with @times: NOT EQUAL , max diff = ' num2str(dx)]) 475 | end 476 | catch 477 | disp('Could not perform comparison with bsxfun, possibly because your version of'); 478 | disp('MATLAB does not have it. You can download a substitute for bsxfun from the'); 479 | disp('FEX here: http://www.mathworks.com/matlabcentral/fileexchange/23005-bsxfun-substitute'); 480 | end 481 | 482 | end 483 | 484 | disp(' '); 485 | disp('Percent Faster Results Table'); 486 | disp(' '); 487 | disp(Cr); 488 | 489 | disp(' '); 490 | disp('Done'); 491 | disp(' '); 492 | 493 | end 494 | -------------------------------------------------------------------------------- /external_libs/opencv_core242.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/external_libs/opencv_core242.dll -------------------------------------------------------------------------------- /external_libs/opencv_imgproc242.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/external_libs/opencv_imgproc242.dll -------------------------------------------------------------------------------- /feature_extraction/fhog.m: -------------------------------------------------------------------------------- 1 | function H = fhog( I, binSize, nOrients, clip, crop ) 2 | % Efficiently compute Felzenszwalb's HOG (FHOG) features. 3 | % 4 | % A fast implementation of the HOG variant used by Felzenszwalb et al. 5 | % in their work on discriminatively trained deformable part models. 6 | % http://www.cs.berkeley.edu/~rbg/latent/index.html 7 | % Gives nearly identical results to features.cc in code release version 5 8 | % but runs 4x faster (over 125 fps on VGA color images). 9 | % 10 | % The computed HOG features are 3*nOrients+5 dimensional. There are 11 | % 2*nOrients contrast sensitive orientation channels, nOrients contrast 12 | % insensitive orientation channels, 4 texture channels and 1 all zeros 13 | % channel (used as a 'truncation' feature). Using the standard value of 14 | % nOrients=9 gives a 32 dimensional feature vector at each cell. This 15 | % variant of HOG, refered to as FHOG, has been shown to achieve superior 16 | % performance to the original HOG features. For details please refer to 17 | % work by Felzenszwalb et al. (see link above). 18 | % 19 | % This function is essentially a wrapper for calls to gradientMag() 20 | % and gradientHist(). Specifically, it is equivalent to the following: 21 | % [M,O] = gradientMag( I,0,0,0,1 ); softBin = -1; useHog = 2; 22 | % H = gradientHist(M,O,binSize,nOrients,softBin,useHog,clip); 23 | % See gradientHist() for more general usage. 24 | % 25 | % This code requires SSE2 to compile and run (most modern Intel and AMD 26 | % processors support SSE2). Please see: http://en.wikipedia.org/wiki/SSE2. 27 | % 28 | % USAGE 29 | % H = fhog( I, [binSize], [nOrients], [clip], [crop] ) 30 | % 31 | % INPUTS 32 | % I - [hxw] color or grayscale input image (must have type single) 33 | % binSize - [8] spatial bin size 34 | % nOrients - [9] number of orientation bins 35 | % clip - [.2] value at which to clip histogram bins 36 | % crop - [0] if true crop boundaries 37 | % 38 | % OUTPUTS 39 | % H - [h/binSize w/binSize nOrients*3+5] computed hog features 40 | % 41 | % EXAMPLE 42 | % I=imResample(single(imread('peppers.png'))/255,[480 640]); 43 | % tic, for i=1:100, H=fhog(I,8,9); end; disp(100/toc) % >125 fps 44 | % figure(1); im(I); V=hogDraw(H,25,1); figure(2); im(V) 45 | % 46 | % EXAMPLE 47 | % % comparison to features.cc (requires DPM code release version 5) 48 | % I=imResample(single(imread('peppers.png'))/255,[480 640]); Id=double(I); 49 | % tic, for i=1:100, H1=features(Id,8); end; disp(100/toc) 50 | % tic, for i=1:100, H2=fhog(I,8,9,.2,1); end; disp(100/toc) 51 | % figure(1); montage2(H1); figure(2); montage2(H2); 52 | % D=abs(H1-H2); mean(D(:)) 53 | % 54 | % See also hog, hogDraw, gradientHist 55 | % 56 | % Piotr's Image&Video Toolbox Version 3.23 57 | % Copyright 2013 Piotr Dollar. [pdollar-at-caltech.edu] 58 | % Please email me if you find bugs, or have suggestions or questions! 59 | % Licensed under the Simplified BSD License [see external/bsd.txt] 60 | 61 | %Note: modified to be more self-contained 62 | 63 | if( nargin<2 ), binSize=8; end 64 | if( nargin<3 ), nOrients=9; end 65 | if( nargin<4 ), clip=.2; end 66 | if( nargin<5 ), crop=0; end 67 | 68 | softBin = -1; useHog = 2; b = binSize; 69 | 70 | [M,O]=gradientMex('gradientMag',I,0,1); 71 | 72 | H = gradientMex('gradientHist',M,O,binSize,nOrients,softBin,useHog,clip); 73 | 74 | if( crop ), e=mod(size(I),b)0 && color < 12) 24 | w2cM=w2c(:,color); 25 | out=reshape(w2cM(index_im(:)),size(im,1),size(im,2)); 26 | end 27 | 28 | if(color==-1) 29 | out=im; 30 | [~,w2cM]=max(w2c,[],2); 31 | out2=reshape(w2cM(index_im(:)),size(im,1),size(im,2)); 32 | 33 | for jj=1:size(im,1) 34 | for ii=1:size(im,2) 35 | out(jj,ii,:)=color_values{out2(jj,ii)}'*255; 36 | end 37 | end 38 | end 39 | 40 | if(color==-2) 41 | out=reshape(w2c(index_im,:),size(im,1),size(im,2),size(w2c,2)); 42 | end 43 | -------------------------------------------------------------------------------- /feature_extraction/imResample.m: -------------------------------------------------------------------------------- 1 | function B = imResample( A, scale, method, norm ) 2 | % Fast bilinear image downsampling/upsampling. 3 | % 4 | % Gives similar results to imresize with the bilinear option and 5 | % antialiasing turned off if scale is near 1, except sometimes the final 6 | % dims are off by 1 pixel. For very small values of the scale imresize is 7 | % faster but only looks at subset of values of original image. 8 | % 9 | % This code requires SSE2 to compile and run (most modern Intel and AMD 10 | % processors support SSE2). Please see: http://en.wikipedia.org/wiki/SSE2. 11 | % 12 | % USAGE 13 | % B = imResample( A, scale, [method], [norm] ) 14 | % 15 | % INPUT 16 | % A - input image (2D or 3D single, double or uint8 array) 17 | % scale - scalar resize factor [s] of target height and width [h w] 18 | % method - ['bilinear'] either 'bilinear' or 'nearest' 19 | % norm - [1] optionally multiply every output pixel by norm 20 | % 21 | % OUPUT 22 | % B - resampled image 23 | % 24 | % EXAMPLE 25 | % I=single(imread('cameraman.tif')); n=100; s=1/2; method='bilinear'; 26 | % tic, for i=1:n, I1=imresize(I,s,method,'Antialiasing',0); end; toc 27 | % tic, for i=1:n, I2=imResample(I,s,method); end; toc 28 | % figure(1); im(I1); figure(2); im(I2); 29 | % 30 | % See also imresize 31 | % 32 | % Piotr's Computer Vision Matlab Toolbox Version 3.24 33 | % Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] 34 | % Licensed under the Simplified BSD License [see external/bsd.txt] 35 | 36 | % figure out method and get target dimensions 37 | if( nargin<3 || isempty(method) ), bilinear=1; else 38 | if(~all(ischar(method))), error('method must be a string'); end 39 | bilinear = ~strcmpi(method,'nearest'); 40 | end 41 | if( nargin<4 || isempty(norm) ), norm=1; end 42 | [m,n,~]=size(A); k=numel(scale); 43 | same = (k==1 && scale==1) | (k==2 && m==scale(1) && n==scale(2)); 44 | if( same && norm==1 ); B=A; return; end 45 | 46 | if( bilinear ) 47 | % use bilinear interpolation 48 | if(k==1), m1=round(scale*m); n1=round(scale*n); 49 | else 50 | m1=scale(1); 51 | n1=scale(2); 52 | end 53 | B=imResampleMex(A,m1,n1,norm); 54 | else 55 | % use nearest neighbor interpolation 56 | if(k==1), sy=scale; sx=sy; m1=ceil(m*sy); n1=ceil(n*sx); 57 | else 58 | m1=scale(1); 59 | n1=scale(2); 60 | sy=m1/m; sx=n1/n; 61 | end 62 | y=(1:m1)'; y=floor(y/sy-.5/sy+1); y=min(max(1,y),m); 63 | x=(1:n1)'; x=floor(x/sx-.5/sx+1); x=min(max(1,x),n); 64 | nd=ndims(A); 65 | if(nd==2) 66 | B=A(y,x); 67 | elseif(nd==3) 68 | B=A(y,x,:); 69 | else 70 | ids={y,x}; 71 | ids(3:nd)={':'}; 72 | B=A(ids{:}); 73 | end 74 | if(norm~=1), B=B*norm; end 75 | end 76 | -------------------------------------------------------------------------------- /feature_extraction/initial_net.m: -------------------------------------------------------------------------------- 1 | function initial_net() 2 | % INITIAL_NET: Loading VGG-Net-19 3 | 4 | global net; 5 | net = load(fullfile('model', 'imagenet-vgg-verydeep-19.mat')); 6 | % Remove the fully connected layers and classification layer 7 | net.layers(37+1:end) = []; 8 | 9 | % Switch to GPU mode 10 | global enableGPU; 11 | if enableGPU 12 | net = vl_simplenn_move(net, 'gpu'); 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /feature_extraction/w2c.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/feature_extraction/w2c.mat -------------------------------------------------------------------------------- /implementation/initialization/initializeAllAreas.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/initialization/initializeAllAreas.m -------------------------------------------------------------------------------- /implementation/scale_filter/affparam2geom.m: -------------------------------------------------------------------------------- 1 | function q = affparam2geom(p) 2 | 3 | % Copyright (C) Jongwoo Lim and David Ross. All rights reserved. 4 | 5 | A = [ p(3), p(4); p(5), p(6) ]; 6 | 7 | [U,S,V] = svd(A); 8 | if (det(U) < 0) 9 | U = U(:,2:-1:1); V = V(:,2:-1:1); S = S(2:-1:1,2:-1:1); 10 | end 11 | 12 | 13 | q(1) = p(1); 14 | q(2) = p(2); 15 | 16 | 17 | q(4) = atan2(U(2,1)*V(1,1)+U(2,2)*V(1,2), U(1,1)*V(1,1)+U(1,2)*V(1,2)); 18 | 19 | phi = atan2(V(1,2),V(1,1)); 20 | if (phi <= -pi/2) 21 | c = cos(-pi/2); s = sin(-pi/2); 22 | R = [c -s; s c]; V = V * R; S = R'*S*R; 23 | end 24 | if (phi >= pi/2) 25 | c = cos(pi/2); s = sin(pi/2); 26 | R = [c -s; s c]; V = V * R; S = R'*S*R; 27 | end 28 | 29 | 30 | q(3) = S(1,1); 31 | q(5) = S(2,2)/S(1,1); 32 | 33 | q(6) = atan2(V(1,2),V(1,1)); 34 | 35 | q = reshape(q, size(p)); 36 | -------------------------------------------------------------------------------- /implementation/scale_filter/affparam2mat.m: -------------------------------------------------------------------------------- 1 | function q = affparam2mat(p) 2 | 3 | % Copyright (C) Jongwoo Lim and David Ross. All rights reserved. 4 | 5 | 6 | sz = size(p); 7 | if (length(p(:)) == 6) 8 | p = p(:); 9 | end 10 | s = p(3,:); th = p(4,:); r = p(5,:); phi = p(6,:); 11 | cth = cos(th); sth = sin(th); cph = cos(phi); sph = sin(phi); 12 | ccc = cth.*cph.*cph; ccs = cth.*cph.*sph; css = cth.*sph.*sph; 13 | scc = sth.*cph.*cph; scs = sth.*cph.*sph; sss = sth.*sph.*sph; 14 | q(1,:) = p(1,:); q(2,:) = p(2,:); 15 | q(3,:) = s.*(ccc +scs +r.*(css -scs)); q(4,:) = s.*(r.*(ccs -scc) -ccs -sss); 16 | q(5,:) = s.*(scc -ccs +r.*(ccs +sss)); q(6,:) = s.*(r.*(ccc +scs) -scs +css); 17 | q = reshape(q, sz); 18 | -------------------------------------------------------------------------------- /implementation/scale_filter/affparaminv.m: -------------------------------------------------------------------------------- 1 | function q = affparaminv(p,q) 2 | % function q = affparaminv(p[, q]) 3 | % 4 | % p(6,n) : [dx dy sc th sr phi]' 5 | % q(6,n) : [q(1) q(3) q(4); q(2) q(5) q(6)] 6 | 7 | % Copyright (C) Jongwoo Lim and David Ross. All rights reserved. 8 | 9 | if (length(p) == 6) 10 | p = p(:); 11 | end 12 | if (nargin > 1) 13 | q = ([p(3) p(4); p(5) p(6)]) \ [q(1)-p(1) q(3:4); q(2)-p(2) q(5:6)]; 14 | else 15 | q = ([p(3) p(4); p(5) p(6)]) \ [-p(1) 1 0; -p(2) 0 1]; 16 | end 17 | q = q([1,2,3,5,4,6]); 18 | -------------------------------------------------------------------------------- /implementation/scale_filter/affwarpimg.m: -------------------------------------------------------------------------------- 1 | function wimg = affwarpimg(img, p, sz) 2 | % function wimg = affwarpimg(img, p, sz) 3 | % 4 | % img(h,w) 5 | % p(6,n) : mat format affine parameter 6 | % sz(th,tw) 7 | % 8 | 9 | %% Copyright (C) Jongwoo Lim and David Ross. 10 | %% All rights reserved. 11 | 12 | 13 | if (nargin < 3) 14 | sz = size(img); 15 | end 16 | if (size(p,1) == 1) 17 | p = p(:); 18 | end 19 | w = sz(2); h = sz(1); n = size(p,2); 20 | [x,y] = meshgrid(1:w, 1:h); 21 | pos = reshape(cat(2, ones(h*w,1),x(:),y(:)) ... 22 | * [p(1,:) p(2,:); p(3:4,:) p(5:6,:)], [h,w,n,2]); 23 | wimg = squeeze(interp2(img, pos(:,:,:,1), pos(:,:,:,2))); 24 | wimg(isnan(wimg)) = 0; 25 | -------------------------------------------------------------------------------- /implementation/scale_filter/gaussian_correlation_scale_single.m: -------------------------------------------------------------------------------- 1 | function kf = gaussian_correlation_scale_single(base, y, sigma) 2 | 3 | k = zeros(1,size(base,2)); 4 | N = numel(y); 5 | for i =1:size(base,2) 6 | n = sum(sum(sum((base(:,i) - y).^2)))/N^2; 7 | k(i) = exp(-n / sigma^2 ) ; 8 | end 9 | 10 | kf = fft(k'); 11 | end 12 | -------------------------------------------------------------------------------- /implementation/scale_filter/getScalePatch.m: -------------------------------------------------------------------------------- 1 | function out = getScalePatch(img, pos, target_size, search_size, ~, ~, hog_scale_cell_size) 2 | % function out = getScalePatch(img, pos, target_size, search_size, scale_window, scale_model_sz, hog_scale_cell_size) 3 | % KCC: Kernel Cross-Correlator 4 | % Visual Tracking Using KCC 5 | % 6 | % Copyright (C) 2017 7 | % Author: Wang Chen wang.chen@zoho.com Nanyang Technological University 8 | % Zhang Le zhang.le@adsc.com Advanced Digital Sciences Center 9 | % 10 | % This file is part of KCC. 11 | % 12 | % KCC is free software: you can redistribute it and/or modify 13 | % it under the terms of the GNU General Public License as published by 14 | % the Free Software Foundation, either version 3 of the License, or 15 | % (at your option) any later version. 16 | % 17 | % KCC is distributed in the hope that it will be useful, 18 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | % GNU General Public License for more details. 21 | % 22 | % You should have received a copy of the GNU General Public License 23 | % along with KCC. If not, see . 24 | 25 | padding=0; 26 | if size(img,3)>1 27 | img= single(rgb2gray(img))/255.0; 28 | end 29 | 30 | tmp_sz = floor((target_size * (1 + padding))*search_size); 31 | param0 = [pos(2), pos(1), tmp_sz(2)/target_size(2), 0,... 32 | tmp_sz(1)/target_size(2)/(target_size(1)/target_size(2)),0]; 33 | param0 = affparam2mat(param0); 34 | patch = warpimg(double(img), param0, target_size); 35 | patch = fhog(single(patch), hog_scale_cell_size); 36 | patch = patch(:,:,1:31); 37 | out = patch(:); 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /implementation/scale_filter/getScaleSubwindow.m: -------------------------------------------------------------------------------- 1 | function out = getScaleSubwindow(im, pos, base_target_sz, scale_factors, scale_window, scale_model_sz, hog_scale_cell_size) 2 | % code from DSST 3 | 4 | num_scales = length(scale_factors); 5 | 6 | for s = 1:num_scales 7 | patch_sz = floor(base_target_sz * scale_factors(s)); 8 | %make sure the size is not to small 9 | patch_sz = max(patch_sz, 2); 10 | 11 | xs = floor(pos(2)) + (1:patch_sz(2)) - floor(patch_sz(2)/2); 12 | ys = floor(pos(1)) + (1:patch_sz(1)) - floor(patch_sz(1)/2); 13 | 14 | %check for out-of-bounds coordinates, and set them to the values at the borders 15 | xs(xs < 1) = 1; 16 | ys(ys < 1) = 1; 17 | xs(xs > size(im,2)) = size(im,2); 18 | ys(ys > size(im,1)) = size(im,1); 19 | 20 | %extract image 21 | im_patch = im(ys, xs, :); 22 | 23 | % resize image to model size 24 | im_patch_resized = mexResize(im_patch, scale_model_sz, 'auto'); 25 | 26 | % extract scale features 27 | temp_hog = fhog(single(im_patch_resized), hog_scale_cell_size); 28 | temp = temp_hog(:,:,1:31); 29 | 30 | if s == 1 31 | out = zeros(numel(temp), num_scales, 'single'); 32 | end 33 | 34 | % window 35 | out(:,s) = temp(:) * scale_window(s); 36 | end 37 | -------------------------------------------------------------------------------- /implementation/scale_filter/getScaleSubwindow_v1.m: -------------------------------------------------------------------------------- 1 | function out = getScaleSubwindow_v1(img, pos, target_size, search_size, ~, ~, hog_scale_cell_size) 2 | % function out = getScaleSubwindow_v1(img, pos, target_size, search_size, scale_window, scale_model_sz, hog_scale_cell_size) 3 | % KCC: Kernel Cross-Correlator 4 | % Visual Tracking Using KCC 5 | % 6 | % Copyright (C) 2017 7 | % Author: Wang Chen wang.chen@zoho.com Nanyang Technological University 8 | % Zhang Le zhang.le@adsc.com Advanced Digital Sciences Center 9 | % 10 | % This file is part of KCC. 11 | % 12 | % KCC is free software: you can redistribute it and/or modify 13 | % it under the terms of the GNU General Public License as published by 14 | % the Free Software Foundation, either version 3 of the License, or 15 | % (at your option) any later version. 16 | % 17 | % KCC is distributed in the hope that it will be useful, 18 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | % GNU General Public License for more details. 21 | % 22 | % You should have received a copy of the GNU General Public License 23 | % along with KCC. If not, see . 24 | padding=0; 25 | num_scales = length(search_size); 26 | if size(img,3)>1 27 | img= single(rgb2gray(img))/255.0; 28 | end 29 | for s = 1:num_scales 30 | tmp_sz = floor((target_size * (1 + padding))*search_size(s)); 31 | param0 = [pos(2), pos(1), tmp_sz(2)/target_size(2), 0,... 32 | tmp_sz(1)/target_size(2)/(target_size(1)/target_size(2)),0]; 33 | param0 = affparam2mat(param0); 34 | patch = warpimg(double(img), param0, target_size); 35 | patch = fhog(single(patch), hog_scale_cell_size); 36 | patch = patch(:,:,1:31); 37 | 38 | if s == 1 39 | out = zeros(numel(patch), num_scales, 'single'); 40 | end 41 | 42 | % window 43 | out(:,s) = patch(:);%* scale_window(s); 44 | end 45 | 46 | -------------------------------------------------------------------------------- /implementation/scale_filter/scale_adaptation_init.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/scale_filter/scale_adaptation_init.m -------------------------------------------------------------------------------- /implementation/scale_filter/scale_search.m: -------------------------------------------------------------------------------- 1 | function [target_sz, bg_area,fg_area,area_resize_factor] = scale_search(p,im, pos, base_target_sz, scale_factor, scale_window, scale_model_sz, im_patch_scale, model_hf, min_scale_factor, max_scale_factor, avg_dim_factor, scale_factors) 2 | 3 | if p.scale_adaptation 4 | current_patch = getScalePatch(im, pos, base_target_sz, scale_factor, scale_window, scale_model_sz, p.hog_scale_cell_size); 5 | ksf = gaussian_correlation_scale_single(im_patch_scale, current_patch, p.scale_sigma); 6 | scale_response = abs(ifft((model_hf.*ksf))); 7 | [~, recovered_scale] = max(scale_response(:)); 8 | 9 | %set the scale 10 | scale_factor = scale_factor / scale_factors(recovered_scale); 11 | % fprintf('frame %d: recovered scale is %.2f:, current sclae factor is %.2f:\n', frame,recovered_scale,scale_factor) 12 | 13 | if scale_factor < min_scale_factor 14 | scale_factor = min_scale_factor; 15 | elseif scale_factor > max_scale_factor 16 | scale_factor = max_scale_factor; 17 | end 18 | 19 | % use new scale to update bboxes for target, filter, bg and fg models 20 | target_sz = round(base_target_sz * scale_factor); 21 | avg_dim = sum(target_sz)/avg_dim_factor; 22 | bg_area = round(target_sz + avg_dim); 23 | if(bg_area(2)>size(im,2)), bg_area(2)=size(im,2)-1; end 24 | if(bg_area(1)>size(im,1)), bg_area(1)=size(im,1)-1; end 25 | 26 | bg_area = bg_area - mod(bg_area - target_sz, 2); 27 | fg_area = round(target_sz - avg_dim * p.inner_padding); 28 | fg_area = fg_area + mod(bg_area - fg_area, 2); 29 | % Compute the rectangle with (or close to) params.fixed_area and 30 | % same aspect ratio as the target bboxgetScaleSubwindow_v1 31 | area_resize_factor = sqrt(p.fixed_area/prod(bg_area)); 32 | end -------------------------------------------------------------------------------- /implementation/scale_filter/scale_update_model.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/scale_filter/scale_update_model.m -------------------------------------------------------------------------------- /implementation/scale_filter/warpimg.m: -------------------------------------------------------------------------------- 1 | function wimg = warpimg(img, p, sz) 2 | %% Copyright (C) 2005 Jongwoo Lim and David Ross. 3 | %% All rights reserved. 4 | 5 | if (nargin < 3) 6 | sz = size(img); 7 | end 8 | if (size(p,1) == 1) 9 | p = p(:); 10 | end 11 | w = sz(2); h = sz(1); n = size(p,2); 12 | [x,y] = meshgrid((1:w)-w/2, (1:h)-h/2); 13 | pos = reshape(cat(2, ones(h*w,1),x(:),y(:)) ... 14 | * [p(1,:) p(2,:); p(3:4,:) p(5:6,:)], [h,w,n,2]); 15 | wimg = squeeze(interp2(img, pos(:,:,:,1), pos(:,:,:,2))); 16 | 17 | 18 | wimg(isnan(wimg)) = 0; 19 | 20 | % B = SQUEEZE(A) returns an array B with the same elements as 21 | % A but with all the singleton dimensions removed. A singleton 22 | % is a dimension such that size(A,dim)==1; 23 | 24 | -------------------------------------------------------------------------------- /implementation/tracker.m: -------------------------------------------------------------------------------- 1 | function results = tracker(p, im, bg_area, fg_area, area_resize_factor) 2 | 3 | %% key parameters 4 | two_feature = p.two_feature; 5 | if two_feature 6 | feat_num = 2; 7 | feat_dim{1} = p.feat1dim; 8 | feat_dim{2} = p.feat2dim; 9 | else 10 | feat_num = 1; 11 | feat_dim{1} = p.feat1dim; 12 | end 13 | dim_att = p.dim_att; 14 | dim_act_threshold = p.dim_act_threshold; 15 | if dim_att 16 | dim_wlr = p.dim_wlr; 17 | end 18 | st_att = p.st_att; 19 | if st_att 20 | pos_lr = p.pos_lr; 21 | end 22 | 23 | %% Intrinsic parameters 24 | feat_type = p.feat_type; 25 | layerInd = p.layerInd; 26 | 27 | lambda1 = p.lambda1; 28 | lambda2 = p.lambda2; 29 | features = p.t_features; 30 | global_feat_params = p.t_global; 31 | num_frames = numel(p.img_files); 32 | s_frames = p.s_frames; 33 | video_path = p.video_path; 34 | % used for benchmark 35 | rect_positions = zeros(num_frames, 4); 36 | pos = p.init_pos; 37 | target_sz = p.target_sz; 38 | hann_window_cosine = single(hann(p.cf_response_size(1)) * hann(p.cf_response_size(2))'); 39 | 40 | offset = [-target_sz(1) 0; 0 -target_sz(2); target_sz(1) 0; 0 target_sz(2)]; 41 | output_sigma{1} = sqrt(prod(p.norm_target_sz)) * p.output_sigma_factor{1} / p.hog_cell_size; 42 | y{1} = gaussianResponse(p.cf_response_size, output_sigma{1}); 43 | yf{1} = fft2(y{1}); 44 | if two_feature 45 | output_sigma{2} = sqrt(prod(p.norm_target_sz)) * p.output_sigma_factor{2} / p.hog_cell_size; 46 | y{2} = gaussianResponse(p.cf_response_size, output_sigma{2}); 47 | yf{2} = fft2(y{2}); 48 | end 49 | 50 | % variables initialization 51 | model_x_f = cell(2,1); 52 | model_w_f = cell(2,1); 53 | z = cell(2,1); 54 | z_f = cell(2,1); 55 | kz_f = cell(2,1); 56 | x = cell(2,1); 57 | x_f = cell(2,1); 58 | k_f = cell(2,1); 59 | learning_rate_pwp = p.learning_rate_pwp; 60 | % patch of the target + padding 61 | patch_padded = getSubwindow(im, pos, p.norm_bg_area, bg_area); 62 | new_pwp_model = true; 63 | [bg_hist, fg_hist] = updateHistModel(new_pwp_model, patch_padded, bg_area, fg_area, target_sz, p.norm_bg_area, p.n_bins, p.grayscale_sequence); 64 | new_pwp_model = false; 65 | 66 | %% Scale filter 67 | % from DSST 68 | p.num_scales = 33; 69 | p.hog_scale_cell_size = 4; 70 | p.learning_rate_scale = 0.025; 71 | p.scale_sigma_factor = 1/2; 72 | p.scale_model_factor = 1.0; 73 | p.scale_step = 1.03; 74 | p.scale_model_max_area = 32*16; 75 | p.lambda = 1e-4; 76 | 77 | scale_factor = 1; 78 | scale_base_target_sz = target_sz; 79 | scale_sigma = sqrt(p.num_scales) * p.scale_sigma_factor; 80 | ss = (1:p.num_scales) - ceil(p.num_scales/2); 81 | ys = exp(-0.5 * (ss.^2) / scale_sigma^2); 82 | ysf = single(fft(ys)); 83 | if mod(p.num_scales,2) == 0 84 | scale_window = single(hann(p.num_scales+1)); 85 | scale_window = scale_window(2:end); 86 | else 87 | scale_window = single(hann(p.num_scales)); 88 | end 89 | ss = 1:p.num_scales; 90 | scale_factors = p.scale_step.^(ceil(p.num_scales/2) - ss); 91 | if p.scale_model_factor^2 * prod(p.norm_target_sz) > p.scale_model_max_area 92 | p.scale_model_factor = sqrt(p.scale_model_max_area/prod(p.norm_target_sz)); 93 | end 94 | scale_model_sz = floor(p.norm_target_sz * p.scale_model_factor); 95 | % find maximum and minimum scales 96 | min_scale_factor = p.scale_step ^ ceil(log(max(5 ./ bg_area)) / log(p.scale_step)); 97 | max_scale_factor = p.scale_step ^ floor(log(min([size(im,1) size(im,2)] ./ target_sz)) / log(p.scale_step)); 98 | 99 | % initialization 100 | trans_vec = []; 101 | 102 | %% MAIN LOOP 103 | t_imread = 0; 104 | tic; 105 | for frame = 1:num_frames 106 | if frame > 1 107 | tic_imread = tic; 108 | % Load the image at the current frame 109 | im = imread([s_frames{frame}]); 110 | t_imread = t_imread + toc(tic_imread); 111 | 112 | %% TESTING step 113 | im_patch_cf = getSubwindow(im, pos, p.norm_bg_area, bg_area); 114 | likelihood_map = getColourMap(im_patch_cf, bg_hist, fg_hist, p.n_bins, p.grayscale_sequence); 115 | likelihood_map(isnan(likelihood_map)) = 0; 116 | likelihood_map = imResample(likelihood_map, p.cf_response_size); 117 | likelihood_map = (likelihood_map + min(likelihood_map(:)))/(max(likelihood_map(:)) + min(likelihood_map(:))); 118 | if (sum(likelihood_map(:))/prod(p.cf_response_size)<0.01) 119 | likelihood_map = 1; 120 | end 121 | likelihood_map = max(likelihood_map, 0.1); 122 | hann_window = hann_window_cosine .* likelihood_map; 123 | if ~dim_att 124 | for M = 1:feat_num 125 | z{M} = bsxfun(@times, get_features(im_patch_cf, features, global_feat_params, feat_type{M}, layerInd{M}), hann_window); 126 | z_f{M} = double(fft2(z{M})); 127 | switch p.kernel_type{M} 128 | case 'gaussian' 129 | kz_f{M} = gaussian_correlation(z_f{M}, model_x_f{M}, p.tran_sigma{M}); 130 | case 'polynomial' 131 | kz_f{M} = polynomial_correlation(z_f{M}, model_x_f{M}, p.polya{M}, p.polyb{M}); 132 | end 133 | end 134 | response_cf{1} = real(ifft2(model_w_f{1} .* kz_f{1})); 135 | % Crop square search region (in feature pixels). 136 | response_cf{1} = cropFilterResponse(response_cf{1},floor_odd(p.norm_delta_area / p.hog_cell_size)); 137 | if two_feature 138 | response_cf{2} = real(ifft2(model_w_f{2} .* kz_f{2})); 139 | response_cf{2} = cropFilterResponse(response_cf{2},floor_odd(p.norm_delta_area / p.hog_cell_size)); 140 | end 141 | else 142 | shift_hann = circshift(hann_window_cosine, -floor(p.cf_response_size(1:2)/2)); 143 | for M = 1:feat_num 144 | z{M} = bsxfun(@times, get_features(im_patch_cf, features, global_feat_params, feat_type{M}, layerInd{M}), hann_window); 145 | z_f{M} = double(fft2(z{M})); 146 | size_zf = size(z_f{M}); 147 | switch p.kernel_type{M} 148 | case 'gaussian' 149 | for d = 1:feat_dim{M} 150 | kz_f{M}(:,:,d) = gaussian_correlation(z_f{M}(:,:,d), model_x_f{M}(:,:,d), p.tran_sigma{M}); 151 | end 152 | case 'polynomial' 153 | for d = 1:feat_dim{M} 154 | kz_f{M}(:,:,d) = polynomial_correlation(z_f{M}(:,:,d), model_x_f{M}(:,:,d), p.polya{M}, p.polyb{M}); 155 | end 156 | end 157 | end 158 | for M = 1:feat_num 159 | response_cf_chann{M} = real(ifft2(model_w_f{M} .* kz_f{M})); 160 | response_cf_ca{M} = bsxfun(@times, response_cf_chann{M}, reshape(model_chann_w{M}, 1, 1, size(response_cf_chann{M},3))); 161 | if st_att 162 | pa_map{M} = pos_attention(response_cf_ca{M}, hann_window, frame, target_sz, trans_vec); 163 | if frame == 2 164 | model_pa_map{M} = pa_map{M}; 165 | else 166 | model_pa_map{M} = pos_lr * pa_map{M} + (1-pos_lr) * model_pa_map{M}; 167 | end 168 | response_cf_cpa{M} = bsxfun(@times, response_cf_ca{M}, model_pa_map{M}); 169 | response_cf{M} = sum(response_cf_cpa{M}, 3); 170 | else 171 | response_cf{M} = sum(response_cf_ca{M}, 3); 172 | end 173 | % Crop square search region (in feature pixels). 174 | response_cf{M} = cropFilterResponse(response_cf{M},floor_odd(p.norm_delta_area / p.hog_cell_size)); 175 | end 176 | end 177 | 178 | if p.context_att 179 | if mod(frame - 1, p.bgl_interv) == 0 180 | gPMER(frame-1) = calPMER(response_cf{1}); 181 | feat_order = 1; 182 | z_bf{feat_order} = zeros([size(x_f{feat_order}) length(offset)], 'single'); 183 | for j = 1:length(offset) 184 | im_patch_bg = getSubwindow(im, pos+offset(j,:), p.norm_bg_area, bg_area); 185 | z_b = bsxfun(@times, get_features(im_patch_bg, features, global_feat_params, feat_type{feat_order}, layerInd{feat_order}), hann_window_cosine); 186 | z_bf{feat_order}(:,:,:,j) = fft2(z_b); 187 | switch p.kernel_type{feat_order} 188 | case 'gaussian' 189 | kz_bf{feat_order}(:,:,j) = gaussian_correlation(z_bf{feat_order}(:,:,:,j), z_bf{feat_order}(:,:,:,j), p.tran_sigma{feat_order}); 190 | case 'polynomial' 191 | kz_bf{feat_order}(:,:,j) = polynomial_correlation(z_bf{feat_order}(:,:,:,j), z_bf{feat_order}(:,:,:,j), p.polya{feat_order}, p.polyb{feat_order}); 192 | end 193 | response_context = real(ifft2(model_w_f{1} .* kz_bf{feat_order}(:,:,j))); 194 | % Crop square search region (in feature pixels). 195 | response_context = cropFilterResponse(response_context,floor_odd(p.norm_delta_area / p.hog_cell_size)); 196 | cPMER(frame-1,j) = calPMER(response_context); 197 | end 198 | part_i = cPMER(frame-1,:) / gPMER(frame-1); 199 | part_i = max(part_i, 0.3); 200 | % activation and normalization to 1 201 | penalty(frame,:) = 4 * part_i.^2 / sumsqr(part_i); 202 | model_p(frame,:) = 0.2 * penalty(frame,:) + 0.8 * model_p(frame-p.bgl_interv,:); 203 | end 204 | end 205 | 206 | % Scale up to match center likelihood resolution. 207 | response_cf{1} = mexResize(response_cf{1}, p.norm_delta_area,'auto'); 208 | if two_feature 209 | response_cf{2} = mexResize(response_cf{2}, p.norm_delta_area,'auto'); 210 | p1 = adaptive_weight(response_cf{1}); 211 | p2 = adaptive_weight(response_cf{2}); 212 | sum_p = p1 + p2; 213 | p1 = p1/sum_p; p2 = p2/sum_p; 214 | response_cf_all = ... 215 | (p1.*response_cf{1}./max(response_cf{1}(:))) + ... 216 | (p2.*response_cf{2}./max(response_cf{2}(:))); 217 | else 218 | response_cf_all = response_cf{1}; 219 | end 220 | center = (1+p.norm_delta_area) / 2; 221 | response = response_cf_all; 222 | 223 | [row, col] = find(response == max(response(:))); 224 | row = row(1); 225 | col = col(1); 226 | delta_row = row - center(1); 227 | delta_col = col - center(2); 228 | % sprintf("frame: %d", frame) 229 | trans_vec = ([delta_row, delta_col]) / area_resize_factor; 230 | pos = pos + trans_vec; 231 | % pos = pos(1:2); % avoid more than one max points 232 | rect_position = [pos([2,1]) - target_sz([2,1])/2, target_sz([2,1])]; 233 | %% SCALE SPACE SEARCH 234 | im_patch_scale = getScaleSubwindow(im, pos, scale_base_target_sz, scale_factor * scale_factors, scale_window, scale_model_sz, p.hog_scale_cell_size); 235 | xsf = fft(im_patch_scale,[],2); 236 | scale_response = real(ifft(sum(sf_num .* xsf, 1) ./ (sf_den + p.lambda) )); 237 | recovered_scale = ind2sub(size(scale_response),find(scale_response == max(scale_response(:)), 1)); 238 | %set the scale 239 | scale_factor = scale_factor * scale_factors(recovered_scale); 240 | 241 | if scale_factor < min_scale_factor 242 | scale_factor = min_scale_factor; 243 | elseif scale_factor > max_scale_factor 244 | scale_factor = max_scale_factor; 245 | end 246 | % use new scale to update bboxes for target, filter, bg and fg models 247 | target_sz = round(scale_base_target_sz * scale_factor); 248 | p.avg_dim = sum(target_sz)/2; 249 | bg_area = round(target_sz + p.avg_dim * p.padding); 250 | if(bg_area(2)>size(im,2)), bg_area(2)=size(im,2)-1; end 251 | if(bg_area(1)>size(im,1)), bg_area(1)=size(im,1)-1; end 252 | 253 | bg_area = bg_area - mod(bg_area - target_sz, 2); 254 | fg_area = round(target_sz - p.avg_dim * p.inner_padding); 255 | fg_area = fg_area + mod(bg_area - fg_area, 2); 256 | % Compute the rectangle with (or close to) params.fixed_area and same aspect ratio as the target bboxgetScaleSubwindow 257 | area_resize_factor = sqrt(p.fixed_area/prod(bg_area)); 258 | end 259 | 260 | %% Train and Update Model 261 | obj = getSubwindow(im, pos, target_sz); 262 | im_patch_fg = getSubwindow(im, pos, p.norm_bg_area, bg_area); 263 | for M = 1:feat_num 264 | x{M} = bsxfun(@times, get_features(im_patch_fg, features, global_feat_params, feat_type{M}, layerInd{M}), hann_window_cosine); 265 | x_f{M} = double(fft2(x{M})); 266 | size_xf = size(x_f{M}); 267 | if dim_att 268 | switch p.kernel_type{M} 269 | case 'gaussian' 270 | for d = 1:feat_dim{M} 271 | k_f{M}(:,:,d) = gaussian_correlation(x_f{M}(:,:,d), x_f{M}(:,:,d), p.tran_sigma{M}); 272 | end 273 | case 'polynomial' 274 | for d = 1:feat_dim{M} 275 | k_f{M}(:,:,d) = polynomial_correlation(x_f{M}(:,:,d), x_f{M}(:,:,d), p.polya{M}, p.polyb{M}); 276 | end 277 | end 278 | else 279 | switch p.kernel_type{M} 280 | case 'gaussian' 281 | k_f{M} = gaussian_correlation(x_f{M}, x_f{M}, p.tran_sigma{M}); 282 | case 'polynomial' 283 | k_f{M} = polynomial_correlation(x_f{M}, x_f{M}, p.polya{M}, p.polyb{M}); 284 | end 285 | end 286 | end 287 | 288 | %% contextual attention 289 | if p.context_att 290 | if frame == 1 291 | model_p(1,:) = [1 1 1 1]; 292 | end 293 | if mod(frame - 1, p.bgl_interv) == 0 294 | ijk = 1; 295 | x_bf{ijk} = zeros([size(x_f{ijk}) length(offset)],'single'); 296 | for j = 1:length(offset) 297 | context = getSubwindow(im, pos+offset(j,:), target_sz); 298 | im_patch_bg = getSubwindow(im, pos+offset(j,:), p.norm_bg_area, bg_area); 299 | x_b = bsxfun(@times, get_features(im_patch_bg, features, global_feat_params, feat_type{ijk}, layerInd{ijk}), hann_window_cosine); 300 | x_bf{ijk}(:,:,:,j) = fft2(x_b * model_p(frame,j) * sqrt(lambda2)); 301 | switch p.kernel_type{ijk} 302 | case 'gaussian' 303 | for d = 1:feat_dim{ijk} 304 | k_bf{ijk}(:,:,d,j) = gaussian_correlation(x_bf{ijk}(:,:,d,j), x_bf{ijk}(:,:,d,j), p.tran_sigma{ijk}); 305 | end 306 | case 'polynomial' 307 | for d = 1:feat_dim{ijk} 308 | k_bf{ijk}(:,:,d,j) = polynomial_correlation(x_bf{ijk}(:,:,d,j), x_bf{ijk}(:,:,d,j), p.polya{ijk}, p.polyb{ijk}); 309 | end 310 | end 311 | end 312 | new_wf_num{1} = k_f{1} .* yf{1}; 313 | new_wf_den{1} = k_f{1} .* conj(k_f{1}) + lambda1 + sum(k_bf{1} .* conj(k_bf{1}), 4); 314 | if two_feature 315 | new_wf_num{2} = k_f{2} .* yf{2}; 316 | new_wf_den{2} = k_f{2} .* conj(k_f{2}) + lambda1; 317 | end 318 | else 319 | new_wf_num{1} = k_f{1} .* yf{1}; 320 | new_wf_den{1} = k_f{1} .* conj(k_f{1}) + lambda1; 321 | if two_feature 322 | new_wf_num{2} = k_f{2} .* yf{2}; 323 | new_wf_den{2} = k_f{2} .* conj(k_f{2}) + lambda1; 324 | end 325 | end 326 | else 327 | for M = 1 : feat_num 328 | new_wf_num{M} = k_f{M} .* yf{M}; 329 | new_wf_den{M} = k_f{M} .* conj(k_f{M}) + lambda1; 330 | end 331 | end 332 | for M = 1:feat_num 333 | w_f{M} = new_wf_num{M} ./ new_wf_den{M}; 334 | end 335 | 336 | %% calculate per-channel feature weights 337 | if dim_att 338 | for M = 1:feat_num 339 | if frame == 1 340 | model_chann_w{M} = ones(1, feat_dim{M},'single'); 341 | end 342 | response_lr{M} = real(ifft2(w_f{M} .* k_f{M})); 343 | chann_w{M} = (max(reshape(response_lr{M}, [size(response_lr{M},1)*size(response_lr{M},2), size(response_lr{M},3)]), [], 1) ... 344 | +mean(mean(reshape(response_lr{M}, [size(response_lr{M},1)*size(response_lr{M},2), size(response_lr{M},3)])))); 345 | chann_w{M} = feat_dim{M} * chann_w{M} / sum(chann_w{M}); 346 | chann_w{M} = max(chann_w{M} - dim_act_threshold, 0) + dim_act_threshold; 347 | model_chann_w{M} = (1-dim_wlr)*model_chann_w{M} + dim_wlr*chann_w{M}; 348 | model_chann_w{M} = feat_dim{M} * model_chann_w{M} / sum(model_chann_w{M}); 349 | end 350 | end 351 | 352 | %% Initialization 353 | if frame == 1 354 | % first frame, train with a single image 355 | model_x_f = x_f; 356 | model_w_f = w_f; 357 | else 358 | % subsequent frames, update the model by linear interpolation 359 | for M = 1:feat_num 360 | model_x_f{M} = (1 - p.learning_rate_cf) * model_x_f{M} + p.learning_rate_cf * x_f{M}; 361 | model_w_f{M} = (1 - p.learning_rate_cf) * model_w_f{M} + p.learning_rate_cf * w_f{M}; 362 | end 363 | % BG/FG MODEL UPDATE patch of the target + padding 364 | im_patch_color = getSubwindow(im, pos, p.norm_bg_area, bg_area*(1-p.inner_padding)); 365 | [bg_hist, fg_hist] = updateHistModel(new_pwp_model, im_patch_color, bg_area, fg_area, target_sz, p.norm_bg_area, p.n_bins, p.grayscale_sequence, bg_hist, fg_hist, learning_rate_pwp); 366 | end 367 | %% Upadate Scale 368 | im_patch_scale = getScaleSubwindow(im, pos, scale_base_target_sz, scale_factor*scale_factors, scale_window, scale_model_sz, p.hog_scale_cell_size); 369 | xsf = fft(im_patch_scale,[],2); 370 | new_sf_num = bsxfun(@times, ysf, conj(xsf)); 371 | new_sf_den = sum(xsf .* conj(xsf), 1); 372 | if frame == 1 373 | sf_den = new_sf_den; 374 | sf_num = new_sf_num; 375 | else 376 | sf_den = (1 - p.learning_rate_scale) * sf_den + p.learning_rate_scale * new_sf_den; 377 | sf_num = (1 - p.learning_rate_scale) * sf_num + p.learning_rate_scale * new_sf_num; 378 | end 379 | %% update bbox position 380 | if (frame == 1) 381 | rect_position = [pos([2,1]) - target_sz([2,1])/2, target_sz([2,1])]; 382 | end 383 | rect_position_padded = [pos([2,1]) - bg_area([2,1])/2, bg_area([2,1])]; 384 | rect_positions(frame,:) = rect_position; 385 | 386 | elapsed_time = toc; 387 | 388 | %% Visualization 389 | if p.visualization == 1 390 | if frame == 1 %first frame, create GUI 391 | figure('Name',['Tracker - ' video_path]); 392 | im_handle = imshow(uint8(im), 'Border','tight', 'InitialMag', 100 + 100 * (length(im) < 500)); 393 | rect_handle = rectangle('Position',rect_position, 'EdgeColor','g', 'LineWidth',2); 394 | rect_handle2 = rectangle('Position',rect_position_padded, 'LineWidth',2, 'LineStyle','--', 'EdgeColor','b'); 395 | text_handle = text(10, 10, int2str(frame)); 396 | set(text_handle, 'color', [0 1 1]); 397 | else 398 | try %subsequent frames, update GUI 399 | set(im_handle, 'CData', im); 400 | set(rect_handle, 'Position', rect_position); 401 | set(rect_handle2, 'Position', rect_position_padded); 402 | set(text_handle, 'string', int2str(frame)); 403 | catch 404 | return 405 | end 406 | end 407 | drawnow 408 | end 409 | end 410 | results.model_p = model_p; 411 | 412 | %% save data for benchmark 413 | results.type = 'rect'; 414 | results.res = rect_positions; 415 | results.fps = num_frames/(elapsed_time - t_imread); 416 | fprintf('fps: %f',results.fps) 417 | 418 | end -------------------------------------------------------------------------------- /implementation/tran_filter/adaptive_weight.m: -------------------------------------------------------------------------------- 1 | function weight = adaptive_weight(response) 2 | 3 | response_temp = response; 4 | max_response = max(response_temp(:)); 5 | avg_response = mean(response_temp(:)); 6 | std_response = std(response_temp(:)); 7 | 8 | % weight = (max_response - avg_response)/ std_response; 9 | 10 | weight = 1 - exp(- (max_response - avg_response)^2 ./ (2 * std_response) ); 11 | end -------------------------------------------------------------------------------- /implementation/tran_filter/computeHistogram.m: -------------------------------------------------------------------------------- 1 | function histogram = computeHistogram(patch, mask, n_bins, grayscale_sequence) 2 | %COMPUTEHISTOGRAM creates a colour (or grayscale) histogram of an image patch 3 | % MASK has the same size as the image patch and selects what should 4 | % be used when computing the histogram (i.e. out-of-frame regions are ignored) 5 | 6 | [h, w, d] = size(patch); 7 | 8 | assert(all([h w]==size(mask)) == 1, 'mask and image are not the same size'); 9 | 10 | bin_width = 256/n_bins; 11 | 12 | % convert image to 1d array with same n channels of img patch 13 | patch_array = reshape(double(patch), w*h, d); 14 | % compute to which bin each pixel (for all 3 channels) belongs to 15 | bin_indices = floor(patch_array/bin_width) + 1; 16 | 17 | if grayscale_sequence 18 | histogram = accumarray(bin_indices, mask(:), [n_bins 1])/sum(mask(:)); 19 | else 20 | % the histogram is a cube of side n_bins 21 | histogram = accumarray(bin_indices, mask(:), [n_bins n_bins n_bins])/sum(mask(:)); 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /implementation/tran_filter/cropFilterResponse.m: -------------------------------------------------------------------------------- 1 | function new_response = cropFilterResponse(response_cf, response_size) 2 | %CROPFILTERRESPONSE makes RESPONSE_CF of size RESPONSE_SIZE (i.e. same size of colour response) 3 | 4 | [h,w] = size(response_cf); 5 | b = response_size(1); 6 | a = response_size(2); 7 | 8 | % a and b must be odd, as we want an exact center 9 | % if ~all_odd([a, b]) 10 | % error('dimensions must be odd'); 11 | % end 12 | half_width = floor(a/2); 13 | half_height = floor(b/2); 14 | 15 | new_response = response_cf(... 16 | mod_one(-half_height:half_height, h), ... 17 | mod_one(-half_width:half_width, w)); 18 | end 19 | 20 | function y = mod_one(a, b) 21 | y = mod(a-1, b)+1; 22 | end 23 | 24 | function y = all_odd(x) 25 | y = all(mod(x, 2) == 1); 26 | end 27 | -------------------------------------------------------------------------------- /implementation/tran_filter/floor_odd.m: -------------------------------------------------------------------------------- 1 | %% We want odd regions so that the central pixel can be exact 2 | function y = floor_odd(x) 3 | y = 2*floor((x-1) / 2) + 1; 4 | end -------------------------------------------------------------------------------- /implementation/tran_filter/gaussianResponse.m: -------------------------------------------------------------------------------- 1 | function y = gaussianResponse(rect_size, sigma) 2 | %GAUSSIANRESPONSE create the (fixed) target response of the correlation filter response 3 | half = floor((rect_size-1) / 2); 4 | i_range = -half(1):half(1); 5 | j_range = -half(2):half(2); 6 | [i, j] = ndgrid(i_range, j_range); 7 | i_mod_range = mod_one(i_range, rect_size(1)); 8 | j_mod_range = mod_one(j_range, rect_size(2)); 9 | y = zeros(rect_size); 10 | y(i_mod_range, j_mod_range) = exp(-(i.^2 + j.^2) / (2 * sigma^2)); 11 | end 12 | 13 | function y = mod_one(a, b) 14 | y = mod(a-1, b)+1; 15 | end 16 | -------------------------------------------------------------------------------- /implementation/tran_filter/gaussian_correlation.m: -------------------------------------------------------------------------------- 1 | function kf = gaussian_correlation(xf, yf, sigma) 2 | %GAUSSIAN_CORRELATION Gaussian Kernel at all shifts, i.e. kernel correlation. 3 | % Evaluates a Gaussian kernel with bandwidth SIGMA for all relative 4 | % shifts between input images X and Y, which must both be MxN. They must 5 | % also be periodic (ie., pre-processed with a cosine window). The result 6 | % is an MxN map of responses. 7 | % 8 | % Inputs and output are all in the Fourier domain. 9 | % 10 | % Joao F. Henriques, 2014 11 | % http://www.isr.uc.pt/~henriques/ 12 | 13 | N = size(xf,1) * size(xf,2); 14 | xx = xf(:)' * xf(:) / N; %squared norm of x 15 | yy = yf(:)' * yf(:) / N; %squared norm of y 16 | 17 | %cross-correlation term in Fourier domain 18 | xyf = xf .* conj(yf); 19 | xy = sum(real(ifft2(xyf)), 3); %to spatial domain 20 | 21 | %calculate gaussian response for all positions, then go back to the 22 | %Fourier domain 23 | kf = fft2(exp(-1 / sigma^2 * (xx + yy - 2 * xy) / numel(xf))); 24 | 25 | end 26 | 27 | -------------------------------------------------------------------------------- /implementation/tran_filter/gaussian_correlation_v2.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/tran_filter/gaussian_correlation_v2.m -------------------------------------------------------------------------------- /implementation/tran_filter/getCenterLikelihood.m: -------------------------------------------------------------------------------- 1 | function center_likelihood = getCenterLikelihood(object_likelihood, m) 2 | %GETCENTERLIKELIHOOD computes the sum over rectangles of size M. 3 | % CENTER_LIKELIHOOD is the 'colour response' 4 | [h,w] = size(object_likelihood); 5 | n1 = h - m(1) + 1; 6 | n2 = w - m(2) + 1; 7 | 8 | %% integral images 9 | % compute summed area table 10 | % SAT = zeros(h, w); 11 | % for y=1:h 12 | % for x=1:w 13 | % if x>1, SAT_left = SAT(y,x-1); 14 | % else SAT_left = 0; end 15 | % if y>1, SAT_up = SAT(y-1,x); 16 | % else SAT_up = 0; end 17 | % if y>1 && x>1, SAT_left_up = SAT(y-1,x-1); 18 | % else SAT_left_up = 0; end 19 | % 20 | % SAT(y,x) = object_likelihood(y,x) + SAT_left + SAT_up - SAT_left_up; 21 | % end 22 | % end 23 | % SAT = padarray(SAT,[1 1], 'pre'); 24 | 25 | %% equivalent MATLAB function 26 | SAT = integralImage(object_likelihood); 27 | i = 1:n1; 28 | j = 1:n2; 29 | center_likelihood = (SAT(i,j) + SAT(i+m(1), j+m(2)) - SAT(i+m(1), j) - SAT(i, j+m(2))) / prod(m); 30 | end 31 | -------------------------------------------------------------------------------- /implementation/tran_filter/getColourMap.m: -------------------------------------------------------------------------------- 1 | function [P_O] = getColourMap(patch, bg_hist, fg_hist, n_bins, grayscale_sequence) 2 | %% GETCOLOURMAP computes pixel-wise probabilities (PwP) given PATCH and models BG_HIST and FG_HIST 3 | % check whether the patch has 3 channels 4 | [h, w, d] = size(patch); 5 | % figure out which bin each pixel falls into 6 | bin_width = 256/n_bins; 7 | % convert image to d channels array 8 | patch_array = reshape(double(patch), w*h, d); 9 | % to which bin each pixel (for all d channels) belongs to 10 | bin_indices = floor(patch_array/bin_width) + 1; 11 | % Get pixel-wise posteriors (PwP) 12 | P_bg = getP(bg_hist, h, w, bin_indices, grayscale_sequence); 13 | P_fg = getP(fg_hist, h, w, bin_indices, grayscale_sequence); 14 | 15 | % Object-likelihood map 16 | P_O = P_fg ./ (P_fg + P_bg); 17 | end 18 | -------------------------------------------------------------------------------- /implementation/tran_filter/getP.m: -------------------------------------------------------------------------------- 1 | function P = getP(histogram, h, w, bin_indices, grayscale_sequence) 2 | %GETP computes the scores given the histogram 3 | % query the hist for the probability of each pixel 4 | if grayscale_sequence 5 | hist_indices = bin_indices; 6 | else 7 | hist_indices = sub2ind(size(histogram), bin_indices(:,1), bin_indices(:,2), bin_indices(:,3)); 8 | end 9 | 10 | % shape it as a matrix 11 | P = reshape(histogram(hist_indices), h, w); 12 | end -------------------------------------------------------------------------------- /implementation/tran_filter/getSubwindow.m: -------------------------------------------------------------------------------- 1 | function im_patch = getSubwindow(im, pos, model_sz, scaled_sz) 2 | %GET_SUBWINDOW Obtain image sub-window, padding is done by replicating border values. 3 | % Returns sub-window of image IM centered at POS ([y, x] coordinates), 4 | % with size MODEL_SZ ([height, width]). If any pixels are outside of the image, 5 | % they will replicate the values at the borders 6 | 7 | % with 3 input, no scale. With 4 params, scale adaptation 8 | if nargin < 4, sz = model_sz; 9 | else, sz = scaled_sz; 10 | end 11 | 12 | %make sure the size is not to small 13 | sz = max(sz, 2); 14 | %if sz(1) < 1, sz(1) = 2; end; 15 | %if sz(2) < 1, sz(2) = 2; end; 16 | 17 | %xs = floor(pos(2)) + (1:sz(2)) - floor(sz(2)/2); 18 | %ys = floor(pos(1)) + (1:sz(1)) - floor(sz(1)/2); 19 | xs = round(pos(2) + (1:sz(2)) - sz(2)/2); 20 | ys = round(pos(1) + (1:sz(1)) - sz(1)/2); 21 | 22 | %check for out-of-bounds coordinates, and set them to the values at 23 | %the borders 24 | xs(xs < 1) = 1; 25 | ys(ys < 1) = 1; 26 | xs(xs > size(im,2)) = size(im,2); 27 | ys(ys > size(im,1)) = size(im,1); 28 | 29 | %extract image 30 | im_patch_original = im(ys, xs, :); 31 | 32 | % (if rescaling is introduced) resize image to model size 33 | % im_patch = imresize(im_patch, model_sz, 'bilinear'); 34 | if nargin>=4 35 | % im_patch = mexResize(im_patch_original, model_sz, 'auto'); 36 | im_patch = mexResize(im_patch_original, model_sz, 'auto'); 37 | else 38 | im_patch = im_patch_original; 39 | end 40 | 41 | end 42 | 43 | -------------------------------------------------------------------------------- /implementation/tran_filter/linear_correlation.m: -------------------------------------------------------------------------------- 1 | function kf = linear_correlation(xf, yf) 2 | %LINEAR_CORRELATION Linear Kernel at all shifts, i.e. correlation. 3 | % Computes the dot-product for all relative shifts between input images 4 | % X and Y, which must both be MxN. They must also be periodic (ie., 5 | % pre-processed with a cosine window). The result is an MxN map of 6 | % responses. 7 | % 8 | % Inputs and output are all in the Fourier domain. 9 | % 10 | % Joao F. Henriques, 2014 11 | % http://www.isr.uc.pt/~henriques/ 12 | 13 | %cross-correlation term in Fourier domain 14 | kf = sum(xf .* conj(yf), 3) / numel(xf); 15 | 16 | end 17 | 18 | -------------------------------------------------------------------------------- /implementation/tran_filter/mergeResponses.m: -------------------------------------------------------------------------------- 1 | function [response] = mergeResponses(response_cf, response_pwp, alpha, merge_method) 2 | %MERGERESPONSES interpolates the two responses with the hyperparameter ALPHA 3 | if strcmp(merge_method, 'const_factor') 4 | response = (1 - alpha) * response_cf + alpha * response_pwp; 5 | end 6 | 7 | if strcmp(merge_method, 'fit_gaussian') 8 | [~, cov2D_cf] = fitGaussian(response_cf); 9 | [~, cov2D_pwp] = fitGaussian(response_pwp); 10 | response_u = ones(size(response_cf)); 11 | [~, cov2D_u] = fitGaussian(response_u); 12 | w_cf = 1 - sqrt(det(cov2D_cf)/det(cov2D_u)); 13 | w_pwp = 1 - sqrt(det(cov2D_pwp)/det(cov2D_u)); 14 | sum_cf_pwp = w_cf + w_pwp; 15 | w_cf = w_cf / sum_cf_pwp; 16 | w_pwp = w_pwp / sum_cf_pwp; 17 | 18 | response = w_cf * response_cf + w_pwp * response_pwp; 19 | fprintf('w_cf: %.3f w_pwp: %.3f\n', w_cf, w_pwp); 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /implementation/tran_filter/myHann.m: -------------------------------------------------------------------------------- 1 | %% Reimplementation of Hann window (in case signal processing toolbox is missing) 2 | function H = myHann(X) 3 | H = .5*(1 - cos(2*pi*(0:X-1)'/(X-1))); 4 | end -------------------------------------------------------------------------------- /implementation/tran_filter/polynomial_correlation.m: -------------------------------------------------------------------------------- 1 | function kf = polynomial_correlation(xf, yf, a, b) 2 | %POLYNOMIAL_CORRELATION Polynomial Kernel at all shifts, i.e. kernel correlation. 3 | % Evaluates a polynomial kernel with constant A and exponent B, for all 4 | % relative shifts between input images XF and YF, which must both be MxN. 5 | % They must also be periodic (ie., pre-processed with a cosine window). 6 | % The result is an MxN map of responses. 7 | % 8 | % Inputs and output are all in the Fourier domain. 9 | % 10 | % Joao F. Henriques, 2014 11 | % http://www.isr.uc.pt/~henriques/ 12 | 13 | %cross-correlation term in Fourier domain 14 | xyf = xf .* conj(yf); 15 | xy = sum(real(ifft2(xyf)), 3); %to spatial domain 16 | 17 | %calculate polynomial response for all positions, then go back to the 18 | %Fourier domain 19 | kf = fft2((xy / numel(xf) + a) .^ b); 20 | 21 | end 22 | 23 | -------------------------------------------------------------------------------- /implementation/tran_filter/predict_position.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/tran_filter/predict_position.m -------------------------------------------------------------------------------- /implementation/tran_filter/sigmoid_correlation.m: -------------------------------------------------------------------------------- 1 | function kf = sigmoid_correlation(xf, yf, sigma, c) 2 | %SIGMOID_CORRELATION Polynomial Kernel at all shifts, i.e. kernel correlation. 3 | % Evaluates a polynomial kernel with constant A and exponent B, for all 4 | % relative shifts between input images XF and YF, which must both be MxN. 5 | % They must also be periodic (ie., pre-processed with a cosine window). 6 | % The result is an MxN map of responses. 7 | % 8 | % Inputs and output are all in the Fourier domain. 9 | 10 | %cross-correlation term in Fourier domain 11 | xyf = xf .* conj(yf); 12 | xy = sum(real(ifft2(xyf)), 3); %to spatial domain 13 | 14 | %calculate polynomial response for all positions, then go back to the 15 | %Fourier domain 16 | kf = fft2(tanh(sigma * xy / numel(xf) + c)); 17 | 18 | end 19 | 20 | -------------------------------------------------------------------------------- /implementation/tran_filter/updateHistModel.m: -------------------------------------------------------------------------------- 1 | function [bg_hist_new, fg_hist_new] = updateHistModel(new_model, patch, bg_area, fg_area, target_sz, norm_area, n_bins, grayscale_sequence, bg_hist, fg_hist, learning_rate_pwp) 2 | %UPDATEHISTMODEL create new models for foreground and background or update the current ones 3 | 4 | % Get BG (frame around target_sz) and FG masks (inner portion of target_sz) 5 | pad_offset1 = (bg_area-target_sz)/2; % we constrained the difference to be mod2, so we do not have to round here 6 | % assert(sum(pad_offset1==round(pad_offset1))==2, 'difference between bg_area and target_sz has to be even.'); 7 | 8 | bg_mask = true(bg_area); % init bg_mask 9 | pad_offset1(pad_offset1<=0)=1; 10 | bg_mask(pad_offset1(1)+1:end-pad_offset1(1), pad_offset1(2)+1:end-pad_offset1(2)) = false; 11 | 12 | pad_offset2 = (bg_area-fg_area)/2; % we constrained the difference to be mod2, so we do not have to round here 13 | % assert(sum(pad_offset2==round(pad_offset2))==2, 'difference between bg_area and fg_area has to be even.'); 14 | fg_mask = false(bg_area); % init fg_mask 15 | pad_offset2(pad_offset2<=0)=1; 16 | fg_mask(pad_offset2(1)+1:end-pad_offset2(1), pad_offset2(2)+1:end-pad_offset2(2)) = true; 17 | 18 | fg_mask = mexResize(fg_mask, norm_area, 'auto'); 19 | bg_mask = mexResize(bg_mask, norm_area, 'auto'); 20 | 21 | %% (TRAIN) BUILD THE MODEL 22 | if new_model 23 | % from scratch (frame=1) 24 | bg_hist_new = computeHistogram(patch, bg_mask, n_bins, grayscale_sequence); 25 | fg_hist_new = computeHistogram(patch, fg_mask, n_bins, grayscale_sequence); 26 | else 27 | % update the model 28 | bg_hist_new = (1 - learning_rate_pwp)*bg_hist + learning_rate_pwp*computeHistogram(patch, bg_mask, n_bins, grayscale_sequence); 29 | fg_hist_new = (1 - learning_rate_pwp)*fg_hist + learning_rate_pwp*computeHistogram(patch, fg_mask, n_bins, grayscale_sequence); 30 | end 31 | 32 | end -------------------------------------------------------------------------------- /implementation/tran_filter/update_model.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/tran_filter/update_model.m -------------------------------------------------------------------------------- /implementation/tri_attention/context_attention/calPMER.m: -------------------------------------------------------------------------------- 1 | function PMER = calPMER(response) 2 | 3 | % Calculates the PMER (Peak-Median Energy Ratio) of the response map 4 | % in order to obtain a measure of peak strength 5 | 6 | % load('sample_data/correlation_mat'); 7 | 8 | % Get location of the max and min peak 9 | [xmax, ymax] = ind2sub(size(response),find(response == max(response(:)), 1)); 10 | 11 | % Get max and min peak value 12 | res_max = response(xmax,ymax); 13 | res_med = median(response(:)); 14 | 15 | % Peak sharpness of the response map 16 | num = (res_max - res_med)^2; 17 | 18 | % Overall fluctuations of the response map 19 | fluc_map = (response - res_med).^ 2; 20 | den = mean(fluc_map(:)); % version1 21 | % den = std(fluc_map(:)); % version2 22 | 23 | PMER = num / den; 24 | end 25 | -------------------------------------------------------------------------------- /implementation/tri_attention/dimension_attention/localmax_nonmaxsup2d.m: -------------------------------------------------------------------------------- 1 | function [local_max] = localmax_nonmaxsup2d(response) 2 | % find local 1st and 2nd maximum in 2d matrix 3 | % code borrow from CSRDCF 4 | 5 | BW = imregionalmax(response); 6 | CC = bwconncomp(BW); 7 | 8 | local_max = [max(response(:)) 0]; 9 | if length(CC.PixelIdxList) > 1 10 | local_max = zeros(length(CC.PixelIdxList)); 11 | for i = 1:length(CC.PixelIdxList) 12 | local_max(i) = response(CC.PixelIdxList{i}(1)); 13 | end 14 | local_max = sort(local_max, 'descend'); 15 | end 16 | 17 | end % endfunction -------------------------------------------------------------------------------- /implementation/tri_attention/dimension_attention/normalize_img.m: -------------------------------------------------------------------------------- 1 | function out = normalize_img(img) 2 | % normalize the 2d matrix 3 | % code borrow from CSRDCF 4 | 5 | min_val = min(img(:)); 6 | max_val = max(img(:)); 7 | 8 | if (max_val - min_val) > 0 9 | out = (img - min_val)/(max_val - min_val); 10 | else 11 | out = zeros(size(img)); 12 | end 13 | 14 | end % endfunction -------------------------------------------------------------------------------- /implementation/tri_attention/position_attention/pos_attention.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/implementation/tri_attention/position_attention/pos_attention.m -------------------------------------------------------------------------------- /implementation/tri_attention/position_attention/pos_pre.m: -------------------------------------------------------------------------------- 1 | function pre_output = pos_pre(R, win) 2 | 3 | % dimension axis sum 4 | R_win = bsxfun(@times, R, win); 5 | pos_sum = sum(R_win,3); 6 | map_norm = normalize_img(pos_sum); 7 | map_mean = map_norm - mean(map_norm(:)); 8 | map = max(map_mean,0); 9 | pre_output = exp(map)-0.5; 10 | 11 | end 12 | 13 | function out = normalize_img(img) 14 | % normalize the 2d matrix 15 | % code borrow from CSRDCF 16 | 17 | min_val = min(img(:)); 18 | max_val = max(img(:)); 19 | 20 | if (max_val - min_val) > 0 21 | out = (img - min_val)/(max_val - min_val); 22 | else 23 | out = zeros(size(img)); 24 | end 25 | 26 | end % endfunction -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # TACF-Tracker 2 | 3 | | **Test passed** | 4 | | ------------------------------------------------------------ | 5 | | [![matlab-2018a](https://img.shields.io/badge/matlab-2018a-yellow.svg)](https://www.mathworks.com/products/matlab.html) | 6 | 7 | Matlab implementation of our Towards Robust Visual Tracking for Unmanned Aerial Vehicle with Tri-Attentional Correlation Filters (TACF) tracker. 8 | 9 | 10 | # Paper and Citation 11 | 12 | This paper has been accepted by IROS2020. 13 | 14 | You can find this paper here: https://arxiv.org/abs/2008.00528. 15 | 16 | Please cite this paper as: 17 | 18 | @article{2008.00528, 19 | 20 | author = {Yujie He and Changhong Fu and Fuling Lin and Yiming Li and Peng Lu}, 21 | 22 | title = {Towards Robust Visual Tracking for Unmanned Aerial Vehicle with Tri-Attentional Correlation Filters}, 23 | 24 | year = {2020}, 25 | 26 | journal = {arXiv:2008.00528} 27 | 28 | } 29 | 30 | ### Abstract 31 | 32 | >Object tracking has been broadly applied in unmanned aerial vehicle (UAV) tasks in recent years. How-ever, existing algorithms still face difficulties such as partial occlusion, clutter background, and other challenging visual factors. Inspired by the cutting-edge attention mechanisms, a new visual tracking framework leveraging multi-level visual attention to make full use of the information during tracking. Three primary attention, i.e., contextual attention, dimensional attention, and spatiotemporal attention, are integrated into the training and detection stages of correlation filter-based tracking pipeline. Therefore, the proposed tracker is equipped with robust discriminative power against challenging factors while maintains high operational efficiency in UAV scenarios. Quantitative and qualitative experiments on two well-known benchmark with 173 challenging UAV video sequences demonstrate the effectiveness of the proposed framework. The proposed tracking algorithm compares favorably against state-of-the-art methods, yielding 4.8% relative gain in UAVDT and 8.2% relative gain in UAV123@10fps against the baseline tracker while operating at the speed of ∼28 frames per second 33 | 34 | 35 | ### Running instructions 36 | 37 | 1. Config dataset path in `UAV123_utils/load_video_information.m`, 38 | 39 | 2. Run `TACF_Demo.m` 40 | 41 | ### Results on UAV datasets 42 | 43 |
44 | UAVDT 45 |
46 | UAVDT_overlap 47 |
48 |
49 | 50 | 51 |
52 | UAV123@10fps 53 |
54 | UAV123@10fps 55 |
56 |
57 | 58 | ### Contact 59 | 60 | Yujie He 61 | 62 | Email: he-yujie@outlook.com 63 | 64 | Changhong Fu 65 | 66 | Email: changhong.fu@tongji.edu.cn 67 | 68 | ### Acknowledgements 69 | 70 | We thank the contribution of Dr.`Chen Wang` and Dr. `Martin Danelljan` for their previous work KCC, DSST and ECO. The feature extraction modules are borrowed from the [ECO](https://github.com/martin-danelljan/ECO) and some of the parameter settings and functions are borrowed from [KCC](https://github.com/wang-chen/KCC/tree/master/tracking). 71 | -------------------------------------------------------------------------------- /results/overlap_OPE_UAV123.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/results/overlap_OPE_UAV123.png -------------------------------------------------------------------------------- /results/overlap_OPE_UAVDT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/results/overlap_OPE_UAVDT.png -------------------------------------------------------------------------------- /run_TACF.m: -------------------------------------------------------------------------------- 1 | function results = run_TACF(seq,res_path, bSaveImage) 2 | 3 | setup_paths; 4 | params.visualization = 1; 5 | 6 | %% New add-on 7 | % % Spatiotemporal attention available 8 | params.st_att = 1; 9 | % % Dimensional attention available 10 | params.dim_att = 1; 11 | params.dim_wlr = 0.022; 12 | params.dim_act_threshold = 0.3; 13 | % % Contextual attention available 14 | params.context_att = 1; 15 | % learning intervals for context similarity /frame 16 | params.bgl_interv = 4; 17 | params.two_feature = 1; 18 | params.pos_lr = 0.02; 19 | 20 | params.hog_cell_size = 4; 21 | params.fixed_area = 200^2; % 150^2 % standard area to which we resize the target 22 | params.n_bins = 2^5; % number of bins for the color histograms (bg and fg models) 23 | params.learning_rate_pwp = 0.02; % bg and fg color models learning rate 24 | params.lambda_scale = 0.1; % regularization weight 25 | params.scale_sigma_factor = 1/16; 26 | params.scale_sigma = 0.1; 27 | params.merge_factor = 0.3; 28 | 29 | % fixed setup 30 | params.hog_scale_cell_size = 4; % Default DSST=4 31 | params.scale_model_factor = 1.0; 32 | 33 | params.feature_type = 'fhog'; 34 | params.scale_adaptation = true; 35 | params.grayscale_sequence = false; % suppose that sequence is colour 36 | params.merge_method = 'const_factor'; 37 | 38 | params.img_files = seq.s_frames; 39 | params.img_path = ''; 40 | 41 | s_frames = seq.s_frames; 42 | params.s_frames = s_frames; 43 | params.video_path = seq.video_path; 44 | im = imread([s_frames{1}]); 45 | % grayscale sequence? --> use 1D instead of 3D histograms 46 | if(size(im,3)==1) 47 | params.grayscale_sequence = true; 48 | end 49 | 50 | region = seq.init_rect; 51 | 52 | if(numel(region)==8) 53 | % polygon format (VOT14, VOT15) 54 | [cx, cy, w, h] = getAxisAlignedBB(region); 55 | else % rectangle format (WuCVPR13) 56 | x = region(1); 57 | y = region(2); 58 | w = region(3); 59 | h = region(4); 60 | cx = x+w/2; 61 | cy = y+h/2; 62 | end 63 | 64 | % init_pos is the centre of the initial bounding box 65 | params.init_pos = [cy cx]; 66 | params.target_sz = round([h w]); 67 | % defines inner area used to sample colors from the foreground 68 | params.inner_padding = 0.2; 69 | 70 | [params, bg_area, fg_area, area_resize_factor] = initializeAllAreas(im, params); 71 | 72 | % HOG feature parameters 73 | hog_params.nDim = 31; 74 | % CN feature parameters 75 | cn_params.nDim = 11; 76 | % Gray feature parameters 77 | gray_params.nDim = 1; 78 | % Saliency feature parameters 79 | saliency_params.nDim = 3; 80 | % Deep feature parameters 81 | params.indLayers = [37, 28, 19];% The CNN layers Conv3-4 in VGG Net 82 | deep_params.nDim = [512, 512, 256]; 83 | deep_params.layers = params.indLayers; 84 | % handcrafted parameters 85 | Feat1 = 'fhog'; % fhog, cn, gray, saliency, handcrafted_assem fhog_cn 86 | switch Feat1 87 | case 'conv3' 88 | params.layerInd{1} = 3; 89 | params.feat1dim = deep_params.nDim(1); 90 | case 'conv4' 91 | params.layerInd{1} = 2; 92 | params.feat1dim = deep_params.nDim(2); 93 | case 'conv5' 94 | params.layerInd{1} = 1; 95 | params.feat1dim = deep_params.nDim(3); 96 | case 'fhog' 97 | params.layerInd{1} = 0; 98 | params.feat1dim = hog_params.nDim; 99 | case 'cn' 100 | params.layerInd{1} = 0; 101 | params.feat1dim = cn_params.nDim; 102 | case 'handcrafted_assem' 103 | params.layerInd{1} = 0; 104 | params.feat1dim = hog_params.nDim + cn_params.nDim; 105 | end 106 | 107 | if params.two_feature 108 | Feat2 = 'cn'; % fhog, cn, gray, saliency, handcrafted_assem 109 | switch Feat2 110 | case 'conv3' 111 | params.layerInd{2} = 3; 112 | params.feat2dim = deep_params.nDim(1); 113 | case 'conv4' 114 | params.layerInd{2} = 2; 115 | params.feat2dim = deep_params.nDim(2); 116 | case 'conv5' 117 | params.layerInd{2} = 1; 118 | params.feat2dim = deep_params.nDim(3); 119 | case 'fhog' 120 | params.layerInd{2} = 0; 121 | params.feat2dim = hog_params.nDim; 122 | case 'cn' 123 | params.layerInd{2} = 0; 124 | params.feat2dim = cn_params.nDim; 125 | case 'handcrafted_assem' 126 | params.layerInd{2} = 0; 127 | params.feat2dim = hog_params.nDim + cn_params.nDim; 128 | end 129 | params.feat_type = {Feat1, Feat2}; 130 | else 131 | params.feat_type = {Feat1}; 132 | end 133 | 134 | params.t_global.type_assem = 'fhog_cn'; % fhog_cn, fhog_gray,fhog_cn_gray_saliency, fhog_gray_saliency,fhog_cn_gray,fhog_gray 135 | switch params.t_global.type_assem 136 | case 'fhog_cn_gray_saliency' 137 | handcrafted_params.nDim = hog_params.nDim + cn_params.nDim + gray_params.nDim + saliency_params.nDim; 138 | case 'fhog_cn_gray' 139 | handcrafted_params.nDim = hog_params.nDim + cn_params.nDim + gray_params.nDim; 140 | case 'fhog_gray_saliency' 141 | handcrafted_params.nDim = hog_params.nDim + gray_params.nDim + saliency_params.nDim; 142 | case 'fhog_gray' 143 | handcrafted_params.nDim = hog_params.nDim + gray_params.nDim; 144 | case 'fhog_cn' 145 | handcrafted_params.nDim = hog_params.nDim + cn_params.nDim; 146 | end 147 | 148 | params.t_features = {struct('getFeature_fhog',@get_fhog,... 149 | 'getFeature_cn',@get_cn,... 150 | 'getFeature_gray',@get_gray,... 151 | 'getFeature_saliency',@get_saliency,... 152 | 'getFeature_deep',@get_deep,... 153 | 'getFeature_handcrafted',@get_handcrafted,... 154 | 'hog_params',hog_params,... 155 | 'cn_params',cn_params,... 156 | 'gray_params',gray_params,... 157 | 'saliency_params',saliency_params,... 158 | 'deep_params',deep_params,... 159 | 'handcrafted_params',handcrafted_params)}; 160 | 161 | params.t_global.w2c_mat = load('w2c.mat'); 162 | params.t_global.factor = 0.2; % for saliency 163 | params.t_global.cell_size = 4; 164 | params.t_global.cell_selection_thresh = 0.75^2; 165 | 166 | params.lambda1 = 1e-4; % 167 | params.lambda2 = 1/(16^2); % 168 | 169 | kernel_type{1} = 'gaussian'; 170 | kernel_type{2} = 'polynomial'; 171 | params.kernel_type = kernel_type; 172 | params.output_sigma_factor = {1/40, 1/16}; 173 | params.tran_sigma = {0.5, 0.5}; 174 | params.polya = {1,1}; 175 | params.polyb = {7,2}; 176 | 177 | params.learning_rate_cf = 0.01; 178 | 179 | params.num_scales = 33; 180 | params.scale_step = 1.03; 181 | params.scale_model_max_area = 32*16; 182 | params.learning_rate_scale = 0.004; 183 | 184 | % start the tracking 185 | results = tracker(params, im, bg_area, fg_area, area_resize_factor); 186 | 187 | end -------------------------------------------------------------------------------- /seq/anno/wakeboard7.txt: -------------------------------------------------------------------------------- 1 | 623,299,11,38 2 | 624,296,11,38 3 | 624,293,11,38 4 | 624,290,11,38 5 | 622,286,11,41 6 | 621,284,12,41 7 | 622,277,12,44 8 | 625,271,12,44 9 | 627,265,12,44 10 | 632,257,13,46 11 | 640,250,13,46 12 | 648,243,13,48 13 | 654,236,13,48 14 | 660,229,13,48 15 | 664,225,13,48 16 | 667,219,13,48 17 | 669,213,13,48 18 | 672,203,13,50 19 | 675,197,14,51 20 | 684,189,15,53 21 | 693,184,15,55 22 | 701,175,16,50 23 | 706,169,17,48 24 | 709,163,17,54 25 | 709,162,17,55 26 | 709,160,17,57 27 | 709,159,18,63 28 | 714,159,22,66 29 | 720,164,24,64 30 | 726,167,24,64 31 | 729,169,24,64 32 | 733,170,24,65 33 | 733,171,28,65 34 | 734,170,30,64 35 | 736,165,31,65 36 | 738,162,33,64 37 | 743,157,35,65 38 | 745,150,38,62 39 | 747,143,41,64 40 | 763,141,39,64 41 | 774,138,39,63 42 | 786,134,38,63 43 | 800,131,41,61 44 | 814,130,41,64 45 | 826,128,43,64 46 | 842,127,42,65 47 | 857,128,42,65 48 | 873,127,45,65 49 | 884,128,45,64 50 | 893,131,45,64 51 | 897,138,45,64 52 | 894,144,43,62 53 | 888,153,43,61 54 | 886,159,42,61 55 | 888,168,41,59 56 | 895,177,41,59 57 | 905,189,39,58 58 | 924,204,38,57 59 | 940,222,38,57 60 | 959,241,35,53 61 | 965,255,35,56 62 | 961,265,36,54 63 | 955,275,34,54 64 | 947,282,34,54 65 | 939,290,32,54 66 | 935,296,32,52 67 | 940,303,30,52 68 | -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000001.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000002.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000003.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000004.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000005.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000006.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000007.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000007.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000008.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000009.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000009.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000010.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000011.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000011.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000012.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000012.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000013.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000013.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000014.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000014.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000015.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000016.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000016.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000017.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000018.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000019.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000020.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000021.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000022.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000022.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000023.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000023.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000024.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000025.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000025.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000026.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000026.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000027.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000027.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000028.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000028.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000029.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000029.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000030.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000031.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000031.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000032.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000032.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000033.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000033.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000034.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000034.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000035.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000035.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000036.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000036.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000037.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000037.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000038.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000038.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000039.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000039.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000040.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000040.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000041.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000041.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000042.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000042.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000043.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000043.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000044.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000044.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000045.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000045.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000046.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000046.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000047.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000047.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000048.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000049.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000049.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000050.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000050.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000051.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000051.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000052.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000052.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000053.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000053.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000054.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000054.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000055.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000055.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000056.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000056.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000057.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000057.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000058.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000058.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000059.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000059.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000060.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000060.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000061.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000061.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000062.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000062.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000063.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000063.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000064.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000064.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000065.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000065.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000066.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000066.jpg -------------------------------------------------------------------------------- /seq/data_seq/wakeboard7/000067.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vision4robotics/TACF-Tracker/8936636bab9e8d95565d5aaeea84cb29eb7f9742/seq/data_seq/wakeboard7/000067.jpg -------------------------------------------------------------------------------- /setup_paths.m: -------------------------------------------------------------------------------- 1 | function setup_paths() 2 | 3 | % Add the neccesary paths 4 | [pathstr,~,~] = fileparts(mfilename('fullpath')); 5 | addpath(genpath([pathstr '/utils/'])); 6 | addpath(genpath([pathstr '/implementation/'])); 7 | addpath(genpath([pathstr '/feature_extraction/'])); 8 | addpath(genpath([pathstr '/external_libs/'])); 9 | 10 | end --------------------------------------------------------------------------------