id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
13,306 | import numpy as np
from ..config import load_object
from .matchSVT import matchSVT
def getDimGroups(lDetections):
dimGroups = [0]
for data in lDetections:
dimGroups.append(dimGroups[-1] + len(data))
views = np.zeros(dimGroups[-1], dtype=int)
for nv in range(len(dimGroups) - 1):
views[di... | null |
13,307 | import numpy as np
from ..config import load_object
from .matchSVT import matchSVT
def composeAff(out, vis=False):
names = list(out.keys())
N = len(names)
aff = out[names[0]].copy()
for i in range(1, N):
aff = aff * out[names[i]]
aff = np.power(aff, 1/N)
return aff | null |
13,308 | import numpy as np
from ..config import load_object
from .matchSVT import matchSVT
def SimpleConstrain(dimGroups):
constrain = np.ones((dimGroups[-1], dimGroups[-1]))
for i in range(len(dimGroups)-1):
start, end = dimGroups[i], dimGroups[i+1]
constrain[start:end, start:end] = 0
N = constrai... | null |
13,309 | import numpy as np
def matchSVT(M_aff, dimGroups, M_constr=None, M_obs=None, control={}):
max_iter = control['maxIter']
w_rank = control['w_rank']
tol = control['tol']
X = M_aff.copy()
N = X.shape[0]
index_diag = np.arange(N)
X[index_diag, index_diag] = 0.
if M_constr is None:
M... | null |
13,310 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import torch
import torch.nn.functional as F
def rot_mat_to_euler(rot_mats):
# Calculates rotation matrix to euler angles
# Careful for extreme cases of eular angles like [0.0, pi, 0.0... | 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 (soubhik.sanyal@tuebingen.mpg.de) for... |
13,312 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import torch
import torch.nn.functional as F
def vertices2joints(J_regressor, vertices):
''' Calculates the 3D joint locations from the vertices
Parameters
----------
J_regress... | 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 BxVx3 The template mesh that will be deformed shapedirs : torch.tensor... |
13,313 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import torch
import torch.nn.functional as F
def vertices2joints(J_regressor, vertices):
''' Calculates the 3D joint locations from the vertices
Parameters
----------
J_regress... | 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 BxVx3 The template mesh that will be deformed shapedirs : torch.tensor... |
13,314 | from .base import Model, Params
from .lbs import lbs, batch_rodrigues
import os
import numpy as np
import torch
def to_np(array, dtype=np.float32):
if 'scipy.sparse' in str(type(array)):
array = array.todense()
return np.array(array, dtype=dtype) | null |
13,315 | from .base import Model, Params
from .lbs import lbs, batch_rodrigues
import os
import numpy as np
import torch
def read_pickle(name):
def load_model_data(model_path):
model_path = os.path.abspath(model_path)
assert os.path.exists(model_path), 'Path {} does not exist!'.format(
model_path)
if model_... | null |
13,316 | from .base import Model, Params
from .lbs import lbs, batch_rodrigues
import os
import numpy as np
import torch
def to_tensor(array, dtype=torch.float32, device=torch.device('cpu')):
if 'torch.tensor' not in str(type(array)):
return torch.tensor(array, dtype=dtype).to(device)
else:
return array.... | null |
13,317 | from .base import Model, Params
from .lbs import lbs, batch_rodrigues
import os
import numpy as np
import torch
def save_regressor(fname, data):
with open(fname, 'w') as f:
f.writelines('{} {} {}\r\n'.format('#', data.shape[0], data.shape[1]))
for i in range(data.shape[0]):
for j in ran... | null |
13,318 | import torch
import torch.nn as nn
from .base import Model
from .smpl import SMPLModel, SMPLLayerEmbedding, read_pickle, to_tensor
from os.path import join
import numpy as np
def read_pickle(name):
def read_hand(path, use_pca, use_flat_mean, num_pca_comps):
data = read_pickle(path)
mean = data['hands_mean'].r... | null |
13,319 | from easymocap.config.baseconfig import load_object, Config
from easymocap.mytools import Timer
from tqdm import tqdm
from easymocap.socket.base_client import BaseSocketClient
from easymocap.mytools.debug_utils import mywarn, run_cmd
import time
import numpy as np
def check_ip_port(address):
ip, port = address.spl... | null |
13,320 | from easymocap.config.baseconfig import load_object, Config
from easymocap.mytools import Timer
from tqdm import tqdm
from easymocap.socket.base_client import BaseSocketClient
from easymocap.mytools.debug_utils import mywarn, run_cmd
import time
import numpy as np
INDEX_HALF = [11,12,13,14,15,16,17,18,19, 20]
INDEX_HAL... | null |
13,321 | from os.path import join
import os
from easymocap.mytools.colmap_wrapper import COLMAPDatabase, colmap_ba, colmap_dense, colmap_feature_match, copy_images, create_empty_db
from easymocap.mytools.colmap_wrapper import colmap_feature_extract
from easymocap.mytools.debug_utils import log
class COLMAPDatabase(sqlite3.Conn... | null |
13,322 | from easymocap.annotator.file_utils import getFileList, read_json, save_json
from os.path import join
import os
from tqdm import tqdm
def read_json(path):
with open(path, 'r') as f:
data = json.load(f)
return data
def save_json(file, data):
if file is None:
return 0
if not os.path.exis... | null |
13,323 | from easymocap.annotator.file_utils import getFileList, read_json, save_json
from os.path import join
import os
from tqdm import tqdm
def read_json(path):
with open(path, 'r') as f:
data = json.load(f)
return data
def save_json(file, data):
if file is None:
return 0
if not os.path.exis... | null |
13,324 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,325 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,326 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,327 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,328 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,329 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,330 | from easymocap.mytools.debug_utils import myerror, mywarn
from easymocap.mytools.file_utils import myarray2string
import cv2
import numpy as np
import os
from os.path import join
from easymocap.mytools import read_json, merge
from easymocap.mytools import read_camera, plot_points2d
from easymocap.mytools import batch_t... | null |
13,331 | import open3d as o3d
import os
import cv2
import numpy as np
from easymocap.mytools.camera_utils import read_cameras
from easymocap.visualize.o3dwrapper import Vector3dVector, create_pcd
from easymocap.mytools.vis_base import generate_colorbar
def transform_cameras(cameras):
dims = {'x': 0, 'y': 1, 'z': 2}
R_g... | null |
13,332 | import shutil
import random
from easymocap.mytools.debug_utils import log, mywarn
from easymocap.mytools.vis_base import plot_points2d
from easymocap.mytools import write_intri, read_json, Timer
import numpy as np
import cv2
import os
from os.path import join
from glob import glob
from easymocap.annotator.chessboard im... | null |
13,333 | import shutil
import random
from easymocap.mytools.debug_utils import log, mywarn
from easymocap.mytools.vis_base import plot_points2d
from easymocap.mytools import write_intri, read_json, Timer
import numpy as np
import cv2
import os
from os.path import join
from glob import glob
from easymocap.annotator.chessboard im... | null |
13,334 | from easymocap.mytools.camera_utils import write_intri
import os
from glob import glob
from os.path import join
import numpy as np
import cv2
from easymocap.mytools import read_intri, write_extri, read_json
from easymocap.mytools.debug_utils import mywarn
def init_intri(path, image):
camnames = sorted(os.listdir(jo... | null |
13,335 | import join
from easymocap.annotator.file_utils import save_json
from easymocap.mytools.debug_utils import myerror, run_cmd, mywarn, log
from easymocap.mytools.camera_utils import read_cameras, write_camera
from easymocap.mytools import read_json
from easymocap.mytools import batch_triangulate, projectN3, Undistort
imp... | null |
13,336 | os.path import join
from easymocap.annotator.file_utils import save_json
from easymocap.mytools.debug_utils import myerror, run_cmd, mywarn, log
from easymocap.mytools.camera_utils import read_cameras, write_camera
from easymocap.mytools import read_json
from easymocap.mytools import batch_triangulate, projectN3, Undis... | null |
13,337 | from easymocap.annotator.file_utils import getFileList, read_json, save_json
from easymocap.mytools.debug_utils import mywarn
from tqdm import tqdm
from easymocap.annotator import ImageFolder
from easymocap.annotator.chessboard import findChessboardCorners
import numpy as np
from os.path import join
import cv2
import o... | null |
13,338 | from easymocap.annotator.file_utils import getFileList, read_json, save_json
from easymocap.mytools.debug_utils import mywarn
from tqdm import tqdm
from easymocap.annotator import ImageFolder
from easymocap.annotator.chessboard import findChessboardCorners
import numpy as np
from os.path import join
import cv2
import o... | null |
13,339 | from easymocap.annotator.file_utils import getFileList, read_json, save_json
from easymocap.mytools.debug_utils import mywarn
from tqdm import tqdm
from easymocap.annotator import ImageFolder
from easymocap.annotator.chessboard import findChessboardCorners
import numpy as np
from os.path import join
import cv2
import o... | null |
13,340 | import os
from os.path import join
import shutil
from easymocap.mytools.debug_utils import log, myerror, mywarn, run_cmd, mkdir
from easymocap.mytools.colmap_wrapper import colmap_feature_extract, colmap_feature_match
from tqdm import tqdm
def copy_images(data, out, nf=0):
subs = sorted(os.listdir(data))
image_... | null |
13,341 | import os
from os.path import join
import shutil
from easymocap.mytools.debug_utils import log, myerror, mywarn, run_cmd, mkdir
from easymocap.mytools.colmap_wrapper import colmap_feature_extract, colmap_feature_match
from tqdm import tqdm
def run_cmd(cmd, verbo=True, bg=False):
if verbo: myprint('[run] ' + cmd, '... | null |
13,344 | import os
import sys
import collections
import numpy as np
import struct
import cv2
def rotmat2qvec(R):
Rxx, Ryx, Rzx, Rxy, Ryy, Rzy, Rxz, Ryz, Rzz = R.flat
K = np.array([
[Rxx - Ryy - Rzz, 0, 0, 0],
[Ryx + Rxy, Ryy - Rxx - Rzz, 0, 0],
[Rzx + Rxz, Rzy + Ryz, Rzz - Rxx - Ryy, 0],
... | null |
13,351 | from easymocap.config import Config, load_object
import open3d as o3d
from easymocap.visualize.o3dwrapper import Vector3dVector, create_mesh, create_coord
import numpy as np
Vector3dVector = o3d.utility.Vector3dVector
def update_vis(vis, mesh, body_model, params):
vertices = body_model(return_verts=True, return_t... | null |
13,352 | from easymocap.mytools.reader import read_smpl
import socket
import time
from easymocap.socket.base_client import BaseSocketClient
import os
def send_rand(client):
import numpy as np
N_person = 10
datas = []
for i in range(N_person):
transl = (np.random.rand(1, 3) - 0.5) * 3
kpts = np.r... | null |
13,353 | from easymocap.mytools.reader import read_smpl
import socket
import time
from easymocap.socket.base_client import BaseSocketClient
import os
def read_keypoints3d(filename):
data = read_json(filename)
res_ = []
for d in data:
pid = d['id'] if 'id' in d.keys() else d['personID']
ret = {'id': ... | null |
13,354 | import Config, load_object
from tqdm import tqdm
def process(dataset, model, args):
ret_all = []
print('[Run] dataset has {} samples'.format(len(dataset)))
if args.num_workers == -1:
for i in tqdm(range(len(dataset)), desc='[Run]'):
data = dataset[i]
ret = model.at_step(data,... | null |
13,355 | from operator import imod
import numpy as np
from tqdm import tqdm
from os.path import join
from easymocap.dataset.mv1pmf_mirror import ImageFolderMirror as ImageFolder
from easymocap.mytools import Timer
from easymocap.smplmodel import load_model, merge_params, select_nf
from easymocap.estimator import SPIN, init_with... | Optimization for single image |
13,356 | from operator import imod
import numpy as np
from tqdm import tqdm
from os.path import join
from easymocap.dataset.mv1pmf_mirror import ImageFolderMirror as ImageFolder
from easymocap.mytools import Timer
from easymocap.smplmodel import load_model, merge_params, select_nf
from easymocap.estimator import SPIN, init_with... | null |
13,357 | from tqdm import tqdm
from easymocap.smplmodel import check_keypoints, load_model, select_nf
from easymocap.mytools import simple_recon_person, Timer, projectN3
from easymocap.pipeline import smpl_from_keypoints3d2d
import os
from os.path import join
import numpy as np
def check_repro_error(keypoints3d, kpts_repro, key... | null |
13,358 | from tqdm import tqdm
from easymocap.smplmodel import check_keypoints, load_model, select_nf
from easymocap.mytools import simple_recon_person, Timer, projectN3
from easymocap.pipeline import smpl_from_keypoints3d2d
import os
from os.path import join
import numpy as np
def mv1pmf_smpl(dataset, args, weight_pose=None, ... | null |
13,359 | from easymocap.dataset import CONFIG
from easymocap.mytools import Timer
from easymocap.smplmodel import load_model, select_nf
from easymocap.mytools.reader import read_keypoints3d_all
from easymocap.mytools.file_utils import write_smpl
from easymocap.pipeline.weight import load_weight_pose, load_weight_shape
from easy... | null |
13,360 | import os
from os.path import exists
from os.path import join
from easymocap.config import Config, CfgNode
from glob import glob
from easymocap.mytools.debug_utils import run_cmd, check_exists, myerror, log, mywarn
def check_image(path):
if not check_exists(join(path, 'images')):
mywarn('Images not found in... | null |
13,361 | import os
from os.path import exists
from os.path import join
from easymocap.config import Config, CfgNode
from glob import glob
from easymocap.mytools.debug_utils import run_cmd, check_exists, myerror, log, mywarn
def check_image(path):
if not check_exists(join(path, 'images')):
mywarn('Images not found in... | null |
13,362 | import os
from os.path import exists
from os.path import join
from easymocap.config import Config, CfgNode
from glob import glob
from easymocap.mytools.debug_utils import run_cmd, check_exists, myerror, log, mywarn
def run_triangulation(cfg_data, cfg_exp, path, out, args):
def append_mocap_flags(path, output, cfg_data,... | null |
13,363 | from easymocap.dataset import CONFIG
from easymocap.dataset import CONFIG
from easymocap.affinity.affinity import ComposedAffinity
from easymocap.assignment.associate import simple_associate
from easymocap.assignment.group import PeopleGroup
from easymocap.mytools import Timer
from tqdm import tqdm
class ComposedAffin... | null |
13,364 | import os
from os.path import join
from glob import glob
extensions = ['.mp4', '.webm', '.flv', '.MP4', '.MOV', '.mov', '.avi']
def run(cmd):
def extract_images(path, ffmpeg, image):
videos = sorted(sum([
glob(join(path, 'videos', '*'+ext)) for ext in extensions
], [])
)
for videoname in vi... | null |
13,365 | import shutil
from easymocap.mytools.debug_utils import log, mkdir, mywarn, run_cmd
import os
from os.path import join
from tqdm import tqdm
def log(text):
myprint(text, 'info')
def mkdir(path):
if os.path.exists(path):
return 0
log('mkdir {}'.format(path))
os.makedirs(path, exist_ok=Tr... | null |
13,366 | import shutil
from easymocap.mytools.debug_utils import log, mkdir, mywarn, run_cmd
import os
from os.path import join
from tqdm import tqdm
def split_directories(root, out):
with open(join(out, 'log.txt'), 'r') as f:
records = f.readlines()
for record in tqdm(records):
seq, sub, imgname = reco... | null |
13,367 | from easymocap.annotator.file_utils import read_json, save_json
from easymocap.config import load_object_from_cmd
import numpy as np
from easymocap.mytools.debug_utils import log, myerror, mywarn, run_cmd
from tqdm import tqdm
import os
from os.path import join
class Tracker:
def __init__(self, missing_frame=10, t... | null |
13,368 | import os
from os.path import join
from tqdm import tqdm
import numpy as np
def load_subs(path, subs):
if len(subs) == 0:
subs = sorted(os.listdir(join(path, 'images')))
subs = [sub for sub in subs if os.path.isdir(join(path, 'images', sub))]
if len(subs) == 0:
subs = ['']
return subs | null |
13,369 | import os
from os.path import join
from easymocap.mytools.debug_utils import myerror
import torch
from easymocap.config import load_object, Config
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning import seed_everything
import resource
class plwrapper(pl.Light... | null |
13,370 | import os
from os.path import join
from easymocap.mytools.debug_utils import myerror
import torch
from easymocap.config import load_object, Config
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning import seed_everything
import resource
def load_ckpt(model, ck... | null |
13,371 | import os
from os.path import join
from easymocap.mytools.debug_utils import myerror
import torch
from easymocap.config import load_object, Config
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning import seed_everything
import resource
def parse(args, cfg):
... | null |
13,372 | from os.path import join
from easymocap.mytools.debug_utils import log, run_cmd
from easymocap.config.baseconfig import Config, CN
import os
from glob import glob
from copy import deepcopy
def reload_config(config, data, outdir):
def log(text):
def run_cmd(cmd, verbo=True, bg=False):
def neuralbody_train(data,... | null |
13,373 | import myerror, mywarn, run_cmd
from easymocap.mytools.vis_base import plot_line
from easymocap.annotator.basic_annotator import AnnotBase, parse_parser
from easymocap.annotator import ImageFolder
from easymocap.annotator import plot_text
from easymocap.annotator.basic_visualize import capture_screen, resize_to_screen
... | null |
13,374 | import myerror, mywarn, run_cmd
from easymocap.mytools.vis_base import plot_line
from easymocap.annotator.basic_annotator import AnnotBase, parse_parser
from easymocap.annotator import ImageFolder
from easymocap.annotator import plot_text
from easymocap.annotator.basic_visualize import capture_screen, resize_to_screen
... | null |
13,375 | import myerror, mywarn, run_cmd
from easymocap.mytools.vis_base import plot_line
from easymocap.annotator.basic_annotator import AnnotBase, parse_parser
from easymocap.annotator import ImageFolder
from easymocap.annotator import plot_text
from easymocap.annotator.basic_visualize import capture_screen, resize_to_screen
... | null |
13,376 | from easymocap.annotator.basic_visualize import capture_screen, plot_skeleton_factory, resize_to_screen
import os
from os.path import join
import numpy as np
from easymocap.annotator import ImageFolder
from easymocap.annotator import AnnotBase
from easymocap.annotator import callback_select_bbox_corner, callback_select... | null |
13,377 | from easymocap.annotator.basic_visualize import plot_text, resize_to_screen, vis_bbox, vis_line
from easymocap.mytools.debug_utils import mywarn
from easymocap.mytools.vis_base import plot_point
from easymocap.annotator import ImageFolder
from easymocap.annotator import vis_point
from easymocap.annotator import AnnotBa... | null |
13,378 | from easymocap.annotator.file_utils import read_json, save_annot
from easymocap.annotator import ImageFolder
from easymocap.annotator import plot_text, vis_active_bbox, vis_line, plot_skeleton
from easymocap.annotator import AnnotBase
from easymocap.annotator.vanish_callback import get_record_vanish_lines, get_calc_int... | null |
13,379 | import os
from os.path import join
from easymocap.annotator import ImageFolder
from easymocap.annotator import plot_text, plot_bbox_body, vis_active_bbox, vis_line
from easymocap.annotator import AnnotBase
from easymocap.annotator import callback_select_bbox_corner, callback_select_bbox_center, auto_pose_track
def ann... | null |
13,380 | from easymocap.annotator import ImageFolder
from easymocap.annotator import vis_point, vis_line
from easymocap.annotator import AnnotBase
def annot_example(path):
# define datasets
dataset = ImageFolder(path)
# define visualize
vis_funcs = [vis_point, vis_line]
# construct annotations
annotator... | null |
13,381 | from os.path import join
from easymocap.config import Config, load_object
from easymocap.config.baseconfig import load_config_from_index, load_object_from_cmd
from easymocap.mytools.debug_utils import mywarn, log, myerror
from tqdm import tqdm
from easymocap.mytools import Timer
def load_object_from_cmd(cfg, opt):
... | null |
13,382 | from easymocap.config.baseconfig import load_object, Config
from easymocap.mytools import Timer
from easymocap.mytools.file_utils import save_json, write_keypoints3d, write_vertices
from easymocap.mytools.reader import read_smpl
from easymocap.bodymodel.base import Params
from os.path import join
from glob import glob
... | null |
13,383 | import random
import os
import time
import datetime as dt
nfns = 4
nargs = 4
def generate_dummy_code_pybind11(nclasses=10):
decl = ""
bindings = ""
for cl in range(nclasses):
decl += "class cl%03i;\n" % cl
decl += '\n'
for cl in range(nclasses):
decl += "class cl%03i {\n" % cl
... | null |
13,384 | import random
import os
import time
import datetime as dt
nfns = 4
nargs = 4
def generate_dummy_code_boost(nclasses=10):
decl = ""
bindings = ""
for cl in range(nclasses):
decl += "class cl%03i;\n" % cl
decl += '\n'
for cl in range(nclasses):
decl += "class cl%03i {\n" % cl
... | null |
13,385 | import sys
import os
import shlex
import subprocess
def generate_doxygen_xml(app):
build_dir = os.path.join(app.confdir, '.build')
if not os.path.exists(build_dir):
os.mkdir(build_dir)
try:
subprocess.call(['doxygen', '--version'])
retcode = subprocess.call(['doxygen'], cwd=app.confd... | Add hook for building doxygen xml when needed |
13,386 | from __future__ import print_function
import argparse
import sys
import sysconfig
from . import get_include
def print_includes():
dirs = [sysconfig.get_path('include'),
sysconfig.get_path('platinclude'),
get_include()]
# Make unique but preserve order
unique_dirs = []
for d in ... | null |
13,387 | import os
import sys
import platform
import re
import textwrap
from clang import cindex
from clang.cindex import CursorKind
from collections import OrderedDict
from glob import glob
from threading import Thread, Semaphore
from multiprocessing import cpu_count
RECURSE_LIST = [
CursorKind.TRANSLATION_UNIT,
Cursor... | null |
13,388 | import os
import sys
import platform
import re
import textwrap
from clang import cindex
from clang.cindex import CursorKind
from collections import OrderedDict
from glob import glob
from threading import Thread, Semaphore
from multiprocessing import cpu_count
def extract_all(args):
parameters, filenames = read_args... | null |
13,389 | import os
import shutil
import yaml
from os.path import join
from easymocap.mytools.debug_utils import log, mywarn
def compare_files(file1, file2):
def log(text):
def mywarn(text):
def copy_node(dir, nodes):
for node in nodes:
if isinstance(node, str):
srcname = join(SRC, dir, node)
... | null |
13,390 | import re
import numpy as np
import os, sys
import cv2
import shutil
from os.path import join
from tqdm import trange, tqdm
from multiprocessing import Pool
import json
def parseImg(imgname):
""" 解析图像名称
Arguments:
imgname {str} --
Returns:
dic -- 包含文件图像信息的字典
"""
s = re.search(
... | null |
13,391 | import re
import numpy as np
import os, sys
import cv2
import shutil
from os.path import join
from tqdm import trange, tqdm
from multiprocessing import Pool
import json
def save_json(file, data):
if not os.path.exists(os.path.dirname(file)):
os.makedirs(os.path.dirname(file))
with open(file, 'w') as f:
... | null |
13,392 | import re
import numpy as np
import os, sys
import cv2
import shutil
from os.path import join
from tqdm import trange, tqdm
from multiprocessing import Pool
import json
from tabulate import tabulate
def read_json(path):
with open(path) as f:
data = json.load(f)
return data | null |
13,393 | import numpy as np
import json
from glob import glob
from os.path import join
import os
from easymocap.mytools import write_camera, read_json, save_json
from easymocap.dataset import CONFIG
import shutil
from tqdm import tqdm, trange
SCALE = 100
def convert_camera(inp, out):
camnames = glob(join(inp, '*.json'))
... | null |
13,394 | import numpy as np
import json
from glob import glob
from os.path import join
import os
from easymocap.mytools import write_camera, read_json, save_json
from easymocap.dataset import CONFIG
import shutil
from tqdm import tqdm, trange
def copy_videos(inp, out):
outdir = join(out, 'videos')
os.makedirs(outdir, e... | null |
13,395 | import numpy as np
import json
from glob import glob
from os.path import join
import os
from easymocap.mytools import write_camera, read_json, save_json
from easymocap.dataset import CONFIG
import shutil
from tqdm import tqdm, trange
SCALE = 100
def convert_keypoints3d(inp, out):
bodynames = join(inp, 'hdPose3d_st... | null |
13,396 | import os
from os.path import join
from glob import glob
import numpy as np
import cv2
from easymocap.mytools.camera_utils import write_camera
def process_camera(xml_path, seq, act, cams):
def write_camera(camera, path):
def convert_h36m_easymocap(H36M_ROOT, OUT_ROOT, seqs, cams):
xml_path = join(H36M_ROOT, 'meta... | null |
13,397 | from glob import glob
from os.path import join
from urllib.error import URLError
from pytube import YouTube
import os
from easymocap.mytools.debug_utils import log, mkdir, myerror
extensions = ['.mp4', '.webm']
def log(text):
myprint(text, 'info')
def myerror(text):
myprint(text, 'error')
def download_y... | null |
13,398 | import os
from os.path import join
import shutil
from tqdm import tqdm
from glob import glob
import cv2
from easymocap.mytools.debug_utils import myerror, mywarn
mkdir = lambda x:os.makedirs(x, exist_ok=True)
import json
def save_json(file, data):
if not os.path.exists(os.path.dirname(file)):
os.makedirs(os... | null |
13,399 | import os
from os.path import join
import shutil
from tqdm import tqdm
from glob import glob
import cv2
from easymocap.mytools.debug_utils import myerror, mywarn
mkdir = lambda x:os.makedirs(x, exist_ok=True)
import json
def export(root, out, keys):
mkdir(out)
for key in keys:
src = join(root, key)
... | null |
13,400 | import os, sys
import cv2
from os.path import join
from tqdm import tqdm
from glob import glob
import numpy as np
import json
def extract_video(videoname, path, start, end, step):
base = os.path.basename(videoname).replace('.mp4', '')
if not os.path.exists(videoname):
return base
outpath = join(pat... | null |
13,401 | import os, sys
import cv2
from os.path import join
from tqdm import tqdm
from glob import glob
import numpy as np
import json
def extract_2d(openpose, image, keypoints, render, args):
skip = False
if os.path.exists(keypoints):
# check the number of images and keypoints
if len(os.listdir(image))... | null |
13,402 | import os, sys
import cv2
from os.path import join
from tqdm import tqdm
from glob import glob
import numpy as np
import json
def save_json(file, data):
if not os.path.exists(os.path.dirname(file)):
os.makedirs(os.path.dirname(file))
with open(file, 'w') as f:
json.dump(data, f, indent=4)
def cr... | null |
13,403 | import os, sys
import cv2
from os.path import join
from tqdm import tqdm
from glob import glob
import numpy as np
import json
def save_json(file, data):
if not os.path.exists(os.path.dirname(file)):
os.makedirs(os.path.dirname(file))
with open(file, 'w') as f:
json.dump(data, f, indent=4)
def cr... | null |
13,404 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
def save_json(output, json_path):
os.system('mkdir -p {}'.format(os.path.dirname(json_path)))
with open(json_path, 'w') as f:
json.dump(output, f, indent=... | null |
13,405 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
def is_right(model_start_point, model_end_point, gt_strat_point, gt_end_point, alpha=0.5):
bone_lenth = np.linalg.norm ( gt_end_point - gt_strat_point )
start_differe... | null |
13,406 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
The provided code snippet includes necessary dependencies for implementing the `openpose2shelf3D` function. Write a Python function `def openpose2shelf3D(pose3d, score)` to s... | transform coco order(our method output) 3d pose to shelf dataset order with interpolation :param pose3d: np.array with shape nJx3 :return: 3D pose in shelf order with shape 14x3 |
13,407 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
def convert_openpose_shelf(keypoints3d):
shelf15 = np.zeros((15, 4))
openpose2shelf = np.array([11, 10, 9, 12, 13, 14, 4, 3, 2, 5, 6, 7, 1, 0, 8])
shelf15 = keypo... | null |
13,408 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
def convert_shelf_shelfgt(keypoints):
gt_hip = (keypoints[2] + keypoints[3]) / 2
gt = np.vstack((keypoints, gt_hip))
return gt | null |
13,409 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
The provided code snippet includes necessary dependencies for implementing the `vectorize_distance` function. Write a Python function `def vectorize_distance(a, b)` to solve ... | Calculate euclid distance on each row of a and b :param a: Nx... np.array :param b: Mx... np.array :return: MxN np.array representing correspond distance |
13,410 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
def distance(a, b, score):
# a: (N, J, 3)
# b: (M, J, 3)
# score: (M, J, 1)
# return: (M, N)
a = a[None, :, :, :]
b = b[:, None, :, :]
score = sco... | null |
13,411 | import os
import sys
from os.path import join
import re
import json
import time
import scipy.io as scio
import numpy as np
from tqdm import tqdm
def convert_openpose_shelf1(keypoints3d):
shelf15 = np.zeros((15, 4))
openpose2shelf = np.array([11, 10, 9, 12, 13, 14, 4, 3, 2, 5, 6, 7, 1, 0, 8])
shelf15 = keypo... | null |
13,412 | from glob import glob
from tqdm import tqdm
from os.path import join
import os
import numpy as np
from easymocap.dataset import CONFIG
from easymocap.mytools.reader import read_keypoints3d
from easymocap.mytools import read_camera
from eval_utils import keypoints_error
from pprint import pprint
class Conversion:
de... | null |
13,413 | from glob import glob
from tqdm import tqdm
from os.path import join
import os
import numpy as np
from easymocap.dataset import CONFIG
from easymocap.mytools.reader import read_keypoints3d
from easymocap.mytools import read_camera
from eval_utils import keypoints_error
from pprint import pprint
class Conversion:
de... | null |
13,414 | import numpy as np
def compute_similarity_transform(S1, S2):
"""
Computes a similarity transform (sR, t) that takes
a set of 3D points S1 (3 x N) closest to a set of 3D points S2,
where R is an 3x3 rotation matrix, t 3x1 translation, s scale.
i.e. solves the orthogonal Procrutes problem.
"""
... | Do Procrustes alignment and compute reconstruction error. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.