mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 20:15:21 +00:00
input shape might be array for some versions
This commit is contained in:
parent
70e9af954e
commit
45892dde2b
@ -91,7 +91,16 @@ def verify(img1_path, img2_path=''
|
|||||||
|
|
||||||
for i in model_names:
|
for i in model_names:
|
||||||
custom_model = model[i]
|
custom_model = model[i]
|
||||||
input_shape = custom_model.layers[0].input_shape[1:3]
|
|
||||||
|
#input_shape = custom_model.layers[0].input_shape[1:3] #my environment returns (None, 224, 224, 3) but some people mentioned that they got [(None, 224, 224, 3)]. I think this is because of version issue.
|
||||||
|
|
||||||
|
input_shape = custom_model.layers[0].input_shape
|
||||||
|
|
||||||
|
if type(input_shape) == list:
|
||||||
|
input_shape = input_shape[0][1:3]
|
||||||
|
else:
|
||||||
|
input_shape = input_shape[1:3]
|
||||||
|
|
||||||
|
|
||||||
img1 = functions.detectFace(img1_path, input_shape, enforce_detection = enforce_detection)
|
img1 = functions.detectFace(img1_path, input_shape, enforce_detection = enforce_detection)
|
||||||
img2 = functions.detectFace(img2_path, input_shape, enforce_detection = enforce_detection)
|
img2 = functions.detectFace(img2_path, input_shape, enforce_detection = enforce_detection)
|
||||||
@ -207,7 +216,14 @@ def verify(img1_path, img2_path=''
|
|||||||
|
|
||||||
#------------------------------
|
#------------------------------
|
||||||
#face recognition models have different size of inputs
|
#face recognition models have different size of inputs
|
||||||
input_shape = model.layers[0].input_shape[1:3]
|
#input_shape = model.layers[0].input_shape[1:3] #my environment returns (None, 224, 224, 3) but some people mentioned that they got [(None, 224, 224, 3)]. I think this is because of version issue.
|
||||||
|
|
||||||
|
input_shape = model.layers[0].input_shape
|
||||||
|
|
||||||
|
if type(input_shape) == list:
|
||||||
|
input_shape = input_shape[0][1:3]
|
||||||
|
else:
|
||||||
|
input_shape = input_shape[1:3]
|
||||||
|
|
||||||
input_shape_x = input_shape[0]
|
input_shape_x = input_shape[0]
|
||||||
input_shape_y = input_shape[1]
|
input_shape_y = input_shape[1]
|
||||||
@ -595,7 +611,15 @@ def find(img_path, db_path
|
|||||||
|
|
||||||
if model_name != 'Ensemble':
|
if model_name != 'Ensemble':
|
||||||
|
|
||||||
input_shape = model.layers[0].input_shape[1:3]
|
#input_shape = model.layers[0].input_shape[1:3] #my environment returns (None, 224, 224, 3) but some people mentioned that they got [(None, 224, 224, 3)]. I think this is because of version issue.
|
||||||
|
|
||||||
|
input_shape = model.layers[0].input_shape
|
||||||
|
|
||||||
|
if type(input_shape) == list:
|
||||||
|
input_shape = input_shape[0][1:3]
|
||||||
|
else:
|
||||||
|
input_shape = input_shape[1:3]
|
||||||
|
|
||||||
input_shape_x = input_shape[0]; input_shape_y = input_shape[1]
|
input_shape_x = input_shape[0]; input_shape_y = input_shape[1]
|
||||||
|
|
||||||
img = functions.detectFace(employee, (input_shape_y, input_shape_x), enforce_detection = enforce_detection)
|
img = functions.detectFace(employee, (input_shape_y, input_shape_x), enforce_detection = enforce_detection)
|
||||||
@ -612,7 +636,16 @@ def find(img_path, db_path
|
|||||||
|
|
||||||
for j in model_names:
|
for j in model_names:
|
||||||
model = models[j]
|
model = models[j]
|
||||||
input_shape = model.layers[0].input_shape[1:3]
|
|
||||||
|
#input_shape = model.layers[0].input_shape[1:3] #my environment returns (None, 224, 224, 3) but some people mentioned that they got [(None, 224, 224, 3)]. I think this is because of version issue.
|
||||||
|
|
||||||
|
input_shape = model.layers[0].input_shape
|
||||||
|
|
||||||
|
if type(input_shape) == list:
|
||||||
|
input_shape = input_shape[0][1:3]
|
||||||
|
else:
|
||||||
|
input_shape = input_shape[1:3]
|
||||||
|
|
||||||
input_shape_x = input_shape[0]; input_shape_y = input_shape[1]
|
input_shape_x = input_shape[0]; input_shape_y = input_shape[1]
|
||||||
|
|
||||||
img = functions.detectFace(employee, (input_shape_y, input_shape_x), enforce_detection = enforce_detection)
|
img = functions.detectFace(employee, (input_shape_y, input_shape_x), enforce_detection = enforce_detection)
|
||||||
@ -650,7 +683,16 @@ def find(img_path, db_path
|
|||||||
if model_name == 'Ensemble':
|
if model_name == 'Ensemble':
|
||||||
for j in model_names:
|
for j in model_names:
|
||||||
model = models[j]
|
model = models[j]
|
||||||
input_shape = model.layers[0].input_shape[1:3]
|
|
||||||
|
#input_shape = model.layers[0].input_shape[1:3] #my environment returns (None, 224, 224, 3) but some people mentioned that they got [(None, 224, 224, 3)]. I think this is because of version issue.
|
||||||
|
|
||||||
|
input_shape = model.layers[0].input_shape
|
||||||
|
|
||||||
|
if type(input_shape) == list:
|
||||||
|
input_shape = input_shape[0][1:3]
|
||||||
|
else:
|
||||||
|
input_shape = input_shape[1:3]
|
||||||
|
|
||||||
img = functions.detectFace(img_path, input_shape, enforce_detection = enforce_detection)
|
img = functions.detectFace(img_path, input_shape, enforce_detection = enforce_detection)
|
||||||
target_representation = model.predict(img)[0,:]
|
target_representation = model.predict(img)[0,:]
|
||||||
|
|
||||||
@ -719,7 +761,16 @@ def find(img_path, db_path
|
|||||||
#----------------------------------
|
#----------------------------------
|
||||||
|
|
||||||
if model_name != 'Ensemble':
|
if model_name != 'Ensemble':
|
||||||
input_shape = model.layers[0].input_shape[1:3]
|
|
||||||
|
#input_shape = model.layers[0].input_shape[1:3] #my environment returns (None, 224, 224, 3) but some people mentioned that they got [(None, 224, 224, 3)]. I think this is because of version issue.
|
||||||
|
|
||||||
|
input_shape = model.layers[0].input_shape
|
||||||
|
|
||||||
|
if type(input_shape) == list:
|
||||||
|
input_shape = input_shape[0][1:3]
|
||||||
|
else:
|
||||||
|
input_shape = input_shape[1:3]
|
||||||
|
|
||||||
input_shape_x = input_shape[0]; input_shape_y = input_shape[1]
|
input_shape_x = input_shape[0]; input_shape_y = input_shape[1]
|
||||||
|
|
||||||
img = functions.detectFace(img_path, (input_shape_y, input_shape_x), enforce_detection = enforce_detection)
|
img = functions.detectFace(img_path, (input_shape_y, input_shape_x), enforce_detection = enforce_detection)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user