From e09d277be9e5babc0d80a6d83ddaf61584cf8c2a Mon Sep 17 00:00:00 2001 From: danielgo13 Date: Thu, 18 Jun 2020 18:30:13 +0700 Subject: [PATCH] fix: check first the type of the input_shape before get the shape. Also fix the if-else model_name --- deepface/DeepFace.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/deepface/DeepFace.py b/deepface/DeepFace.py index 067a1b5..259bf19 100644 --- a/deepface/DeepFace.py +++ b/deepface/DeepFace.py @@ -196,7 +196,7 @@ def verify(img1_path, img2_path='' print("Using FB DeepFace model backend", distance_metric,"distance.") model = FbDeepFace.loadModel() - if model_name == 'DeepID': + elif model_name == 'DeepID': print("Using DeepID2 model backend", distance_metric,"distance.") model = DeepID.loadModel() @@ -207,8 +207,11 @@ def verify(img1_path, img2_path='' #------------------------------ #face recognition models have different size of inputs - input_shape = model.layers[0].input_shape[1:3] - + input_shape = model.layers[0].input_shape + + if type(input_shape) is list: + input_shape = input_shape[0][1:3] + input_shape_x = input_shape[0] input_shape_y = input_shape[1]