Spaces:
Running
Running
refactor: remove get_face_embeddings method from EnsembleFaceRecognition class
Browse files
models/face_recognition.py
CHANGED
|
@@ -33,12 +33,6 @@ class EnsembleFaceRecognition:
|
|
| 33 |
exp_distances = np.exp(-normalized_distances / temperature)
|
| 34 |
return exp_distances / np.sum(exp_distances)
|
| 35 |
|
| 36 |
-
def get_face_embeddings(self, image: np.ndarray) -> Dict[str, np.ndarray]:
|
| 37 |
-
"""Get face embeddings for each model"""
|
| 38 |
-
return {
|
| 39 |
-
'facenet': DeepFace.represent(img_path=image, detector_backend='skip', model_name='Facenet512', normalization='Facenet2018',align=True)[0]['embedding'],
|
| 40 |
-
'arc': DeepFace.represent(img_path=image, detector_backend='skip', model_name='ArcFace',align=True)[0]['embedding']}
|
| 41 |
-
|
| 42 |
def _preprocess_face_batch(self, faces: np.ndarray, target_size: Tuple[int, int], normalization: str) -> np.ndarray:
|
| 43 |
"""Preprocess a batch of face images for model inference"""
|
| 44 |
batch_size = faces.shape[0]
|
|
|
|
| 33 |
exp_distances = np.exp(-normalized_distances / temperature)
|
| 34 |
return exp_distances / np.sum(exp_distances)
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def _preprocess_face_batch(self, faces: np.ndarray, target_size: Tuple[int, int], normalization: str) -> np.ndarray:
|
| 37 |
"""Preprocess a batch of face images for model inference"""
|
| 38 |
batch_size = faces.shape[0]
|