Skip to content

Commit

Permalink
Merge pull request #27 from sbelharbi/main
Browse files Browse the repository at this point in the history
support numpy >= 1.20.0
  • Loading branch information
choyingw committed Mar 28, 2023
2 parents d34e4af + 49438d6 commit 5fe2e72
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion FaceBoxes/utils/nms/cpu_nms.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh):

cdef int ndets = dets.shape[0]
cdef np.ndarray[np.int_t, ndim=1] suppressed = \
np.zeros((ndets), dtype=np.int)
np.zeros((ndets), dtype=np.int64)

# nominal indices
cdef int _i, _j
Expand Down
6 changes: 3 additions & 3 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def benchmark_aflw2000_params(params, data_param):
#plot the first 50 samples for validation
bkg = cv2.imread(img_list[i*batch_size+j],-1)
lm_sample = lm[j]
c0 = np.clip((lm_sample[1,:]).astype(np.int), 0, 119)
c1 = np.clip((lm_sample[0,:]).astype(np.int), 0, 119)
c0 = np.clip((lm_sample[1,:]).astype(np.int64), 0, 119)
c1 = np.clip((lm_sample[0,:]).astype(np.int64), 0, 119)
for y, x, in zip([c0,c0,c0-1,c0-1],[c1,c1-1,c1,c1-1]):
bkg[y, x, :] = np.array([233,193,133])
cv2.imwrite(f'./results/{i*batch_size+j}.png', bkg)
Expand Down Expand Up @@ -253,4 +253,4 @@ def main():


if __name__ == '__main__':
main()
main()
6 changes: 3 additions & 3 deletions model_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class SynergyNet(nn.Module):
def __init__(self, args):
super(SynergyNet, self).__init__()
self.triangles = sio.loadmat('./3dmm_data/tri.mat')['tri'] -1
self.triangles = torch.Tensor(self.triangles.astype(np.int)).long().cuda()
self.triangles = torch.Tensor(self.triangles.astype(np.int64)).long().cuda()
self.img_size = args.img_size
# Image-to-parameter
self.I2P = I2P(args)
Expand Down Expand Up @@ -170,7 +170,7 @@ class WrapUpSynergyNet(nn.Module):
def __init__(self):
super(WrapUpSynergyNet, self).__init__()
self.triangles = sio.loadmat('./3dmm_data/tri.mat')['tri'] -1
self.triangles = torch.Tensor(self.triangles.astype(np.int)).long()
self.triangles = torch.Tensor(self.triangles.astype(np.int64)).long()
args = types.SimpleNamespace()
args.arch = 'mobilenet_v2'
args.checkpoint_fp = 'pretrained/best.pth.tar'
Expand Down Expand Up @@ -306,4 +306,4 @@ def get_all_outputs(self, input):
return pts_res, vertices_lst, poses

if __name__ == '__main__':
pass
pass
4 changes: 2 additions & 2 deletions synergy3DMM.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SynergyNet(nn.Module):
def __init__(self):
super(SynergyNet, self).__init__()
self.triangles = sio.loadmat(os.path.join(prefix_path, '3dmm_data/tri.mat'))['tri'] -1
self.triangles = torch.Tensor(self.triangles.astype(np.int)).long()
self.triangles = torch.Tensor(self.triangles.astype(np.int64)).long()
args = types.SimpleNamespace()
args.arch = 'mobilenet_v2'
args.checkpoint_fp = os.path.join(prefix_path, 'pretrained/best.pth.tar')
Expand Down Expand Up @@ -207,4 +207,4 @@ def get_all_outputs(self, input):
return pts_res, vertices_lst, poses

if __name__ == '__main__':
pass
pass

0 comments on commit 5fe2e72

Please sign in to comment.