mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 20:15:21 +00:00
issue 435
This commit is contained in:
parent
a4c6355344
commit
79e78e8448
@ -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,9 +75,10 @@ print("opencv detector")
|
|||||||
res = DeepFace.verify(dataset, detector_backend = 'opencv')
|
res = DeepFace.verify(dataset, detector_backend = 'opencv')
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
print("dlib detector")
|
if False:
|
||||||
res = DeepFace.verify(dataset, detector_backend = 'dlib')
|
print("dlib detector")
|
||||||
print(res)
|
res = DeepFace.verify(dataset, detector_backend = 'dlib')
|
||||||
|
print(res)
|
||||||
|
|
||||||
print("mtcnn detector")
|
print("mtcnn detector")
|
||||||
res = DeepFace.verify(dataset, detector_backend = 'mtcnn')
|
res = DeepFace.verify(dataset, detector_backend = 'mtcnn')
|
||||||
@ -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,41 +270,46 @@ print(resp_obj)
|
|||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
print("--------------------------")
|
print("--------------------------")
|
||||||
|
|
||||||
print("Ensemble for find function")
|
if False:
|
||||||
df = DeepFace.find(img_path = "dataset/img1.jpg", db_path = "dataset", model_name = "Ensemble")
|
print("Ensemble for find function")
|
||||||
print(df.head())
|
df = DeepFace.find(img_path = "dataset/img1.jpg", db_path = "dataset", model_name = "Ensemble")
|
||||||
|
print(df.head())
|
||||||
|
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
print("--------------------------")
|
print("--------------------------")
|
||||||
|
|
||||||
print("Ensemble for verify function")
|
if False:
|
||||||
resp_obj = DeepFace.verify(dataset, model_name = "Ensemble")
|
print("Ensemble for verify function")
|
||||||
|
resp_obj = DeepFace.verify(dataset, model_name = "Ensemble")
|
||||||
|
|
||||||
for i in range(0, len(dataset)):
|
for i in range(0, len(dataset)):
|
||||||
item = resp_obj['pair_%s' % (i+1)]
|
item = resp_obj['pair_%s' % (i+1)]
|
||||||
verified = item["verified"]
|
verified = item["verified"]
|
||||||
score = item["score"]
|
score = item["score"]
|
||||||
print(verified)
|
print(verified)
|
||||||
|
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
print("--------------------------")
|
print("--------------------------")
|
||||||
|
|
||||||
print("Pre-trained ensemble method - find")
|
if False:
|
||||||
|
|
||||||
from deepface import DeepFace
|
print("Pre-trained ensemble method - find")
|
||||||
from deepface.basemodels import Boosting
|
|
||||||
|
|
||||||
model = Boosting.loadModel()
|
from deepface import DeepFace
|
||||||
df = DeepFace.find("dataset/img1.jpg", db_path = "dataset", model_name = 'Ensemble', model = model, enforce_detection=False)
|
from deepface.basemodels import Boosting
|
||||||
|
|
||||||
print(df)
|
model = Boosting.loadModel()
|
||||||
|
df = DeepFace.find("dataset/img1.jpg", db_path = "dataset", model_name = 'Ensemble', model = model, enforce_detection=False)
|
||||||
|
|
||||||
|
print(df)
|
||||||
|
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
print("--------------------------")
|
print("--------------------------")
|
||||||
|
|
||||||
print("Pre-trained ensemble method - verify")
|
if False:
|
||||||
res = DeepFace.verify(dataset, model_name = "Ensemble", model = model)
|
print("Pre-trained ensemble method - verify")
|
||||||
print(res)
|
res = DeepFace.verify(dataset, model_name = "Ensemble", model = model)
|
||||||
|
print(res)
|
||||||
|
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
print("--------------------------")
|
print("--------------------------")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user