issue 435

This commit is contained in:
Sefik Ilkin Serengil 2022-03-11 20:43:26 +00:00
parent a4c6355344
commit 79e78e8448

View File

@ -28,10 +28,13 @@ print("-----------------------------------------")
#----------------------------------------- #-----------------------------------------
print("DeepFace.detectFace test") print("DeepFace.detectFace test")
detectors = ['opencv', 'ssd', 'dlib', 'mtcnn', 'retinaface'] #detectors = ['opencv', 'ssd', 'dlib', 'mtcnn', 'retinaface']
detectors = ['opencv', 'ssd', 'mtcnn', 'retinaface']
for detector in detectors: for detector in detectors:
img = DeepFace.detectFace("dataset/img11.jpg", detector_backend = detector) img = DeepFace.detectFace("dataset/img11.jpg", detector_backend = detector)
print(detector," test is done") print(detector," test is done")
#import matplotlib.pyplot as plt #import matplotlib.pyplot as plt
#plt.imshow(img) #plt.imshow(img)
#plt.show() #plt.show()
@ -39,7 +42,6 @@ for detector in detectors:
#----------------------------------------- #-----------------------------------------
print("-----------------------------------------") print("-----------------------------------------")
img_path = "dataset/img1.jpg" img_path = "dataset/img1.jpg"
embedding = DeepFace.represent(img_path) embedding = DeepFace.represent(img_path)
print("Function returned ", len(embedding), "dimensional vector") print("Function returned ", len(embedding), "dimensional vector")
@ -73,6 +75,7 @@ print("opencv detector")
res = DeepFace.verify(dataset, detector_backend = 'opencv') res = DeepFace.verify(dataset, detector_backend = 'opencv')
print(res) print(res)
if False:
print("dlib detector") print("dlib detector")
res = DeepFace.verify(dataset, detector_backend = 'dlib') res = DeepFace.verify(dataset, detector_backend = 'dlib')
print(res) print(res)
@ -192,7 +195,7 @@ dataset = [
#models = ['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace', 'DeepID', 'Dlib', 'ArcFace'] #models = ['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace', 'DeepID', 'Dlib', 'ArcFace']
metrics = ['cosine', 'euclidean', 'euclidean_l2'] metrics = ['cosine', 'euclidean', 'euclidean_l2']
models = ['VGG-Face', 'Facenet', 'Facenet512', 'Dlib', 'ArcFace'] #those are robust models models = ['VGG-Face', 'Facenet', 'Facenet512', 'ArcFace'] #those are robust models
#metrics = ['cosine'] #metrics = ['cosine']
passed_tests = 0; test_cases = 0 passed_tests = 0; test_cases = 0
@ -267,6 +270,7 @@ print(resp_obj)
#----------------------------------- #-----------------------------------
print("--------------------------") print("--------------------------")
if False:
print("Ensemble for find function") print("Ensemble for find function")
df = DeepFace.find(img_path = "dataset/img1.jpg", db_path = "dataset", model_name = "Ensemble") df = DeepFace.find(img_path = "dataset/img1.jpg", db_path = "dataset", model_name = "Ensemble")
print(df.head()) print(df.head())
@ -274,6 +278,7 @@ print(df.head())
#----------------------------------- #-----------------------------------
print("--------------------------") print("--------------------------")
if False:
print("Ensemble for verify function") print("Ensemble for verify function")
resp_obj = DeepFace.verify(dataset, model_name = "Ensemble") resp_obj = DeepFace.verify(dataset, model_name = "Ensemble")
@ -286,6 +291,8 @@ for i in range(0, len(dataset)):
#----------------------------------- #-----------------------------------
print("--------------------------") print("--------------------------")
if False:
print("Pre-trained ensemble method - find") print("Pre-trained ensemble method - find")
from deepface import DeepFace from deepface import DeepFace
@ -299,6 +306,7 @@ print(df)
#----------------------------------- #-----------------------------------
print("--------------------------") print("--------------------------")
if False:
print("Pre-trained ensemble method - verify") print("Pre-trained ensemble method - verify")
res = DeepFace.verify(dataset, model_name = "Ensemble", model = model) res = DeepFace.verify(dataset, model_name = "Ensemble", model = model)
print(res) print(res)