def main(): args = parseArgs() print(args) argv = ['', args.groundTruth, args.predictions] print("Loading data") gtFramesAll, prFramesAll = eval_helpers.load_data_dir(argv) print("# gt frames :", len(gtFramesAll)) print("# pred frames:", len(prFramesAll)) if (not os.path.exists(args.outputDir)): os.makedirs(args.outputDir) txt = open('result.txt', 'a') if (args.evalPoseEstimation): ##################################################### # evaluate per-frame multi-person pose estimation (AP) # compute AP print("Evaluation of per-frame multi-person pose estimation") apAll, preAll, recAll = evaluateAP(gtFramesAll, prFramesAll, args.outputDir, True, args.saveEvalPerSequence) # print AP print("Average Precision (AP) metric:") eval_helpers.printTable(apAll) print("Mean Precision (Pre) metric:") eval_helpers.printTable(preAll) print("Mean Recall (Rec) metric:") eval_helpers.printTable(recAll) total_AP, total_Pre, total_Rec = apAll[15][0], preAll[15][0], recAll[ 15][0] txt.write('AP:{} Pre:{} Rec:{}\n'.format(total_AP, total_Pre, total_Rec)) txt.close() if (args.evalPoseTracking): ##################################################### # evaluate multi-person pose tracking in video (MOTA) # compute MOTA print("Evaluation of video-based multi-person pose tracking") metricsAll = evaluateTracking(gtFramesAll, prFramesAll, args.outputDir, True, args.saveEvalPerSequence) metrics = np.zeros([Joint().count + 4, 1]) for i in range(Joint().count + 1): metrics[i, 0] = metricsAll['mota'][0, i] metrics[Joint().count + 1, 0] = metricsAll['motp'][0, Joint().count] metrics[Joint().count + 2, 0] = metricsAll['pre'][0, Joint().count] metrics[Joint().count + 3, 0] = metricsAll['rec'][0, Joint().count] # print AP print("Multiple Object Tracking (MOT) metrics:") eval_helpers.printTable(metrics, motHeader=True)
def main(): args = parseArgs() print args argv = ['', args.groundTruth, args.predictions] print "Loading data" gtFramesAll, prFramesAll = eval_helpers.load_data_dir(argv) print "# gt frames :", len(gtFramesAll) print "# pred frames:", len(prFramesAll) if (not os.path.exists(args.outputDir)): os.makedirs(args.outputDir) if (args.evalPoseEstimation): ##################################################### # evaluate per-frame multi-person pose estimation (AP) # compute AP print "Evaluation of per-frame multi-person pose estimation" apAll, preAll, recAll = evaluateAP(gtFramesAll, prFramesAll, args.outputDir, True, args.saveEvalPerSequence) # print AP print "Average Precision (AP) metric:" eval_helpers.printTable(apAll) if (args.evalPoseTracking): ##################################################### # evaluate multi-person pose tracking in video (MOTA) # compute MOTA print "Evaluation of video-based multi-person pose tracking" metricsAll = evaluateTracking(gtFramesAll, prFramesAll, args.outputDir, True, args.saveEvalPerSequence) metrics = np.zeros([Joint().count + 4, 1]) for i in range(Joint().count + 1): metrics[i, 0] = metricsAll['mota'][0, i] metrics[Joint().count + 1, 0] = metricsAll['motp'][0, Joint().count] metrics[Joint().count + 2, 0] = metricsAll['pre'][0, Joint().count] metrics[Joint().count + 3, 0] = metricsAll['rec'][0, Joint().count] # print AP print "Multiple Object Tracking (MOT) metrics:" eval_helpers.printTable(metrics, motHeader=True)
def _do_posetrack_keypoint_eval(self, gt_folder, pred_folder): argv = ['', gt_folder, pred_folder] outputDir = 'lib/poseval/py/out' print("Loading data") gtFramesAll, prFramesAll = eval_helpers.load_data_dir(argv) print("# gt frames :", len(gtFramesAll)) print("# pred frames:", len(prFramesAll)) # evaluate per-frame multi-person pose estimation (AP) # compute AP print("Evaluation of per-frame multi-person pose estimation") apAll, preAll, recAll = evaluateAP(gtFramesAll, prFramesAll, outputDir, True, False) # print AP print("Average Precision (AP) metric:") eval_helpers.printTable(apAll)
def evaluate(gtdir, preddir, eval_pose=True, eval_track=True, eval_upper_bound=False): gtFramesAll, prFramesAll = load_data_dir(['', gtdir, preddir]) print('# gt frames :', len(gtFramesAll)) print('# pred frames:', len(prFramesAll)) apAll = np.full((Joint().count + 1, 1), np.nan) preAll = np.full((Joint().count + 1, 1), np.nan) recAll = np.full((Joint().count + 1, 1), np.nan) if eval_pose: apAll, preAll, recAll = evaluateAP(gtFramesAll, prFramesAll) print('Average Precision (AP) metric:') #printTable(apAll) cum = printTable(apAll) metrics = np.full((Joint().count + 4, 1), np.nan) #print(eval_track) if eval_track: #print(xy) metricsAll = evaluateTracking(gtFramesAll, prFramesAll, eval_upper_bound) for i in range(Joint().count + 1): metrics[i, 0] = metricsAll['mota'][0, i] metrics[Joint().count + 1, 0] = metricsAll['motp'][0, Joint().count] metrics[Joint().count + 2, 0] = metricsAll['pre'][0, Joint().count] metrics[Joint().count + 3, 0] = metricsAll['rec'][0, Joint().count] print('Multiple Object Tracking (MOT) metrics:') track_cum = printTable(metrics, motHeader=True) #return (apAll, preAll, recAll), metrics #print(xy) return cum