Merge pull request #269 from peabody124/numpy_int_fix

Replace np.int with int given the deprecation
This commit is contained in:
Qing Shuai 2023-02-11 20:55:31 +08:00 committed by GitHub
commit 95693f7d33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 17 deletions

View File

@ -52,7 +52,7 @@ def load_cube():
[1, 5], [1, 5],
[2, 6], [2, 6],
[3, 7] [3, 7]
], dtype=np.int) ], dtype=int)
points3d = np.hstack((points3d, np.ones((points3d.shape[0], 1)))) points3d = np.hstack((points3d, np.ones((points3d.shape[0], 1))))
return points3d, lines return points3d, lines
@ -100,7 +100,7 @@ def load_axes():
[0,1], [0,1],
[0,2], [0,2],
[0,3] [0,3]
], dtype=np.int) ], dtype=int)
points3d = np.hstack((points3d, np.ones((points3d.shape[0], 1)))) points3d = np.hstack((points3d, np.ones((points3d.shape[0], 1))))
return points3d, lines return points3d, lines

View File

@ -13,7 +13,7 @@ def getDimGroups(lDetections):
dimGroups = [0] dimGroups = [0]
for data in lDetections: for data in lDetections:
dimGroups.append(dimGroups[-1] + len(data)) dimGroups.append(dimGroups[-1] + len(data))
views = np.zeros(dimGroups[-1], dtype=np.int) views = np.zeros(dimGroups[-1], dtype=int)
for nv in range(len(dimGroups) - 1): for nv in range(len(dimGroups) - 1):
views[dimGroups[nv]:dimGroups[nv+1]] = nv views[dimGroups[nv]:dimGroups[nv+1]] = nv
return dimGroups, views return dimGroups, views

View File

@ -10,7 +10,7 @@ from ..mytools.reconstruction import batch_triangulate, projectN3
from ..config import load_object from ..config import load_object
def views_from_dimGroups(dimGroups): def views_from_dimGroups(dimGroups):
views = np.zeros(dimGroups[-1], dtype=np.int) views = np.zeros(dimGroups[-1], dtype=int)
for nv in range(len(dimGroups) - 1): for nv in range(len(dimGroups) - 1):
views[dimGroups[nv]:dimGroups[nv+1]] = nv views[dimGroups[nv]:dimGroups[nv+1]] = nv
return views return views
@ -42,8 +42,8 @@ def simple_associate(annots, affinity, dimGroups, Pall, group, cfg):
views_cnt[:, nv] = affinity[:, dimGroups[nv]:dimGroups[nv+1]].sum(axis=1) views_cnt[:, nv] = affinity[:, dimGroups[nv]:dimGroups[nv+1]].sum(axis=1)
views_cnt = (views_cnt>0.5).sum(axis=1) views_cnt = (views_cnt>0.5).sum(axis=1)
sortidx = np.argsort(-views_cnt) sortidx = np.argsort(-views_cnt)
p2dAssigned = np.zeros(n2D, dtype=np.int) - 1 p2dAssigned = np.zeros(n2D, dtype=int) - 1
indices_zero = np.zeros((nViews), dtype=np.int) - 1 indices_zero = np.zeros((nViews), dtype=int) - 1
for idx in sortidx: for idx in sortidx:
if p2dAssigned[idx] != -1: if p2dAssigned[idx] != -1:
continue continue

View File

@ -15,7 +15,7 @@ FLIP_BODYHAND = [
0,1,5,6,7,2,3,4,8,12,13,14,9,10,11,16,15,18,17,22,23,24,19,20,21, # body 25 0,1,5,6,7,2,3,4,8,12,13,14,9,10,11,16,15,18,17,22,23,24,19,20,21, # body 25
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, # right hand 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, # right hand
] ]
FLIP_SMPL_VERTICES = np.loadtxt(join(os.path.dirname(__file__), 'smpl_vert_sym.txt'), dtype=np.int) FLIP_SMPL_VERTICES = np.loadtxt(join(os.path.dirname(__file__), 'smpl_vert_sym.txt'), dtype=int)
def flipPoint2D(point): def flipPoint2D(point):
if point.shape[-2] == 25: if point.shape[-2] == 25:

View File

@ -208,7 +208,7 @@ class BaseBody:
parents = body_model.parents[1:].cpu().numpy() parents = body_model.parents[1:].cpu().numpy()
child = np.arange(1, parents.shape[0]+1, dtype=np.int64) child = np.arange(1, parents.shape[0]+1, dtype=np.int64)
self.kintree = np.stack([parents, child], axis=1) self.kintree = np.stack([parents, child], axis=1)
self.parents = np.zeros(parents.shape[0]+1, dtype=np.int) - 1 self.parents = np.zeros(parents.shape[0]+1, dtype=int) - 1
self.parents[self.kintree[:, 1]] = self.kintree[:, 0] self.parents[self.kintree[:, 1]] = self.kintree[:, 0]
self.rootIdx = 0 self.rootIdx = 0
self.time = time() self.time = time()
@ -490,7 +490,7 @@ class MyFilter:
value_mean = (value_pre * conf_pre).sum(axis=0)/(conf_sum + 1e-5) value_mean = (value_pre * conf_pre).sum(axis=0)/(conf_sum + 1e-5)
self.x = value_mean self.x = value_mean
self.x_conf = conf_sum self.x_conf = conf_sum
t_prev = np.zeros_like(self.x, dtype=np.int) - 1 t_prev = np.zeros_like(self.x, dtype=int) - 1
t_prev[conf_sum>0] = self.counter t_prev[conf_sum>0] = self.counter
self.t_prev = t_prev self.t_prev = t_prev
# 零速度初始化 # 零速度初始化

View File

@ -385,7 +385,7 @@ def check_cluster(affinity, row, views, dimGroups, indices, p2dAssigned, visited
return indices_all return indices_all
def views_from_dimGroups(dimGroups): def views_from_dimGroups(dimGroups):
views = np.zeros(dimGroups[-1], dtype=np.int) views = np.zeros(dimGroups[-1], dtype=int)
for nv in range(len(dimGroups) - 1): for nv in range(len(dimGroups) - 1):
views[dimGroups[nv]:dimGroups[nv+1]] = nv views[dimGroups[nv]:dimGroups[nv+1]] = nv
return views return views
@ -462,11 +462,11 @@ class SimpleMatchAndTriangulator(SimpleTriangulator):
sum1 += affinity[:, start:end].max(axis=-1) sum1 += affinity[:, start:end].max(axis=-1)
n2d = affinity.shape[0] n2d = affinity.shape[0]
nViews = len(dimGroups) - 1 nViews = len(dimGroups) - 1
idx_zero = np.zeros(nViews, dtype=np.int) - 1 idx_zero = np.zeros(nViews, dtype=int) - 1
views = views_from_dimGroups(dimGroups) views = views_from_dimGroups(dimGroups)
# the assigned results of each person # the assigned results of each person
p2dAssigned = np.zeros(n2d, dtype=np.int) - 1 p2dAssigned = np.zeros(n2d, dtype=int) - 1
visited = np.zeros(n2d, dtype=np.int) visited = np.zeros(n2d, dtype=int)
sortidx = np.argsort(-sum1) sortidx = np.argsort(-sum1)
pid = 0 pid = 0
k3dresults = [] k3dresults = []

View File

@ -26,7 +26,7 @@ def optimizeShape(body_model, body_params, keypoints3d,
""" """
device = body_model.device device = body_model.device
# 计算不同的骨长 # 计算不同的骨长
kintree = np.array(kintree, dtype=np.int) kintree = np.array(kintree, dtype=int)
# limb_length: nFrames, nLimbs, 1 # limb_length: nFrames, nLimbs, 1
limb_length = np.linalg.norm(keypoints3d[:, kintree[:, 1], :3] - keypoints3d[:, kintree[:, 0], :3], axis=2, keepdims=True) limb_length = np.linalg.norm(keypoints3d[:, kintree[:, 1], :3] - keypoints3d[:, kintree[:, 0], :3], axis=2, keepdims=True)
# conf: nFrames, nLimbs, 1 # conf: nFrames, nLimbs, 1

View File

@ -13,13 +13,13 @@ from os.path import join
def load_sphere(): def load_sphere():
cur_dir = os.path.dirname(__file__) cur_dir = os.path.dirname(__file__)
faces = np.loadtxt(join(cur_dir, 'sphere_faces_20.txt'), dtype=np.int) faces = np.loadtxt(join(cur_dir, 'sphere_faces_20.txt'), dtype=int)
vertices = np.loadtxt(join(cur_dir, 'sphere_vertices_20.txt')) vertices = np.loadtxt(join(cur_dir, 'sphere_vertices_20.txt'))
return vertices, faces return vertices, faces
def load_cylinder(): def load_cylinder():
cur_dir = os.path.dirname(__file__) cur_dir = os.path.dirname(__file__)
faces = np.loadtxt(join(cur_dir, 'cylinder_faces_20.txt'), dtype=np.int) faces = np.loadtxt(join(cur_dir, 'cylinder_faces_20.txt'), dtype=int)
vertices = np.loadtxt(join(cur_dir, 'cylinder_vertices_20.txt')) vertices = np.loadtxt(join(cur_dir, 'cylinder_vertices_20.txt'))
return vertices, faces return vertices, faces

View File

@ -50,7 +50,7 @@ class SkelModel:
self.body_type = body_type self.body_type = body_type
self.device = 'none' self.device = 'none'
cur_dir = os.path.dirname(__file__) cur_dir = os.path.dirname(__file__)
faces = np.loadtxt(join(cur_dir, 'assets', 'sphere_faces_{}.txt'.format(res)), dtype=np.int) faces = np.loadtxt(join(cur_dir, 'assets', 'sphere_faces_{}.txt'.format(res)), dtype=int)
self.vertices = np.loadtxt(join(cur_dir, 'assets', 'sphere_vertices_{}.txt'.format(res))) self.vertices = np.loadtxt(join(cur_dir, 'assets', 'sphere_vertices_{}.txt'.format(res)))
# compose faces # compose faces
faces_all = [] faces_all = []