def get_results(net_type, net_base_path, model_name, vis=False):
    # get the default parameters
    p = Config()
    # load all videos
    all_videos = os.listdir(p.seq_base_path)
    p.bbox_output = True
    p.bbox_output_path = os.path.join("./tracking_result/", str(net_type))
    p.visualization = vis

    if p.bbox_output:
        if not os.path.exists(p.bbox_output_path):
            os.makedirs(p.bbox_output_path)

    fps_all = .0

    for it, video in enumerate(all_videos):
        p.video = video
        print("Processing %s ... " % p.video)
        print("{} / {}".format(it, len(all_videos)))
        bbox_result, fps = run_tracker(p, net_type, net_base_path, model_name)
        # fps for this video
        print("FPS: %d " % fps)
        # saving tracking results
        if p.bbox_output:
            np.savetxt(os.path.join(p.bbox_output_path, p.video.lower() + '_SiamFC.txt'), bbox_result, fmt='%.3f')
        fps_all = fps_all + fps

    avg_fps = fps_all / len(all_videos)
    print("Average FPS: %f" % avg_fps)
Exemplo n.º 2
0
def get_specific_video_results(net_type, net_base_path, model_name, video_name, vis=False, save_to_file=False):
    # get the default parameters
    p = Config()
    p.visualization = vis
    p.save_to_file = save_to_file
    p.save_to_video = False

    p.video = video_name
    print("Processing %s ... " % p.video)
    bbox_result, fps = run_tracker(p, net_type, net_base_path, model_name)
    # fps for this video
    print("FPS: %d " % fps)