id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
180,811 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def save_mesh_to_obj(obj_path, verts, faces=None):
assert isinstance(verts, np.ndarray)
assert isinstance(faces, np.ndarray)
with open(obj_path, 'w') as out_f:
# write ... | null |
180,812 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def renew_dir(target_dir):
if osp.exists(target_dir):
shutil.rmtree(target_dir)
os.makedirs(target_dir) | null |
180,813 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def update_extension(file_path, new_extension):
assert new_extension[0] == '.'
old_extension = '.' + file_path.split('.')[-1]
new_file_path = file_path.replace(old_extension, ne... | null |
180,814 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def remove_swp(in_dir):
remove_files = list()
for subdir, dirs, files in os.walk(in_dir):
for file in files:
if file.endswith('.swp'):
full_path ... | null |
180,815 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def remove_pyc(in_dir):
remove_files = list()
for subdir, dirs, files in os.walk(in_dir):
for file in files:
if file.endswith('.pyc'):
full_path ... | null |
180,816 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def md5sum(file_path):
import hashlib
hash_md5 = hashlib.md5()
with open(file_path, 'rb') as in_f:
hash_md5.update(in_f.read())
return hash_md5.hexdigest() | null |
180,817 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def load_npz(npz_file):
res_data = dict()
assert npz_file.endswith(".npz")
raw_data = np.load(npz_file, mmap_mode='r')
for key in raw_data.files:
res_data[key] = raw... | null |
180,818 | import os, sys, shutil
import os.path as osp
import multiprocessing as mp
import numpy as np
import cv2
import pickle
import json
def update_npz_file(npz_file, new_key, new_data):
# load original data
assert npz_file.endswith(".npz")
raw_data = np.load(npz_file, mmap_mode='r')
all_data = dict()
for... | null |
180,819 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
def flip_hand_pose(pose):
if len(pose.shape) == 1:
pose = pose.reshape(-1, 3)
pose[:, 1] *= -1
pose[:, 2] *= -1
return pose.reshape(-1,)
else:
assert len(pose.shape) == 2
pose[:, 1]... | null |
180,820 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
def flip_hand_joints_3d(joints_3d):
assert joints_3d.shape[1] == 3
assert len(joints_3d.shape) == 2
rot_mat = np.diag([-1, 1, 1])
return np.matmul(rot_mat, joints_3d.T).T | null |
180,821 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
pi = torch.Tensor([3.14159265358979323846])
The provided code snippet includes necessary dependencies for implementing the `rad2deg` function. Write a Python function `def rad2deg(tensor)` to solve the following problem:
r"""Function tha... | r"""Function that converts angles from radians to degrees. See :class:`~torchgeometry.RadToDeg` for details. Args: tensor (Tensor): Tensor of arbitrary shape. Returns: Tensor: Tensor with same shape as input. Example: >>> input = tgm.pi * torch.rand(1, 3, 3) >>> output = tgm.rad2deg(input) |
180,822 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
pi = torch.Tensor([3.14159265358979323846])
The provided code snippet includes necessary dependencies for implementing the `deg2rad` function. Write a Python function `def deg2rad(tensor)` to solve the following problem:
r"""Function tha... | r"""Function that converts angles from degrees to radians. See :class:`~torchgeometry.DegToRad` for details. Args: tensor (Tensor): Tensor of arbitrary shape. Returns: Tensor: Tensor with same shape as input. Examples:: >>> input = 360. * torch.rand(1, 3, 3) >>> output = tgm.deg2rad(input) |
180,823 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
The provided code snippet includes necessary dependencies for implementing the `convert_points_from_homogeneous` function. Write a Python function `def convert_points_from_homogeneous(points)` to solve the following problem:
r"""Function... | r"""Function that converts points from homogeneous to Euclidean space. See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tgm.convert_points_from_homogeneous(input) # BxNx2 |
180,824 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
The provided code snippet includes necessary dependencies for implementing the `convert_points_to_homogeneous` function. Write a Python function `def convert_points_to_homogeneous(points)` to solve the following problem:
r"""Function tha... | r"""Function that converts points from Euclidean to homogeneous space. See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tgm.convert_points_to_homogeneous(input) # BxNx4 |
180,825 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
def angle_axis_to_rotation_matrix(angle_axis):
"""Convert 3d vector of axis-angle rotation to 4x4 rotation matrix
Args:
angle_axis (Tensor): tensor of 3d vector of axis-angle rotations.
Returns:
Tensor: tensor ... | Convert axis-angle rotation and translation vector to 4x4 pose matrix Args: rtvec (Tensor): Rodrigues vector transformations Returns: Tensor: transformation matrices Shape: - Input: :math:`(N, 6)` - Output: :math:`(N, 4, 4)` Example: >>> input = torch.rand(3, 6) # Nx6 >>> output = tgm.rtvec_to_pose(input) # Nx4x4 |
180,826 | import torch
import torch.nn as nn
import numpy as np
import torchgeometry as tgm
def rotation_matrix_to_angle_axis(rotation_matrix):
"""Convert 3x4 rotation matrix to Rodrigues vector
Args:
rotation_matrix (Tensor): rotation matrix.
Returns:
Tensor: Rodrigues vector transformation.
Shap... | init_pred_rotmat: torch.tensor with (1, N,3,3) dimension output: (1, N,3) |
180,827 | import sys
import torch
import numpy as np
import scipy.misc
import cv2
from torchvision.transforms import Normalize
def convert_smpl_to_bbox_perspective(data3D, scale_ori, trans_ori, focalLeng, scaleFactor=1.0):
data3D = data3D.copy()
resnet_input_size_half = 224 *0.5
scale = scale_ori* resnet_input_size... | null |
180,828 | import sys
import torch
import numpy as np
import scipy.misc
import cv2
from torchvision.transforms import Normalize
The provided code snippet includes necessary dependencies for implementing the `bbox_from_openpose` function. Write a Python function `def bbox_from_openpose(openpose_file, rescale=1.2, detection_thresh... | Get center and scale for bounding box from openpose detections. |
180,829 | import sys
import torch
import numpy as np
import scipy.misc
import cv2
from torchvision.transforms import Normalize
The provided code snippet includes necessary dependencies for implementing the `bbox_from_keypoint2d` function. Write a Python function `def bbox_from_keypoint2d(keypoints, rescale=1.2, detection_thresh... | output: center: bbox center scale: scale_n2o: 224x224 -> original bbox size (max length if not a square bbox) |
180,830 | import sys
import torch
import numpy as np
import scipy.misc
import cv2
from torchvision.transforms import Normalize
The provided code snippet includes necessary dependencies for implementing the `bbox_from_keypoints` function. Write a Python function `def bbox_from_keypoints(keypoints, rescale=1.2, detection_thresh=0... | Get center and scale for bounding box from openpose detections. |
180,831 | import sys
import torch
import numpy as np
import scipy.misc
import cv2
from torchvision.transforms import Normalize
The provided code snippet includes necessary dependencies for implementing the `bbox_from_bbr` function. Write a Python function `def bbox_from_bbr(bbox_XYWH, rescale=1.2, detection_thresh=0.2, imageHei... | Get center and scale for bounding box from openpose detections. |
180,832 | import sys
import torch
import numpy as np
import scipy.misc
import cv2
from torchvision.transforms import Normalize
The provided code snippet includes necessary dependencies for implementing the `bbox_from_json` function. Write a Python function `def bbox_from_json(bbox_file)` to solve the following problem:
Get cent... | Get center and scale of bounding box from bounding box annotations. The expected format is [top_left(x), top_left(y), width, height]. |
180,833 | import os, sys, shutil
import os.path as osp
import numpy as np
import torch
from torch.nn import functional as F
import cv2
import numpy.matlib as npm
import mocap_utils.geometry_utils_torch as gut
def flip_hand_pose(pose):
pose = pose.copy()
if len(pose.shape) == 1:
pose = pose.reshape(-1, 3)
... | null |
180,834 | import os, sys, shutil
import os.path as osp
import numpy as np
import torch
from torch.nn import functional as F
import cv2
import numpy.matlib as npm
import mocap_utils.geometry_utils_torch as gut
def flip_hand_joints_3d(joints_3d):
assert joints_3d.shape[1] == 3
assert len(joints_3d.shape) == 2
rot_mat ... | null |
180,835 | import os, sys, shutil
import os.path as osp
import numpy as np
import torch
from torch.nn import functional as F
import cv2
import numpy.matlib as npm
import mocap_utils.geometry_utils_torch as gut
The provided code snippet includes necessary dependencies for implementing the `rot6d_to_rotmat` function. Write a Pytho... | 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 |
180,836 | import os, sys, shutil
import os.path as osp
import numpy as np
import torch
from torch.nn import functional as F
import cv2
import numpy.matlib as npm
import mocap_utils.geometry_utils_torch as gut
def angle_axis_to_rotation_matrix(angle_axis):
aa = angle_axis
if isinstance(aa, torch.Tensor):
return __... | null |
180,837 | import cv2
import numpy as np
def draw_bbox(image, bbox, color=(0,0,255), thickness=3):
x0, y0 = int(bbox[0]), int(bbox[1])
x1, y1 = int(bbox[2]), int(bbox[3])
res_img = cv2.rectangle(image.copy(), (x0,y0), (x1,y1), color=color, thickness=thickness)
return res_img.astype(np.uint8)
def draw_raw_bbox(img... | null |
180,838 | import cv2
import numpy as np
def draw_bbox(image, bbox, color=(0,0,255), thickness=3):
x0, y0 = int(bbox[0]), int(bbox[1])
x1, y1 = int(bbox[2]), int(bbox[3])
res_img = cv2.rectangle(image.copy(), (x0,y0), (x1,y1), color=color, thickness=thickness)
return res_img.astype(np.uint8)
def draw_body_bbox(im... | null |
180,839 | import cv2
import numpy as np
def draw_keypoints(image, kps, color=(0,0,255), radius=5, check_exist=False):
# recover color
if color == 'red':
color = (0, 0, 255)
elif color == 'green':
color = (0, 255, 0)
elif color == 'blue':
color = (255, 0, 0)
else:
assert isinst... | null |
180,840 | import cv2
import numpy as np
def draw_bbox(image, bbox, color=(0,0,255), thickness=3):
x0, y0 = int(bbox[0]), int(bbox[1])
x1, y1 = int(bbox[2]), int(bbox[3])
res_img = cv2.rectangle(image.copy(), (x0,y0), (x1,y1), color=color, thickness=thickness)
return res_img.astype(np.uint8)
def draw_hand_bbox(im... | null |
180,841 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
g_ambientLight = (0.35, 0.35, 0.35, 1.0)
g_d... | null |
180,842 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
g_xTrans = 0.
g_yTrans = 0.
g_zTrans = 0.
g_... | null |
180,843 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_camView_K = ... | null |
180,844 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
g_bOrthoCam = False
from collections imp... | null |
180,845 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_renderOutput... | null |
180,846 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_cameraPoses ... | null |
180,847 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_ptCloud =Non... | null |
180,848 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_meshColor = ... | null |
180,849 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_bApplyRootOf... | null |
180,850 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,851 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,852 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,853 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
HOLDEN_DATA_SC... | null |
180,854 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_speech = Non... | null |
180,855 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_speechGT = N... | null |
180,856 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_speechGT = N... | null |
180,857 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_faces = None... | null |
180,858 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_posOnly = No... | null |
180,859 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,860 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_skeletons = ... | null |
180,861 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_skeletons = ... | null |
180,862 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_frameLimit =... | null |
180,863 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_meshes = Non... | null |
180,864 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_meshes = Non... | null |
180,865 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,866 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,867 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,868 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,869 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_meshes = Non... | null |
180,870 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_bSaveOnlyMod... | null |
180,871 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_bSaveToFile ... | null |
180,872 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,873 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
g_zoom = 600.
from collections import deque
... | null |
180,874 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_saveImageNam... | null |
180,875 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_saveImageNam... | null |
180,876 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
g_bShowBackgro... | null |
180,877 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
from collections import deque
import timeit
... | null |
180,878 | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import json
import numpy as np
from PIL import Image, ImageOps
import cv2
import numpy as np
import sys, math
import threading
import time
import pickle
from renderer.render_utils import ComputeNormal
g_nearPlane = 0.01
from collections i... | null |
180,879 | import numpy as np
def ComputeNormal_gpu(vertices, trifaces):
import torch
import torch.nn.functional as F
if vertices.shape[0] > 5000:
print('ComputeNormal: Warning: too big to compute {0}'.format(vertices.shape) )
return
#compute vertex Normals for all frames
#trifaces_cuda = to... | null |
180,880 | import os
from OpenGL.GL import *
def findFileOrThrow(strBasename):
def loadShader(shaderType, shaderFile):
# check if file exists, get full path name
strFilename = findFileOrThrow(shaderFile)
shaderData = None
with open(strFilename, 'r') as f:
shaderData = f.read()
shader = glCreateShader... | null |
180,881 | import os
from OpenGL.GL import *
def createProgram(shaderList):
program = glCreateProgram()
for shader in shaderList:
glAttachShader(program, shader)
glLinkProgram(program)
status = glGetProgramiv(program, GL_LINK_STATUS)
if status == GL_FALSE:
# Note that getting the error log ... | null |
180,882 | import numpy as np
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
from renderer.shaders.framework import createProgram, loadShader
from renderer.render_utils import ComputeNormal
import cv2
The provided code snippet includes necessary dependencies for implementing the `loadSMPL` function. W... | Converting SMPL parameters to vertices |
180,883 | import sys
import numpy as np
import cv2
import pdb
from PIL import Image, ImageDraw
from opendr.camera import ProjectPoints
from opendr.renderer import ColoredRenderer
from opendr.lighting import LambertianPointLight
def _create_renderer(w=640,
h=480,
rt=np.zeros(3),
... | null |
180,884 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def __ValidateNumpyImg(inputImg):
veryFirstImShow = True
def ImgSC(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
minVal = np.min(inputImg)
maxVal = np.max(inputImg)
#resc... | null |
180,885 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Bbox_XYXY(inputImg, bbox_xyxy, color=None):
#draw biggest bbox
pt1 = ( int(bbox_xyxy[0]),int(bbox_xyxy[1]) )
pt2 = (int(bbox_xyxy[2]),int(bbox_xyxy[3]) )
if color is None:
color = (0,0,255)
cv2.rectangle(inputImg... | null |
180,886 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def __ValidateNumpyImg(inputImg):
if isinstance(inputImg, Image):
# inputImg = cv2.cvtColor(np.array(inputImg), cv2.COLOR_RGB2BGR)
inputImg = np.array(inputImg)
return inputImg #Q? is this copying someting (wasting memory o... | null |
180,887 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def __ValidateNumpyImg(inputImg):
def Vis_CocoSkeleton(keypoints, image=None):
# def Vis_CocoSkeleton(inputImg, coco_annot):
if not isinstance(image, np.ndarray):#not image: #If no image is given, generate Blank image
image = np.ones((10... | null |
180,888 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def __ValidateNumpyImg(inputImg):
if isinstance(inputImg, Image):
# inputImg = cv2.cvtColor(np.array(inputImg), cv2.COLOR_RGB2BGR)
inputImg = np.array(inputImg)
return inputImg #Q? is this copying someting (wasting memory o... | null |
180,889 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Skeleton_2D_H36m(pt2d, image = None, color=None):
pt2d = np.reshape(pt2d,[-1,2]) #Just in case. Make sure (32, 2)
#Draw via opencv
if not isinstance(image, np.ndarray):#not image: #If no image is given, generate Blank i... | null |
180,890 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Skeleton_2D_SMC19(pt2d, image = None, color=None):
pt2d = np.reshape(pt2d,[-1,2]) #Just in case. Make sure (32, 2)
#Draw via opencv
if not isinstance(image, np.ndarray):#not image: #If no image is given, generate Blank ... | null |
180,892 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Skeleton_2D_Hand(pt2d, image = None, color=None):
pt2d = np.reshape(pt2d,[-1,2]) #Just in case. Make sure (32, 2)
#Draw via opencv
if not isinstance(image, np.ndarray):#not image: #If no image is given, generate Blank im... | null |
180,893 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,894 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,895 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,896 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,897 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,898 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Skeleton_2D_SPIN49(pt2d, pt2d_visibility = None, image = None, bVis = False, color=None):
def Vis_Skeleton_2D_Openpose25(pt2d, pt2d_visibility = None, image = None, bVis = False, color=None):
pt2d = np.reshape(pt2d,(-1,2)) #Just ... | null |
180,899 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Skeleton_2D_Openpose_hand(pt2d, pt2d_visibility = None, image = None, bVis = False, color=None):
pt2d = np.reshape(pt2d,(-1,2)) #Just in case. Make sure (32, 2)
#Draw via opencv
if not isinstance(image, np.ndarray):#not ... | null |
180,900 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def Vis_Skeleton_2D_Openpose18(pt2d, pt2d_visibility = None, image = None, bVis = False, color=None):
pt2d = np.reshape(pt2d,(-1,2)) #Just in case. Make sure (32, 2)
#Draw via opencv
if not isinstance(image, np.ndarray):#not ima... | null |
180,901 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,902 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,903 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,904 | import cv2
import numpy as np
import PIL
from PIL.Image import Image
def ImShow(inputImg, waitTime=1, bConvRGB2BGR=False,name='image', scale=1.0):
inputImg = __ValidateNumpyImg(inputImg)
if scale!=1.0:
inputImg = cv2.resize(inputImg, (inputImg.shape[0]*int(scale), inputImg.shape[1]*int(scale)))
if b... | null |
180,905 | import os
import sys
import os.path as osp
import torch
import numpy as np
import cv2
import argparse
import json
import pickle
import smplx
from datetime import datetime
from demo.demo_options import DemoOptions
from bodymocap.body_mocap_api import BodyMocap
import mocap_utils.demo_utils as demo_utils
import mocap_uti... | null |
180,906 | import os
import sys
import os.path as osp
import torch
import numpy as np
import cv2
import argparse
import json
import pickle
import smplx
from datetime import datetime
from demo.demo_options import DemoOptions
from bodymocap.body_mocap_api import BodyMocap
import mocap_utils.demo_utils as demo_utils
import mocap_uti... | null |
180,907 | import os
import sys
import os.path as osp
import torch
import numpy as np
import cv2
import argparse
import json
import pickle
import smplx
from datetime import datetime
from demo.demo_options import DemoOptions
from bodymocap.body_mocap_api import BodyMocap
import mocap_utils.demo_utils as demo_utils
import mocap_uti... | null |
180,908 | import os, sys, shutil
import os.path as osp
import numpy as np
import cv2
import json
import torch
from torchvision.transforms import Normalize
from demo.demo_options import DemoOptions
import mocap_utils.general_utils as gnu
import mocap_utils.demo_utils as demo_utils
from handmocap.hand_mocap_api import HandMocap
fr... | null |
180,909 | import os
import sys
import os.path as osp
import torch
from torchvision.transforms import Normalize
import numpy as np
import cv2
import argparse
import json
import pickle
from datetime import datetime
from demo.demo_options import DemoOptions
from bodymocap.body_mocap_api import BodyMocap
from bodymocap.body_bbox_det... | null |
180,910 | import os
import sys
import os.path as osp
import torch
from torchvision.transforms import Normalize
import numpy as np
import cv2
import argparse
import json
import pickle
from demo.demo_options import DemoOptions
from bodymocap.body_mocap_api import BodyMocap
from handmocap.hand_mocap_api import HandMocap
import moca... | null |
180,911 | import torch
import torch.nn as nn
from torch.nn import init
import functools
import numpy as np
from . import resnet
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
m.weight.data.normal_(0.0, 0.02)
if hasattr(m.bias, 'data'):
m.bias.data.fill_... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.