Converted postprocessing steps to cpp as well.
This commit is contained in:
@ -373,11 +373,6 @@ def main():
|
||||
cam["K"][0][2] = cam["K"][0][2] * (1000 / ishape[1])
|
||||
images_2d[i] = cv2.resize(img, (1000, 1000))
|
||||
|
||||
roomparams = {
|
||||
"room_size": label["room_size"],
|
||||
"room_center": label["room_center"],
|
||||
}
|
||||
|
||||
start = time.time()
|
||||
poses_2d = utils_2d_pose.get_2d_pose(kpt_model, images_2d)
|
||||
poses_2d = test_triangulate.update_keypoints(poses_2d, joint_names_2d)
|
||||
@ -386,36 +381,18 @@ def main():
|
||||
|
||||
start = time.time()
|
||||
if sum(np.sum(p) for p in poses_2d) == 0:
|
||||
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
||||
poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3])
|
||||
poses3D = np.zeros([1, len(joint_names_3d), 4]).tolist()
|
||||
else:
|
||||
cameras = spt.convert_cameras(label["cameras"])
|
||||
roomp = [roomparams["room_center"], roomparams["room_size"]]
|
||||
poses_3d = triangulator.triangulate_poses(
|
||||
poses_2d, cameras, roomp, joint_names_2d
|
||||
spt_cameras = spt.convert_cameras(label["cameras"])
|
||||
roomparams = [label["room_center"], label["room_size"]]
|
||||
poses3D = triangulator.triangulate_poses(
|
||||
poses_2d, spt_cameras, roomparams, joint_names_2d
|
||||
)
|
||||
poses3D = np.array(poses_3d)
|
||||
if len(poses3D) == 0:
|
||||
poses3D = np.zeros([1, len(joint_names_3d), 4])
|
||||
|
||||
poses2D = []
|
||||
for cam in label["cameras"]:
|
||||
poses_2d, _ = utils_pose.project_poses(poses3D, cam)
|
||||
poses2D.append(poses_2d)
|
||||
poses3D, poses2D = add_extra_joints(poses3D, poses2D, joint_names_3d)
|
||||
poses3D, poses2D = test_triangulate.filter_poses(
|
||||
poses3D,
|
||||
poses2D,
|
||||
roomparams,
|
||||
joint_names_3d,
|
||||
drop_few_limbs=(dataset_use != "mvor"),
|
||||
)
|
||||
poses3D = add_missing_joints(poses3D, joint_names_3d)
|
||||
|
||||
time_3d = time.time() - start
|
||||
print("3D time:", time_3d)
|
||||
|
||||
all_poses.append(poses3D)
|
||||
all_poses.append(np.array(poses3D))
|
||||
all_ids.append(label["id"])
|
||||
all_paths.append(label["imgpaths"])
|
||||
times.append((time_2d, time_3d))
|
||||
|
||||
Reference in New Issue
Block a user