changeset 956:196a1fd498ba

removing unnecessary complexity of varying number of return elements
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 15 Aug 2017 16:15:55 -0400
parents a15e843af55a
children 5d9899504977
files python/moving.py scripts/compute-clearmot.py
diffstat 2 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/python/moving.py	Tue Aug 15 16:15:27 2017 -0400
+++ b/python/moving.py	Tue Aug 15 16:15:55 2017 -0400
@@ -1810,6 +1810,9 @@
     if returnMatches:
         gtMatches = {a.getNum():{} for a in annotations}
         toMatches = {o.getNum():{} for o in objects}
+    else:
+        gtMatches = None
+        toMatches = None
     for t in xrange(firstInstant, lastInstant+1):
         previousMatches = matches.copy()
         # go through currently matched GT-TO and check if they are still matched withing matchingDistance
@@ -1881,10 +1884,7 @@
         mota = 1.-float(mt+fpt+mme)/gt
     else:
         mota = None
-    if returnMatches:
-        return motp, mota, mt, mme, fpt, gt, gtMatches, toMatches
-    else:
-        return motp, mota, mt, mme, fpt, gt
+    return motp, mota, mt, mme, fpt, gt, gtMatches, toMatches
 
 def plotRoadUsers(objects, colors):
     '''Colors is a PlottingPropertyValues instance'''
--- a/scripts/compute-clearmot.py	Tue Aug 15 16:15:27 2017 -0400
+++ b/scripts/compute-clearmot.py	Tue Aug 15 16:15:55 2017 -0400
@@ -57,10 +57,7 @@
     for a in annotations:
         a.shiftTimeInterval(args.nFramesOffsetAnnotations)
 
-if args.display:
-    motp, mota, mt, mme, fpt, gt, gtMatches, toMatches = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant, True)
-else:
-    motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant)
+motp, mota, mt, mme, fpt, gt, gtMatches, toMatches = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant, args.display)
 
 if args.csvOutput:
     print('{},{},{},{},{}'.format(motp, mota, mt, mme, fpt))