import project_path import argparse from track_detection import main as track import sys import numpy as np sys.path.append('..') sys.path.append('../caltech-fish-counting') from evaluate import evaluate class Object(object): pass def main(args): infer_args = Object() infer_args.detections = args.detection_dir infer_args.metadata = "../frames/metadata" infer_args.output = "../frames/result_testing" infer_args.tracker = 'tracker' config = { 'conf_threshold': float(args.conf_threshold), 'low_conf_threshold': float(args.low_conf), 'high_conf_threshold': float(args.high_conf), 'nms_iou': float(args.nms_iou), 'min_length': float(args.min_length), 'max_age': int(args.max_age), 'iou_threshold': float(args.iou_threshold), 'min_hits': int(args.min_hits), 'boost_power': float(args.boost_power), 'boost_decay': float(args.boost_decay), 'use_associative': args.use_associative } print("verbose", args.verbose) track(infer_args, config=config, verbose=args.verbose) result = evaluate(infer_args.output, "../frames/MOT", "../frames/metadata", infer_args.tracker, True) metrics = result['MotChallenge2DBox']['tracker']['COMBINED_SEQ']['pedestrian'] print('HOTA:', np.mean(metrics['HOTA']['HOTA'])*100) print('MOTA:', metrics['CLEAR']['MOTA']*100) print('IDF1:', metrics['Identity']['IDF1']*100) print('nMAE:', metrics['nMAE']['nMAE']*100) print('misscounts:', str(metrics['nMAE']['nMAE_numer']) + "/" + str(metrics['nMAE']['nMAE_denom'])) return result def argument_parser(): parser = argparse.ArgumentParser() parser.add_argument("--detection_dir", default="../frames/detection_storage") parser.add_argument("--conf_threshold", default=0.3, help="Config object. Required.") parser.add_argument("--low_conf", default=0.01, help="Config object. Required.") parser.add_argument("--high_conf", default=0.3, help="Config object. Required.") parser.add_argument("--nms_iou", default=0.3, help="Config object. Required.") parser.add_argument("--min_length", default=0.3, help="Config object. Required.") parser.add_argument("--max_age", default=20, help="Config object. Required.") parser.add_argument("--iou_threshold", default=0.01, help="Config object. Required.") parser.add_argument("--min_hits", default=11, help="Config object. Required.") parser.add_argument("--boost_power", default=1, help="Config object. Required.") parser.add_argument("--boost_decay", default=1, help="Config object. Required.") parser.add_argument("--use_associative", action='store_true', help="Config object. Required.") parser.add_argument("--verbose", action='store_true', help="Config object. Required.") return parser if __name__ == "__main__": args = argument_parser().parse_args() main(args)