Mercurial Hosting > traffic-intelligence
comparison scripts/compute-clearmot.py @ 592:985a3021cff2
first match table implementation
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 05 Dec 2014 17:50:16 -0500 |
parents | aded6c1c2ebd |
children | e2a873e08568 |
comparison
equal
deleted
inserted
replaced
591:aded6c1c2ebd | 592:985a3021cff2 |
---|---|
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 | 2 |
3 import sys, argparse | 3 import sys, argparse |
4 | 4 from numpy import loadtxt |
5 import moving, storage | 5 import moving, storage |
6 | 6 |
7 from numpy import loadtxt | 7 # TODO: need to trim objects to same mask ? |
8 # pass frame interval where matching is done? | |
8 | 9 |
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 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 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 |
12 Polytrack format: | 13 Polytrack format: |
14 see examples on http://www.jpjodoin.com/urbantracker/dataset.html''', formatter_class=argparse.RawDescriptionHelpFormatter) | 15 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('-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('-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('-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 parser.add_argument('-m', dest = 'matchingDistance', help = 'matching distance between tracker and ground truth trajectories', required = True) |
20 parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True) | |
21 parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True) | |
19 args = parser.parse_args() | 22 args = parser.parse_args() |
20 | 23 |
21 # args.homographyFilename is None if nothing as argument | 24 # args.homographyFilename is None if nothing as argument |
22 if args.homographyFilename != None: | 25 if args.homographyFilename != None: |
23 homography = loadtxt(args.homographyFilename) | 26 homography = loadtxt(args.homographyFilename) |
27 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object') | 30 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object') |
28 annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename) | 31 annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename) |
29 for a in annotations: | 32 for a in annotations: |
30 a.computeCentroidTrajectory(homography) | 33 a.computeCentroidTrajectory(homography) |
31 | 34 |
32 moving.matchingGroundTruthToTracker(objects, annotations, args.matchingDistance) | 35 moving.matchingGroundTruthToTracker(objects, annotations, args.matchingDistance, |
36 int(args.firstInstant), int(args.lastInstant)) | |
33 #storage.deleteFromSqlite(args.databaseFilename, args.dataType) | 37 #storage.deleteFromSqlite(args.databaseFilename, args.dataType) |
38 |