Beispiel #1
0
        for i in xrange(test_data.shape[0]):
            joints.append(jts[i].reshape((-1, 3)) *
                          (seq.config['cube'][2] / 2.) + seq.data[i].com)

    joints = numpy.array(joints)

    hpe = NYUHandposeEvaluation(gt3D, joints)
    hpe.subfolder += '/' + eval_prefix + '/'
    print("Train samples: {}, test samples: {}".format(train_data.shape[0],
                                                       len(gt3D)))
    print("Mean error: {}mm, max error: {}mm".format(hpe.getMeanError(),
                                                     hpe.getMaxError()))
    print("{}".format(
        [hpe.getJointMeanError(j) for j in range(joints[0].shape[0])]))
    print("{}".format(
        [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',
        jts = jts_embed
        for i in range(test_data.shape[0]):
            joints.append(jts[i].reshape(gt3D[0].shape[0], 3)*(seq.config['cube'][2]/2.) + seq.data[i].com)

    joints = numpy.array(joints)

    hpe = NYUHandposeEvaluation(gt3D, joints)
    hpe.subfolder += '/'+eval_prefix+'/'
    mean_error = hpe.getMeanError()
    max_error = hpe.getMaxError()
    print("Train samples: {}, test samples: {}".format(train_data.shape[0], len(gt3D)))
    print("Mean error: {}mm, max error: {}mm".format(mean_error, max_error))
    print("MD score: {}".format(hpe.getMDscore(80)))

    print("{}".format([hpe.getJointMeanError(j) for j in range(joints[0].shape[0])]))
    print("{}".format([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()))