Skip to content

Commit

Permalink
Remove references to deprecated NumPy type aliases
Browse files Browse the repository at this point in the history
This change replaces references to a number of deprecated NumPy type
aliases (np.bool, np.int, np.float, np.complex, np.object, np.str)
with their recommended replacement
(bool, int, float, complex, object, str).

NumPy 1.24 drops the deprecated aliases
so we must remove uses before updating NumPy.

Change-Id: I9f5dfcbb11fe6534fce358054f210c7653f278c3
  • Loading branch information
jeromejj committed Dec 21, 2022
1 parent e022d5b commit 1115194
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tools/3D-Reconstruction/MotionEST/Exhaust.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self, cur_f, ref_f, blk_size, wnd_size, beta, metric=MSE):
self.beta = beta
self.metric = metric
super(ExhaustNeighbor, self).__init__(cur_f, ref_f, blk_size)
self.assign = np.zeros((self.num_row, self.num_col), dtype=np.bool)
self.assign = np.zeros((self.num_row, self.num_col), dtype=bool)

"""
estimate neighbor loss:
Expand Down
4 changes: 2 additions & 2 deletions tools/3D-Reconstruction/MotionEST/GroundTruth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GroundTruth(MotionEST):
def __init__(self, cur_f, ref_f, blk_sz, gt_path, mf=None, mask=None):
self.name = 'ground truth'
super(GroundTruth, self).__init__(cur_f, ref_f, blk_sz)
self.mask = np.zeros((self.num_row, self.num_col), dtype=np.bool)
self.mask = np.zeros((self.num_row, self.num_col), dtype=bool)
if gt_path:
with open(gt_path) as gt_file:
lines = gt_file.readlines()
Expand All @@ -42,7 +42,7 @@ def __init__(self, cur_f, ref_f, blk_sz, gt_path, mf=None, mask=None):
self.mask[i, -j - 1] = True
continue
#the order of original file is flipped on the x axis
self.mf[i, -j - 1] = np.array([float(y), -float(x)], dtype=np.int)
self.mf[i, -j - 1] = np.array([float(y), -float(x)], dtype=int)
else:
self.mf = mf
self.mask = mask
4 changes: 2 additions & 2 deletions tools/3D-Reconstruction/MotionEST/MotionEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def __init__(self, cur_f, ref_f, blk_sz):
self.ref_f = ref_f
self.blk_sz = blk_sz
#convert RGB to YUV
self.cur_yuv = np.array(self.cur_f.convert('YCbCr'), dtype=np.int)
self.ref_yuv = np.array(self.ref_f.convert('YCbCr'), dtype=np.int)
self.cur_yuv = np.array(self.cur_f.convert('YCbCr'), dtype=int)
self.ref_yuv = np.array(self.ref_f.convert('YCbCr'), dtype=int)
#frame size
self.width = self.cur_f.size[0]
self.height = self.cur_f.size[1]
Expand Down
2 changes: 1 addition & 1 deletion tools/3D-Reconstruction/MotionEST/Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def MSE(blk1, blk2):
return np.mean(
LA.norm(
np.array(blk1, dtype=np.int) - np.array(blk2, dtype=np.int), axis=2))
np.array(blk1, dtype=int) - np.array(blk2, dtype=int), axis=2))


def drawMF(img, blk_sz, mf):
Expand Down

0 comments on commit 1115194

Please sign in to comment.