Update DeepFace.py

model type check
This commit is contained in:
Sefik Ilkin Serengil 2023-12-18 12:06:49 +00:00 committed by GitHub
parent 19f7cf620d
commit 0c0dfb8090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -743,7 +743,8 @@ def represent(
img = functions.normalize_input(img=img, normalization=normalization)
# represent
if "keras" in str(type(model)):
# if "keras" in str(type(model)):
if isinstance(model, Model):
# model.predict causes memory issue when it is called in a for loop
# embedding = model.predict(img, verbose=0)[0].tolist()
embedding = model(img, training=False).numpy()[0].tolist()