mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
model_name and distance_metric check
This commit is contained in:
parent
79e27f9a07
commit
9f785003b8
@ -27,12 +27,6 @@ def verify(img1_path, img2_path
|
|||||||
|
|
||||||
#-------------------------
|
#-------------------------
|
||||||
|
|
||||||
#print("Face verification will be applied on ",model_name," model and ",distance_metric," metric")
|
|
||||||
|
|
||||||
functions.validateInputs(model_name, distance_metric)
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
|
|
||||||
#tuned thresholds for model and metric pair
|
#tuned thresholds for model and metric pair
|
||||||
threshold = functions.findThreshold(model_name, distance_metric)
|
threshold = functions.findThreshold(model_name, distance_metric)
|
||||||
|
|
||||||
@ -53,6 +47,9 @@ def verify(img1_path, img2_path
|
|||||||
model = Facenet.loadModel()
|
model = Facenet.loadModel()
|
||||||
input_shape = (160, 160)
|
input_shape = (160, 160)
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid model_name passed - ", model_name)
|
||||||
|
|
||||||
#-------------------------
|
#-------------------------
|
||||||
#crop face
|
#crop face
|
||||||
|
|
||||||
@ -80,6 +77,8 @@ def verify(img1_path, img2_path
|
|||||||
elif distance_metric == 'euclidean_l2':
|
elif distance_metric == 'euclidean_l2':
|
||||||
print("Using euclidean distance l2 form")
|
print("Using euclidean distance l2 form")
|
||||||
distance = dst.findEuclideanDistance(dst.l2_normalize(img1_representation), dst.l2_normalize(img2_representation))
|
distance = dst.findEuclideanDistance(dst.l2_normalize(img1_representation), dst.l2_normalize(img2_representation))
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid distance_metric passed - ", distance_metric)
|
||||||
|
|
||||||
#-------------------------
|
#-------------------------
|
||||||
#decision
|
#decision
|
||||||
|
Loading…
x
Reference in New Issue
Block a user