Seq2 = di.loadSequence('P0')
    testSeqs = [Seq2]

    # di = ICVLImporter('../data/ICVL/')
    # Seq2 = di.loadSequence('test_seq_1')
    # testSeqs = [Seq2]

    #di = NYUImporter('../data/NYU/')
    #Seq2 = di.loadSequence('test_1')
    #testSeqs = [Seq2]

    # load trained network
    poseNetParams = ResNetParams(type=1, nChan=1, wIn=128, hIn=128, batchSize=1, numJoints=14, nDims=3)
    poseNetParams.loadFile = "/content/deep-prior-pp/src/eval/MSRA_network_prior_0.pkl"
    comrefNetParams = ScaleNetParams(type=1, nChan=1, wIn=128, hIn=128, batchSize=1, resizeFactor=2, numJoints=1, nDims=3)
    comrefNetParams.loadFile = "/content/deep-prior-pp/src/eval/net_MSRA15_COM_AUGMENT.pkl"
    config = {'fx': 588., 'fy': 587., 'cube': (300, 300, 300)}
    # config = {'fx': 241.42, 'fy': 241.42, 'cube': (250, 250, 250)}
    # config = {'fx': 224.5, 'fy': 230.5, 'cube': (300, 300, 300)}  # Creative Gesture Camera
    rtp = RealtimeHandposePipeline(poseNetParams, config, di, verbose=False, comrefNet=comrefNetParams)

    # use filenames
    filenames = []
    for i in testSeqs[0].data:
        filenames.append(i.fileName)
    dev = FileDevice(filenames, di)

    # use depth camera
    # dev = CreativeCameraDevice(mirror=True)
    rtp.processVideoThreaded(dev)
                                 nChan=1,
                                 wIn=128,
                                 hIn=128,
                                 batchSize=1,
                                 numJoints=14,
                                 nDims=3)
    poseNetParams.loadFile = "./eval/NYU_network_prior.pkl"
    comrefNetParams = ScaleNetParams(type=1,
                                     nChan=1,
                                     wIn=128,
                                     hIn=128,
                                     batchSize=1,
                                     resizeFactor=2,
                                     numJoints=1,
                                     nDims=3)
    comrefNetParams.loadFile = "./eval/net_NYU_COM_AUGMENT.pkl"
    config = {'fx': 588., 'fy': 587., 'cube': (300, 300, 300)}
    # config = {'fx': 241.42, 'fy': 241.42, 'cube': (250, 250, 250)}
    # config = {'fx': 224.5, 'fy': 230.5, 'cube': (300, 300, 300)}  # Creative Gesture Camera
    rtp = RealtimeHandposePipeline(poseNetParams,
                                   config,
                                   di,
                                   verbose=False,
                                   comrefNet=comrefNetParams)

    # use filenames
    filenames = []
    for i in testSeqs[0].data:
        filenames.append(i.fileName)
    dev = FileDevice(filenames, di)
Example #3
0
dsize = (int(train_data.shape[2] // 4), int(train_data.shape[3] // 4))
xstart = int(train_data.shape[2] / 2 - dsize[0] / 2)
xend = xstart + dsize[0]
ystart = int(train_data.shape[3] / 2 - dsize[1] / 2)
yend = ystart + dsize[1]
train_data4 = train_data[:, :, ystart:yend, xstart:xend]

comrefNetParams = ScaleNetParams(type=1,
                                 nChan=1,
                                 wIn=96,
                                 hIn=96,
                                 batchSize=1,
                                 resizeFactor=2,
                                 numJoints=1,
                                 nDims=3)
comrefNetParams.loadFile = "../../ptm/net_MSRA15_COM_AUGMENT.pkl"
poseNet = ScaleNet(numpy.random.RandomState(23455), cfgParams=comrefNetParams)
train_data = numpy.ndarray.astype(train_data, dtype='float64')
train_data2 = numpy.ndarray.astype(train_data2, dtype='float64')
train_data4 = numpy.ndarray.astype(train_data4, dtype='float64')
#Seq_all list of sequence data
gt3D = []
for i in xrange(len(Seq_all)):
    gt3D_temp = [
        j.gt3Dorig[di.crop_joint_idx].reshape(1, 3) for j in Seq_all[i].data
    ]
    gt3D.extend(gt3D_temp)
jts = poseNet.computeOutput([train_data, train_data2, train_data4])
joints = []
for i in xrange(train_data.shape[0]):
    joints.append(jts[i].reshape(1, 3) * (Seq_all[0].config['cube'][2] / 2.) +