mirror of
https://github.com/serengil/deepface.git
synced 2025-06-05 19:15:23 +00:00
linting
This commit is contained in:
parent
da03b479d8
commit
f1734b2367
@ -387,7 +387,8 @@ def represent(
|
||||
Represent facial images as multi-dimensional vector embeddings.
|
||||
|
||||
Args:
|
||||
img_path (str, np.ndarray, IO[bytes], or Sequence[Union[str, np.ndarray, IO[bytes]]]): The exact path to the image, a numpy array
|
||||
img_path (str, np.ndarray, IO[bytes], or Sequence[Union[str, np.ndarray, IO[bytes]]]):
|
||||
The exact path to the image, a numpy array
|
||||
in BGR format, a file object that supports at least `.read` and is opened in binary
|
||||
mode, or a base64 encoded image. If the source image contains multiple faces,
|
||||
the result will include information for each detected face. If a sequence is provided,
|
||||
|
@ -31,5 +31,4 @@ class FacialRecognition(ABC):
|
||||
embeddings = self.model(img, training=False).numpy()
|
||||
if embeddings.shape[0] == 1:
|
||||
return embeddings[0].tolist()
|
||||
else:
|
||||
return embeddings.tolist()
|
||||
return embeddings.tolist()
|
||||
|
@ -53,8 +53,7 @@ class DlibClient(FacialRecognition):
|
||||
embeddings = [np.array(embedding).tolist() for embedding in embeddings]
|
||||
if len(embeddings) == 1:
|
||||
return embeddings[0]
|
||||
else:
|
||||
return embeddings
|
||||
return embeddings
|
||||
|
||||
|
||||
class DlibResNet:
|
||||
|
@ -47,8 +47,7 @@ class SFaceClient(FacialRecognition):
|
||||
|
||||
if embeddings.shape[0] == 1:
|
||||
return embeddings[0].tolist()
|
||||
else:
|
||||
return embeddings.tolist()
|
||||
return embeddings.tolist()
|
||||
|
||||
|
||||
def load_model(
|
||||
|
@ -71,7 +71,7 @@ class VggFaceClient(FacialRecognition):
|
||||
# instead we are now calculating it with traditional way not with keras backend
|
||||
embedding = super().forward(img)
|
||||
if (
|
||||
isinstance(embedding, list) and
|
||||
isinstance(embedding, list) and
|
||||
isinstance(embedding[0], list)
|
||||
):
|
||||
embedding = verification.l2_normalize(embedding, axis=1)
|
||||
|
@ -25,8 +25,10 @@ def represent(
|
||||
Represent facial images as multi-dimensional vector embeddings.
|
||||
|
||||
Args:
|
||||
img_path (str, np.ndarray, or Sequence[Union[str, np.ndarray]]): The exact path to the image, a numpy array in BGR format,
|
||||
a base64 encoded image, or a sequence of these. If the source image contains multiple faces,
|
||||
img_path (str, np.ndarray, or Sequence[Union[str, np.ndarray]]):
|
||||
The exact path to the image, a numpy array in BGR format,
|
||||
a base64 encoded image, or a sequence of these.
|
||||
If the source image contains multiple faces,
|
||||
the result will include information for each detected face.
|
||||
|
||||
model_name (str): Model for face recognition. Options: VGG-Face, Facenet, Facenet512,
|
||||
@ -84,7 +86,8 @@ def represent(
|
||||
|
||||
for single_img_path in images:
|
||||
# ---------------------------------
|
||||
# we have run pre-process in verification. so, this can be skipped if it is coming from verify.
|
||||
# we have run pre-process in verification.
|
||||
# so, this can be skipped if it is coming from verify.
|
||||
target_size = model.input_shape
|
||||
if detector_backend != "skip":
|
||||
img_objs = detection.extract_faces(
|
||||
|
Loading…
x
Reference in New Issue
Block a user