Mercurial Hosting > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
592:985a3021cff2 | 593:e2a873e08568 |
---|---|
1337 matchTable.append([t, a.getNum(), None, minDist]) | 1337 matchTable.append([t, a.getNum(), None, minDist]) |
1338 else: | 1338 else: |
1339 matchTable.append([t, a.getNum(), matchingObject.getNum(), minDist]) | 1339 matchTable.append([t, a.getNum(), matchingObject.getNum(), minDist]) |
1340 return matchTable | 1340 return matchTable |
1341 | 1341 |
1342 def computeClearMOT(matchTable, nTrackFrames): | |
1343 '''Computes the MOTA/MOTP measures from the matching statistics | |
1344 between ground truth and tracker output | |
1345 computed by matchingGroundTruthToTracker | |
1346 | |
1347 nTrackFrames is the sum of the number of frames of existence of all tracker output | |
1348 | |
1349 Adapted from Dariush Ettehadieh's thesis work''' | |
1350 #Calculate MOTP | |
1351 dist = 0. # total distance between GT and tracker output | |
1352 nAssociatedGTFrames = 0 | |
1353 mt = 0 # number of missed GT frames (sum of the number of GT not detected in each frame) | |
1354 for mtab in matchTable: | |
1355 if mtab[2] != None: | |
1356 dist += float(mtab[3])#/T | |
1357 nAssociatedGTFrames += 1 | |
1358 else: | |
1359 mt += 1 | |
1360 if nAssociatedGTFrames != 0: | |
1361 motp = dist/nAssociatedGTFrames | |
1362 else: | |
1363 return 0,0,0,0,0,0 | |
1364 | |
1365 #Calculate MOTA | |
1366 gt = len(matchTable) # sum of the number of GT in each frame, or sum of the length of existence of each GT | |
1367 #for sgt in sorted_gt_positions: | |
1368 # gt += (len(sgt)-1) | |
1369 | |
1370 #total_traces = len(object_positions) | |
1371 fpt = nTrackFrames - nAssociatedGTFrames | |
1372 | |
1373 # gtobj = 0 | |
1374 mme = 0 | |
1375 # while gtobj <= n_gt_objects: | |
1376 # prev = [0,0,-1,0] | |
1377 # new_match = 0 | |
1378 # for mtab in matchTable: | |
1379 # if mtab[1] == gtobj: | |
1380 # if new_match == 0: | |
1381 # new_match = 1 | |
1382 # mme = mme - 1 | |
1383 # if mtab[2] != prev[2]: | |
1384 # mme += 1 | |
1385 # prev = mtab | |
1386 # gtobj += 1 | |
1387 | |
1388 mota = 1-(float(mt+fpt+mme)/gt) | |
1389 | |
1390 print 'MOTP: ' + str(motp) | |
1391 print 'MOTA: ' + str(mota) | |
1392 return motp, mota, dist, mt, mme, fpt | |
1393 | |
1394 | |
1342 def plotRoadUsers(objects, colors): | 1395 def plotRoadUsers(objects, colors): |
1343 '''Colors is a PlottingPropertyValues instance''' | 1396 '''Colors is a PlottingPropertyValues instance''' |
1344 from matplotlib.pyplot import figure, axis | 1397 from matplotlib.pyplot import figure, axis |
1345 figure() | 1398 figure() |
1346 for obj in objects: | 1399 for obj in objects: |