コード例 #1
0
        # jts = diaboloNet.computeOutputFromEmbedding(jts_embed) # calculate pose from codes
        # jts = pca.inverse_transform(jts_embed)
        jts = jts_embed
        for i in range(test_data.shape[0]):
            joints.append(jts[i].reshape((-1, 3)) *
                          (testSeqs[0].config['cube'][2] / 2.) +
                          testSeqs[0].data[i].com)

        joints = numpy.array(joints)

        hpe = MSRAHandposeEvaluation(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(gt3D,
                     open("./eval/{}/gt_{}.pkl".format(eval_prefix, icv),
                          "wb"),
                     protocol=cPickle.HIGHEST_PROTOCOL)
        cPickle.dump(joints,
                     open("./eval/{}/result_{}.pkl".format(eval_prefix, icv),
                          "wb"),
                     protocol=cPickle.HIGHEST_PROTOCOL)
コード例 #2
0
    # save results
    poseNet.save("./eval/{}/net_{}.pkl".format(eval_prefix, eval_prefix))
    # poseNet.load("./eval/{}/net_{}.pkl".format(eval_prefix,eval_prefix))

    ####################################################
    # TEST
    print("Testing ...")
    gt3D = [j.gt3Dorig[di.crop_joint_idx].reshape(1, 3) for j in testSeqs[0].data]
    jts = poseNet.computeOutput([test_data, test_data2, test_data4])
    joints = []
    for i in range(test_data.shape[0]):
        joints.append(jts[i].reshape(1, 3)*(testSeqs[0].config['cube'][2]/2.) + testSeqs[0].data[i].com)

    hpe = MSRAHandposeEvaluation(gt3D, joints)
    hpe.subfolder += '/'+eval_prefix+'/'
    print(("Mean error: {}mm, max error: {}mm".format(hpe.getMeanError(), hpe.getMaxError())))

    # save results
    pickle.dump(joints, open("./eval/{}/result_{}_{}.pkl".format(eval_prefix,os.path.split(__file__)[1],eval_prefix), "wb"), protocol=pickle.HIGHEST_PROTOCOL)

    print("Testing baseline")

    #################################
    # BASELINE
    com = [j.com for j in testSeqs[0].data]
    hpe_com = MSRAHandposeEvaluation(gt3D, numpy.asarray(com).reshape((len(gt3D), 1, 3)))
    hpe_com.subfolder += '/'+eval_prefix+'/'
    print(("Mean error: {}mm".format(hpe_com.getMeanError())))

    hpe.plotEvaluation(eval_prefix, methodName='Our regr', baseline=[('CoM', hpe_com)])
コード例 #3
0
    # TEST
    print("Testing ...")
    gt3D = [
        j.gt3Dorig[di.crop_joint_idx].reshape(1, 3) for j in testSeqs[0].data
    ]
    jts = poseNet.computeOutput([test_data, test_data2, test_data4])
    joints = []
    for i in xrange(test_data.shape[0]):
        joints.append(jts[i].reshape(1, 3) *
                      (testSeqs[0].config['cube'][2] / 2.) +
                      testSeqs[0].data[i].com)

    hpe = MSRAHandposeEvaluation(gt3D, joints)
    hpe.subfolder += '/' + eval_prefix + '/'
    print("Mean error: {}mm, max error: {}mm".format(hpe.getMeanError(),
                                                     hpe.getMaxError()))

    # 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
    com = [j.com for j in testSeqs[0].data]
    hpe_com = MSRAHandposeEvaluation(