@@ -115,22 +115,21 @@ def verify(
115
115
}
116
116
117
117
def extract_embeddings_and_facial_areas (
118
- img_path : Union [str , np .ndarray , List [float ]],
119
- index : int
120
- ) -> Tuple [List [List [float ]], List [dict ]]:
118
+ img_path : Union [str , np .ndarray , List [float ]], index : int
119
+ ) -> Tuple [List [List [float ]], List [dict ]]:
121
120
"""
122
121
Extracts facial embeddings and corresponding facial areas from an
123
122
image or returns pre-calculated embeddings.
124
123
125
124
Depending on the type of img_path, the function either extracts
126
- facial embeddings from the provided image
125
+ facial embeddings from the provided image
127
126
(via a path or NumPy array) or verifies that the input is a list of
128
127
pre-calculated embeddings and validates them.
129
128
130
129
Args:
131
- img_path (Union[str, np.ndarray, List[float]]):
132
- - A string representing the file path to an image,
133
- - A NumPy array containing the image data,
130
+ img_path (Union[str, np.ndarray, List[float]]):
131
+ - A string representing the file path to an image,
132
+ - A NumPy array containing the image data,
134
133
- Or a list of pre-calculated embedding values (of type `float`).
135
134
index (int): An index value used in error messages and logging
136
135
to identify the number of the image.
@@ -150,15 +149,15 @@ def extract_embeddings_and_facial_areas(
150
149
151
150
if silent is False :
152
151
logger .warn (
153
- "You passed 1st image as pre-calculated embeddings."
152
+ f "You passed { index } -th image as pre-calculated embeddings."
154
153
"Please ensure that embeddings have been calculated"
155
154
f" for the { model_name } model."
156
155
)
157
156
158
157
if len (img_path ) != dims :
159
158
raise ValueError (
160
159
f"embeddings of { model_name } should have { dims } dimensions,"
161
- f" but it has { len (img_path )} dimensions input"
160
+ f" but { index } -th image has { len (img_path )} dimensions input"
162
161
)
163
162
164
163
img_embeddings = [img_path ]
0 commit comments