mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
printing backends
This commit is contained in:
parent
b7ed1897f5
commit
08d09421c4
@ -39,14 +39,17 @@ def verify(img1_path, img2_path
|
|||||||
#-------------------------
|
#-------------------------
|
||||||
|
|
||||||
if model_name == 'VGG-Face':
|
if model_name == 'VGG-Face':
|
||||||
|
print("Using VGG-Face backend.")
|
||||||
model = VGGFace.loadModel()
|
model = VGGFace.loadModel()
|
||||||
input_shape = (224, 224)
|
input_shape = (224, 224)
|
||||||
|
|
||||||
elif model_name == 'OpenFace':
|
elif model_name == 'OpenFace':
|
||||||
|
print("Using OpenFace backend.")
|
||||||
model = OpenFace.loadModel()
|
model = OpenFace.loadModel()
|
||||||
input_shape = (96, 96)
|
input_shape = (96, 96)
|
||||||
|
|
||||||
elif model_name == 'Facenet':
|
elif model_name == 'Facenet':
|
||||||
|
print("Using Facenet backend.")
|
||||||
model = Facenet.loadModel()
|
model = Facenet.loadModel()
|
||||||
input_shape = (160, 160)
|
input_shape = (160, 160)
|
||||||
|
|
||||||
@ -69,10 +72,13 @@ def verify(img1_path, img2_path
|
|||||||
#find distances between embeddings
|
#find distances between embeddings
|
||||||
|
|
||||||
if distance_metric == 'cosine':
|
if distance_metric == 'cosine':
|
||||||
|
print("Using cosine similarity")
|
||||||
distance = dst.findCosineDistance(img1_representation, img2_representation)
|
distance = dst.findCosineDistance(img1_representation, img2_representation)
|
||||||
elif distance_metric == 'euclidean':
|
elif distance_metric == 'euclidean':
|
||||||
|
print("Using euclidean distance")
|
||||||
distance = dst.findEuclideanDistance(img1_representation, img2_representation)
|
distance = dst.findEuclideanDistance(img1_representation, img2_representation)
|
||||||
elif distance_metric == 'euclidean_l2':
|
elif distance_metric == 'euclidean_l2':
|
||||||
|
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))
|
||||||
|
|
||||||
#-------------------------
|
#-------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user