Mercurial Hosting > traffic-intelligence
diff scripts/compute-clearmot.py @ 594:9e39cd95e017
first implementation of CLEAR MOT (needs formal tests)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 07 Dec 2014 01:32:36 -0500 |
parents | e2a873e08568 |
children | 17b02c8054d0 |
line wrap: on
line diff
--- a/scripts/compute-clearmot.py Sat Dec 06 22:15:56 2014 -0500 +++ b/scripts/compute-clearmot.py Sun Dec 07 01:32:36 2014 -0500 @@ -5,7 +5,6 @@ import moving, storage # TODO: need to trim objects to same mask ? -# pass frame interval where matching is done? parser = argparse.ArgumentParser(description='The program computes the CLEAR MOT metrics between ground truth and tracker output (in Polytrack format)', epilog='''CLEAR MOT metrics information: Keni, Bernardin, and Stiefelhagen Rainer. "Evaluating multiple object tracking performance: the CLEAR MOT metrics." EURASIP Journal on Image and Video Processing 2008 (2008) @@ -16,30 +15,25 @@ parser.add_argument('-d', dest = 'trackerDatabaseFilename', help = 'name of the Sqlite database containing the tracker output', required = True) parser.add_argument('-g', dest = 'groundTruthDatabaseFilename', help = 'name of the Sqlite database containing the ground truth', required = True) parser.add_argument('-o', dest = 'homographyFilename', help = 'name of the filename for the homography (if tracking was done using the homography)') -parser.add_argument('-m', dest = 'matchingDistance', help = 'matching distance between tracker and ground truth trajectories', required = True) -parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True) -parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True) +parser.add_argument('-m', dest = 'matchingDistance', help = 'matching distance between tracker and ground truth trajectories', required = True, type = float) +parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True, type = int) +parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True, type = int) args = parser.parse_args() -# args.homographyFilename is None if nothing as argument if args.homographyFilename != None: homography = loadtxt(args.homographyFilename) else: homography = None -firstInstant = int(args.firstInstant) -lastInstant = int(args.lastInstant) - objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object') annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename) for a in annotations: a.computeCentroidTrajectory(homography) -matchTable = moving.matchingGroundTruthToTracker(objects, annotations, args.matchingDistance, - firstInstant, lastInstant) +motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(objects, annotations, args.matchingDistance, args.firstInstant, args.lastInstant) -# number of frames of existence of all objects within [firstInstant, lastInstant] -nTrackFrames = sum([min(o.getLastInstant(),lastInstant)-max(o.getFirstInstant(),firstInstant)+1 for o in objects]) - -print moving.computeClearMOT(matchTable, nTrackFrames) - +print 'MOTP: {}'.format(motp) +print 'MOTA: {}'.format(mota) +print 'Number of missed objects.frames: {}'.format(mt) +print 'Number of mismatches: {}'.format(mme) +print 'Number of false alarms.frames: {}'.format(fpt)