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 parse_line(line):
"""Parse information from a line in a requirements text file."""
if line.startswith("-r "):
# Allow specifying requirements in other files
target = line.split(" ")[1]
for info in parse_require_file(target):
yield info
else... | Parse information from a line in a requirements text file. | parse_line | python | iPERDance/iPERCore | setup.py | https://github.com/iPERDance/iPERCore/blob/master/setup.py | Apache-2.0 |
def get_by_name(dataset_name, opt, is_for_train):
"""
Args:
dataset_name:
opt:
is_for_train:
Returns:
dataset (torch.utils.data.Dataset): it must implements the function of self.__getitem(item), and it
will return a sample diction... |
Args:
dataset_name:
opt:
is_for_train:
Returns:
dataset (torch.utils.data.Dataset): it must implements the function of self.__getitem(item), and it
will return a sample dictionary which contains the following information:
... | get_by_name | python | iPERDance/iPERCore | iPERCore/data/dataset.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/data/dataset.py | Apache-2.0 |
def __getitem__(self, index):
"""
Args:
index (int): the sample index of self._dataset_size.
Returns:
sample (dict): the data sample, it contains the following informations:
--images (torch.Tensor): (ns + nt, 3, h, w), here `ns` and `nt` are the number o... |
Args:
index (int): the sample index of self._dataset_size.
Returns:
sample (dict): the data sample, it contains the following informations:
--images (torch.Tensor): (ns + nt, 3, h, w), here `ns` and `nt` are the number of source and targets;
--m... | __getitem__ | python | iPERDance/iPERCore | iPERCore/data/processed_video_dataset.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/data/processed_video_dataset.py | Apache-2.0 |
def __init__(self, output_size):
"""
Args:
output_size (tuple or int): Desired output size. If tuple, output is matched to output_size.
If int, smaller of image edges is matched to output_size keeping aspect ratio the same.
"""
assert isinstance(ou... |
Args:
output_size (tuple or int): Desired output size. If tuple, output is matched to output_size.
If int, smaller of image edges is matched to output_size keeping aspect ratio the same.
| __init__ | python | iPERDance/iPERCore | iPERCore/data/transforms.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/data/transforms.py | Apache-2.0 |
def make_uv_img(self, src_img, src_info):
"""
Args:
src_img (torch.tensor): (bs, ns, 3, h, w)
src_info (dict):
Returns:
merge_uv (torch.tensor): (bs, 3, h, w)
"""
bs, ns, _, h, w = src_img.shape
bsxns = bs * ns
## previous
... |
Args:
src_img (torch.tensor): (bs, ns, 3, h, w)
src_info (dict):
Returns:
merge_uv (torch.tensor): (bs, 3, h, w)
| make_uv_img | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def add_rendered_f2verts_fim_wim(self, smpl_info, use_morph=False, get_uv_info=True):
"""
Args:
smpl_info (dict): the smpl information contains:
--cam (torch.Tensor):
--verts (torch.Tensor):
use_morph (bool): use morphing strategy to adjust the f2... |
Args:
smpl_info (dict): the smpl information contains:
--cam (torch.Tensor):
--verts (torch.Tensor):
use_morph (bool): use morphing strategy to adjust the f2pts to segmentation observation,
it might be used to process the source informati... | add_rendered_f2verts_fim_wim | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def make_tsf_inputs(self, uv_img, ref_info):
"""
Args:
uv_img (torch.tensor): (bs, 3, h, w)
ref_info (dict): the dict of smpl details, including
--cam (torch.tensor): (bs * nt, 3),
--verts (torch.tensor): (bs * nt, 6890, 3),
--j2... |
Args:
uv_img (torch.tensor): (bs, 3, h, w)
ref_info (dict): the dict of smpl details, including
--cam (torch.tensor): (bs * nt, 3),
--verts (torch.tensor): (bs * nt, 6890, 3),
--j2d (torch.tensor): (bs * nt, 19, 2),
--... | make_tsf_inputs | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def cal_top_k_ids(self, uncertain_points, boundaries_points, top_k=3):
"""
Args:
uncertain_points (torch.Tensor): (n1, 2)
boundaries_points (torch.Tensor): (n2, 2)
top_k (int):
Returns:
weights (torch.Tensor): (n1, top_k)
nn_pts (tor... |
Args:
uncertain_points (torch.Tensor): (n1, 2)
boundaries_points (torch.Tensor): (n2, 2)
top_k (int):
Returns:
weights (torch.Tensor): (n1, top_k)
nn_pts (torch.Tensor): (n1, top_k, 2)
| cal_top_k_ids | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def morph_image(self, src_img, weights, uncertain_pts, nn_pts, confidant_sil):
"""
Args:
src_img (torch.Tensor): (3, h, w)
weights (torch.Tensor): (n1, top_k)
uncertain_pts (torch.Tensor): (n1, 2)
nn_pts (torch.Tensor): (n1, top_k, 2)
... |
Args:
src_img (torch.Tensor): (3, h, w)
weights (torch.Tensor): (n1, top_k)
uncertain_pts (torch.Tensor): (n1, 2)
nn_pts (torch.Tensor): (n1, top_k, 2)
confidant_sil (torch.Tensor): (1, h, w)
Returns:
morph_img... | morph_image | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def make_morph_image(self, src_img, src_info, erode_ks=3, dilate_ks=11):
"""
Args:
src_img (torch.Tensor): (bs * ns, 3, h, w)
src_info (dict):
erode_ks (int):
dilate_ks (int):
Returns:
all_morph_imgs (torch.cuda.Tensor): (bs * ns,... |
Args:
src_img (torch.Tensor): (bs * ns, 3, h, w)
src_info (dict):
erode_ks (int):
dilate_ks (int):
Returns:
all_morph_imgs (torch.cuda.Tensor): (bs * ns, 3, h, w)
| make_morph_image | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def morph_f2pts(self, f2pts, fbc, fim, confidant_mask):
"""
Args:
f2pts (torch.Tensor): (nf, 3, 2)
fbc (torch.Tensor): (nf, 2)
fim (torch.Tensor): (h, w)
confidant_mask (torch.Tensor): (h, w)
Returns:
mor... |
Args:
f2pts (torch.Tensor): (nf, 3, 2)
fbc (torch.Tensor): (nf, 2)
fim (torch.Tensor): (h, w)
confidant_mask (torch.Tensor): (h, w)
Returns:
morph_f2pts (torch.Tensor): (nf, 3, 2)
| morph_f2pts | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def make_morph_f2pts(self, f2pts, fim, human_sil, erode_ks=0):
"""
Args:
f2pts (torch.Tensor): (bs, nf, 3, 2)
fim (torch.Tensor): (bs, h, w)
human_sil (torch.Tensor): (bs, 1, h, w)
erode_ks (int)
Returns:
morphed_f2... |
Args:
f2pts (torch.Tensor): (bs, nf, 3, 2)
fim (torch.Tensor): (bs, h, w)
human_sil (torch.Tensor): (bs, 1, h, w)
erode_ks (int)
Returns:
morphed_f2pts (torch.Tensor): (bs, nf, 3, 2)
| make_morph_f2pts | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def process_source(self, src_img, src_info, primary_ids=None):
"""
calculate the inputs for bg_net and src_net.
Args:
src_img (torch.Tensor): (bs, ns, 3, h, w)
src_info (dict): the details information of smpl, including:
--theta (torch.Tensor): (bs * n... |
calculate the inputs for bg_net and src_net.
Args:
src_img (torch.Tensor): (bs, ns, 3, h, w)
src_info (dict): the details information of smpl, including:
--theta (torch.Tensor): (bs * ns, 85),
--cam (torch.Tensor): (bs * ns, 3),
... | process_source | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def make_trans_flow(self, bs, ns, nt, src_info, temp_info, ref_info, temporal=True, use_selected_f2pts=False):
"""
It needs to be mentioned that this function is used for testing/inference phase, and do not use it in
training phase.
Args:
bs (int): the number of batch si... |
It needs to be mentioned that this function is used for testing/inference phase, and do not use it in
training phase.
Args:
bs (int): the number of batch size
ns (int): the number of source image
nt (int): the number of time-step
src_info (d... | make_trans_flow | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def make_batch_trans_flow(self, bs, ns, nt, src_info, ref_info, temporal=True, use_selected_f2pts=False):
"""
It needs to be mentioned that this function is used for training phase, and do not use it in
testing/inference phase.
Args:
bs (int): the number of batch size
... |
It needs to be mentioned that this function is used for training phase, and do not use it in
testing/inference phase.
Args:
bs (int): the number of batch size
ns (int): the number of source image
nt (int): the number of time-step
src_info (d... | make_batch_trans_flow | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.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):
"""
Make the inputs for bg_net, src_net, and tsf_net. It needs to be mentioned that this function is only
for training phase, do not use it in... |
Make the inputs for bg_net, src_net, and tsf_net. It needs to be mentioned that this function is only
for training phase, do not use it in testing or inference phase.
Args:
src_img (torch.Tensor) : (bs, ns, 3, H, W)
ref_img (torch.Tensor) : (bs, ... | forward | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def get_selected_fids(self, selected_part_ids):
"""
Args:
selected_part_ids (list of int):
Returns:
selected_fids (list of int):
"""
selected_fids = set()
for i in selected_part_ids:
fs = set(self.part_faces[i])
selected... |
Args:
selected_part_ids (list of int):
Returns:
selected_fids (list of int):
| get_selected_fids | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def add_rendered_selected_f2pts(self, src_info, selected_fids):
"""
Args:
src_info (dict):
selected_fids (List[List[int]]):
Returns:
"""
obj_f2pts = src_info["obj_f2pts"]
selected_obj_f2pts = self.render.get_selected_f2pts(obj_f2pts, selected_fid... |
Args:
src_info (dict):
selected_fids (List[List[int]]):
Returns:
| add_rendered_selected_f2pts | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def merge_uv_img(self, src_info_list):
"""
[src_img_0, src_img_1, ..., src_img_sn-1], src_img[0: primary + 1] are the primary images.
for the selected area of the primary, average the area of the primary and the left;
for the selected are of the left, only uses the selected a... |
[src_img_0, src_img_1, ..., src_img_sn-1], src_img[0: primary + 1] are the primary images.
for the selected area of the primary, average the area of the primary and the left;
for the selected are of the left, only uses the selected area.
This operation is going to reduce... | merge_uv_img | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def merge_src_info(self, src_info_list, primary_ids):
"""
Args:
src_info_list (list of dict):
primary_ids (int):
Returns:
merge_src_info (dict): the source setup information, it contains the followings:
--cam (torch.Tensor): ... |
Args:
src_info_list (list of dict):
primary_ids (int):
Returns:
merge_src_info (dict): the source setup information, it contains the followings:
--cam (torch.Tensor): (ns, 3);
--shape (torch.Tensor): ... | merge_src_info | python | iPERDance/iPERCore | iPERCore/models/flowcomposition.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/flowcomposition.py | Apache-2.0 |
def append_info(self, smpl_info=None, preds=None, tsf_enc_outs=None, tsf_res_outs=None):
"""
1. add the smpl_info to self.temporal_info, the details are
--fim: [(bs, h, w), (bs, h, w), ..., (bs, h, w)], the length is self.time_step
--wim: [(bs, h, w, 3), (bs, ... |
1. add the smpl_info to self.temporal_info, the details are
--fim: [(bs, h, w), (bs, h, w), ..., (bs, h, w)], the length is self.time_step
--wim: [(bs, h, w, 3), (bs, h, w, 3), ..., (bs, h, w, 3)], the length is self.time_step
--f2pts: [(bs, 13776, 3,... | append_info | python | iPERDance/iPERCore | iPERCore/models/imitator.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/imitator.py | Apache-2.0 |
def source_setup(self, src_path, src_smpl, masks=None, bg_img=None, offsets=0, links_ids=None, visualizer=None):
"""
pre-process the source information
Args:
src_path (list of str): the source image paths, len(src_path) = ns
src_smpl (torch.tensor or np.ndarray)): (ns... |
pre-process the source information
Args:
src_path (list of str): the source image paths, len(src_path) = ns
src_smpl (torch.tensor or np.ndarray)): (ns, 85)
masks (list of np.ndarray): [(1, h, w), (1, h, w), ..., (1, h, w)] or (ns, 1, h, w)
bg_img (to... | source_setup | python | iPERDance/iPERCore | iPERCore/models/imitator.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/imitator.py | Apache-2.0 |
def make_inputs_for_tsf(self, src_info, tgt_smpl, cam_strategy="smooth", t=0,
primary_ids=0, use_selected_f2pts=False):
"""
process the inputs for tsf_net
Args:
src_info (dict): the source setup information, it contains the followings:
... |
process the inputs for tsf_net
Args:
src_info (dict): the source setup information, it contains the followings:
--cam (torch.Tensor): (ns, 3);
--shape (torch.Tensor): (ns, 10);
--pose (torch.Tensor): ... | make_inputs_for_tsf | python | iPERDance/iPERCore | iPERCore/models/imitator.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/imitator.py | Apache-2.0 |
def get_selected_info_by_part_name(self, swap_parts, primary_ids=0):
"""
Each source image might provides multiple parts, and here we need to calculate the parts of each source.
Args:
swap_parts (List[List[str]]): the part names of each source.
primary_ids (int):
... |
Each source image might provides multiple parts, and here we need to calculate the parts of each source.
Args:
swap_parts (List[List[str]]): the part names of each source.
primary_ids (int):
Returns:
--selected_part_ids (List[List[int]]):
--s... | get_selected_info_by_part_name | python | iPERDance/iPERCore | iPERCore/models/imitator.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/imitator.py | Apache-2.0 |
def swap_source_setup(self, src_path_list, src_smpl_list, masks_list, bg_img_list=None,
offsets_list=0, links_ids_list=None, swap_parts=(["head"], ["body"]),
swap_masks=None, primary_ids=0, visualizer=None):
"""
pre-process the source information
... |
pre-process the source information
Args:
src_path_list (List[List[str]]): the source image paths, len(src_path_list) = the number of people;
src_smpl_list (List[Union[torch.tensor,np.ndarray]]): [(ns_1, 85), ..., (ns_p, 85)];
masks_list (List[Union[np.ndarr... | swap_source_setup | python | iPERDance/iPERCore | iPERCore/models/imitator.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/imitator.py | Apache-2.0 |
def compute_loss(self, img1, img2):
"""
Args:
img1 (torch.Tensor): (bs, 3, 112, 92)
img2 (torch.Tensor): (bs, 3, 112, 92)
Returns:
"""
f1, f2 = self.net(img1), self.net(img2)
loss = 0.0
for i in range(len(f1)):
loss += self... |
Args:
img1 (torch.Tensor): (bs, 3, 112, 92)
img2 (torch.Tensor): (bs, 3, 112, 92)
Returns:
| compute_loss | python | iPERDance/iPERCore | iPERCore/models/networks/criterions/faceloss.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/criterions/faceloss.py | Apache-2.0 |
def crop_head_kps(self, imgs, kps):
"""
Args:
imgs (torch.Tensor): (N, C, H, W)
kps (torch.Tensor): (N, 19, 2)
Returns:
"""
bs, _, ori_h, ori_w = imgs.shape
rects = self.find_head_rect(kps, ori_h, ori_w)
head_imgs = []
... |
Args:
imgs (torch.Tensor): (N, C, H, W)
kps (torch.Tensor): (N, 19, 2)
Returns:
| crop_head_kps | python | iPERDance/iPERCore | iPERCore/models/networks/criterions/faceloss.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/criterions/faceloss.py | Apache-2.0 |
def crop_img(imgs, rects, fact=2):
"""
Args:
imgs (torch.Tensor): (N, C, H, W);
rects (torch.Tensor): (N, 4=(x0, y0, x1, y1));
fact (float): the crop and size factor.
Returns:
crops (torch.Tensor):
"""
bs, _, ori_h, ori_w = imgs.shape
crops = []
for i in ran... |
Args:
imgs (torch.Tensor): (N, C, H, W);
rects (torch.Tensor): (N, 4=(x0, y0, x1, y1));
fact (float): the crop and size factor.
Returns:
crops (torch.Tensor):
| crop_img | python | iPERDance/iPERCore | iPERCore/models/networks/discriminators/multi_scale_dis.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/discriminators/multi_scale_dis.py | Apache-2.0 |
def __init__(self, cfg, use_aug_bg=False):
"""
Args:
cfg (dict or EasyDict): the configurations, and it contains the followings,
--cond_nc (int): the input dimension;
--ndf (int): the number of filters at the first layer, default is 64;
--n_la... |
Args:
cfg (dict or EasyDict): the configurations, and it contains the followings,
--cond_nc (int): the input dimension;
--ndf (int): the number of filters at the first layer, default is 64;
--n_layers (int): the number of downsampling operations, suc... | __init__ | python | iPERDance/iPERCore | iPERCore/models/networks/discriminators/multi_scale_dis.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/discriminators/multi_scale_dis.py | Apache-2.0 |
def forward(self, inputs):
"""
Args:
inputs (dict): the inputs information, and it contains the followings,
--x (torch.Tensor): (N, C, H, W);
--bg_x (torch.Tensor): (N, C, H, W).
Returns:
outs (list of torch.Tensor):
"""
x... |
Args:
inputs (dict): the inputs information, and it contains the followings,
--x (torch.Tensor): (N, C, H, W);
--bg_x (torch.Tensor): (N, C, H, W).
Returns:
outs (list of torch.Tensor):
| forward | python | iPERDance/iPERCore | iPERCore/models/networks/discriminators/multi_scale_dis.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/discriminators/multi_scale_dis.py | Apache-2.0 |
def forward(self, inputs):
"""
Args:
inputs (dict): the inputs informations, and it contains the followings,
--x (torch.Tensor): (N, C, H, W);
--bg_x (torch.Tensor): (N, C, H, W);
--body_rects (torch.Tensor): (N, 4 = (x0, x1, y0, y1));
... |
Args:
inputs (dict): the inputs informations, and it contains the followings,
--x (torch.Tensor): (N, C, H, W);
--bg_x (torch.Tensor): (N, C, H, W);
--body_rects (torch.Tensor): (N, 4 = (x0, x1, y0, y1));
--get_avg (bool): get the avg... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/discriminators/multi_scale_dis.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/discriminators/multi_scale_dis.py | Apache-2.0 |
def forward(self, inputs):
"""
Args:
inputs (dict): the inputs informations, and it contains the followings,
--x (torch.Tensor): (N, C, H, W);
--bg_x (torch.Tensor): (N, C, H, W);
--body_rects (torch.LongTensor): (N, 4 = (x0, x1, y0, y1));
... |
Args:
inputs (dict): the inputs informations, and it contains the followings,
--x (torch.Tensor): (N, C, H, W);
--bg_x (torch.Tensor): (N, C, H, W);
--body_rects (torch.LongTensor): (N, 4 = (x0, x1, y0, y1));
--head_rects (torch.LongT... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/discriminators/multi_scale_dis.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/discriminators/multi_scale_dis.py | Apache-2.0 |
def forward(self, content, gamma, beta):
"""
Args:
content (torch.tensor): (b, c, h, w)
gamma (torch.tensor): (b, c1, h, w)
beta (torch.tensor): (b, c2, h, w)
Returns:
"""
b, c, h, w = content.size()
# (b, 1, h, w)
conte... |
Args:
content (torch.tensor): (b, c, h, w)
gamma (torch.tensor): (b, c1, h, w)
beta (torch.tensor): (b, c2, h, w)
Returns:
| forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward(self, q, k, v):
"""
Args:
q (torch.tensor): (N, C, H, W)
k (torch.tensor): (N, ns, C, H, W)
v (torch.tensor): (N, ns, C, H, W)
Returns:
x (torch.tensor): (N, C, H, W)
"""
alpha = self.query(q, k) # (N, ns, 1,... |
Args:
q (torch.tensor): (N, C, H, W)
k (torch.tensor): (N, ns, C, H, W)
v (torch.tensor): (N, ns, C, H, W)
Returns:
x (torch.tensor): (N, C, H, W)
| forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def query(self, q, k):
"""
Args:
q (torch.tensor): (N, C, H, W)
k (torch.tensor): (N, ns, C, H, W)
Returns:
alpha (torch.tensor): (N, ns, 1, H, W)
"""
bs, ns, c, h, w = k.shape
dk = c * h * w
q = torch.mean(q, dim=(2, 3))
... |
Args:
q (torch.tensor): (N, C, H, W)
k (torch.tensor): (N, ns, C, H, W)
Returns:
alpha (torch.tensor): (N, ns, 1, H, W)
| query | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward(self, X, T):
"""
Args:
X (torch.tensor): (N, C, H, W) or (N, nt, C, H, W) or (N, ns, C, H, W)
T (torch.tensor): (N, h, w, 2) or (N, nt, h, w, 2) or (N, nt, ns, h, w, 2)
Returns:
x_warp (torch.tensor): (N, C, H ,W)
"""
x_shape = X.s... |
Args:
X (torch.tensor): (N, C, H, W) or (N, nt, C, H, W) or (N, ns, C, H, W)
T (torch.tensor): (N, h, w, 2) or (N, nt, h, w, 2) or (N, nt, ns, h, w, 2)
Returns:
x_warp (torch.tensor): (N, C, H ,W)
| forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward(self, tsf_x, src_x, Tst, temp_x=None, Ttt=None):
"""
Args:
tsf_x (torch.tensor): (bs, c1, h, w)
src_x (torch.tensor): (bs * ns, c2, h, w)
Tst (torch.tensor): (bs, ns, h, w, 2)
temp_x (torch.tensor or None): (bs * nt, c, H, W)
T... |
Args:
tsf_x (torch.tensor): (bs, c1, h, w)
src_x (torch.tensor): (bs * ns, c2, h, w)
Tst (torch.tensor): (bs, ns, h, w, 2)
temp_x (torch.tensor or None): (bs * nt, c, H, W)
Ttt (torch.tensor or None): (bs, nt, H, W, 2)
Returns:
... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward_bg(self, bg_inputs):
"""
Args:
bg_inputs (torch.tensor): (bs, ns, 4, h, w)
Returns:
bg_img (torch.tensor): the `viewed` bg_img from (bs * ns, 3, h, w) to (bs, ns, 3, h, w)
"""
bs, ns, _, h, w = bg_inputs.shape
bg_img = self.bg_net(bg... |
Args:
bg_inputs (torch.tensor): (bs, ns, 4, h, w)
Returns:
bg_img (torch.tensor): the `viewed` bg_img from (bs * ns, 3, h, w) to (bs, ns, 3, h, w)
| forward_bg | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward_src(self, src_inputs, only_enc=True):
"""
Args:
src_inputs (torch.tensor): (bs, ns, 6, h, w)
only_enc (bool): the flag to control only encode or return the all outputs, including,
encoder outputs, predicted img and mask map.
Returns:
... |
Args:
src_inputs (torch.tensor): (bs, ns, 6, h, w)
only_enc (bool): the flag to control only encode or return the all outputs, including,
encoder outputs, predicted img and mask map.
Returns:
enc_outs (list of torch.tensor): [torch.tensor(bs*ns, c1,... | forward_src | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward_tsf(self, tsf_inputs, src_enc_outs, src_res_outs, Tst,
temp_enc_outs=None, temp_res_outs=None, Ttt=None):
"""
Processing one time step of tsf stream.
Args:
tsf_inputs (torch.tensor): (bs, 6, h, w)
src_enc_outs (list of torch.tensor): [... |
Processing one time step of tsf stream.
Args:
tsf_inputs (torch.tensor): (bs, 6, h, w)
src_enc_outs (list of torch.tensor): [(bs*ns, c1, h1, w1), (bs*ns, c2, h2, w2),..]
src_res_outs (list of torch.tensor): [(bs*ns, c1, h1, w1), (bs*ns, c2, h2, w2),..]
... | forward_tsf | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward(self, bg_inputs, src_inputs, tsf_inputs, Tst, Ttt=None, only_tsf=True):
"""
Args:
bg_inputs (torch.tensor): (bs, ns, 4, H, W)
src_inputs (torch.tensor): (bs, ns, 6, H, W)
tsf_inputs (torch.tensor): (bs, nt, 3 or 6, H, W)
Tst (torch.tensor)... |
Args:
bg_inputs (torch.tensor): (bs, ns, 4, H, W)
src_inputs (torch.tensor): (bs, ns, 6, H, W)
tsf_inputs (torch.tensor): (bs, nt, 3 or 6, H, W)
Tst (torch.tensor): (bs, nt, ns, H, W, 2)
Ttt (torch.tensor or None): (bs, nt - 1, H, H, 2)
... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_adain_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_adain_resunet.py | Apache-2.0 |
def forward_src(self, src_inputs, only_enc=True):
"""
Run forward of SIDNet, and get the reconstructed source images.
If only_enc is True, then it only returns the features at each stage of the source images;
Otherwise, it returns the features, and the recontructed source images, as well... |
Run forward of SIDNet, and get the reconstructed source images.
If only_enc is True, then it only returns the features at each stage of the source images;
Otherwise, it returns the features, and the recontructed source images, as well as the masks.
Args:
src_inputs (torch.t... | forward_src | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_spade_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_spade_resunet.py | Apache-2.0 |
def forward_tsf(self, tsf_inputs, src_enc_outs, src_res_outs, Tst,
temp_enc_outs=None, temp_res_outs=None, Ttt=None):
"""
Processing one time step of TSFNet.
Args:
tsf_inputs (torch.Tensor): (bs, 6, h, w)
src_enc_outs (list of torch.Tensor): [(bs*... |
Processing one time step of TSFNet.
Args:
tsf_inputs (torch.Tensor): (bs, 6, h, w)
src_enc_outs (list of torch.Tensor): [(bs*ns, c1, h1, w1), (bs*ns, c2, h2, w2),..]
src_res_outs (list of torch.Tensor): [(bs*ns, c1, h1, w1), (bs*ns, c2, h2, w2),..]
T... | forward_tsf | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_spade_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_spade_resunet.py | Apache-2.0 |
def __init__(self, cfg, temporal=False):
"""
Args:
cfg (dict or EasyDict): the configurations, it contains the followings:
--name (str): the name of Generator;
--BGNet (dict or EasyDict): the configurations of BGNet, and it contains the followings:
... |
Args:
cfg (dict or EasyDict): the configurations, it contains the followings:
--name (str): the name of Generator;
--BGNet (dict or EasyDict): the configurations of BGNet, and it contains the followings:
--norm_type (str): the type of normalizati... | __init__ | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_spade_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_spade_resunet.py | Apache-2.0 |
def forward_bg(self, bg_inputs):
"""
Run forward of BGNet, and predict the inpainted results.
Args:
bg_inputs (torch.tensor): (bs, ns, 4, h, w)
Returns:
bg_img (torch.tensor): the `viewed` bg_img from (bs * ns, 3, h, w) to (bs, ns, 3, h, w)
"""
... |
Run forward of BGNet, and predict the inpainted results.
Args:
bg_inputs (torch.tensor): (bs, ns, 4, h, w)
Returns:
bg_img (torch.tensor): the `viewed` bg_img from (bs * ns, 3, h, w) to (bs, ns, 3, h, w)
| forward_bg | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_spade_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_spade_resunet.py | Apache-2.0 |
def forward(self, bg_inputs, src_inputs, tsf_inputs, Tst, Ttt=None, only_tsf=True):
"""
Forward to get all results.
If only_tsf is True, then it returns [bg_img, src_imgs, src_masks, tsf_imgs, tsf_masks];
Otherwise, then it only returns [bg_img, tsf_imgs, tsf_masks].
Args:
... |
Forward to get all results.
If only_tsf is True, then it returns [bg_img, src_imgs, src_masks, tsf_imgs, tsf_masks];
Otherwise, then it only returns [bg_img, tsf_imgs, tsf_masks].
Args:
bg_inputs (torch.tensor): (bs, ns, 4, H, W)
src_inputs (torch.tensor): (b... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_spade_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_spade_resunet.py | Apache-2.0 |
def forward(self, src_inputs, tsf_inputs, Tst, Ttt=None, only_tsf=True):
"""
Forward to get all results.
If only_tsf is True, then it returns [src_imgs, src_masks, tsf_imgs, tsf_masks];
Otherwise, then it only returns [tsf_imgs, tsf_masks].
Args:
src_inputs (torch.te... |
Forward to get all results.
If only_tsf is True, then it returns [src_imgs, src_masks, tsf_imgs, tsf_masks];
Otherwise, then it only returns [tsf_imgs, tsf_masks].
Args:
src_inputs (torch.tensor): (bs, ns, 6, H, W)
tsf_inputs (torch.tensor): (bs, nt, 3 or 6, H... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/attlwb_spade_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/attlwb_spade_resunet.py | Apache-2.0 |
def forward_tsf(self, tsf_inputs, src_enc_outs, src_res_outs=None, Tst=None,
temp_enc_outs=None, temp_res_outs=None, Ttt=None):
"""
Processing one time step of tsf stream.
Args:
tsf_inputs (torch.tensor): (bs, 6, h, w)
src_enc_outs (torch.tensor):... |
Processing one time step of tsf stream.
Args:
tsf_inputs (torch.tensor): (bs, 6, h, w)
src_enc_outs (torch.tensor): (bs, c, h, wc)
src_res_outs (None): None
Tst (torch.tensor): (bs, ns, h, w, 2), flow transformation from source images/features
... | forward_tsf | python | iPERDance/iPERCore | iPERCore/models/networks/generators/input_concat_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/input_concat_resunet.py | Apache-2.0 |
def forward(self, tsf_x, src_x, Tst):
"""
Args:
tsf_x (torch.Tensor): (bs, c, h, w)
src_x (torch.Tensor): (bs * ns, c, h, w)
Tst (torch.Tensor): (bs * ns, h, w, 2)
Returns:
fused_x (torch.Tensor): (bs, c, h, w)
"""
bsns, _, ... |
Args:
tsf_x (torch.Tensor): (bs, c, h, w)
src_x (torch.Tensor): (bs * ns, c, h, w)
Tst (torch.Tensor): (bs * ns, h, w, 2)
Returns:
fused_x (torch.Tensor): (bs, c, h, w)
| forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/lwb_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/lwb_resunet.py | Apache-2.0 |
def forward(self, tsf_x, src_x, Tst, temp_x=None, Ttt=None):
"""
Args:
tsf_x (torch.tensor): (bs, c1, h, w)
src_x (torch.tensor): (bs * ns, c2, h, w)
Tst (torch.tensor): (bs, ns, h, w, 2)
temp_x (torch.tensor or None): (bs * nt, c, H, W)
T... |
Args:
tsf_x (torch.tensor): (bs, c1, h, w)
src_x (torch.tensor): (bs * ns, c2, h, w)
Tst (torch.tensor): (bs, ns, h, w, 2)
temp_x (torch.tensor or None): (bs * nt, c, H, W)
Ttt (torch.tensor or None): (bs, nt, H, W, 2)
Returns:
... | forward | python | iPERDance/iPERCore | iPERCore/models/networks/generators/lwb_softgate_resunet.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/models/networks/generators/lwb_softgate_resunet.py | Apache-2.0 |
def add_hands_params_to_smpl(smpls, hands_param):
"""
Args:
smpls (np.ndarray): (length, 85)
hands_param (np.ndarary): (length, 90) or (90,)
Returns:
smplhs (np.ndarray): (length, 156)
"""
n_num1 = smpls.shape[0]
if hands_param.ndim == 1:
hands_param = np.tile... |
Args:
smpls (np.ndarray): (length, 85)
hands_param (np.ndarary): (length, 90) or (90,)
Returns:
smplhs (np.ndarray): (length, 156)
| add_hands_params_to_smpl | python | iPERDance/iPERCore | iPERCore/services/base_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/base_runner.py | Apache-2.0 |
def add_view_effect(smpls, view_dir):
"""
Args:
smpls (np.ndarray): (n, 85)
view_dir (float):
Returns:
smpls (np.ndarray): (n, 85)
"""
length = len(smpls)
r = R.from_euler("xyz", [0, view_dir, 0], degrees=True)
for i in range(length):
orig_r = R.from_rotve... |
Args:
smpls (np.ndarray): (n, 85)
view_dir (float):
Returns:
smpls (np.ndarray): (n, 85)
| add_view_effect | python | iPERDance/iPERCore | iPERCore/services/base_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/base_runner.py | Apache-2.0 |
def add_bullet_time_effect(smpls, img_paths, bt_list):
"""
Args:
smpls (np.ndarray): (n, 85);
img_paths (list of str): (n,);
bt_list (list of tuple): (number of Bullet Effects, 2=(frame_id, duration)), eg [(f_1, n_1), ..., (f_k, n_k)]
Returns:
smpls (np.ndarray): (n + n_1 +... |
Args:
smpls (np.ndarray): (n, 85);
img_paths (list of str): (n,);
bt_list (list of tuple): (number of Bullet Effects, 2=(frame_id, duration)), eg [(f_1, n_1), ..., (f_k, n_k)]
Returns:
smpls (np.ndarray): (n + n_1 + ... + n_k, 85)
img_paths (list of str): (n + n_1 + ..... | add_bullet_time_effect | python | iPERDance/iPERCore | iPERCore/services/base_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/base_runner.py | Apache-2.0 |
def get_src_info_for_swapper_inference(opt, vid_info_list):
"""
Args:
opt:
vid_info_list (list of dict):
Returns:
src_info_for_inference
"""
src_info_for_inference = {
"paths": [],
"src_paths": [],
"smpls": [],
"offsets": [],
"links"... |
Args:
opt:
vid_info_list (list of dict):
Returns:
src_info_for_inference
| get_src_info_for_swapper_inference | python | iPERDance/iPERCore | iPERCore/services/base_runner.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/base_runner.py | Apache-2.0 |
def prepare_inputs_for_run_sil2smpl_offsets(self, process_info):
"""
Prepare the inputs for run_sil2smpl_offsets. It will return a dict, contains the
keys of img_path, output_dir, init_smpls;
Args:
process_info (ProcessInfo):
Returns:
prepared_info (... |
Prepare the inputs for run_sil2smpl_offsets. It will return a dict, contains the
keys of img_path, output_dir, init_smpls;
Args:
process_info (ProcessInfo):
Returns:
prepared_info (dict): the prepared information, which contains:
--obs_sils ... | prepare_inputs_for_run_sil2smpl_offsets | python | iPERDance/iPERCore | iPERCore/services/preprocess.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/preprocess.py | Apache-2.0 |
def prepare_inputs_for_run_cloth_smpl_links(self, process_info):
"""
Prepare the inputs for human_digitalizer.ClothSmplLinkDeformer().find_links().
It will return a dict, contains the keys of img_path, output_dir, init_smpls;
Args:
process_info (ProcessInfo):
... |
Prepare the inputs for human_digitalizer.ClothSmplLinkDeformer().find_links().
It will return a dict, contains the keys of img_path, output_dir, init_smpls;
Args:
process_info (ProcessInfo):
Returns:
prepared_info (dict): the prepared information, which... | prepare_inputs_for_run_cloth_smpl_links | python | iPERDance/iPERCore | iPERCore/services/preprocess.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/preprocess.py | Apache-2.0 |
def digital_deform(opt) -> None:
"""
Digitalizing the source images.
Args:
opt:
Returns:
None
"""
print("\t\tPre-processing: digital deformation start...")
que = Queue()
need_to_process = 0
meta_src_proc = opt.meta_data["meta_src"]
for i, meta_proc in enu... |
Digitalizing the source images.
Args:
opt:
Returns:
None
| digital_deform | python | iPERDance/iPERCore | iPERCore/services/preprocess.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/preprocess.py | Apache-2.0 |
def post_update_opt(opt):
"""
Post update the configurations based on the results of preprocessing.
Args:
opt:
Returns:
"""
meta_src_proc = opt.meta_data["meta_src"]
valid_meta_src_proc = []
cur_num_source = 1
for meta_proc in meta_src_proc:
process_info = Process... |
Post update the configurations based on the results of preprocessing.
Args:
opt:
Returns:
| post_update_opt | python | iPERDance/iPERCore | iPERCore/services/preprocess.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/preprocess.py | Apache-2.0 |
def preprocess(opt) -> bool:
"""
Preprocess the source and target image path or video directory.
Args:
opt :
Returns:
successful (bool): Whether it processes successfully or not.
"""
print("\tPre-processing: start...")
# 1. human estimation, including 2D pose, tracking... |
Preprocess the source and target image path or video directory.
Args:
opt :
Returns:
successful (bool): Whether it processes successfully or not.
| preprocess | python | iPERDance/iPERCore | iPERCore/services/preprocess.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/preprocess.py | Apache-2.0 |
def imitate(opt):
"""
Args:
opt:
Returns:
all_meta_outputs (list of MetaOutput):
"""
print("Step 3: running imitator.")
if opt.ip:
from iPERCore.tools.utils.visualizers.visdom_visualizer import VisdomVisualizer
visualizer = VisdomVisualizer(env=opt.model_id, ... |
Args:
opt:
Returns:
all_meta_outputs (list of MetaOutput):
| imitate | python | iPERDance/iPERCore | iPERCore/services/run_imitator.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/run_imitator.py | Apache-2.0 |
def parse_effect_str(effect_str):
"""
Args:
effect_str (str): View-45;BT-t-number;BT-t-number
Returns:
effect_info (dict):
"""
effect_splits = effect_str.split(";")
effect_info = {
"BT": [],
"View": [],
"keep_length": True
}
for sub_effect in e... |
Args:
effect_str (str): View-45;BT-t-number;BT-t-number
Returns:
effect_info (dict):
| parse_effect_str | python | iPERDance/iPERCore | iPERCore/services/options/meta_info.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/meta_info.py | Apache-2.0 |
def parse_parts_str(parts_str):
"""
Args:
parts_str (str): part1-part2-part-3. We use `-` as the part separator. For example, head-left_arm.
Here, we only support 15 parts, and they are
`head`, `torso`, `left_arm`, `right_arm`, `left_leg`, `right_leg`, `left_root... |
Args:
parts_str (str): part1-part2-part-3. We use `-` as the part separator. For example, head-left_arm.
Here, we only support 15 parts, and they are
`head`, `torso`, `left_arm`, `right_arm`, `left_leg`, `right_leg`, `left_root`,
`right_root`, `left_... | parse_parts_str | python | iPERDance/iPERCore | iPERCore/services/options/meta_info.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/meta_info.py | Apache-2.0 |
def parse(self, src_str):
"""
Parse the src_str to structure meta information,
1. 'path?=path1,bg_path?=bg_path1'
2. 'path1,bg_path?=bg_path1' is valid.
3. 'path1,bg_path1,fps' is not valid, it will ignore name, fps, since we do not know its key.
Args:
... |
Parse the src_str to structure meta information,
1. 'path?=path1,bg_path?=bg_path1'
2. 'path1,bg_path?=bg_path1' is valid.
3. 'path1,bg_path1,fps' is not valid, it will ignore name, fps, since we do not know its key.
Args:
src_str (str): e.g. 'path?=p... | parse | python | iPERDance/iPERCore | iPERCore/services/options/meta_info.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/meta_info.py | Apache-2.0 |
def parse(self, ref_str):
"""
Parse the ref_str to structure meta information,
1. 'path?=path1,name?=name1,audio?=audio_path1,fps?=30,pose_fc?=300,cam_fc?=100'
2. 'path1,fps?=25' is valid.
3. 'path1,name,fps' is not valid, it will ignore name and fps, since we do ... |
Parse the ref_str to structure meta information,
1. 'path?=path1,name?=name1,audio?=audio_path1,fps?=30,pose_fc?=300,cam_fc?=100'
2. 'path1,fps?=25' is valid.
3. 'path1,name,fps' is not valid, it will ignore name and fps, since we do not know their key.
Args:
... | parse | python | iPERDance/iPERCore | iPERCore/services/options/meta_info.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/meta_info.py | Apache-2.0 |
def recursive_update_item(sub_models, val, cfg):
"""
Args:
sub_models (list of str):
val (Any):
cfg (EasyDict):
Returns:
cfg (EasyDict):
"""
if len(sub_models) == 0:
return cfg
top_key = sub_models[0]
if len(sub_models) == 1:
if top_key not... |
Args:
sub_models (list of str):
val (Any):
cfg (EasyDict):
Returns:
cfg (EasyDict):
| recursive_update_item | python | iPERDance/iPERCore | iPERCore/services/options/options_setup.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/options_setup.py | Apache-2.0 |
def load_cfg(cfg_path):
"""
Parsing the configuration from self._opt.cfg_path, and add all configs to the self._opt.cfg.
Returns:
"""
cfg = EasyDict(load_toml_file(cfg_path))
neural_render_cfg_path = cfg["neural_render_cfg_path"]
neural_render_cfg = EasyDict(load_toml_file(neural_render_... |
Parsing the configuration from self._opt.cfg_path, and add all configs to the self._opt.cfg.
Returns:
| load_cfg | python | iPERDance/iPERCore | iPERCore/services/options/options_setup.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/options_setup.py | Apache-2.0 |
def load_meta_data(cfg):
"""
Set the meta directories:
|--self._opt.output_dir:
|--models:
|--self._opt.model_id:
|--opt_train.txt or opt_test.txt
Returns:
meta_data (EasyDict): the meta directories, it contains the followings:
--... |
Set the meta directories:
|--self._opt.output_dir:
|--models:
|--self._opt.model_id:
|--opt_train.txt or opt_test.txt
Returns:
meta_data (EasyDict): the meta directories, it contains the followings:
--checkpoints_dir:
| load_meta_data | python | iPERDance/iPERCore | iPERCore/services/options/options_setup.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/options_setup.py | Apache-2.0 |
def setup(opt, extra_args=()):
"""
Args:
opt:
extra_args (list or tuple):
Returns:
"""
# parse the configurations
cfg = load_cfg(opt.cfg_path)
update_extra_args(extra_args, cfg)
update_cfg(opt, cfg)
# get and set gpus
set_envs(cfg)
# set the meta data dir... |
Args:
opt:
extra_args (list or tuple):
Returns:
| setup | python | iPERDance/iPERCore | iPERCore/services/options/options_setup.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/options_setup.py | Apache-2.0 |
def read_src_infos(vid_infos, num_source, num_verts=6890, ignore_bg=False):
"""
Args:
vid_infos (dict):
num_source:
num_verts:
ignore_bg (bool)
Returns:
formated_vid_infos (dict): the formated video information, and it contains the followings,
--
""... |
Args:
vid_infos (dict):
num_source:
num_verts:
ignore_bg (bool)
Returns:
formated_vid_infos (dict): the formated video information, and it contains the followings,
--
| read_src_infos | python | iPERDance/iPERCore | iPERCore/services/options/process_info.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/services/options/process_info.py | Apache-2.0 |
def __init__(self, cfg_or_path,
device=torch.device("cuda:0")):
"""
Args:
cfg_or_path (str or dict):
device (torch.device):
"""
if isinstance(cfg_or_path, str):
cfg = load_toml_file(cfg_or_path)
else:
cfg = cfg_o... |
Args:
cfg_or_path (str or dict):
device (torch.device):
| __init__ | python | iPERDance/iPERCore | iPERCore/tools/background_inpaintors/mmedit_inpaintors.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/background_inpaintors/mmedit_inpaintors.py | Apache-2.0 |
def run_inpainting(self, img_or_path, mask_or_path,
dilate_kernel_size=19, dilate_iter_num=3):
"""
Args:
img_or_path (str or np.ndarray): (h, w, 3) is in the range of [0, 255] with BGR channel;
mask_or_path (str or np.ndarray): (h, w) is in the range of [0... |
Args:
img_or_path (str or np.ndarray): (h, w, 3) is in the range of [0, 255] with BGR channel;
mask_or_path (str or np.ndarray): (h, w) is in the range of [0, 255], np.uint8;
dilate_kernel_size (int): the kernel size of dilation;
dilate_iter_num (int): the itera... | run_inpainting | python | iPERDance/iPERCore | iPERCore/tools/background_inpaintors/mmedit_inpaintors.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/background_inpaintors/mmedit_inpaintors.py | Apache-2.0 |
def batch_orth_proj_idrot(X, camera):
"""
X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N
"""
# TODO check X dim size.
# X_trans is (N, num_points, 2)
X_trans = X[:, :, :2] + camera[:, None, 1:]
return camera[:, None, 0:1] * X_trans |
X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N
| batch_orth_proj_idrot | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | Apache-2.0 |
def link(self, verts, linked_ids):
"""
Args:
verts (torch.Tensor): (N, 6890, 3)
linked_ids (np.ndarray or torch.tensor): (N, number of verts, 2 = (from_vert_ids, to_verts_ids);
Returns:
linked_verts (torch.Tensor): (N, 6890, 3)
"""
bs = vert... |
Args:
verts (torch.Tensor): (N, 6890, 3)
linked_ids (np.ndarray or torch.tensor): (N, number of verts, 2 = (from_vert_ids, to_verts_ids);
Returns:
linked_verts (torch.Tensor): (N, 6890, 3)
| link | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | Apache-2.0 |
def split(self, theta) -> dict:
"""
Args:
theta: (N, 3 + 72 + 10)
Returns:
detail_info (dict): it contains the following information,
--cam (torch.Tensor): (N, 3)
--pose (torch.Tensor): (N, 72)
--shape (torch.Tensor): (N, 10... |
Args:
theta: (N, 3 + 72 + 10)
Returns:
detail_info (dict): it contains the following information,
--cam (torch.Tensor): (N, 3)
--pose (torch.Tensor): (N, 72)
--shape (torch.Tensor): (N, 10)
--theta (torch.Tensor): (... | split | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | Apache-2.0 |
def skinning(self, theta, offsets=0, links_ids=None) -> dict:
"""
Args:
theta: (N, 3 + 72 + 10);
offsets (torch.Tensor) : (N, nv, 3) or 0;
links_ids (None or np.ndarray or torch.tensor): (nv, 2) or (bs, nv, 2)
Returns:
detail_info (dict): it contai... |
Args:
theta: (N, 3 + 72 + 10);
offsets (torch.Tensor) : (N, nv, 3) or 0;
links_ids (None or np.ndarray or torch.tensor): (nv, 2) or (bs, nv, 2)
Returns:
detail_info (dict): it contains the following information,
--cam (torch.Tensor): (N, 3... | skinning | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | Apache-2.0 |
def get_details(self, theta, offsets=0, links_ids=None) -> dict:
"""
calc verts, joint2d, joint3d, Rotation matrix
Args:
theta (torch.Tensor): (N, 85) = (N , 3 + 72 + 10)
offsets (torch.Tensor) : (N, nv, 3) or 0
links_ids (None or np.ndarray or torch.tenso... |
calc verts, joint2d, joint3d, Rotation matrix
Args:
theta (torch.Tensor): (N, 85) = (N , 3 + 72 + 10)
offsets (torch.Tensor) : (N, nv, 3) or 0
links_ids (None or np.ndarray or torch.tensor): (nv, 2) or (bs, nv, 2)
Returns:
detail_info (dict): ... | get_details | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/base_smpl.py | Apache-2.0 |
def batch_rodrigues(theta):
"""
Theta is N x 3
rodrigues (from cv2.rodrigues):
source: https://docs.opencv.org/3.0-beta/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
input: r (3 x 1)
output: R (3 x 3)
angle = norm(r)
r = r / angle
skew(r) = [[ 0, ... |
Theta is N x 3
rodrigues (from cv2.rodrigues):
source: https://docs.opencv.org/3.0-beta/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
input: r (3 x 1)
output: R (3 x 3)
angle = norm(r)
r = r / angle
skew(r) = [[ 0, -rz, ry],
... | batch_rodrigues | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def batch_rot6d_to_rotmat(x):
"""Convert 6D rotation representation to 3x3 rotation matrix.
Based on Zhou et al., "On the Continuity of Rotation Representations in Neural Networks", CVPR 2019
Input:
(B,6) Batch of 6-D rotation representations
Output:
(B,3,3) Batch of corresponding rotati... | Convert 6D rotation representation to 3x3 rotation matrix.
Based on Zhou et al., "On the Continuity of Rotation Representations in Neural Networks", CVPR 2019
Input:
(B,6) Batch of 6-D rotation representations
Output:
(B,3,3) Batch of corresponding rotation matrices
| batch_rot6d_to_rotmat | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def batch_lrotmin(theta):
""" NOTE: not used bc I want to reuse R and this is simple.
Output of this is used to compute joint-to-pose blend shape mapping.
Equation 9 in SMPL paper.
Args:
pose: `Tensor`, N x 72 vector holding the axis-angle rep of K joints.
This includes the global ro... | NOTE: not used bc I want to reuse R and this is simple.
Output of this is used to compute joint-to-pose blend shape mapping.
Equation 9 in SMPL paper.
Args:
pose: `Tensor`, N x 72 vector holding the axis-angle rep of K joints.
This includes the global rotation so K=24
Returns
... | batch_lrotmin | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def batch_global_rigid_transformation(Rs, Js, parent, rotate_base=False, device="cpu"):
"""
Computes absolute joint locations given pose.
rotate_base: if True, rotates the global rotation by 90 deg in x axis.
if False, this is the original SMPL coordinate.
Args:
Rs: N x 24 x 3 x 3 rotation v... |
Computes absolute joint locations given pose.
rotate_base: if True, rotates the global rotation by 90 deg in x axis.
if False, this is the original SMPL coordinate.
Args:
Rs: N x 24 x 3 x 3 rotation vector of K joints
Js: N x 24 x 3, joint locations before posing
parent: 24 holding ... | batch_global_rigid_transformation | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def make_A(R, t):
"""
Composite homogeneous matrix.
Args:
R: N x 3 x 3 rotation matrix.
t: N x 3 x 1 translation vector.
Returns:
homogeneous matrix N x 4 x 4.
"""
# # Rs is N x 3 x 3, ts is N x 3 x 1
# R_homo = np.pad(R, [[0,... |
Composite homogeneous matrix.
Args:
R: N x 3 x 3 rotation matrix.
t: N x 3 x 1 translation vector.
Returns:
homogeneous matrix N x 4 x 4.
| make_A | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def __init__(self, model_path="./assets/checkpoints/pose3d/smpl_model.pkl", rotate=False):
"""
pkl_path is the path to a SMPL model
"""
super(SMPL, self).__init__()
self.rotate = rotate
# -- Load SMPL params --
dd = load_pickle_file(model_path)
# define ... |
pkl_path is the path to a SMPL model
| __init__ | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def forward(self, beta, theta, offsets=0, links_ids=None, get_skin=False):
"""
Obtain SMPL with shape (beta) & pose (theta) inputs.
Theta includes the global rotation.
Args:
beta: N x 10
theta: N x 72 (with 3-D axis-angle rep)
offsets: N x 6890 x 3
... |
Obtain SMPL with shape (beta) & pose (theta) inputs.
Theta includes the global rotation.
Args:
beta: N x 10
theta: N x 72 (with 3-D axis-angle rep)
offsets: N x 6890 x 3
links_ids (None or list of np.ndarray): (from_verts_idx, to_verts_idx)
get_... | forward | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smpl.py | Apache-2.0 |
def __init__(
self, model_path,
use_pca: bool = False,
num_pca_comps: int = 6,
gender: str = "neutral",
dtype=torch.float32,
vertex_ids=None,
ext: str = "pkl",
**kwargs
) -> None:
""" SMPLH model constructor
Parameters
... | SMPLH 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/bodynets/batch_smplh.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smplh.py | Apache-2.0 |
def forward(self, beta, theta, offsets=0, links_ids=None, get_skin=False):
"""
Args:
beta (torch.Tensor): (batch_size, 10)
theta (torch.Tensor):
full pose: (batch_size, (1(global) + 21(body) + 15(left hand) + 15(right hand))*3 --> 52*3 --> 156)
pc... |
Args:
beta (torch.Tensor): (batch_size, 10)
theta (torch.Tensor):
full pose: (batch_size, (1(global) + 21(body) + 15(left hand) + 15(right hand))*3 --> 52*3 --> 156)
pca: (batch_size, (1(global) + 21(body))*3 + 6(left hand) + 6(right hand) --> 22*3+6+6 -... | forward | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/bodynets/batch_smplh.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/bodynets/batch_smplh.py | Apache-2.0 |
def find_links(self, img_path, init_smpls):
"""
Args:
img_path (str):
init_smpls (np.ndarray or torch.tensor): (1, 85)
Returns:
flag (bool): if has found skirt or dress;
from_verts_idx (list or np.ndarray):
to_verts_idx (list or np.nd... |
Args:
img_path (str):
init_smpls (np.ndarray or torch.tensor): (1, 85)
Returns:
flag (bool): if has found skirt or dress;
from_verts_idx (list or np.ndarray):
to_verts_idx (list or np.ndarray):
| find_links | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/clothlinks_deformer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/clothlinks_deformer.py | Apache-2.0 |
def create_360_degree_T_Pose_view_smpl(frame_num, ret_quat=True):
"""
Args:
frame_num (int): number of frame
ret_quat (bool): if True, return quat (N, 24, 4)
if False, return rotvec (N, 24, 3)
Returns:
quat (np.ndarray): if ret_quat is True, (N, 24, 4)
... |
Args:
frame_num (int): number of frame
ret_quat (bool): if True, return quat (N, 24, 4)
if False, return rotvec (N, 24, 3)
Returns:
quat (np.ndarray): if ret_quat is True, (N, 24, 4)
recvec (np.ndarray): if ret_quat is False, (N, 24, 3)
| create_360_degree_T_Pose_view_smpl | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/link_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/link_utils.py | Apache-2.0 |
def get_inner_verts_idx_of_leg(self, leg_verts_idx, inner_part_rate=0.3, right=True):
"""
Args:
leg_verts_idx (np.ndarray or list): (leg_verts_num,)
inner_part_rate (float):
right (bool): if True, x will be sorted from small to large (for right leg)
Returns:... |
Args:
leg_verts_idx (np.ndarray or list): (leg_verts_num,)
inner_part_rate (float):
right (bool): if True, x will be sorted from small to large (for right leg)
Returns:
innter_verts_idx (np.ndarray or list): (inner_verts_num,)
| get_inner_verts_idx_of_leg | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/link_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/link_utils.py | Apache-2.0 |
def find_nearest_vert(src_vert, tgt_vert_idx_list, tgt_verts):
"""
Args:
src_vert (list or np.ndarray or torch.tensor): (3,);
tgt_vert_idx_list (list or np.ndarray): (N,) save verts idx;
tgt_verts (np.ndarray or torch.tensor): (N, 3);
Returns:
[(... |
Args:
src_vert (list or np.ndarray or torch.tensor): (3,);
tgt_vert_idx_list (list or np.ndarray): (N,) save verts idx;
tgt_verts (np.ndarray or torch.tensor): (N, 3);
Returns:
[(vert_idx_0, dis_0), (vert_idx_1, dis_1)]
| find_nearest_vert | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/link_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/link_utils.py | Apache-2.0 |
def link(self, cam, pose, shape, skirt_y, ret_tensor=True):
"""
Args:
cam (torch.cuda.tensor): (1, 3)
pose (torch.cuda.tensor): (1, 72)
shape (torch.cuda.tensor): (1, 10)
skirt_y (float):
ret_tensor (bool):
Returns:
from_v... |
Args:
cam (torch.cuda.tensor): (1, 3)
pose (torch.cuda.tensor): (1, 72)
shape (torch.cuda.tensor): (1, 10)
skirt_y (float):
ret_tensor (bool):
Returns:
from_verts_idx (np.ndarray or torch.tensor): (N,)
to_verts_idx (n... | link | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/link_utils.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/link_utils.py | Apache-2.0 |
def solve(self, obs, visualizer=None, visual_poses=None):
"""
Args:
obs (dict): observations contains:
--sil:
--cam:
--pose:
--shape:
visualizer:
visual_poses:
Returns:
"""
prin... |
Args:
obs (dict): observations contains:
--sil:
--cam:
--pose:
--shape:
visualizer:
visual_poses:
Returns:
| solve | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/sil_deformer.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/sil_deformer.py | Apache-2.0 |
def run_sil2smpl_offsets(obs_sils, init_smpls, image_size, device=torch.device("cuda:0"),
visualizer=None, visual_poses=None):
"""
Args:
obs_sils (np.ndarray):
init_smpls (np.ndarray):
image_size (int):
device (torch.device):
visualizer (None or ... |
Args:
obs_sils (np.ndarray):
init_smpls (np.ndarray):
image_size (int):
device (torch.device):
visualizer (None or Visualizer):
visual_poses (None or np.ndarray):
Returns:
| run_sil2smpl_offsets | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/deformers/__init__.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/deformers/__init__.py | Apache-2.0 |
def orthographic_proj_withz_idrot(X, cam, offset_z=0.):
"""
X: B x N x 3
cam: B x 3: [sc, tx, ty]
No rotation!
Orth preserving the z.
sc * ( x + [tx; ty])
as in HMR..
"""
scale = cam[:, 0].contiguous().view(-1, 1, 1)
trans = cam[:, 1:3].contiguous().view(cam.size(0), 1, -1)
... |
X: B x N x 3
cam: B x 3: [sc, tx, ty]
No rotation!
Orth preserving the z.
sc * ( x + [tx; ty])
as in HMR..
| orthographic_proj_withz_idrot | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def orthographic_proj_withz(X, cam, offset_z=0.):
"""
X: B x N x 3
cam: B x 7: [sc, tx, ty, quaternions]
Orth preserving the z.
sc * ( x + [tx; ty])
as in HMR..
"""
quat = cam[:, -4:]
X_rot = quat_rotate(X, quat)
scale = cam[:, 0].contiguous().view(-1, 1, 1)
trans = cam[:, 1... |
X: B x N x 3
cam: B x 7: [sc, tx, ty, quaternions]
Orth preserving the z.
sc * ( x + [tx; ty])
as in HMR..
| orthographic_proj_withz | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def quat_rotate(X, q):
"""Rotate points by quaternions.
Args:
X: B X N X 3 points
q: B X 4 quaternions
Returns:
X_rot: B X N X 3 (rotated points)
"""
# repeat q along 2nd dim
ones_x = X[[0], :, :][:, :, [0]] * 0 + 1
q = torch.unsqueeze(q, 1) * ones_x
q_conj = t... | Rotate points by quaternions.
Args:
X: B X N X 3 points
q: B X 4 quaternions
Returns:
X_rot: B X N X 3 (rotated points)
| quat_rotate | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def hamilton_product(qa, qb):
"""Multiply qa by qb.
Args:
qa: B X N X 4 quaternions
qb: B X N X 4 quaternions
Returns:
q_mult: B X N X 4
"""
qa_0 = qa[:, :, 0]
qa_1 = qa[:, :, 1]
qa_2 = qa[:, :, 2]
qa_3 = qa[:, :, 3]
qb_0 = qb[:, :, 0]
qb_1 = qb[:, :, 1]... | Multiply qa by qb.
Args:
qa: B X N X 4 quaternions
qb: B X N X 4 quaternions
Returns:
q_mult: B X N X 4
| hamilton_product | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def batch_orth_proj_idrot(camera, X):
"""
X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N
"""
# TODO check X dim size.
# X_trans is (N, num_points, 2)
X_trans = X[:, :, :2] + camera[:, None, 1:]
# reshape X_trans... |
X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N
| batch_orth_proj_idrot | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def points_to_sampler(coords, faces):
"""
Args:
coords: [2, T*T]
faces: [batch size, number of vertices, 3, 2]
Returns:
[batch_size, number of vertices, T*T, 2]
"""
# Compute alpha, beta (this is the same order as NMR)
nf = faces.shap... |
Args:
coords: [2, T*T]
faces: [batch size, number of vertices, 3, 2]
Returns:
[batch_size, number of vertices, T*T, 2]
| points_to_sampler | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def get_selected_f2pts(self, f2pts, selected_fids):
"""
Args:
f2pts (torch.tensor): (bs, f, 3, 2) or (bs, f, 3, 3)
selected_fids (list of list):
Returns:
"""
def get_selected(orig_f2pts, face_ids):
"""
Args:
orig... |
Args:
f2pts (torch.tensor): (bs, f, 3, 2) or (bs, f, 3, 3)
selected_fids (list of list):
Returns:
| get_selected_f2pts | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
def get_vis_f2pts(self, f2pts, fims):
"""
Args:
f2pts: (bs, f, 3, 2) or (bs, f, 3, 3)
fims: (bs, 256, 256)
Returns:
"""
def get_vis(orig_f2pts, fim):
"""
Args:
orig_f2pts: (f, 3, 2) or (f, 3, 3)
f... |
Args:
f2pts: (bs, f, 3, 2) or (bs, f, 3, 3)
fims: (bs, 256, 256)
Returns:
| get_vis_f2pts | python | iPERDance/iPERCore | iPERCore/tools/human_digitalizer/renders/nmr.py | https://github.com/iPERDance/iPERCore/blob/master/iPERCore/tools/human_digitalizer/renders/nmr.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.