Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 593:e2a873e08568
non-working clear mot metrics
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sat, 06 Dec 2014 22:15:56 -0500 |
parents | 985a3021cff2 |
children | 9e39cd95e017 |
line wrap: on
line diff
--- a/python/moving.py Fri Dec 05 17:50:16 2014 -0500 +++ b/python/moving.py Sat Dec 06 22:15:56 2014 -0500 @@ -1339,6 +1339,59 @@ matchTable.append([t, a.getNum(), matchingObject.getNum(), minDist]) return matchTable +def computeClearMOT(matchTable, nTrackFrames): + '''Computes the MOTA/MOTP measures from the matching statistics + between ground truth and tracker output + computed by matchingGroundTruthToTracker + + nTrackFrames is the sum of the number of frames of existence of all tracker output + + Adapted from Dariush Ettehadieh's thesis work''' + #Calculate MOTP + dist = 0. # total distance between GT and tracker output + nAssociatedGTFrames = 0 + mt = 0 # number of missed GT frames (sum of the number of GT not detected in each frame) + for mtab in matchTable: + if mtab[2] != None: + dist += float(mtab[3])#/T + nAssociatedGTFrames += 1 + else: + mt += 1 + if nAssociatedGTFrames != 0: + motp = dist/nAssociatedGTFrames + else: + return 0,0,0,0,0,0 + + #Calculate MOTA + gt = len(matchTable) # sum of the number of GT in each frame, or sum of the length of existence of each GT + #for sgt in sorted_gt_positions: + # gt += (len(sgt)-1) + + #total_traces = len(object_positions) + fpt = nTrackFrames - nAssociatedGTFrames + + # gtobj = 0 + mme = 0 + # while gtobj <= n_gt_objects: + # prev = [0,0,-1,0] + # new_match = 0 + # for mtab in matchTable: + # if mtab[1] == gtobj: + # if new_match == 0: + # new_match = 1 + # mme = mme - 1 + # if mtab[2] != prev[2]: + # mme += 1 + # prev = mtab + # gtobj += 1 + + mota = 1-(float(mt+fpt+mme)/gt) + + print 'MOTP: ' + str(motp) + print 'MOTA: ' + str(mota) + return motp, mota, dist, mt, mme, fpt + + def plotRoadUsers(objects, colors): '''Colors is a PlottingPropertyValues instance''' from matplotlib.pyplot import figure, axis