2
0
mirror of https://github.com/Shawn-Shan/fawkes.git synced 2024-09-20 07:26:37 +05:30

Fix Attribute Error with Keras 'img_to_array' in Keras 2.9.0

This commit is contained in:
Longhao.Chen 2022-08-10 01:00:52 +08:00 committed by GitHub
parent aedaa82d22
commit 272469421b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ import tensorflow as tf
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