From 9a9670da293329102cef6a6e33018d18cfaa1d46 Mon Sep 17 00:00:00 2001 From: wangna11BD <79366697+wangna11BD@users.noreply.github.com> Date: Wed, 1 Feb 2023 13:46:21 +0800 Subject: [PATCH] fix bug (#737) * fix DLTP-61461 * fix install --- data/realsr_preprocess/imresize.py | 2 +- ppgan/faceutils/face_detection/utils.py | 2 +- ppgan/models/generators/generator_starganv2.py | 8 ++++---- requirements.txt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/realsr_preprocess/imresize.py b/data/realsr_preprocess/imresize.py index 02fa92a..6d61bc7 100644 --- a/data/realsr_preprocess/imresize.py +++ b/data/realsr_preprocess/imresize.py @@ -218,7 +218,7 @@ def kernel_shift(kernel, sf): # Before applying the shift, we first pad the kernel so that nothing is lost due to the shift # (biggest shift among dims + 1 for safety) - kernel = np.pad(kernel, np.int(np.ceil(np.max(shift_vec))) + 1, 'constant') + kernel = np.pad(kernel, np.int_(np.ceil(np.max(shift_vec))) + 1, 'constant') # Finally shift the kernel and return return interpolation.shift(kernel, shift_vec) diff --git a/ppgan/faceutils/face_detection/utils.py b/ppgan/faceutils/face_detection/utils.py index 6590f96..570b2c2 100644 --- a/ppgan/faceutils/face_detection/utils.py +++ b/ppgan/faceutils/face_detection/utils.py @@ -59,7 +59,7 @@ def crop(image, center, scale, resolution=256.0): dtype=np.int32) newImg = np.zeros(newDim, dtype=np.uint8) else: - newDim = np.array([br[1] - ul[1], br[0] - ul[0]], dtype=np.int) + newDim = np.array([br[1] - ul[1], br[0] - ul[0]], dtype=np.int_) newImg = np.zeros(newDim, dtype=np.uint8) ht = image.shape[0] wd = image.shape[1] diff --git a/ppgan/models/generators/generator_starganv2.py b/ppgan/models/generators/generator_starganv2.py index e5bbce0..636df79 100755 --- a/ppgan/models/generators/generator_starganv2.py +++ b/ppgan/models/generators/generator_starganv2.py @@ -240,8 +240,8 @@ class StarGANv2Mapping(nn.Layer): s = [] for i in range(idx.shape[0]): s += [ - out[idx[i].numpy().astype(np.int).tolist()[0], - y[i].numpy().astype(np.int).tolist()[0]] + out[idx[i].numpy().astype(np.int_).tolist()[0], + y[i].numpy().astype(np.int_).tolist()[0]] ] s = paddle.stack(s) s = paddle.reshape(s, (s.shape[0], -1)) @@ -286,8 +286,8 @@ class StarGANv2Style(nn.Layer): s = [] for i in range(idx.shape[0]): s += [ - out[idx[i].numpy().astype(np.int).tolist()[0], - y[i].numpy().astype(np.int).tolist()[0]] + out[idx[i].numpy().astype(np.int_).tolist()[0], + y[i].numpy().astype(np.int_).tolist()[0]] ] s = paddle.stack(s) s = paddle.reshape(s, (s.shape[0], -1)) diff --git a/requirements.txt b/requirements.txt index 8b072c6..6eeab89 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,11 +2,11 @@ tqdm PyYAML>=5.1 scikit-image>=0.14.0 scipy>=1.1.0 -opencv-python <= 4.6.0 +opencv-python==4.6.0.66 imageio==2.9.0 imageio-ffmpeg librosa==0.8.1 -numba==0.53.1 +numba easydict munch natsort -- GitLab