img_dir = os.path.join(data_path, 'img') tracker = PyTracker(img_dir, tracker_type=tracker_type, dataset_config=dataset_config) result_path = "../results/CF/{0}/{1}/{2}".format( tracker_type, dataset, data_name) if not os.path.exists(result_path): os.makedirs(result_path) poses, fps, apce, psr, fmax = tracker.tracking( verbose=True, video_path=os.path.join(result_path, data_name + '.avi')) auc = plot_success( gts, poses, os.path.join(result_path, data_name + '_success.jpg')) precision = plot_precision( gts, poses, os.path.join(result_path, data_name + '_precision.jpg')) fpss.append(np.float(fps)) apses.append(np.float(apce)) psrs.append(np.float(psr)) fmaxs.append(np.float(fmax)) aucs.append(np.float(auc)) precisions.append(np.float(precision)) file_path = "../results/CF/{0}/{1}/result.txt".format( tracker_type, dataset) if not os.path.exists(file_path): with open(file_path, "w") as f: f.write( "Name\t\tFPS\t\tAPCE\t\tPSR\t\tFmax\t\tAUC\t\tPrecision\n"
import os from examples.pytracker import PyTracker from lib.utils import get_ground_truthes, plot_precision, plot_success from examples.otbdataset_config import OTBDatasetConfig if __name__ == '__main__': data_dir = '../dataset/test' data_names = sorted(os.listdir(data_dir)) print(data_names) dataset_config = OTBDatasetConfig() for data_name in data_names: data_path = os.path.join(data_dir, data_name) gts = get_ground_truthes(data_path) if data_name in dataset_config.frames.keys(): start_frame, end_frame = dataset_config.frames[data_name][:2] if data_name != 'David': gts = gts[start_frame - 1:end_frame] img_dir = os.path.join(data_path, 'img') tracker = PyTracker(img_dir, tracker_type='LDES', dataset_config=dataset_config) poses = tracker.tracking(verbose=True, video_path=os.path.join( '../results/CF', data_name + '_vis.avi')) plot_success(gts, poses, os.path.join('../results/CF', data_name + '_success.jpg')) plot_precision( gts, poses, os.path.join('../results/CF', data_name + '_precision.jpg'))
img_dir = os.path.join(data_path, 'img') # Elnura color names (CN) #trackers___ = ['MOSSE', 'KCF_GRAY', 'CN'] tracker = PyTracker( img_dir, tracker_type=tracker_type, dataset_config=dataset_config ) # DCF_HOG DCF_GRAY STRCF ECO KCF_GRAY MOSSE KCF_CN CN ECO-HC CSRDCF video_path = join(join(data_dir, data_name), 'img/RESULT/' + tracker_type + '_vis.avi') success_plot_path = join(join(data_dir, data_name), 'img/RESULT/' + tracker_type + '_success.png') precision_plot_path = join( join(data_dir, data_name), 'img/RESULT/' + tracker_type + '_precision.png') poses = tracker.tracking(verbose=True, video_path=video_path) plot_success(gts, poses, success_plot_path) plot_precision(gts, poses, precision_plot_path) ''' for data_name in data_names: print(data_name) data_path = os.path.join(data_dir, data_name) # Elnura img_dir1 = os.path.join(data_path,'img/RESULT/MOSSE') img_dir2 = os.path.join(data_path, 'img/RESULT/KCF_CN') img_dir3 = os.path.join(data_path, 'img/RESULT/KCF_GRAY') create_fig(img_dir1, 'MOSSE ' + data_name +'.png') create_fig(img_dir2, 'KCF_CN ' + data_name +'.png') create_fig(img_dir3, 'KCF_GRAY ' + data_name +'.png') '''