Spaces:
Runtime error
Runtime error
File size: 2,909 Bytes
809371f f639061 809371f 03cb39e 809371f c0dc29f 809371f f639061 809371f 2316e0f 809371f 31f0f25 7ce97ad 31f0f25 809371f 75844fb ea3fb59 809371f 31371fc 1b9ad62 3086785 ac33b94 71b0765 809371f 31f0f25 809371f 2316e0f 809371f 711b619 31f0f25 ea3fb59 809371f |
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
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) |