mirror of
https://github.com/serengil/deepface.git
synced 2025-06-05 19:15:23 +00:00
List->Sequence typing
This commit is contained in:
parent
035d3c8ba8
commit
3a9385fad8
@ -2,7 +2,7 @@
|
||||
import os
|
||||
import warnings
|
||||
import logging
|
||||
from typing import Any, Dict, IO, List, Union, Optional
|
||||
from typing import Any, Dict, IO, List, Union, Optional, Sequence
|
||||
|
||||
# this has to be set before importing tensorflow
|
||||
os.environ["TF_USE_LEGACY_KERAS"] = "1"
|
||||
@ -373,7 +373,7 @@ def find(
|
||||
|
||||
|
||||
def represent(
|
||||
img_path: Union[str, np.ndarray, IO[bytes], List[Union[str, np.ndarray]]],
|
||||
img_path: Union[str, np.ndarray, IO[bytes], Sequence[Union[str, np.ndarray, IO[bytes]]]],
|
||||
model_name: str = "VGG-Face",
|
||||
enforce_detection: bool = True,
|
||||
detector_backend: str = "opencv",
|
||||
@ -387,10 +387,10 @@ def represent(
|
||||
Represent facial images as multi-dimensional vector embeddings.
|
||||
|
||||
Args:
|
||||
img_path (str, np.ndarray, IO[bytes], or List[Union[str, np.ndarray]]): 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 list is provided,
|
||||
the result will include information for each detected face. If a sequence is provided,
|
||||
each element should be a string or numpy array representing an image, and the function
|
||||
will process images in batch.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# built-in dependencies
|
||||
from typing import Any, Dict, List, Union, Optional
|
||||
from typing import Any, Dict, List, Union, Optional, Sequence, IO
|
||||
|
||||
# 3rd party dependencies
|
||||
import numpy as np
|
||||
@ -11,7 +11,7 @@ from deepface.models.FacialRecognition import FacialRecognition
|
||||
|
||||
|
||||
def represent(
|
||||
img_path: Union[str, np.ndarray, List[Union[str, np.ndarray]]],
|
||||
img_path: Union[str, IO[bytes], np.ndarray, Sequence[Union[str, np.ndarray, IO[bytes]]]],
|
||||
model_name: str = "VGG-Face",
|
||||
enforce_detection: bool = True,
|
||||
detector_backend: str = "opencv",
|
||||
@ -25,8 +25,8 @@ def represent(
|
||||
Represent facial images as multi-dimensional vector embeddings.
|
||||
|
||||
Args:
|
||||
img_path (str, np.ndarray, or list): The exact path to the image, a numpy array in BGR format,
|
||||
a base64 encoded image, or a list 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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user