charbel-malo
commited on
Commit
•
42a6712
1
Parent(s):
4133d16
Update face_analyser.py
Browse files- face_analyser.py +2 -3
face_analyser.py
CHANGED
@@ -32,7 +32,6 @@ swap_options_list = [
|
|
32 |
"Smallest",
|
33 |
]
|
34 |
|
35 |
-
@spaces.GPU(enable_queue=True)
|
36 |
def get_single_face(faces, method="best detection"):
|
37 |
total_faces = len(faces)
|
38 |
if total_faces == 1:
|
@@ -59,7 +58,7 @@ def get_single_face(faces, method="best detection"):
|
|
59 |
return sorted(faces, key=lambda face: (face["bbox"][2] - face["bbox"][0]) * (face["bbox"][3] - face["bbox"][1]))[0]
|
60 |
|
61 |
|
62 |
-
|
63 |
def analyse_face(image, model, return_single_face=True, detect_condition="best detection", scale=1.0):
|
64 |
faces = model.get(image)
|
65 |
if scale != 1: # landmark-scale
|
@@ -81,7 +80,7 @@ def cosine_distance(a, b):
|
|
81 |
return 1 - np.dot(a, b)
|
82 |
|
83 |
|
84 |
-
|
85 |
def get_analysed_data(face_analyser, image_sequence, source_data, swap_condition="All face", detect_condition="left most", scale=1.0):
|
86 |
if swap_condition != "Specific Face":
|
87 |
source_path, age = source_data
|
|
|
32 |
"Smallest",
|
33 |
]
|
34 |
|
|
|
35 |
def get_single_face(faces, method="best detection"):
|
36 |
total_faces = len(faces)
|
37 |
if total_faces == 1:
|
|
|
58 |
return sorted(faces, key=lambda face: (face["bbox"][2] - face["bbox"][0]) * (face["bbox"][3] - face["bbox"][1]))[0]
|
59 |
|
60 |
|
61 |
+
|
62 |
def analyse_face(image, model, return_single_face=True, detect_condition="best detection", scale=1.0):
|
63 |
faces = model.get(image)
|
64 |
if scale != 1: # landmark-scale
|
|
|
80 |
return 1 - np.dot(a, b)
|
81 |
|
82 |
|
83 |
+
|
84 |
def get_analysed_data(face_analyser, image_sequence, source_data, swap_condition="All face", detect_condition="left most", scale=1.0):
|
85 |
if swap_condition != "Specific Face":
|
86 |
source_path, age = source_data
|