comparison scripts/compute-clearmot.py @ 873:6b474db46b45

added csv printing option
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 15 Feb 2017 14:54:10 -0500
parents f6790357f53b
children a1e92c48dfb4
comparison
equal deleted inserted replaced
872:c70adaeeddf5 873:6b474db46b45
27 parser.add_argument('--intrinsic', dest = 'intrinsicCameraMatrixFilename', help = 'name of the intrinsic camera file') 27 parser.add_argument('--intrinsic', dest = 'intrinsicCameraMatrixFilename', help = 'name of the intrinsic camera file')
28 parser.add_argument('--distortion-coefficients', dest = 'distortionCoefficients', help = 'distortion coefficients', nargs = '*', type = float) 28 parser.add_argument('--distortion-coefficients', dest = 'distortionCoefficients', help = 'distortion coefficients', nargs = '*', type = float)
29 parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float) 29 parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float)
30 30
31 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (for display)') 31 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (for display)')
32 parser.add_argument('--csv', dest = 'csvOutput', help = 'output comma-separated metrics')
32 args = parser.parse_args() 33 args = parser.parse_args()
33 34
34 if args.homographyFilename is not None: 35 if args.homographyFilename is not None:
35 homography = loadtxt(args.homographyFilename) 36 homography = loadtxt(args.homographyFilename)
36 else: 37 else:
59 if args.display: 60 if args.display:
60 motp, mota, mt, mme, fpt, gt, gtMatches, toMatches = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant, True) 61 motp, mota, mt, mme, fpt, gt, gtMatches, toMatches = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant, True)
61 else: 62 else:
62 motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant) 63 motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant)
63 64
64 65 if args.csvOutput:
65 print 'MOTP: {}'.format(motp) 66 print(','.join([motp, mota, mt, mme, fpt]))
66 print 'MOTA: {}'.format(mota) 67 else:
67 print 'Number of missed objects.frames: {}'.format(mt) 68 print 'MOTP: {}'.format(motp)
68 print 'Number of mismatches: {}'.format(mme) 69 print 'MOTA: {}'.format(mota)
69 print 'Number of false alarms.frames: {}'.format(fpt) 70 print 'Number of missed objects.frames: {}'.format(mt)
71 print 'Number of mismatches: {}'.format(mme)
72 print 'Number of false alarms.frames: {}'.format(fpt)
70 73
71 def shiftMatches(matches, offset): 74 def shiftMatches(matches, offset):
72 shifted = {} 75 shifted = {}
73 for k in matches: 76 for k in matches:
74 shifted[k] = {t+offset:v for t, v in matches[k].iteritems()} 77 shifted[k] = {t+offset:v for t, v in matches[k].iteritems()}