Пример #1
0
############ below code is required if we want to create video - it saves each frame ina folder ######
# shutil.rmtree('/data/Guha/GR/Output/GT/')
# shutil.rmtree('/data/Guha/GR/Output/Prediction/')
# os.mkdir('/data/Guha/GR/Output/GT/')
# os.mkdir('/data/Guha/GR/Output/Prediction/')



with open(path, 'rb') as file:
    print (path)
    data_dict = dict(np.load(file))
    gt = data_dict['target']
    pred = data_dict['predictions']

    # for SMPL 15 to 24 joints
    gt_full = myUtil.smpl_reduced_to_full(gt.reshape(-1,15*4))
    pred_full = myUtil.smpl_reduced_to_full(pred.reshape(-1,15*4))

    #from quat to axis-angle
    gt_aa = myUtil.quat_to_aa_representation(gt_full,24)
    pred_aa = myUtil.quat_to_aa_representation(pred_full,24)

    seq_len = pred_aa.shape[0]
    print('seq len:', seq_len)
    ######### loop through the Sequence
    for seq_num in range(seq_len):

        pose1 = gt_aa[seq_num]
        pose2 = pred_aa[seq_num]

        ############ update SMPL model with ground truth pose parameters
    'lankle', 'rankle'
]
SENSORS = ['lknee', 'rknee', 'lelbow', 'relbow', 'head', 'belly']
SMPL_SENSOR = ['L_Knee', 'R_Knee', 'L_Elbow', 'R_Elbow', 'Head', 'Pelvis']
sensor_idx = [11, 12, 7, 8, 0, 2]

############# calirated file
SMPL_MAJOR_JOINTS = [1, 2, 3, 4, 5, 6, 9, 12, 13, 14, 15, 16, 17, 18, 19]
file_path1 = '/data/Guha/GR/code/dip18/train_and_eval/data/dipIMU/imu_own_validation.npz'
file_path2 = '/data/Guha/GR/DIPIMUandOthers/DIP_IMU_and_Others/DIP_IMU/s_10'
fileList = os.listdir(file_path2)
dippath = os.path.join(file_path2, fileList[4])
with open(file_path1, 'rb') as file1, open(dippath, 'rb') as file2:
    data_dict_nn = dict(np.load(file1))
    smpl_nn = data_dict_nn['smpl_pose'][1]
    smpl_nn_full = myUtil.smpl_reduced_to_full(smpl_nn)
    aa_nn = myUtil.rot_matrix_to_aa(smpl_nn_full)

    data_dict_imu = dict(np.load(file2))
    smpl_imu = data_dict_imu['gt']

    seq_len = aa_nn.shape[0]
    print(aa_nn - smpl_imu)

    for seq_num in range(seq_len):
        pose1 = aa_nn[seq_num]
        pose2 = smpl_imu[seq_num]

        m1.pose[:] = (pose1).reshape(72)
        m1.pose[0] = np.pi
Пример #3
0
def getGlobalBoneOriFromPose(pose, boneName):
    pose = pose.reshape(1, 15 * 3 * 3)
    fullPose = myUtil.smpl_reduced_to_full(pose).reshape(24, 3, 3)
    return fullPose[myUtil.boneSMPLDict[boneName]]
path2 = '/data/Guha/GR/synthetic60FPS/H36/S8_WalkDog.pkl'
with open(path1, 'rb') as file1, open(path2, 'rb') as file2:
    print(path1)
    data_dict1 = np.load(file1, encoding='latin1')
    sample_pose1 = data_dict1['poses'].reshape(-1, 135)
    sample_ori1 = data_dict1['ori'].reshape(-1, 5, 3, 3)
    sample_acc1 = data_dict1['acc'].reshape(-1, 5, 3)

    print(path2)
    data_dict2 = np.load(file2, encoding='latin1')
    sample_pose2 = data_dict2['poses'].reshape(-1, 135)
    sample_ori2 = data_dict2['ori'].reshape(-1, 5, 3, 3)
    sample_acc2 = data_dict2['acc'].reshape(-1, 5, 3)

    # for SMPL 15 to 24 joints
    dip = myUtil.smpl_reduced_to_full(sample_pose1)
    syn = myUtil.smpl_reduced_to_full(sample_pose2)

    #from quat to axis-angle
    dip_aa = myUtil.rot_matrix_to_aa(dip)
    syn_aa = myUtil.rot_matrix_to_aa(syn)

    seq_len = dip_aa.shape[0]
    print('seq len:', seq_len)
    for seq_num in range(seq_len):

        pose1 = dip_aa[seq_num]
        pose2 = syn_aa[seq_num]

        m1.pose[:] = pose1
        m1.pose[0] = np.pi