comparison scripts/compute-clearmot.py @ 591:aded6c1c2ebd

added framework script and function to compute matchings
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 05 Dec 2014 17:00:37 -0500
parents
children 985a3021cff2
comparison
equal deleted inserted replaced
590:0fa73cbe9fdb 591:aded6c1c2ebd
1 #! /usr/bin/env python
2
3 import sys, argparse
4
5 import moving, storage
6
7 from numpy import loadtxt
8
9 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:
10 Keni, Bernardin, and Stiefelhagen Rainer. "Evaluating multiple object tracking performance: the CLEAR MOT metrics." EURASIP Journal on Image and Video Processing 2008 (2008)
11
12 Polytrack format:
13 JP. Jodoin\'s MSc thesis (in french)
14 see examples on http://www.jpjodoin.com/urbantracker/dataset.html''', formatter_class=argparse.RawDescriptionHelpFormatter)
15 parser.add_argument('-d', dest = 'trackerDatabaseFilename', help = 'name of the Sqlite database containing the tracker output', required = True)
16 parser.add_argument('-g', dest = 'groundTruthDatabaseFilename', help = 'name of the Sqlite database containing the ground truth', required = True)
17 parser.add_argument('-o', dest = 'homographyFilename', help = 'name of the filename for the homography (if tracking was done using the homography)')
18 parser.add_argument('-m', dest = 'matchingDistance', help = 'matching distance between tracker and ground truth trajectories', required = True)
19 args = parser.parse_args()
20
21 # args.homographyFilename is None if nothing as argument
22 if args.homographyFilename != None:
23 homography = loadtxt(args.homographyFilename)
24 else:
25 homography = None
26
27 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object')
28 annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename)
29 for a in annotations:
30 a.computeCentroidTrajectory(homography)
31
32 moving.matchingGroundTruthToTracker(objects, annotations, args.matchingDistance)
33 #storage.deleteFromSqlite(args.databaseFilename, args.dataType)