def main(): args = parse_args() # prepare model (SiamRPN or SiamFC) # prepare tracker info = edict() info.arch = args.arch info.dataset = args.video info.epoch_test = True info.cls_type = 'thinner' if 'FC' in args.arch: net = models.__dict__[args.arch]() tracker = SiamFC(info) else: net = models.__dict__[args.arch](anchors_nums=5, cls_type='thinner') tracker = SiamRPN(info) print('[*] ======= Track video with {} ======='.format(args.arch)) net = load_pretrain(net, args.resume) net.eval() net = net.cuda() # check init box is list or not if not isinstance(args.init_bbox, list) and args.init_bbox is not None: args.init_bbox = list(eval(args.init_bbox)) else: pass track_video(tracker, net, args.video, init_box=args.init_bbox)
def main(): args = parse_args() # prepare model (SiamRPN or SiamFC) # prepare tracker info = edict() info.arch = args.arch info.dataset = 'NOUSE' info.epoch_test = True if 'FC' in args.arch: net = models.__dict__[args.arch]() tracker = SiamFC(info) else: net = models.__dict__[args.arch](anchors_nums=5) tracker = SiamRPN(info) print('[*] ======= Track video with {} ======='.format(args.arch)) net = load_pretrain(net, args.resume) net.eval() net = net.cuda() track_webcam(tracker, net)
def __init__(self, backbone, target): super(SiamDWGroup, self).__init__(f"SiamDWGroup/{backbone}/{target}") info = edict() info.arch = backbone info.dataset = target info.epoch_test = False if target == "OTB": info.dataset = "OTB2015" elif target == "VOT": info.dataset = "VOT2017" else: raise ValueError("Invalid target") if backbone == "SiamFCIncep22": net_file = path_config.SIAMDW_CIRINCEP22_MODEL self.tracker = SiamFC(info) self.net = models.__dict__[info.arch]() elif backbone == "SiamFCNext22": net_file = path_config.SIAMDW_CIRNEXT22_MODEL self.tracker = SiamFC(info) self.net = models.__dict__[info.arch]() elif backbone == "SiamFCRes22": net_file = path_config.SIAMDW_CIRESNET22_MODEL self.tracker = SiamFC(info) self.net = models.__dict__[info.arch]() elif backbone == "SiamRPNRes22": net_file = path_config.SIAMDW_CIRESNET22_RPN_MODEL info.cls_type = "thinner" self.tracker = SiamRPN(info) self.net = models.__dict__[info.arch](anchors_nums=5, cls_type=info.cls_type) else: raise ValueError("Invalid backbone") self.net = load_pretrain(self.net, net_file) self.net.eval() self.net = self.net.cuda()
def main(): args = parse_args() # prepare model net = models.__dict__[args.arch]() net = load_pretrain(net, args.resume) net.eval() net = net.cuda() # prepare video dataset = load_dataset(args.dataset) video_keys = list(dataset.keys()).copy() # prepare tracker info = edict() info.arch = args.arch info.dataset = args.dataset info.epoch_test = args.epoch_test tracker = SiamFC(info) # tracking all videos in benchmark for video in video_keys: track(tracker, net, dataset[video], args)
crossover=crossover, mutation=mutation, \ analysis=[FitnessStore, ConsoleOutput]) # create model net = models.__dict__[args.arch]() net = load_pretrain(net, args.resume) net.eval() net = net.cuda() print('==> pretrained model has been loaded') # prepare tracker info = edict() info.arch = args.arch info.dataset = args.dataset info.epoch_test = False tracker = SiamFC(info) # Define fitness function. @engine.fitness_register def fitness(indv): scale_step, scale_lr, scale_penalty, window_influence = indv.solution # add params top config config = dict() config['benchmark'] = args.dataset config['arch'] = args.arch config['resume'] = args.resume config['hp'] = dict() config['hp']['scale_step'] = scale_step config['hp']['scale_penalty'] = scale_penalty
def fitness(config, reporter): # create model if args.arch in ['Ocean']: model = models.__dict__[args.arch](align=info.align) tracker = Ocean(info) elif args.arch in ['OceanPlus']: model = models.__dict__[args.arch](online=args.online, mms=args.MMS) tracker = OceanPlus(info) elif 'SiamDW' in args.arch: model = models.__dict__[args.arch]() tracker = SiamFC(info) else: raise ValueError('not supported other model now') model = load_pretrain(model, args.resume) model.eval() model = model.cuda() print('pretrained model has been loaded') print(os.environ['CUDA_VISIBLE_DEVICES']) if args.arch in ['Ocean']: penalty_k = config["penalty_k"] scale_lr = config["scale_lr"] window_influence = config["window_influence"] small_sz = config["small_sz"] big_sz = config["big_sz"] ratio = config["ratio"] model_config = dict() model_config['benchmark'] = args.dataset model_config['arch'] = args.arch model_config['resume'] = args.resume model_config['hp'] = dict() model_config['hp']['penalty_k'] = penalty_k model_config['hp']['window_influence'] = window_influence model_config['hp']['lr'] = scale_lr model_config['hp']['small_sz'] = small_sz model_config['hp']['big_sz'] = big_sz model_config['hp']['ratio'] = ratio elif args.arch in ['OceanPlus']: penalty_k = config["penalty_k"] scale_lr = config["scale_lr"] window_influence = config["window_influence"] small_sz = config["small_sz"] big_sz = config["big_sz"] lambda_u = config["lambda_u"] lambda_s = config["lambda_s"] cyclic_thr = config["cyclic_thr"] choose_thr = config["choose_thr"] model_config = dict() model_config['benchmark'] = args.dataset model_config['arch'] = args.arch model_config['resume'] = args.resume model_config['hp'] = dict() model_config['hp']['penalty_k'] = penalty_k model_config['hp']['window_influence'] = window_influence model_config['hp']['lr'] = scale_lr model_config['hp']['small_sz'] = small_sz model_config['hp']['big_sz'] = big_sz model_config['hp']['lambda_u'] = lambda_u model_config['hp']['lambda_s'] = lambda_s model_config['hp']['cyclic_thr'] = cyclic_thr model_config['hp']['choose_thr'] = choose_thr elif args.arch in ['SiamFC', 'SiamDW']: scale_step = config["scale_step"] scale_penalty = config["scale_penalty"] scale_lr = config["scale_lr"] w_influence = config["w_influence"] model_config = dict() model_config['benchmark'] = args.dataset model_config['arch'] = args.arch model_config['resume'] = args.resume model_config['hp'] = dict() model_config['hp']['scale_step'] = scale_step model_config['hp']['scale_penalty'] = scale_penalty model_config['hp']['w_influence'] = w_influence model_config['hp']['scale_lr'] = scale_lr else: raise ValueError('not supported tracker') # ------------- # For OceanPlus # ------------- # VOT and OceanPlus if args.dataset.startswith('VOT') and args.arch in ['OceanPlus']: eao = eao_vot_oceanplus(tracker, model, model_config) print( "penalty_k: {0}, scale_lr: {1}, window_influence: {2}, small_sz: {3}, big_sz: {4}, lambda_u: {5}, lambda_s: {6}, cyclic_thr: {7}, choose_thr: {8}, eao: {9}" .format(penalty_k, scale_lr, window_influence, small_sz, big_sz, lambda_u, lambda_s, cyclic_thr, choose_thr, eao)) reporter(EAO=eao) # GOT10K and OceanPlus if args.dataset.startswith('GOT') and args.arch in ['OceanPlus']: auc = auc_got10k_oceanplus(tracker, model, model_config) print( "penalty_k: {0}, scale_lr: {1}, window_influence: {2}, small_sz: {3}, big_sz: {4}, lambda_u: {5}, lambda_s: {6}, cyclic_thr: {7}, choose_thr: {8}, eao: {9}" .format(penalty_k, scale_lr, window_influence, small_sz, big_sz, lambda_u, lambda_s, cyclic_thr, choose_thr, auc.item())) reporter(AUC=auc) # ---------- # For Ocean # ---------- # VOT and Ocean if args.dataset.startswith('VOT') and args.arch in ['Ocean']: eao = eao_vot(tracker, model, model_config) print( "penalty_k: {0}, scale_lr: {1}, window_influence: {2}, small_sz: {3}, big_sz: {4}, ratio: {6}, eao: {5}" .format(penalty_k, scale_lr, window_influence, small_sz, big_sz, eao, ratio)) reporter(EAO=eao) # OTB and Ocean if args.dataset.startswith('OTB') and args.arch in ['Ocean']: auc = auc_otb(tracker, model, model_config) print( "penalty_k: {0}, scale_lr: {1}, window_influence: {2}, small_sz: {3}, big_sz: {4}, ratio: {6}, eao: {5}" .format(penalty_k, scale_lr, window_influence, small_sz, big_sz, auc.item(), ratio)) reporter(AUC=auc) # ------------ # For SiamDW # ------------ # OTB and SiamFC/DW if args.dataset.startswith('OTB') and ('SiamFC' in args.arch or 'SiamDW' in args.arch): auc = auc_otb_fc(tracker, model, model_config) print( "scale_step: {0}, scale_lr: {1}, scale_penalty: {2}, window_influence: {3}, auc: {4}" .format(scale_step, scale_lr, scale_penalty, w_influence, auc.item())) reporter(AUC=auc) # VOT and SiamFC/DW if args.dataset.startswith('VOT') and ('SiamFC' in args.arch or 'SiamDW' in args.arch): eao = eao_vot_fc(tracker, model, model_config) print( "scale_step: {0}, scale_lr: {1}, scale_penalty: {2}, window_influence: {3}, eao: {4}" .format(scale_step, scale_lr, scale_penalty, w_influence, eao)) reporter(EAO=eao)