-
Notifications
You must be signed in to change notification settings - Fork 0
/
focal_demo.py
41 lines (31 loc) · 1.64 KB
/
focal_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import sys
import argparse
prj_path = os.path.join(os.path.dirname(__file__), '..')
if prj_path not in sys.path:
sys.path.append(prj_path)
from lib.test.evaluation import Tracker
def run_focal(tracker_name, tracker_param, optional_box=None, debug=None, save_results=False):
"""Run the tracker on your webcam.
args:
tracker_name: Name of tracking method.
tracker_param: Name of parameter file.
debug: Debug level.
"""
tracker = Tracker(tracker_name, tracker_param, "video")
tracker.run_focal(optional_box=optional_box, debug=debug, save_results=save_results)
# tracker.run_2d(optional_box=optional_box, debug=debug, save_results=save_results)
def main():
parser = argparse.ArgumentParser(description='Run the tracker on your webcam.')
parser.add_argument('tracker_name', type=str, help='Name of tracking method.')
parser.add_argument('tracker_param', type=str, help='Name of parameter file.')
# parser.add_argument('videofile', type=str, help='path to a video file.')
parser.add_argument('--optional_box', type=float, default=None, nargs="+", help='optional_box with format x y w h.')
parser.add_argument('--debug', type=int, default=0, help='Debug level.')
parser.add_argument('--save_results', dest='save_results', action='store_true', help='Save bounding boxes')
parser.set_defaults(save_results=False)
args = parser.parse_args()
run_focal(args.tracker_name, args.tracker_param, args.optional_box, args.debug, args.save_results)
if __name__ == '__main__':
main()
# python main/video_demo.py cswintt CSWinTT.pth car.mp4 --optional_box 50 50 50 50 --save_results