def run_vot_exp(tracker_name, para_name, refine_model_name, threshold, VIS=False): torch.set_num_threads(1) save_root = os.path.join( '/home/alphabin/Desktop/AlphaRefine_submit/vot20_debug', para_name) if VIS and (not os.path.exists(save_root)): os.mkdir(save_root) tracker = build_tracker(tracker_name, para_name, refine_model_name, threshold) handle = vot.VOT("mask") selection = handle.region() imagefile = handle.frame() # if not imagefile: # sys.exit(0) # if VIS: # '''for vis''' # seq_name = imagefile.split('/')[-3] # save_v_dir = os.path.join(save_root,seq_name) # if not os.path.exists(save_v_dir): # os.mkdir(save_v_dir) # cur_time = int(time.time() % 10000) # save_dir = os.path.join(save_v_dir, str(cur_time)) # if not os.path.exists(save_dir): # os.makedirs(save_dir) image = cv2.cvtColor(cv2.imread(imagefile), cv2.COLOR_BGR2RGB) # Right # mask given by the toolkit ends with the target (zero-padding to the right and down is needed) mask = make_full_size(selection, (image.shape[1], image.shape[0])) tracker.initialize(image, mask) while True: imagefile = handle.frame() if not imagefile: break image = cv2.cvtColor(cv2.imread(imagefile), cv2.COLOR_BGR2RGB) # Right b1, m, search, search_m = tracker.track(image) handle.report(m)
def run_vot_exp(threshold): tracker = build_tracker(threshold) handle = VOT("mask") selection = handle.region() imagefile = handle.frame() image = cv2.cvtColor(cv2.imread(imagefile), cv2.COLOR_BGR2RGB) # Right # mask given by the toolkit ends with the target (zero-padding to the right and down is needed) mask = make_full_size(selection, (image.shape[1], image.shape[0])) tracker.initialize(image, mask) while True: imagefile = handle.frame() if not imagefile: break image = cv2.cvtColor(cv2.imread(imagefile), cv2.COLOR_BGR2RGB) # Right b1, m = tracker.track(image) handle.report(m)