diff python/moving.py @ 595:17b02c8054d0

added tests and corrected one bug
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 07 Dec 2014 22:59:47 -0500
parents 9e39cd95e017
children 04a8304e13f0 aee4cbac9e0e
line wrap: on
line diff
--- a/python/moving.py	Sun Dec 07 01:32:36 2014 -0500
+++ b/python/moving.py	Sun Dec 07 22:59:47 2014 -0500
@@ -1315,7 +1315,7 @@
         else:
             return matchingDistance + 1
 
-def computeClearMOT(objects, annotations, matchingDistance, firstInstant, lastInstant, debug = False):
+def computeClearMOT(annotations, objects, matchingDistance, firstInstant, lastInstant, debug = False):
     '''Computes the CLEAR MOT metrics 
 
     Reference:
@@ -1368,10 +1368,7 @@
         nTOs = len(matchedTOs)+len(unmatchedTOs)
         if len(unmatchedTOs) > 0:
             for a in unmatchedGTs:
-                aCosts = [a.matches(o, t, matchingDistance) for o in unmatchedTOs]
-                if min(aCosts) < matchingDistance:
-                    costs.append(aCosts)
-        # print costs
+                costs.append([a.matches(o, t, matchingDistance) for o in unmatchedTOs])
         if len(costs) > 0:
             newMatches = munk.compute(costs)
             for k,v in newMatches:
@@ -1408,7 +1405,11 @@
         motp = dist/ct
     else:
         motp = None
-    return motp, 1.-float(mt+fpt+mme)/gt, mt, mme, fpt, gt
+    if gt > 0:
+        mota = 1.-float(mt+fpt+mme)/gt
+    else:
+        mota = None
+    return motp, mota, mt, mme, fpt, gt
 
 
 def plotRoadUsers(objects, colors):