comparison scripts/compute-clearmot.py @ 723:e14e2101a5a9

returns detailed matching information for clear mot
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 06 Aug 2015 17:47:04 -0400
parents 3058e00887bc
children 43ae3a1af290
comparison
equal deleted inserted replaced
722:49e99ca34a7d 723:e14e2101a5a9
16 parser.add_argument('-g', dest = 'groundTruthDatabaseFilename', help = 'name of the Sqlite database containing the ground truth', required = True) 16 parser.add_argument('-g', dest = 'groundTruthDatabaseFilename', help = 'name of the Sqlite database containing the ground truth', required = True)
17 parser.add_argument('-o', dest = 'homographyFilename', help = 'name of the filename for the homography (if tracking was done using the homography)') 17 parser.add_argument('-o', dest = 'homographyFilename', help = 'name of the filename for the homography (if tracking was done using the homography)')
18 parser.add_argument('-m', dest = 'matchingDistance', help = 'matching distance between tracker and ground truth trajectories', required = True, type = float) 18 parser.add_argument('-m', dest = 'matchingDistance', help = 'matching distance between tracker and ground truth trajectories', required = True, type = float)
19 parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True, type = int) 19 parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True, type = int)
20 parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True, type = int) 20 parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True, type = int)
21 parser.add_argument('--display', dest = 'display', help = 'display the ground truth to object matches (graphically)', action = 'store_true')
21 args = parser.parse_args() 22 args = parser.parse_args()
22 23
23 if args.homographyFilename is not None: 24 if args.homographyFilename is not None:
24 homography = loadtxt(args.homographyFilename) 25 homography = loadtxt(args.homographyFilename)
25 else: 26 else:
28 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object') 29 objects = storage.loadTrajectoriesFromSqlite(args.trackerDatabaseFilename, 'object')
29 annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename) 30 annotations = storage.loadGroundTruthFromSqlite(args.groundTruthDatabaseFilename)
30 for a in annotations: 31 for a in annotations:
31 a.computeCentroidTrajectory(homography) 32 a.computeCentroidTrajectory(homography)
32 33
33 motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant) 34 if args.display:
35 motp, mota, mt, mme, fpt, gt, gtMatches, toMatches = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant, True)
36 else:
37 motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(annotations, objects, args.matchingDistance, args.firstInstant, args.lastInstant)
38
34 39
35 print 'MOTP: {}'.format(motp) 40 print 'MOTP: {}'.format(motp)
36 print 'MOTA: {}'.format(mota) 41 print 'MOTA: {}'.format(mota)
37 print 'Number of missed objects.frames: {}'.format(mt) 42 print 'Number of missed objects.frames: {}'.format(mt)
38 print 'Number of mismatches: {}'.format(mme) 43 print 'Number of mismatches: {}'.format(mme)
39 print 'Number of false alarms.frames: {}'.format(fpt) 44 print 'Number of false alarms.frames: {}'.format(fpt)
45 if args.display:
46 print('Ground truth matches')
47 print(gtMatches)
48 print('Object matches')
49 print toMatches