@@ -0,0 +1,1602 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0Aimport os%0Aimport sys%0Asys.path.insert(1, 'external')%0Afrom vdetlib.vdet.dataset import imagenet_vdet_classes%0Afrom vdetlib.utils.visual import unique_colors, add_bbox%0Afrom vdetlib.utils.common import imread, imwrite%0Afrom vdetlib.utils.protocol import proto_dump, proto_load, top_detections, frame_path_at, track_box_at_frame%0Aimport cv2%0A%0Aif __name__ == '__main__':%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument('vid_file')%0A    parser.add_argument('track_file')%0A    parser.add_argument('--save_dir', default=None)%0A    args = parser.parse_args()%0A%0A    vid_proto = proto_load(args.vid_file)%0A    track_proto = proto_load(args.track_file)%0A%0A    colors = unique_colors(len(track_proto%5B'tracks'%5D))%0A%0A    if not args.save_dir:%0A        cv2.namedWindow('tracks')%0A    for frame in vid_proto%5B'frames'%5D:%0A        img = imread(frame_path_at(vid_proto, frame%5B'frame'%5D))%0A        boxes = %5Btrack_box_at_frame(tracklet, frame%5B'frame'%5D) %5C%0A                for tracklet in track_proto%5B'tracks'%5D%5D%0A        tracked = add_bbox(img, boxes, None, 2)%0A        if args.save_dir:%0A            if not os.path.isdir(args.save_dir):%0A                try:%0A                    os.makedirs(args.save_dir)%0A                except:%0A                    pass%0A            imwrite(os.path.join(args.save_dir, %22%7B:04d%7D.jpg%22.format(frame%5B'frame'%5D)),%0A                    tracked)%0A        else:%0A            cv2.imshow('tracks', tracked)%0A            if cv2.waitKey(0) == ord('q'):%0A                cv2.destroyAllWindows()%0A                sys.exit(0)%0A    if not args.save_dir:%0A        cv2.destroyAllWindows()%0A

Add a script to show tracking results.