mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 03:55:21 +00:00
minor linting changes
This commit is contained in:
parent
fac74113ca
commit
4166729939
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import numpy as np
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from deepface.commons import weight_utils, folder_utils
|
from deepface.commons import weight_utils, folder_utils
|
||||||
from deepface.commons.logger import Logger
|
from deepface.commons.logger import Logger
|
||||||
@ -70,7 +70,8 @@ class Buffalo_L(FacialRecognition):
|
|||||||
if len(img.shape) == 4:
|
if len(img.shape) == 4:
|
||||||
img = img[0]
|
img = img[0]
|
||||||
if len(img.shape) != 3:
|
if len(img.shape) != 3:
|
||||||
raise ValueError(f"Expected image to be 3D after preprocessing, but got shape: {img.shape}")
|
raise ValueError(
|
||||||
|
f"Expected image to be 3D after preprocessing, but got shape: {img.shape}")
|
||||||
if img.max() <= 1.0:
|
if img.max() <= 1.0:
|
||||||
img = (img * 255).astype(np.uint8)
|
img = (img * 255).astype(np.uint8)
|
||||||
img = img[:, :, ::-1] # Convert RGB to BGR
|
img = img[:, :, ::-1] # Convert RGB to BGR
|
||||||
@ -86,12 +87,11 @@ class Buffalo_L(FacialRecognition):
|
|||||||
"""
|
"""
|
||||||
img = self.preprocess(img)
|
img = self.preprocess(img)
|
||||||
embedding = self.model.get_feat(img)
|
embedding = self.model.get_feat(img)
|
||||||
|
|
||||||
if isinstance(embedding, np.ndarray) and len(embedding.shape) > 1:
|
if isinstance(embedding, np.ndarray) and len(embedding.shape) > 1:
|
||||||
embedding = embedding.flatten()
|
embedding = embedding.flatten()
|
||||||
elif isinstance(embedding, list):
|
elif isinstance(embedding, list):
|
||||||
embedding = np.array(embedding).flatten()
|
embedding = np.array(embedding).flatten()
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unexpected embedding type: {type(embedding)}")
|
raise ValueError(f"Unexpected embedding type: {type(embedding)}")
|
||||||
|
return embedding.tolist()
|
||||||
return embedding.tolist()
|
|
Loading…
x
Reference in New Issue
Block a user