Go to the documentation of this file.00001
00002 import argparse
00003 import os
00004 import deep_sort_app
00005
00006
00007 def parse_args():
00008 """ Parse command line arguments.
00009 """
00010 parser = argparse.ArgumentParser(description="MOTChallenge evaluation")
00011 parser.add_argument(
00012 "--mot_dir", help="Path to MOTChallenge directory (train or test)",
00013 required=True)
00014 parser.add_argument(
00015 "--detection_dir", help="Path to detections.", default="detections",
00016 required=True)
00017 parser.add_argument(
00018 "--output_dir", help="Folder in which the results will be stored. Will "
00019 "be created if it does not exist.", default="results")
00020 parser.add_argument(
00021 "--min_confidence", help="Detection confidence threshold. Disregard "
00022 "all detections that have a confidence lower than this value.",
00023 default=0.0, type=float)
00024 parser.add_argument(
00025 "--min_detection_height", help="Threshold on the detection bounding "
00026 "box height. Detections with height smaller than this value are "
00027 "disregarded", default=0, type=int)
00028 parser.add_argument(
00029 "--nms_max_overlap", help="Non-maxima suppression threshold: Maximum "
00030 "detection overlap.", default=1.0, type=float)
00031 parser.add_argument(
00032 "--max_cosine_distance", help="Gating threshold for cosine distance "
00033 "metric (object appearance).", type=float, default=0.2)
00034 parser.add_argument(
00035 "--nn_budget", help="Maximum size of the appearance descriptors "
00036 "gallery. If None, no budget is enforced.", type=int, default=100)
00037 return parser.parse_args()
00038
00039
00040 if __name__ == "__main__":
00041 args = parse_args()
00042
00043 os.makedirs(args.output_dir, exist_ok=True)
00044 sequences = os.listdir(args.mot_dir)
00045 for sequence in sequences:
00046 print("Running sequence %s" % sequence)
00047 sequence_dir = os.path.join(args.mot_dir, sequence)
00048 detection_file = os.path.join(args.detection_dir, "%s.npy" % sequence)
00049 output_file = os.path.join(args.output_dir, "%s.txt" % sequence)
00050 deep_sort_app.run(
00051 sequence_dir, detection_file, output_file, args.min_confidence,
00052 args.nms_max_overlap, args.min_detection_height,
00053 args.max_cosine_distance, args.nn_budget, display=False)