From 272469421bb5d7773d966a7150ff4f9be943a7ed Mon Sep 17 00:00:00 2001 From: "Longhao.Chen" Date: Wed, 10 Aug 2022 01:00:52 +0800 Subject: [PATCH] Fix Attribute Error with Keras 'img_to_array' in Keras 2.9.0 --- fawkes/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fawkes/utils.py b/fawkes/utils.py index 07ccf36..5f284a0 100644 --- a/fawkes/utils.py +++ b/fawkes/utils.py @@ -35,7 +35,7 @@ from PIL import Image, ExifTags from keras.layers import Dense, Activation from keras.models import Model -from keras.preprocessing import image +from keras.utils import image_utils as image from fawkes.align_face import align from six.moves.urllib.request import urlopen @@ -263,7 +263,7 @@ def load_victim_model(number_classes, teacher_model=None, end2end=False): def resize(img, sz): assert np.min(img) >= 0 and np.max(img) <= 255.0 - from keras.preprocessing import image + from keras.utils import image_utils as image im_data = image.array_to_img(img).resize((sz[1], sz[0])) im_data = image.img_to_array(im_data) return im_data