Jamshaid89
commited on
Commit
•
5f0e788
1
Parent(s):
63eb88f
Removed dlib detectot backend
Browse files
app.py
CHANGED
@@ -10,10 +10,13 @@ uri = f"mongodb+srv://{credentials}@cluster0.uimyui3.mongodb.net/?retryWrites=tr
|
|
10 |
client = MongoClient(uri)
|
11 |
db = client["Face_identification"]
|
12 |
identities_collection = db["face_identities"]
|
|
|
|
|
|
|
13 |
|
14 |
def save_identity(image , name):
|
15 |
try:
|
16 |
-
embeddings = DeepFace.represent(image , model_name=
|
17 |
embeddings = embeddings[0]
|
18 |
|
19 |
identity = {"embeddings":embeddings["embedding"] , "name" : name }
|
@@ -50,10 +53,6 @@ def findThreshold(model_name, distance_metric):
|
|
50 |
|
51 |
return threshold
|
52 |
|
53 |
-
model_name="Facenet"
|
54 |
-
threshold = findThreshold(model_name , "cosine")
|
55 |
-
debug=False
|
56 |
-
|
57 |
def predict_image(image):
|
58 |
if debug:
|
59 |
print("1")
|
@@ -68,7 +67,6 @@ def predict_image(image):
|
|
68 |
target_embedding_array = DeepFace.represent(
|
69 |
img_path=image,
|
70 |
model_name=model_name,
|
71 |
-
detector_backend="dlib",
|
72 |
)
|
73 |
identities = []
|
74 |
# for each face compare its embeddings with all face embeddings in database
|
|
|
10 |
client = MongoClient(uri)
|
11 |
db = client["Face_identification"]
|
12 |
identities_collection = db["face_identities"]
|
13 |
+
model_name="Facenet"
|
14 |
+
threshold = findThreshold(model_name , "cosine")
|
15 |
+
debug=False
|
16 |
|
17 |
def save_identity(image , name):
|
18 |
try:
|
19 |
+
embeddings = DeepFace.represent(image , model_name=model_name)
|
20 |
embeddings = embeddings[0]
|
21 |
|
22 |
identity = {"embeddings":embeddings["embedding"] , "name" : name }
|
|
|
53 |
|
54 |
return threshold
|
55 |
|
|
|
|
|
|
|
|
|
56 |
def predict_image(image):
|
57 |
if debug:
|
58 |
print("1")
|
|
|
67 |
target_embedding_array = DeepFace.represent(
|
68 |
img_path=image,
|
69 |
model_name=model_name,
|
|
|
70 |
)
|
71 |
identities = []
|
72 |
# for each face compare its embeddings with all face embeddings in database
|