code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def create(model_path, model_type='smpl',
**kwargs):
""" Method for creating a model from a path and a model type
Parameters
----------
model_path: str
Either the path to the model you wish to load or a folder,
where each subfolder contains the differents ... | Method for creating a model from a path and a model type
Parameters
----------
model_path: str
Either the path to the model you wish to load or a folder,
where each subfolder contains the differents types, i.e.:
model_path:
|
|-- smpl... | create | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/body_models.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/body_models.py | Apache-2.0 |
def __init__(self, model_path, data_struct=None,
create_betas=True,
betas=None,
create_global_orient=True,
global_orient=None,
create_body_pose=True,
body_pose=None,
create_transl=True,
... | SMPL model constructor
Parameters
----------
model_path: str
The path to the folder or to the file where the model
parameters are stored
data_struct: Strct
A struct object. If given, then the parameters of the model are
... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/body_models.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/body_models.py | Apache-2.0 |
def forward(self, betas=None, body_pose=None, global_orient=None,
transl=None, return_verts=True, return_full_pose=False, pose2rot=True,
**kwargs):
""" Forward pass for the SMPL model
Parameters
----------
global_orient: torch.tensor, optional... | Forward pass for the SMPL model
Parameters
----------
global_orient: torch.tensor, optional, shape Bx3
If given, ignore the member variable and use it as the global
rotation of the body. Useful if someone wishes to predicts this
with ... | forward | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/body_models.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/body_models.py | Apache-2.0 |
def __init__(self, model_path,
create_expression=True, expression=None,
create_jaw_pose=True, jaw_pose=None,
create_leye_pose=True, leye_pose=None,
create_reye_pose=True, reye_pose=None,
use_face_contour=False,
batch_s... | SMPLX model constructor
Parameters
----------
model_path: str
The path to the folder or to the file where the model
parameters are stored
create_expression: bool, optional
Flag for creating a member variable for the expres... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/body_models.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/body_models.py | Apache-2.0 |
def forward(self, betas=None, global_orient=None, body_pose=None,
left_hand_pose=None, right_hand_pose=None, transl=None,
expression=None, jaw_pose=None, leye_pose=None, reye_pose=None,
return_verts=True, return_full_pose=False, pose2rot=True, **kwargs):
'''
... |
Forward pass for the SMPLX model
Parameters
----------
global_orient: torch.tensor, optional, shape Bx3
If given, ignore the member variable and use it as the global
rotation of the body. Useful if someone wishes to predicts this
... | forward | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/body_models.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/body_models.py | Apache-2.0 |
def find_dynamic_lmk_idx_and_bcoords(vertices, pose, dynamic_lmk_faces_idx,
dynamic_lmk_b_coords,
neck_kin_chain, dtype=torch.float32):
''' Compute the faces, barycentric coordinates for the dynamic landmarks
To do so, we first comp... | Compute the faces, barycentric coordinates for the dynamic landmarks
To do so, we first compute the rotation of the neck around the y-axis
and then use a pre-computed look-up table to find the faces and the
barycentric coordinates that will be used.
Special thanks to Soubhik Sanyal (... | find_dynamic_lmk_idx_and_bcoords | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def vertices2landmarks(vertices, faces, lmk_faces_idx, lmk_bary_coords):
''' Calculates landmarks by barycentric interpolation
Parameters
----------
vertices: torch.tensor BxVx3, dtype = torch.float32
The tensor of input vertices
faces: torch.tensor Fx3, dtype = torch.lo... | Calculates landmarks by barycentric interpolation
Parameters
----------
vertices: torch.tensor BxVx3, dtype = torch.float32
The tensor of input vertices
faces: torch.tensor Fx3, dtype = torch.long
The faces of the mesh
lmk_faces_idx: torch.tensor L, dtyp... | vertices2landmarks | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def lbs(betas, pose, v_template, shapedirs, posedirs, J_regressor, parents,
lbs_weights, pose2rot=True, dtype=torch.float32):
''' Performs Linear Blend Skinning with the given shape and pose parameters
Parameters
----------
betas : torch.tensor BxNB
The tensor of shape p... | Performs Linear Blend Skinning with the given shape and pose parameters
Parameters
----------
betas : torch.tensor BxNB
The tensor of shape parameters
pose : torch.tensor Bx(J + 1) * 3
The pose parameters in axis-angle format
v_template torch.tensor BxVx... | lbs | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def blend_shapes(betas, shape_disps):
''' Calculates the per vertex displacement due to the blend shapes
Parameters
----------
betas : torch.tensor Bx(num_betas)
Blend shape coefficients
shape_disps: torch.tensor Vx3x(num_betas)
Blend shapes
Returns
-------
torch.tenso... | Calculates the per vertex displacement due to the blend shapes
Parameters
----------
betas : torch.tensor Bx(num_betas)
Blend shape coefficients
shape_disps: torch.tensor Vx3x(num_betas)
Blend shapes
Returns
-------
torch.tensor BxVx3
The per-vertex displacement d... | blend_shapes | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def batch_rodrigues(rot_vecs, epsilon=1e-8, dtype=torch.float32):
''' Calculates the rotation matrices for a batch of rotation vectors
Parameters
----------
rot_vecs: torch.tensor Nx3
array of N axis-angle vectors
Returns
-------
R: torch.tensor Nx3x3
... | Calculates the rotation matrices for a batch of rotation vectors
Parameters
----------
rot_vecs: torch.tensor Nx3
array of N axis-angle vectors
Returns
-------
R: torch.tensor Nx3x3
The rotation matrices for the given axis-angle parameters
| batch_rodrigues | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def transform_mat(R, t):
''' Creates a batch of transformation matrices
Args:
- R: Bx3x3 array of a batch of rotation matrices
- t: Bx3x1 array of a batch of translation vectors
Returns:
- T: Bx4x4 Transformation matrix
'''
# No padding left or right, only... | Creates a batch of transformation matrices
Args:
- R: Bx3x3 array of a batch of rotation matrices
- t: Bx3x1 array of a batch of translation vectors
Returns:
- T: Bx4x4 Transformation matrix
| transform_mat | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def batch_rigid_transform(rot_mats, joints, parents, dtype=torch.float32):
"""
Applies a batch of rigid transformations to the joints
Parameters
----------
rot_mats : torch.tensor BxNx3x3
Tensor of rotation matrices
joints : torch.tensor BxNx3
Locations of joints
parents : t... |
Applies a batch of rigid transformations to the joints
Parameters
----------
rot_mats : torch.tensor BxNx3x3
Tensor of rotation matrices
joints : torch.tensor BxNx3
Locations of joints
parents : torch.tensor BxN
The kinematic tree of each object
dtype : torch.dtype,... | batch_rigid_transform | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def pose_to_rotation_matrix(pose, num_joints=24):
"""
Convert pose parameters to rotation matrix.
Args:
pose (torch.Tensor): (bs, 24 * angle_dim), here angle_dim is the angle dimension;
num_joints (int): the number of joints, and the number of SMPL joints is 24.
Returns:
rotmat... |
Convert pose parameters to rotation matrix.
Args:
pose (torch.Tensor): (bs, 24 * angle_dim), here angle_dim is the angle dimension;
num_joints (int): the number of joints, and the number of SMPL joints is 24.
Returns:
rotmat (torch.Tensor): (bs, num_joints, 3, 3)
| pose_to_rotation_matrix | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/lbs.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/lbs.py | Apache-2.0 |
def forward(self, vertices, joints):
"""
Selects the extra joints from vertices, and then concatenates the original joints with the extra joints.
1. If `self.use_feet_keypoints == False` and `self.use_hands == False`, then the extra joints is empty:
1.1 if the model is `SMPL`, then ... |
Selects the extra joints from vertices, and then concatenates the original joints with the extra joints.
1. If `self.use_feet_keypoints == False` and `self.use_hands == False`, then the extra joints is empty:
1.1 if the model is `SMPL`, then it returns joints, and the output shape is (batc... | forward | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/smplx/vertex_joint_selector.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/smplx/vertex_joint_selector.py | Apache-2.0 |
def __init__(self, cfg_or_path, device=torch.device("cuda:0")):
"""
Args:
cfg_or_path: the config object, it contains the following information:
seg_cfg_path="./assets/configs/detection/point_rend/point_rend_r50_caffe_fpn_mstrain_3x_coco.py",
seg_ckpt_path="... |
Args:
cfg_or_path: the config object, it contains the following information:
seg_cfg_path="./assets/configs/detection/point_rend/point_rend_r50_caffe_fpn_mstrain_3x_coco.py",
seg_ckpt_path="./assets/checkpoints/detection/point_rend_r50_caffe_fpn_mstrain_3x_coco-e0eb... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/point_render_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/point_render_parser.py | Apache-2.0 |
def generate_trimap(self, mask):
"""
Args:
mask (np.ndarray): (h, w) 0 or 1
Returns:
trimap (np.ndarray): (h, w) is in the range [0, 255]
"""
origin_h, origin_w = mask.shape
scaled_size = compute_scaled_size((origin_w, origin_h), control_size=se... |
Args:
mask (np.ndarray): (h, w) 0 or 1
Returns:
trimap (np.ndarray): (h, w) is in the range [0, 255]
| generate_trimap | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/point_render_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/point_render_parser.py | Apache-2.0 |
def run_detection(self, img_path):
"""
Run detection to get the segmentation mask and trimap, assuming that there is only a single human
in the image.
Args:
img_path (str): the image path
Returns:
has_person (bool): whether there is person or not.
... |
Run detection to get the segmentation mask and trimap, assuming that there is only a single human
in the image.
Args:
img_path (str): the image path
Returns:
has_person (bool): whether there is person or not.
segm_mask (np.ndarray): (h, w)
... | run_detection | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/point_render_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/point_render_parser.py | Apache-2.0 |
def run_matting(self, img_or_path):
"""
1. run instance segmentation with PointRender, detection first;
2. generate trimap;
3. run matting;
Args:
img_or_path (str or np.ndarray): (h, w, 3) is in the range of [0, 255] with BGR channel space.
Returns:
... |
1. run instance segmentation with PointRender, detection first;
2. generate trimap;
3. run matting;
Args:
img_or_path (str or np.ndarray): (h, w, 3) is in the range of [0, 255] with BGR channel space.
Returns:
has_person (bool): whether there is person ... | run_matting | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/point_render_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/point_render_parser.py | Apache-2.0 |
def run(self, src_dir, out_dir, src_img_names=None, save_visual=True):
"""
Run human matting of all the images on a directory.
Args:
src_dir (str):
out_dir (str):
src_img_names (List[str]):
save_visual (bool):
Returns:
None
... |
Run human matting of all the images on a directory.
Args:
src_dir (str):
out_dir (str):
src_img_names (List[str]):
save_visual (bool):
Returns:
None
| run | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/point_render_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/point_render_parser.py | Apache-2.0 |
def find_largest_connected_mask(gray):
"""
remove the isolated noisy, and return the largest connected mask.
Args:
gray (np.ndarray): size is (h, w), intensity is [0, 255], dtype is np.uint8
Returns:
mask (np.ndarray): the largest connected mask, size is (h, w), intensity is [0, 25... |
remove the isolated noisy, and return the largest connected mask.
Args:
gray (np.ndarray): size is (h, w), intensity is [0, 255], dtype is np.uint8
Returns:
mask (np.ndarray): the largest connected mask, size is (h, w), intensity is [0, 255], dtype is np.uint8.
| find_largest_connected_mask | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/schp_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/schp_parser.py | Apache-2.0 |
def decode_parsing(pred_labels, num_classes=21):
"""Decode batch of segmentation masks.
Args:
pred_labels (np.ndarray): result of inference after taking argmax.
num_classes: number of classes to predict (including background).
Returns:
labels_color (np.ndarray): A batch with num_images R... | Decode batch of segmentation masks.
Args:
pred_labels (np.ndarray): result of inference after taking argmax.
num_classes: number of classes to predict (including background).
Returns:
labels_color (np.ndarray): A batch with num_images RGB images of the same size as the input.
| decode_parsing | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/schp_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/schp_parser.py | Apache-2.0 |
def build_schp(num_classes=20, pretrained="./models/resnet101-imagenet.pth"):
"""
Args:
num_classes (int):
pretrained (str or None):
Returns:
"""
global pretrained_settings
model = ResNet(Bottleneck, [3, 4, 23, 3], num_classes)
if pretrained is not None:
settings... |
Args:
num_classes (int):
pretrained (str or None):
Returns:
| build_schp | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/schp_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/schp_parser.py | Apache-2.0 |
def remove_prefix_state_dict(state_dict, prefix="module"):
"""
remove prefix from the key of pretrained state dict for Data-Parallel
"""
new_state_dict = {}
first_state_name = list(state_dict.keys())[0]
if not first_state_name.startswith(prefix):
for key, value in state_dict.items():
... |
remove prefix from the key of pretrained state dict for Data-Parallel
| remove_prefix_state_dict | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/schp_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/schp_parser.py | Apache-2.0 |
def run(self, src_dir, out_dir, src_file_list=None, target="body", save_visual=True):
"""
Args:
src_dir (str or None):
out_dir (str or None):
src_file_list (list of str or None):
target (str): "body" or "skirt+dress";
save_visual (bool):
... |
Args:
src_dir (str or None):
out_dir (str or None):
src_file_list (list of str or None):
target (str): "body" or "skirt+dress";
save_visual (bool):
Returns:
flag (bool): if it detects mask, then it returns True, otherwise it will... | run | python | iPERDance/iPERCore | iPERCore/tools/human_mattors/schp_parser.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_mattors/schp_parser.py | Apache-2.0 |
def boxes_from_keypoints(self, kps, threshold=0.3):
"""
Args:
kps (np.ndarray): (number of keypoints, 3)
threshold (float):
Returns:
"""
valid = kps[:, 2] > threshold
valid_kps = kps[valid, 0:2]
min_xy = np.min(valid_kps, axis=0, keepd... |
Args:
kps (np.ndarray): (number of keypoints, 3)
threshold (float):
Returns:
| boxes_from_keypoints | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/__init__.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/__init__.py | Apache-2.0 |
def calculate_area(kps):
"""
Args:
kps (np.ndarray): (number of keypoints, 3).
Returns:
area (float): the area of the bounding boxes;
boxes (list): (x0, y0, x1, y1)
"""
vis = kps[:, 2] > 0
if len(vis) > 0:
vis_kps = kps[vis, 0:2]
x0, y0 = np.min(vis_k... |
Args:
kps (np.ndarray): (number of keypoints, 3).
Returns:
area (float): the area of the bounding boxes;
boxes (list): (x0, y0, x1, y1)
| calculate_area | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | Apache-2.0 |
def run_single_image(self, image_or_path: Union[np.ndarray, str], get_visual: bool = False):
"""
Run the OpenPose to estimate the keypoints, here we return the largest area of person.
Args:
image_or_path (str or np.ndarray): if it is np.ndarray, it must be (height, width, 3) with n... |
Run the OpenPose to estimate the keypoints, here we return the largest area of person.
Args:
image_or_path (str or np.ndarray): if it is np.ndarray, it must be (height, width, 3) with np.uint8 in the
range of [0, 255], BGR channel;
get_visual (bool): return the... | run_single_image | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | Apache-2.0 |
def post_process(self, datum, img_shape):
"""
Args:
datum:
img_shape (tuple): (height, width)
Returns:
"""
height, width = img_shape
poseKps = datum.poseKeypoints
faceKps = datum.faceKeypoints
leftHandKps = datum.handKeypoints[0... |
Args:
datum:
img_shape (tuple): (height, width)
Returns:
| post_process | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | Apache-2.0 |
def format_output(self, number, boxes, poseKps, leftHandKps, rightHandKps, faceKps, height, width):
"""
Args:
number (int):
poseKps (np.ndarray):
leftHandKps (np.ndarray ir List):
rightHandKps (np.ndarray or List):
faceKps (np.ndarray or List)... |
Args:
number (int):
poseKps (np.ndarray):
leftHandKps (np.ndarray ir List):
rightHandKps (np.ndarray or List):
faceKps (np.ndarray or List):
height (int or None):
width (int or None):
Returns:
output (dict... | format_output | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | Apache-2.0 |
def choose_large_one(self, poseKps, leftHandKps, rightHandKps, faceKps):
"""
Args:
poseKps (np.ndarray): (bs, dim), if self.model_pose == "BODY_25", then dim = 75.
leftHandKps:
rightHandKps:
faceKps:
Returns:
"""
bs = poseKps.sha... |
Args:
poseKps (np.ndarray): (bs, dim), if self.model_pose == "BODY_25", then dim = 75.
leftHandKps:
rightHandKps:
faceKps:
Returns:
| choose_large_one | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/caffe_runner.py | Apache-2.0 |
def infer_fast_post_process(net_outputs, PoseClass):
"""
Args:
net_outputs (dict): the output of the networks, and it contains,
--heatmaps:
--pafs:
PoseClass (type of tools.human_pose2d_estimators.utils.pose_utils.OpenPoseBody25):
Returns:
outputs (dict): t... |
Args:
net_outputs (dict): the output of the networks, and it contains,
--heatmaps:
--pafs:
PoseClass (type of tools.human_pose2d_estimators.utils.pose_utils.OpenPoseBody25):
Returns:
outputs (dict): the output results, and it contains the followings keys,
... | infer_fast_post_process | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/post_process.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/post_process.py | Apache-2.0 |
def run_single_image(self, img, height_size=368, use_fast=True, previous_poses=None, pose_smooth=False):
"""
Args:
img (np.darary):
height_size (int):
use_fast (bool):
previous_poses (None or BasePose):
pose_smooth (bool):
Returns:
... |
Args:
img (np.darary):
height_size (int):
use_fast (bool):
previous_poses (None or BasePose):
pose_smooth (bool):
Returns:
output (dict): the dict information of, and it contains:
--number (int): the number of the ... | run_single_image | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/runner.py | Apache-2.0 |
def run_over_folder(self, root_dir, height_size=368, use_fast=True, pose_smooth=True):
"""
Run detector over all the images in one folder.
Args:
root_dir (str): the directory of the folder;
height_size (int):
use_fast (bool):
pose_smooth (bool):
... |
Run detector over all the images in one folder.
Args:
root_dir (str): the directory of the folder;
height_size (int):
use_fast (bool):
pose_smooth (bool):
Returns:
pose_results (dict): the pose results and it contains the followings... | run_over_folder | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/runner.py | Apache-2.0 |
def body25_make_layers(block, act_types):
"""
Args:
block:
act_types (dict):
Returns:
module (nn.Sequential): the module layer.
"""
layers = []
for layer_name, v in block.items():
if 'pool' in layer_name:
layer = nn.MaxPool2d(kernel_size=v[0], strid... |
Args:
block:
act_types (dict):
Returns:
module (nn.Sequential): the module layer.
| body25_make_layers | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/models/openposenet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/models/openposenet.py | Apache-2.0 |
def __init__(self, stage, stage_params):
"""
Args:
stage (int):
stage_params (dict):
stage_params = {
# layer_num: [in_channel, out_channel, kernel_size, stride, padding, is_single, has_relu, l_name]
1: [128, 96, 3, 1, 1, F... |
Args:
stage (int):
stage_params (dict):
stage_params = {
# layer_num: [in_channel, out_channel, kernel_size, stride, padding, is_single, has_relu, l_name]
1: [128, 96, 3, 1, 1, False, True, 2],
2: [96 * 3, 96, ... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/openpose/models/openposenet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/openpose/models/openposenet.py | Apache-2.0 |
def track_poses(cls, previous_poses, current_poses, threshold=3, smooth=False):
"""
Propagate poses ids from previous frame results. Id is propagated,
if there are at least `threshold` similar keypoints between pose from previous frame and current.
If correspondence between pose on previ... |
Propagate poses ids from previous frame results. Id is propagated,
if there are at least `threshold` similar keypoints between pose from previous frame and current.
If correspondence between pose on previous and current frame was established, pose keypoints are smoothed.
Args:
... | track_poses | python | iPERDance/iPERCore | iPERCore/tools/human_pose2d_estimators/utils/pose_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose2d_estimators/utils/pose_utils.py | Apache-2.0 |
def build_pose3d_estimator(name: str, *args, **kwargs):
"""
Args:
name (str):
*args:
**kwargs:
Returns:
estimator (BaseRunner):
"""
if name == "spin":
from .spin import SPINRunner
estimator = SPINRunner(*args, **kwargs)
else:
raise Valu... |
Args:
name (str):
*args:
**kwargs:
Returns:
estimator (BaseRunner):
| build_pose3d_estimator | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/__init__.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/__init__.py | Apache-2.0 |
def build_pose3d_refiner(name: str, *args, **kwargs):
"""
Args:
name:
*args:
**kwargs:
Returns:
estimator (BaseRunner):
"""
if name == "smplify":
from .smplify import SMPLifyRunner
estimator = SMPLifyRunner(*args, **kwargs)
else:
raise V... |
Args:
name:
*args:
**kwargs:
Returns:
estimator (BaseRunner):
| build_pose3d_refiner | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/__init__.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/__init__.py | Apache-2.0 |
def angle_prior(pose):
"""
Angle prior that penalizes unnatural bending of the knees and elbows
"""
# We subtract 3 because pose does not include the global rotation of the model
return torch.exp(
pose[:, [55 - 3, 58 - 3, 12 - 3, 15 - 3]] * torch.tensor([1., -1., -1, -1.], device=pose.device... |
Angle prior that penalizes unnatural bending of the knees and elbows
| angle_prior | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/losses.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/losses.py | Apache-2.0 |
def forward(self, pose, with_global_pose=False):
""" Returns the angle prior loss for the given pose
Args:
pose: (Bx[23 + 1] * 3) torch tensor with the axis-angle
representation of the rotations of the joints of the SMPL model.
Kwargs:
with_global_pose: Wheth... | Returns the angle prior loss for the given pose
Args:
pose: (Bx[23 + 1] * 3) torch tensor with the axis-angle
representation of the rotations of the joints of the SMPL model.
Kwargs:
with_global_pose: Whether the pose vector also contains the global
orie... | forward | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/prior.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/prior.py | Apache-2.0 |
def log_likelihood(self, pose, betas, *args, **kwargs):
''' Create graph operation for negative log-likelihood calculation
'''
likelihoods = []
for idx in range(self.num_gaussians):
mean = self.means[idx]
prec = self.precisions[idx]
cov = self.covs[id... | Create graph operation for negative log-likelihood calculation
| log_likelihood | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/prior.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/prior.py | Apache-2.0 |
def __init__(self,
cfg_or_path, use_lbfgs=False,
joint_type="OpenPose-Body-25", device=torch.device("cpu")):
"""
Args:
cfg_or_path: the configuration of SMPLify, the default file is `./assets/configs/pose3d/smplify.toml`. It
contains the fo... |
Args:
cfg_or_path: the configuration of SMPLify, the default file is `./assets/configs/pose3d/smplify.toml`. It
contains the followings parameters:
model_path = "./assets/pretrains/smpl_model.pkl"
prior_folder = "./assets/pretrains"
... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/runner.py | Apache-2.0 |
def __call__(self, keypoints, pred_camera, pred_betas, pred_pose, proc_kps=True, temporal=True):
"""
Args:
keypoints (dict): the outputs of the OpenPose, Halpe, or COCO, it contains:
--pose_keypoints_2d (np.ndarray): the scale is in the range of [-1, 1]
pred_came... |
Args:
keypoints (dict): the outputs of the OpenPose, Halpe, or COCO, it contains:
--pose_keypoints_2d (np.ndarray): the scale is in the range of [-1, 1]
pred_camera: torch.Tensor, (bs, 3), the camera output of the SPIN or HMR;
pred_betas: torch.Tensor, (bs, ... | __call__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/runner.py | Apache-2.0 |
def __call__(self, init_pose, init_betas, init_cam_t, camera_center, keypoints_2d,
opt_cam=False, use_lbfgs=False, use_temporal=False):
"""Perform body fitting.
Input:
init_pose: SMPL pose estimate;
init_betas: SMPL betas estimate;
init_cam_t: Camera ... | Perform body fitting.
Input:
init_pose: SMPL pose estimate;
init_betas: SMPL betas estimate;
init_cam_t: Camera translation estimate;
camera_center: Camera center location;
keypoints_2d: Keypoints used for the optimization;
opt_cam (bool): ... | __call__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/smplify.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/smplify.py | Apache-2.0 |
def smpl_to_openpose(model_type="smplx", use_hands=True, use_face=True,
use_face_contour=False, openpose_format="coco25"):
"""
Returns the indices of the permutation that maps OpenPose to SMPL
Args:
model_type (str): The type of SMPL-like model that is used. The default mapping
... |
Returns the indices of the permutation that maps OpenPose to SMPL
Args:
model_type (str): The type of SMPL-like model that is used. The default mapping
returned is for the SMPLX model.
use_hands (bool): Flag for adding to the returned permutation the mapping for the
hand... | smpl_to_openpose | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/smplify/utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/smplify/utils.py | Apache-2.0 |
def preprocess(img, boxes):
"""
Args:
img (np.ndarray): (height, width, 3) is in the range of [0, 255], BGR channel.
boxes (np.ndarray, List, or Tuple) : (4,) = [x0, y0, x1, y1]
Returns:
proc_img (np.ndarray): the cropped image, (3, 224, 224) is in the range of [0, 1], RGB channel;
... |
Args:
img (np.ndarray): (height, width, 3) is in the range of [0, 255], BGR channel.
boxes (np.ndarray, List, or Tuple) : (4,) = [x0, y0, x1, y1]
Returns:
proc_img (np.ndarray): the cropped image, (3, 224, 224) is in the range of [0, 1], RGB channel;
proc_info (dict): the infor... | preprocess | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/dataset.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/dataset.py | Apache-2.0 |
def __getitem__(self, item):
"""
Args:
item (int):
Returns:
sample (dict): the sample information, it contains,
--image (torch.Tensor): (3, 224, 224) is the cropped image range of [0, 1] and normalized
by MEAN and STD, RGB channel;
... |
Args:
item (int):
Returns:
sample (dict): the sample information, it contains,
--image (torch.Tensor): (3, 224, 224) is the cropped image range of [0, 1] and normalized
by MEAN and STD, RGB channel;
--orig_image (torch.Tensor): ... | __getitem__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/dataset.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/dataset.py | Apache-2.0 |
def __getitem__(self, item):
"""
Args:
item (int):
Returns:
sample (dict): the sample information, it contains,
--image (torch.Tensor): (3, 224, 224) is the cropped image range of [0, 1] and normalized
by MEAN and STD, RGB channel;
... |
Args:
item (int):
Returns:
sample (dict): the sample information, it contains,
--image (torch.Tensor): (3, 224, 224) is the cropped image range of [0, 1] and normalized
by MEAN and STD, RGB channel;
--orig_image (torch.Tensor): ... | __getitem__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/dataset.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/dataset.py | Apache-2.0 |
def build_spin(pretrained=False, **kwargs):
""" Constructs an HMR model with ResNet50 backbone.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
"""
model = SPIN(Bottleneck, [3, 4, 6, 3], **kwargs)
if pretrained:
resnet_imagenet = resnet.resnet50(pretrained=T... | Constructs an HMR model with ResNet50 backbone.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
| build_spin | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/network.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/network.py | Apache-2.0 |
def __init__(self,
cfg_or_path: Union[EasyDict, str],
device=torch.device("cpu")):
"""
Args:
cfg_or_path (EasyDict or str): the configuration EasyDict or the cfg_path with `toml` file.
If it is an EasyDict instance, it must contains the foll... |
Args:
cfg_or_path (EasyDict or str): the configuration EasyDict or the cfg_path with `toml` file.
If it is an EasyDict instance, it must contains the followings,
--ckpt_path (str): the path of the pre-trained checkpoints;
--smpl_path (str): t... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/runner.py | Apache-2.0 |
def __call__(self, image: np.ndarray,
boxes: Union[np.ndarray, List, Tuple, Any],
action: ACTIONS = ACTIONS.SPLIT) -> Dict[str, Any]:
"""
Args:
image (np.ndarray): (H, W, C), color intensity [0, 255] with BGR color channel;
boxes (np.ndarray or ... |
Args:
image (np.ndarray): (H, W, C), color intensity [0, 255] with BGR color channel;
boxes (np.ndarray or List, or Tuple or None): (N, 4)
action:
-- 0: only return `cams`, `pose` and `shape` of SMPL;
-- 1: return `cams`, `pose`, `shape` and ... | __call__ | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/runner.py | Apache-2.0 |
def run_with_smplify(self, image_paths: List[str], boxes: List[Union[List, Tuple, np.ndarray]],
keypoints_info: Dict, smplify_runner: BasePose3dRefiner,
batch_size: int = 16, num_workers: int = 4,
filter_invalid: bool = True, temporal: bool = Tr... |
Args:
image_paths (list of str): the image paths;
boxes (list of Union[np.np.ndarray, list, tuple)): the bounding boxes of each image;
keypoints_info (Dict): the keypoints information of each image;
smplify_runner (BasePose3dRefiner): the simplify instance, it m... | run_with_smplify | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/runner.py | Apache-2.0 |
def run(self, image_paths: List[str], boxes: List[List],
batch_size: int = 16, num_workers: int = 4,
filter_invalid: bool = True, temporal: bool = True):
"""
Args:
image_paths (list of str): the image paths;
boxes (list of list): the bounding boxes of ea... |
Args:
image_paths (list of str): the image paths;
boxes (list of list): the bounding boxes of each image;
batch_size (int): the mini-batch size;
num_workers (int): the number of processes;
filter_invalid (bool): the flag to control whether filter inv... | run | python | iPERDance/iPERCore | iPERCore/tools/human_pose3d_estimators/spin/runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_pose3d_estimators/spin/runner.py | Apache-2.0 |
def get_largest_instance(human_instances: np.ndarray) -> Tuple[Union[np.ndarray, None], int]:
"""
Get the largest area boxes from the instances.
Args:
human_instances (np.ndarray): (number of person, 5 = (x1, y1, x2, y2, cls_pred)). If number of person is 0,
then it will return None.
... |
Get the largest area boxes from the instances.
Args:
human_instances (np.ndarray): (number of person, 5 = (x1, y1, x2, y2, cls_pred)). If number of person is 0,
then it will return None.
Returns:
target_instance (np.ndarray or None): [1, 5 = (x1, y1, x2, y2, cls_pred)]. It ret... | get_largest_instance | python | iPERDance/iPERCore | iPERCore/tools/human_trackers/max_box_tracker.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_trackers/max_box_tracker.py | Apache-2.0 |
def __call__(self, img, human_instances: np.ndarray) -> Tuple[Union[np.ndarray, None], int]:
"""
Get the largest area boxes from the instances.
Args:
human_instances (np.ndarray): (number of person, 5 = (x1, y1, x2, y2, cls_pred)). If number of person is 0,
then it ... |
Get the largest area boxes from the instances.
Args:
human_instances (np.ndarray): (number of person, 5 = (x1, y1, x2, y2, cls_pred)). If number of person is 0,
then it will return None.
Returns:
target_instance (np.ndarray or None): [1, 5 = (x1, y1, x2... | __call__ | python | iPERDance/iPERCore | iPERCore/tools/human_trackers/max_box_tracker.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_trackers/max_box_tracker.py | Apache-2.0 |
def run_tracker(self, human_detections: List[np.ndarray]) -> List[Union[np.ndarray, None]]:
"""
Args:
human_detections (List[np.ndarray]]): [(number of person, 5 = (x1, y1, x2, y2, cls_pred)),
(number of person, 5 = (x1, y1, x2, y2, cls_pre... |
Args:
human_detections (List[np.ndarray]]): [(number of person, 5 = (x1, y1, x2, y2, cls_pred)),
(number of person, 5 = (x1, y1, x2, y2, cls_pred)),
...,
... | run_tracker | python | iPERDance/iPERCore | iPERCore/tools/human_trackers/max_box_tracker.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_trackers/max_box_tracker.py | Apache-2.0 |
def execute(self, processed_info: ProcessInfo,
crop_size=512, estimate_boxes_first=True, factor=1.25, num_workers=0,
use_simplify=True, filter_invalid=True, parser=True,
inpaintor=False, dilate_kernel_size=19, dilate_iter_num=3, bg_replace=False,
find_fron... |
Args:
processed_info:
crop_size:
estimate_boxes_first:
factor:
num_workers:
use_simplify:
filter_invalid:
parser:
inpaintor:
dilate_kernel_size:
dilate_iter_num:
bg_r... | execute | python | iPERDance/iPERCore | iPERCore/tools/processors/base_preprocessor.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/base_preprocessor.py | Apache-2.0 |
def _execute_post_pose3d(self, processed_info: ProcessInfo, use_simplify: bool = True,
filter_invalid: bool = True, temporal: bool = True):
"""
Args:
processed_info (ProcessInfo):
use_simplify (bool): the flag to control use simplify to refine the es... |
Args:
processed_info (ProcessInfo):
use_simplify (bool): the flag to control use simplify to refine the estimated SMPL parameters
by network or not.
filter_invalid (bool): the flag to control whether to filter the valid or invalid estimated SMPL.
... | _execute_post_pose3d | python | iPERDance/iPERCore | iPERCore/tools/processors/base_preprocessor.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/base_preprocessor.py | Apache-2.0 |
def _execute_post_inpaintor(self, processed_info: ProcessInfo, dilate_kernel_size: int = 19,
dilate_iter_num: int = 3, bg_replace: bool = True):
"""
Args:
processed_info (ProcessInfo):
dilate_kernel_size (int):
dilate_iter_num (int):
... |
Args:
processed_info (ProcessInfo):
dilate_kernel_size (int):
dilate_iter_num (int):
bg_replace (bool):
Returns:
| _execute_post_inpaintor | python | iPERDance/iPERCore | iPERCore/tools/processors/base_preprocessor.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/base_preprocessor.py | Apache-2.0 |
def run_detector(self, image: np.ndarray):
"""
Args:
image (np.ndarray): it must be (height, width, 3) with np.uint8 in the range of [0, 255], BGR channel.
Returns:
output (dict):
"""
# print(image_or_path)
output = self.pose2d_estimator.run_sing... |
Args:
image (np.ndarray): it must be (height, width, 3) with np.uint8 in the range of [0, 255], BGR channel.
Returns:
output (dict):
| run_detector | python | iPERDance/iPERCore | iPERCore/tools/processors/preprocessors.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/preprocessors.py | Apache-2.0 |
def run_inpaintor(self, img_path, mask_path, dilate_kernel_size=19, dilate_iter_num=3):
"""
Args:
img_path (str): the full image path;
mask_path (str): the mask path, 0 means the background, 255 means the area need to be inpainted;
dilate_kernel_size (int):
... |
Args:
img_path (str): the full image path;
mask_path (str): the mask path, 0 means the background, 255 means the area need to be inpainted;
dilate_kernel_size (int):
dilate_iter_num (int):
Returns:
bg_img (np.ndarray): inpainted background i... | run_inpaintor | python | iPERDance/iPERCore | iPERCore/tools/processors/preprocessors.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/preprocessors.py | Apache-2.0 |
def process_crop_img(orig_img, active_bbox, image_size):
"""
Args:
orig_img (np.ndarray):
active_bbox (4,) : [x0, y0, x1, y1]
image_size (int):
Returns:
image_info (dict): the information of processed image,
`image` (np.ndarray): the crop and resized image, the s... |
Args:
orig_img (np.ndarray):
active_bbox (4,) : [x0, y0, x1, y1]
image_size (int):
Returns:
image_info (dict): the information of processed image,
`image` (np.ndarray): the crop and resized image, the shape is (image_size, image_size, 3);
`orig_shape` (t... | process_crop_img | python | iPERDance/iPERCore | iPERCore/tools/processors/process_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/process_utils.py | Apache-2.0 |
def crop_resize_boxes(boxes, scale, start_pt):
"""
crop and resize the boxes in the original image coordinates into cropped image coordinates.
Args:
boxes (list):
scale:
start_pt:
Returns:
new_boxes (list):
"""
x0, y0, x1, y1 = np.copy(boxes)
x0 = x0 * s... |
crop and resize the boxes in the original image coordinates into cropped image coordinates.
Args:
boxes (list):
scale:
start_pt:
Returns:
new_boxes (list):
| crop_resize_boxes | python | iPERDance/iPERCore | iPERCore/tools/processors/process_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/process_utils.py | Apache-2.0 |
def crop_resize_kps(keypoints, scale, start_pt):
"""
crop and resize the keypoints in the original image coordinates into cropped image coordinates.
Args:
keypoints (dict):
scale:
start_pt:
Returns:
new_kps (dict):
"""
new_kps = dict()
for part, kps in ... |
crop and resize the keypoints in the original image coordinates into cropped image coordinates.
Args:
keypoints (dict):
scale:
start_pt:
Returns:
new_kps (dict):
| crop_resize_kps | python | iPERDance/iPERCore | iPERCore/tools/processors/process_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/process_utils.py | Apache-2.0 |
def norm_kps(keypoints, orig_shape, norm_type="01=>-1+1"):
"""
Args:
keypoints (dict):
orig_shape (tuple): (height, width)
norm_type (str): if norm_type is `01`, then normalize the kps into [0, 1],
if norm_type is `-1+1`, then normalize the kps into [-1, 1].
... |
Args:
keypoints (dict):
orig_shape (tuple): (height, width)
norm_type (str): if norm_type is `01`, then normalize the kps into [0, 1],
if norm_type is `-1+1`, then normalize the kps into [-1, 1].
if norm_type us `hw`, then normalize the kps... | norm_kps | python | iPERDance/iPERCore | iPERCore/tools/processors/process_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/processors/process_utils.py | Apache-2.0 |
def forward(self, src_img, ref_img, src_smpl, ref_smpl, src_mask=None, ref_mask=None,
links_ids=None, offsets=0, temporal=False):
"""
Args:
src_img (torch.tensor) : (bs, ns, 3, H, W);
ref_img (torch.tensor) : (bs, nt, 3, H, W);
src_smpl (torch.tensor):... |
Args:
src_img (torch.tensor) : (bs, ns, 3, H, W);
ref_img (torch.tensor) : (bs, nt, 3, H, W);
src_smpl (torch.tensor): (bs, ns, 85);
ref_smpl (torch.tesnor): (bs, nt, 85);
src_mask (torch.tensor): (bs, ns, 3, H, W) or None, front is 0, background is 1... | forward | python | iPERDance/iPERCore | iPERCore/tools/trainers/base.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/base.py | Apache-2.0 |
def cal_head_bbox_by_mask(head_mask, factor=1.2):
"""
Args:
head_mask (torch.cuda.FloatTensor): (N, 1, 256, 256).
factor (float): the factor to enlarge the bbox of head.
Returns:
bbox (np.ndarray.int32): (N, 4), hear, 4 = (left_top_x, left_top_y, right_top_x,... |
Args:
head_mask (torch.cuda.FloatTensor): (N, 1, 256, 256).
factor (float): the factor to enlarge the bbox of head.
Returns:
bbox (np.ndarray.int32): (N, 4), hear, 4 = (left_top_x, left_top_y, right_top_x, right_top_y)
| cal_head_bbox_by_mask | python | iPERDance/iPERCore | iPERCore/tools/trainers/base.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/base.py | Apache-2.0 |
def cal_body_bbox_by_kps(self, kps, factor=1.2):
"""
Args:
kps (torch.cuda.FloatTensor): (N, 19, 2)
factor (float):
Returns:
bbox: (N, 4)
"""
image_size = self._opt.image_size
bs = kps.shape[0]
kps = (kps + 1) / 2.0
zer... |
Args:
kps (torch.cuda.FloatTensor): (N, 19, 2)
factor (float):
Returns:
bbox: (N, 4)
| cal_body_bbox_by_kps | python | iPERDance/iPERCore | iPERCore/tools/trainers/base.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/base.py | Apache-2.0 |
def optimize_G(self, fake_bg, fake_tsf_imgs, fake_masks):
"""
Args:
fake_bg (torch.Tensor):
fake_tsf_imgs (torch.Tensor):
fake_masks (torch.Tensor):
Returns:
"""
ns = self._ns
bs, nt, c, h, w = fake_tsf_imgs.shape
fake_bg = ... |
Args:
fake_bg (torch.Tensor):
fake_tsf_imgs (torch.Tensor):
fake_masks (torch.Tensor):
Returns:
| optimize_G | python | iPERDance/iPERCore | iPERCore/tools/trainers/baseline_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/baseline_trainer.py | Apache-2.0 |
def __init__(self, opt, device):
"""
Args:
opt (dict or EasyDict): the option information, and it contains the followings,
--gpu_ids:
--image_size (int): the image size;
--num_source (int): fix the number of sources;
--time_ste... |
Args:
opt (dict or EasyDict): the option information, and it contains the followings,
--gpu_ids:
--image_size (int): the image size;
--num_source (int): fix the number of sources;
--time_step (int): the time step for temporal attentio... | __init__ | python | iPERDance/iPERCore | iPERCore/tools/trainers/lwg_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/lwg_trainer.py | Apache-2.0 |
def _create_generator(self, cfg):
"""
Args:
cfg (dict or EasyDict): the configurations of the generator.
Returns:
"""
gen_name = self._opt.gen_name
return NetworksFactory.get_by_name(gen_name, cfg=cfg, temporal=self._opt.temporal) |
Args:
cfg (dict or EasyDict): the configurations of the generator.
Returns:
| _create_generator | python | iPERDance/iPERCore | iPERCore/tools/trainers/lwg_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/lwg_trainer.py | Apache-2.0 |
def set_input(self, inputs, device):
"""
Args:
inputs (dict): the inputs information get from the dataset, it contains the following items,
--images (torch.Tensor): ();
--smpls (torch.Tensor): ();
--masks (torch.Tensor): (), the front is 0, an... |
Args:
inputs (dict): the inputs information get from the dataset, it contains the following items,
--images (torch.Tensor): ();
--smpls (torch.Tensor): ();
--masks (torch.Tensor): (), the front is 0, and the background is 1;
--offsets... | set_input | python | iPERDance/iPERCore | iPERCore/tools/trainers/lwg_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/lwg_trainer.py | Apache-2.0 |
def optimize_G(self, fake_bg, fake_src_imgs, fake_tsf_imgs, fake_masks):
"""
Args:
fake_bg (torch.Tensor):
fake_src_imgs (torch.Tensor):
fake_tsf_imgs (torch.Tensor):
fake_masks (torch.Tensor):
Returns:
"""
ns = fake_src_imgs.sh... |
Args:
fake_bg (torch.Tensor):
fake_src_imgs (torch.Tensor):
fake_tsf_imgs (torch.Tensor):
fake_masks (torch.Tensor):
Returns:
| optimize_G | python | iPERDance/iPERCore | iPERCore/tools/trainers/lwg_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/lwg_trainer.py | Apache-2.0 |
def set_input(self, inputs, device):
"""
Args:
inputs (dict): the inputs information get from the dataset, it contains the following items,
--images (torch.Tensor): ();
--smpls (torch.Tensor): ();
--masks (torch.Tensor): ();
--... |
Args:
inputs (dict): the inputs information get from the dataset, it contains the following items,
--images (torch.Tensor): ();
--smpls (torch.Tensor): ();
--masks (torch.Tensor): ();
--offsets (torch.Tensor): ();
--li... | set_input | python | iPERDance/iPERCore | iPERCore/tools/trainers/lwg_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/lwg_trainer.py | Apache-2.0 |
def optimize_D(self, fake_bg, fake_tsf_imgs):
"""
Args:
fake_bg (torch.Tensor):
fake_tsf_imgs (torch.Tensor):
Returns:
"""
bs, nt, c, h, w = fake_tsf_imgs.shape
fake_tsf_imgs = fake_tsf_imgs.view(bs * nt, c, h, w)
real_tsf_imgs = self._... |
Args:
fake_bg (torch.Tensor):
fake_tsf_imgs (torch.Tensor):
Returns:
| optimize_D | python | iPERDance/iPERCore | iPERCore/tools/trainers/lwg_trainer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/trainers/lwg_trainer.py | Apache-2.0 |
def compute_scaled_size(origin_size, control_size):
"""
Args:
origin_size (tuple or List): (h, w) or [h, w]
control_size (int or float): the final size of the min(h, w)
Returns:
scaled_size (tuple or List): (h', w')
"""
scale_rate = np.sqrt(control_size * control_size / (o... |
Args:
origin_size (tuple or List): (h, w) or [h, w]
control_size (int or float): the final size of the min(h, w)
Returns:
scaled_size (tuple or List): (h', w')
| compute_scaled_size | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def read_cv2_img(path):
"""
Read color images
Args:
path (str): Path to image
Returns:
img (np.ndarray): color images with RGB channel, and its shape is (H, W, 3).
"""
img = cv2.imread(path, -1)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img |
Read color images
Args:
path (str): Path to image
Returns:
img (np.ndarray): color images with RGB channel, and its shape is (H, W, 3).
| read_cv2_img | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def load_images(images_paths: Union[str, List[str]], image_size):
"""
Args:
images_paths (Union[str, List[str]]):
Returns:
images (np.ndarray): shape is (ns, 3, H, W), channel is RGB, and color space is [-1, 1].
"""
if isinstance(images_paths, str):
images_paths = [images_... |
Args:
images_paths (Union[str, List[str]]):
Returns:
images (np.ndarray): shape is (ns, 3, H, W), channel is RGB, and color space is [-1, 1].
| load_images | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def read_mask(path, image_size):
"""
Read mask
Args:
path (str): Path to mask
Returns:
mask (np.ndarray): mask image with grayscale, and its shape is (1, H, W) in the range of [0, 1]
"""
mask = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
mask = cv2.resize(mask, (image_size, i... |
Read mask
Args:
path (str): Path to mask
Returns:
mask (np.ndarray): mask image with grayscale, and its shape is (1, H, W) in the range of [0, 1]
| read_mask | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def kp_to_bbox_param(kp, vis_thresh=0, diag_len=150.0):
"""
Finds the bounding box parameters from the 2D keypoints.
Args:
kp (Kx3): 2D Keypoints.
vis_thresh (float): Threshold for visibility.
diag_len(float): diagonal length of bbox of each person
Returns:
[center_x, c... |
Finds the bounding box parameters from the 2D keypoints.
Args:
kp (Kx3): 2D Keypoints.
vis_thresh (float): Threshold for visibility.
diag_len(float): diagonal length of bbox of each person
Returns:
[center_x, center_y, scale]
| kp_to_bbox_param | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def process_hmr_img(im_path, bbox_param, rescale=None, image=None, image_size=256, proc=False):
"""
Args:
im_path (str): the path of image.
image (np.ndarray or None): if it is None, then loading the im_path, else use image.
bbox_param (3,) : [cx, cy, scale].
rescale (float, np.n... |
Args:
im_path (str): the path of image.
image (np.ndarray or None): if it is None, then loading the im_path, else use image.
bbox_param (3,) : [cx, cy, scale].
rescale (float, np.ndarray or None): rescale factor.
proc (bool): the flag to return processed image or not.
... | process_hmr_img | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def cam_init2orig(cam, scale, start_pt, N=224):
"""
Args:
cam (3,): (s, tx, ty)
scale (float): scale = resize_h / orig_h
start_pt (2,): (lt_x, lt_y)
N (int): hmr_image_size (224) or IMG_SIZE
Returns:
cam_orig (3,): (s, tx, ty), camera in original image coordinates.
... |
Args:
cam (3,): (s, tx, ty)
scale (float): scale = resize_h / orig_h
start_pt (2,): (lt_x, lt_y)
N (int): hmr_image_size (224) or IMG_SIZE
Returns:
cam_orig (3,): (s, tx, ty), camera in original image coordinates.
| cam_init2orig | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def cam_orig2crop_center(cam, scale, start_pt, N=256, normalize=True):
"""
Args:
cam (3,): (s, tx, ty), camera in orginal image coordinates.
scale (float): scale = resize_h / orig_h or (resize_w / orig_w)
start_pt (2,): (lt_x, lt_y)
N (int): hmr_image_size (224) or IMG_SIZE
... |
Args:
cam (3,): (s, tx, ty), camera in orginal image coordinates.
scale (float): scale = resize_h / orig_h or (resize_w / orig_w)
start_pt (2,): (lt_x, lt_y)
N (int): hmr_image_size (224) or IMG_SIZE
normalize (bool)
Returns:
| cam_orig2crop_center | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def intrinsic_mtx(f, c):
"""
Obtain intrisic camera matrix.
Args:
f: np.array, 1 x 2, the focus lenth of camera, (fx, fy)
c: np.array, 1 x 2, the center of camera, (px, py)
Returns:
- cam_mat: np.array, 3 x 3, the intrisic camera matrix.
"""
return np.array([[f[1], 0, c[1... |
Obtain intrisic camera matrix.
Args:
f: np.array, 1 x 2, the focus lenth of camera, (fx, fy)
c: np.array, 1 x 2, the center of camera, (px, py)
Returns:
- cam_mat: np.array, 3 x 3, the intrisic camera matrix.
| intrinsic_mtx | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def extrinsic_mtx(rt, t):
"""
Obtain extrinsic matrix of camera.
Args:
rt: np.array, 1 x 3, the angle of rotations.
t: np.array, 1 x 3, the translation of camera center.
Returns:
- ext_mat: np.array, 3 x 4, the extrinsic matrix of camera.
"""
# R is (3, 3)
R = cv2.Rod... |
Obtain extrinsic matrix of camera.
Args:
rt: np.array, 1 x 3, the angle of rotations.
t: np.array, 1 x 3, the translation of camera center.
Returns:
- ext_mat: np.array, 3 x 4, the extrinsic matrix of camera.
| extrinsic_mtx | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def extrinsic(rt, t):
"""
Obtain extrinsic matrix of camera.
Args:
rt: np.array, 1 x 3, the angle of rotations.
t: np.array, 1 x 3, or (3,) the translation of camera center.
Returns:
- R: np.ndarray, 3 x 3
- t: np.ndarray, 1 x 3
"""
R = cv2.Rodrigues(rt)[0]
t ... |
Obtain extrinsic matrix of camera.
Args:
rt: np.array, 1 x 3, the angle of rotations.
t: np.array, 1 x 3, or (3,) the translation of camera center.
Returns:
- R: np.ndarray, 3 x 3
- t: np.ndarray, 1 x 3
| extrinsic | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def euler2matrix(rt):
"""
Obtain rotation matrix from euler angles
Args:
rt: np.array, (3,)
Returns:
R: np.array, (3,3)
"""
Rx = np.array([[1, 0, 0],
[0, np.cos(rt[0]), -np.sin(rt[0])],
[0, np.sin(rt[0]), np.cos(rt[0])]], dtype=np... |
Obtain rotation matrix from euler angles
Args:
rt: np.array, (3,)
Returns:
R: np.array, (3,3)
| euler2matrix | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def get_rotated_smpl_pose(pose, theta):
"""
:param pose: (72,)
:param theta: rotation angle of y axis
:return:
"""
global_pose = pose[:3]
R, _ = cv2.Rodrigues(global_pose)
Ry = np.array([
[np.cos(theta), 0, np.sin(theta)],
[0, 1, 0],
[-np.sin(theta), 0, np.cos(the... |
:param pose: (72,)
:param theta: rotation angle of y axis
:return:
| get_rotated_smpl_pose | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def rotvec2mat(rotvec):
"""
Args:
quat (np.ndarray): (N, 72)
Returns:
rot_vec (np.ndarray): (N, 24, 3, 3)
"""
r = R.from_rotvec(rotvec.reshape(-1, 3)).as_matrix()
r = r.reshape(-1, 24, 3, 3)
return r |
Args:
quat (np.ndarray): (N, 72)
Returns:
rot_vec (np.ndarray): (N, 24, 3, 3)
| rotvec2mat | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def quat2rotvec(quat):
"""
Args:
quat (np.ndarray): (N, 96)
Returns:
rot_vec (np.ndarray): (N, 72)
"""
rotvec_pos = R.from_quat(quat.reshape(-1, 4)).as_rotvec()
rotvec_pos = rotvec_pos.reshape(-1, 24 * 3)
return rotvec_pos |
Args:
quat (np.ndarray): (N, 96)
Returns:
rot_vec (np.ndarray): (N, 72)
| quat2rotvec | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def rotvec2quat(rotvec):
"""
Args:
rotvec (np.ndarray): (N, 72)
Returns:
qaut (np.ndarray): (N, 96)
"""
n = rotvec.shape[0]
quat_pos = R.from_rotvec(rotvec.reshape(-1, 3)).as_quat()
quat_pos = quat_pos.reshape(n, -1)
return quat_pos |
Args:
rotvec (np.ndarray): (N, 72)
Returns:
qaut (np.ndarray): (N, 96)
| rotvec2quat | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def rotvec2euler(rotvec):
"""
Args:
rotvec (np.ndarray): (N, 72)
Returns:
euler (np.ndarray): (N, 72)
"""
n = rotvec.shape[0]
r = R.from_rotvec(rotvec.reshape(-1, 3)).as_euler("xyz", degrees=False)
r = r.reshape(n, -1)
return r |
Args:
rotvec (np.ndarray): (N, 72)
Returns:
euler (np.ndarray): (N, 72)
| rotvec2euler | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def euler2rotvec(euler):
"""
Args:
euler (np.ndarray): (N, 72)
Returns:
euler (np.ndarray): (N, 72)
"""
n = euler.shape[0]
r = R.from_euler("xyz", euler.reshape(-1, 3), degrees=False)
r = r.as_rotvec()
r = r.reshape(n, -1)
return r |
Args:
euler (np.ndarray): (N, 72)
Returns:
euler (np.ndarray): (N, 72)
| euler2rotvec | python | iPERDance/iPERCore | iPERCore/tools/utils/filesio/cv_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/filesio/cv_utils.py | Apache-2.0 |
def cal_mask_bbox(head_mask, factor=1.25):
"""
Args:
head_mask (np.ndarray): (N, 1, 256, 256).
factor (float): the factor to enlarge the bbox of head.
Returns:
bbox (np.ndarray.int32): (N, 4), hear, 4 = (x1, x2, y1, y2)
"""
bs, _, height, width = head_mask.shape
bbox =... |
Args:
head_mask (np.ndarray): (N, 1, 256, 256).
factor (float): the factor to enlarge the bbox of head.
Returns:
bbox (np.ndarray.int32): (N, 4), hear, 4 = (x1, x2, y1, y2)
| cal_mask_bbox | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/boxes.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/boxes.py | Apache-2.0 |
def cal_head_bbox(kps, image_size):
"""
Args:
kps (torch.Tensor): (N, 19, 2)
image_size (int):
Returns:
bbox (torch.Tensor): (N, 4)
"""
NECK_IDS = 12 # in cocoplus
kps = (kps + 1) / 2.0
necks = kps[:, NECK_IDS, 0]
zeros = torch.zeros_like(necks)
ones = tor... |
Args:
kps (torch.Tensor): (N, 19, 2)
image_size (int):
Returns:
bbox (torch.Tensor): (N, 4)
| cal_head_bbox | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/boxes.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/boxes.py | Apache-2.0 |
def cal_body_bbox(kps, image_size, factor=1.25):
"""
Args:
kps (torch.cuda.FloatTensor): (N, 19, 2)
image_size (int):
factor (float):
Returns:
bbox: (N, 4)
"""
bs = kps.shape[0]
kps = (kps + 1) / 2.0
zeros = torch.zeros((bs,), device=kps.device)
ones = to... |
Args:
kps (torch.cuda.FloatTensor): (N, 19, 2)
image_size (int):
factor (float):
Returns:
bbox: (N, 4)
| cal_body_bbox | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/boxes.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/boxes.py | Apache-2.0 |
def cal_head_bbox_by_mask(head_mask, factor=1.25):
"""
Args:
head_mask (torch.cuda.FloatTensor): (N, 1, 256, 256).
factor (float): the factor to enlarge the bbox of head.
Returns:
bbox (np.ndarray.int32): (N, 4), hear, 4 = (left_top_x, left_top_y, right_top_x, right_top_y)
"""
... |
Args:
head_mask (torch.cuda.FloatTensor): (N, 1, 256, 256).
factor (float): the factor to enlarge the bbox of head.
Returns:
bbox (np.ndarray.int32): (N, 4), hear, 4 = (left_top_x, left_top_y, right_top_x, right_top_y)
| cal_head_bbox_by_mask | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/boxes.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/boxes.py | Apache-2.0 |
def cam_swap(src_cam, ref_cam, first_cam=None, strategy="smooth"):
"""
Swap the camera between the source and the reference poses, according to the different swapping
strategies, including, `smooth`, `source`, `ref_txty`, and `copy`
Args:
src_cam (torch.tensor): (bs, 3);
... |
Swap the camera between the source and the reference poses, according to the different swapping
strategies, including, `smooth`, `source`, `ref_txty`, and `copy`
Args:
src_cam (torch.tensor): (bs, 3);
ref_cam (torch.tesnor): (bs, 3);
first_cam (torch.tensor ... | cam_swap | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/cam_pose_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/cam_pose_utils.py | Apache-2.0 |
def stabilize(self, smpls):
"""
Args:
smpls (torch.tensor): (bs, 85)
Returns:
stable_smpls (torch.tensor): (bs, 85)
"""
cam = smpls[:, 0:3]
pose = smpls[:, 3:-10]
shape = smpls[:, -10:]
new_cam = torch.zeros_like(cam, device=smp... |
Args:
smpls (torch.tensor): (bs, 85)
Returns:
stable_smpls (torch.tensor): (bs, 85)
| stabilize | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/cam_pose_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/cam_pose_utils.py | Apache-2.0 |
def infer_smpl_foot_y(self, pose, shape):
"""
Args:
pose (torch.tensor): (bs, 72)
shape (torch.tensor): (bs, 10)
Returns:
foot_y (torch.tensor): (bs,)
"""
N = pose.shape[0]
batch_size = self.infer_smpl_batch_size
foot_y_list... |
Args:
pose (torch.tensor): (bs, 72)
shape (torch.tensor): (bs, 10)
Returns:
foot_y (torch.tensor): (bs,)
| infer_smpl_foot_y | python | iPERDance/iPERCore | iPERCore/tools/utils/geometry/cam_pose_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/utils/geometry/cam_pose_utils.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.