in contactopt/hand_object.py [0:0]
def load_from_image(self, hand_beta, hand_pose, obj_faces, obj_verts, hand_verts=None):
"""Load from image-based results pkl file. Mano root translation is not known, but hand vertices are"""
self.hand_beta = hand_beta
self.hand_pose = hand_pose
self.hand_mTc = np.eye(4)
self.obj_verts = obj_verts
self.obj_faces = obj_faces
self.run_mano() # Run mano model forwards
if hand_verts is not None:
displ = hand_verts[0, :] - self.hand_verts[0, :] # Find translation by comparing vertices of aligned hands
self.hand_mTc[:3, 3] = displ
self.run_mano() # Rerun mano model to account for translation
mean_err = np.linalg.norm(self.hand_verts - hand_verts, 2, 1)
if mean_err.mean() > 1e-6: # Check if there's much error in reconstruction
print('Mean verts error', mean_err.mean())
print('Mano reconstruction failure')
# self.calc_dist_contact(hand=True, obj=True)
self.hand_contact = np.zeros((self.hand_verts.shape[0], 1)) # Set to zero since we don't know the ground truth
self.obj_contact = np.zeros((self.obj_verts.shape[0], 1))