# save results cPickle.dump(joints, open( "./eval/{}/result_{}_{}.pkl".format( eval_prefix, os.path.split(__file__)[1], eval_prefix), "wb"), protocol=cPickle.HIGHEST_PROTOCOL) print "Testing baseline" ################################# # BASELINE # Load the evaluation data_baseline = di.loadBaseline( '../data/NYU/test/test_predictions.mat', numpy.concatenate([ numpy.asarray([j.gt3Dorig for j in testSeqs[0].data]), numpy.asarray([j.gt3Dorig for j in testSeqs[1].data]) ])) hpe_base = NYUHandposeEvaluation( gt3D, numpy.asarray(data_baseline)[:, 13, :].reshape((len(gt3D), 1, 3))) hpe_base.subfolder += '/' + eval_prefix + '/' print("Mean error: {}mm".format(hpe_base.getMeanError())) com = [j.com for j in testSeqs[0].data] com.extend([j.com for j in testSeqs[1].data]) hpe_com = NYUHandposeEvaluation( gt3D, numpy.asarray(com).reshape((len(gt3D), 1, 3))) hpe_com.subfolder += '/' + eval_prefix + '/'
[hpe.getJointMaxError(j) for j in range(joints[0].shape[0])])) # save results cPickle.dump(joints, open( "./eval/{}/result_{}_{}.pkl".format( eval_prefix, os.path.split(__file__)[1], eval_prefix), "wb"), protocol=cPickle.HIGHEST_PROTOCOL) print "Testing baseline" ################################# # BASELINE # Load the evaluation data_baseline = di.loadBaseline('../data/NYU/test/test_predictions.mat', numpy.asarray(gt3D)) hpe_base = NYUHandposeEvaluation(gt3D, data_baseline) hpe_base.subfolder += '/' + eval_prefix + '/' print("Mean error: {}mm".format(hpe_base.getMeanError())) hpe.plotEvaluation(eval_prefix, methodName='Our regr', baseline=[('Tompson et al.', hpe_base)]) ind = 0 for i in testSeqs[0].data: if ind % 20 != 0: ind += 1 continue jtI = transformPoints2D(di.joints3DToImg(joints[ind]), i.T) hpe.plotResult(i.dpt, i.gtcrop, jtI, "{}_{}".format(eval_prefix, ind))
if ABLATION: # plot list plot_list = zip(['Basic', 'Spatial', 'Temporal', 'Final'], hpe) # plot ablation result # NOTE: figure is in mix_100000 folder hpe[-1].plotEvaluation('ablation', methodName='Final', baseline=plot_list[:-1]) else: # plot list plot_list = [] # Comparison # siggraph data_siggrpah = di.loadBaseline( '../dataset/NYU/test/test_predictions.mat', np.asarray(gt3D)) hpe_siggrpah = NYUHandposeEvaluation(gt3D, data_siggrpah) hpe_siggrpah.subfolder += 'comparison/' print("Tompson et al. Siggraph 2014") print("Mean error: {}mm".format(hpe_siggrpah.getMeanError())) plot_list.append(('HeatMap', hpe_siggrpah)) # cvww15 deeppriori data_deeppriori = di.loadBaseline( '../result/CVWW15/CVWW15_NYU_Prior-Refinement.txt') hpe_deeppriori = NYUHandposeEvaluation(gt3D, data_deeppriori) hpe_deeppriori.subfolder += 'comparison/' print("Oberweger et al. CVWW 2015") print("Mean error: {}mm".format(hpe_deeppriori.getMeanError())) plot_list.append(('DeepPrior', hpe_deeppriori))