changeset 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 0fa73cbe9fdb
children 985a3021cff2
files scripts/compute-clearmot.py scripts/compute-homography.py
diffstat 2 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/compute-clearmot.py	Fri Dec 05 17:00:37 2014 -0500
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+
+import sys, argparse
+
+import moving, storage
+
+from numpy import loadtxt
+
+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)
+
+Polytrack format: 
+JP. Jodoin\'s MSc thesis (in french)
+see examples on http://www.jpjodoin.com/urbantracker/dataset.html''', formatter_class=argparse.RawDescriptionHelpFormatter)
+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)
+args = parser.parse_args()
+
+# args.homographyFilename is None if nothing as argument
+if args.homographyFilename != None:
+    homography = loadtxt(args.homographyFilename)
+else:
+    homography = None
+
+objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object')
+annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename)
+for a in annotations:
+    a.computeCentroidTrajectory(homography)
+
+moving.matchingGroundTruthToTracker(objects, annotations, args.matchingDistance)
+#storage.deleteFromSqlite(args.databaseFilename, args.dataType)
--- a/scripts/compute-homography.py	Fri Dec 05 16:41:11 2014 -0500
+++ b/scripts/compute-homography.py	Fri Dec 05 17:00:37 2014 -0500
@@ -17,7 +17,7 @@
 If providing video and world images, with a number of points to input
 and a ration to convert pixels to world distance unit (eg meters per pixel), 
 the images will be shown in turn and the user should click 
-in the same order the corresponding points in world and image spaces.''', formatter_class=argparse.RawDescriptionHelpFormatter,)
+in the same order the corresponding points in world and image spaces.''', formatter_class=argparse.RawDescriptionHelpFormatter)
 
 parser.add_argument('-p', dest = 'pointCorrespondencesFilename', help = 'name of the text file containing the point correspondences')
 parser.add_argument('-i', dest = 'videoFrameFilename', help = 'filename of the video frame')