MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / visualize_smpl_hmr

Function visualize_smpl_hmr

detrsmpl/core/visualization/visualize_smpl.py:1079–1114  ·  view source on GitHub ↗

Simplest way to visualize HMR or SPIN or Smplify pred smpl with origin frames and predicted cameras.

(cam_transl,
                       bbox=None,
                       kp2d=None,
                       focal_length=5000,
                       det_width=224,
                       det_height=224,
                       bbox_format='xyxy',
                       **kwargs)

Source from the content-addressed store, hash-verified

1077
1078
1079def visualize_smpl_hmr(cam_transl,
1080 bbox=None,
1081 kp2d=None,
1082 focal_length=5000,
1083 det_width=224,
1084 det_height=224,
1085 bbox_format='xyxy',
1086 **kwargs) -> None:
1087 """Simplest way to visualize HMR or SPIN or Smplify pred smpl with origin
1088 frames and predicted cameras."""
1089 if kp2d is not None:
1090 bbox = convert_kp2d_to_bbox(kp2d, bbox_format=bbox_format)
1091 Ks = convert_bbox_to_intrinsic(bbox, bbox_format=bbox_format)
1092 K = torch.Tensor(
1093 get_default_hmr_intrinsic(focal_length=focal_length,
1094 det_height=det_height,
1095 det_width=det_width))
1096 func = partial(
1097 render_smpl,
1098 projection='perspective',
1099 convention='opencv',
1100 in_ndc=False,
1101 K=None,
1102 R=None,
1103 orig_cam=None,
1104 )
1105 if isinstance(cam_transl, np.ndarray):
1106 cam_transl = torch.Tensor(cam_transl)
1107 T = torch.cat([
1108 cam_transl[..., [1]], cam_transl[..., [2]], 2 * focal_length /
1109 (det_width * cam_transl[..., [0]] + 1e-9)
1110 ], -1)
1111 for k in func.keywords.keys():
1112 if k in kwargs:
1113 kwargs.pop(k)
1114 return func(Ks=Ks, K=K, T=T, **kwargs)
1115
1116
1117def visualize_smpl_vibe(orig_cam=None,

Callers

nothing calls this directly

Calls 4

convert_kp2d_to_bboxFunction · 0.90
keysMethod · 0.45

Tested by

no test coverage detected