Skip to content

Commit

Permalink
Added SMPL to TopDownPerson
Browse files Browse the repository at this point in the history
Now can populate TopDownPerson with SMPL keypoints from bridging.
Also added HybrIK to set_environmentak_variables and the model loading
use that path.
  • Loading branch information
peifferjd committed Aug 24, 2023
1 parent d49d58f commit 2a99320
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions pose_pipeline/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def set_environmental_variables(pose_project_dir=None):
"RIE_PATH": f"{pose_project_dir}Pose3D-RIE",
"VIDEOPOSE3D_PATH": f"{pose_project_dir}VideoPose3D",
"POSEAUG_PATH": f"{pose_project_dir}PoseAug",
"HYBRIDIK_PATH": f"{pose_project_dir}HybrIK",
}
for var, path in env_paths.items():
assert Path(path).exists(), f"Could not find path {path}"
Expand Down
10 changes: 10 additions & 0 deletions pose_pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ class TopDownMethodLookup(dj.Lookup):
{"top_down_method": 9, "top_down_method_name": "OpenPose_LR"},
{"top_down_method": 11, "top_down_method_name": "Bridging_COCO_25"},
{"top_down_method": 12, "top_down_method_name": "Bridging_bml_movi_87"},
{"top_down_method": 13, "top_down_method_name": "Bridging_smpl+head_30"},
]


Expand Down Expand Up @@ -1074,6 +1075,15 @@ def make(self, key):
# Filter out keypoints that are outside of the image since confidence estimates do
# not capture this
key["keypoints"] = keypoints_filter_clipped_image(key, key["keypoints"])
elif method_name == "Bridging_smpl+head_30":
from pose_pipeline.wrappers.bridging import filter_skeleton
from pose_pipeline.utils.keypoints import keypoints_filter_clipped_image

key["keypoints"] = (BottomUpBridgingPerson & key).fetch1("keypoints")
key["keypoints"] = np.array(filter_skeleton(key["keypoints"], "smpl+head_30"))
# Filter out keypoints that are outside of the image since confidence estimates do
# not capture this
key["keypoints"] = keypoints_filter_clipped_image(key, key["keypoints"])
else:
raise Exception("Method not implemented")

Expand Down
5 changes: 3 additions & 2 deletions pose_pipeline/wrappers/hybrik.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ def process_hybrik(key):

def get_hybrik_smpl_callback(key, device='cuda'):

from hybrik.models.layers.smpl.lbs import hybrik as hybrik_compute_smpl
from hybrik.utils.render_pytorch3d import render_mesh
with add_path(os.environ["HYBRIDIK_PATH"]):
from hybrik.models.layers.smpl.lbs import hybrik as hybrik_compute_smpl
from hybrik.utils.render_pytorch3d import render_mesh

from pose_pipeline.utils.visualization import draw_keypoints

Expand Down

0 comments on commit 2a99320

Please sign in to comment.