yoloserv/modules/paravision/recognition/sdk/__init__.pyi

220 lines
7.2 KiB
Python

from __future__ import annotations
import paravision.recognition.sdk
import typing
import numpy
import paravision.recognition.types
_Shape = typing.Tuple[int, ...]
__all__ = [
"Metadata",
"SDK"
]
class Metadata():
def __init__(self) -> None: ...
@property
def embedding_size(self) -> int:
"""
The embedding size of the Recognition models being used.
:type: int
"""
@embedding_size.setter
def embedding_size(self, arg0: int) -> None:
"""
The embedding size of the Recognition models being used.
"""
@property
def engine(self) -> str:
"""
The engine or accelerator of the Recognition SDK instance being used.
:type: str
"""
@engine.setter
def engine(self, arg0: str) -> None:
"""
The engine or accelerator of the Recognition SDK instance being used.
"""
@property
def engine_version(self) -> str:
"""
The version of the engine or accelerator being used.
:type: str
"""
@engine_version.setter
def engine_version(self, arg0: str) -> None:
"""
The version of the engine or accelerator being used.
"""
@property
def generation(self) -> int:
"""
The generation of the Recognition SDK.
:type: int
"""
@generation.setter
def generation(self, arg0: int) -> None:
"""
The generation of the Recognition SDK.
"""
@property
def model(self) -> str:
"""
The name of the Recognition models.
:type: str
"""
@model.setter
def model(self, arg0: str) -> None:
"""
The name of the Recognition models.
"""
@property
def model_version(self) -> str:
"""
The version of the Recognition models.
:type: str
"""
@model_version.setter
def model_version(self, arg0: str) -> None:
"""
The version of the Recognition models.
"""
@property
def sdk_version(self) -> str:
"""
The version of the Recognition SDK.
:type: str
"""
@sdk_version.setter
def sdk_version(self, arg0: str) -> None:
"""
The version of the Recognition SDK.
"""
pass
class SDK():
"""
SDK()
A sdk object contains an instance of the Paravision model and its
associated resources.
SDK objects are long-living and do not need to be re-instantiated between
method calls.
"""
def __init__(self, models_dir: typing.Optional[str] = None, settings: typing.Optional[paravision.recognition.types.Settings] = None) -> None:
"""
Create a new SDK instance with settings as a struct
"""
@typing.overload
def get_bounding_boxes(self, imgs: list[numpy.ndarray], image_source: paravision.recognition.types.ImageSource = ImageSource.UNKNOWN) -> paravision.recognition.types.InferenceResult:
"""
Detect bounding boxes of faces in the image, returning a list of Faces.
"""
@typing.overload
def get_bounding_boxes(self, imgs: list[paravision.recognition.types.Image], detection_model: paravision.recognition.types.ImageSource = '') -> paravision.recognition.types.InferenceResult:
"""
Accepts a list of NumPy arrays (images).
"""
@typing.overload
def get_embedding_from_prepared_image(self, prepared_image: numpy.ndarray) -> paravision.recognition.types.Embedding:
"""
Get the embedding for a prepared image.
"""
@typing.overload
def get_embedding_from_prepared_image(self, prepared_image: paravision.recognition.types.Image) -> paravision.recognition.types.Embedding:
"""
Accepts one prepared image (numpy array).
"""
def get_embeddings(self, faces: list[paravision.recognition.types.Face]) -> None:
"""
Get the embeddings for faces.
"""
@typing.overload
def get_embeddings_from_landmarks(self, image: numpy.ndarray, landmarks: list[paravision.recognition.types.Landmarks]) -> list[paravision.recognition.types.Embedding]:
"""
Get the embeddings for faces.
"""
@typing.overload
def get_embeddings_from_landmarks(self, image: paravision.recognition.types.Image, landmarks: list[paravision.recognition.types.Landmarks]) -> list[paravision.recognition.types.Embedding]:
"""
Accepts a NumPy array (image) and a list of landmarks.
"""
@typing.overload
def get_faces(self, imgs: list[numpy.ndarray], qualities: bool = False, landmarks: bool = False, embeddings: bool = False, image_source: paravision.recognition.types.ImageSource = ImageSource.UNKNOWN) -> paravision.recognition.types.InferenceResult:
"""
Detect faces in the image.
"""
@typing.overload
def get_faces(self, imgs: list[paravision.recognition.types.Image], qualities: bool = False, landmarks: bool = False, embeddings: bool = False, image_source: paravision.recognition.types.ImageSource = ImageSource.UNKNOWN) -> paravision.recognition.types.InferenceResult:
"""
Includes bounding boxes, landmarks, and [optionally] image quality
details.
"""
def get_landmarks(self, faces: list[paravision.recognition.types.Face]) -> None:
"""
Get the landmarks for faces.
"""
@typing.overload
def get_landmarks_from_bounding_boxes(self, img: numpy.ndarray, bboxes: list[paravision.recognition.types.BoundingBox]) -> paravision.recognition.types.InferenceResult:
"""
Get the landmarks from a bounding box.
"""
@typing.overload
def get_landmarks_from_bounding_boxes(self, img: paravision.recognition.types.Image, bboxes: list[paravision.recognition.types.BoundingBox]) -> paravision.recognition.types.InferenceResult:
"""
Accepts a NumPy array (image) and a list of bounding boxes.
"""
@staticmethod
def get_match_score(emb1: paravision.recognition.types.Embedding, emb2: paravision.recognition.types.Embedding, scoring_mode: paravision.recognition.types.ScoringMode = ScoringMode.EnhancedEmbedding) -> int:
"""
Compute the difference score of two faces embeddings. A larger number indicates a
greater similarity between the two embeddings; a lower number indicates a
greater difference between the two embeddings.
"""
@staticmethod
def get_metadata(models_dir: typing.Optional[str] = None) -> Metadata:
"""
Returns metadata for SDK and model info.
"""
def get_qualities(self, faces: list[paravision.recognition.types.Face]) -> None:
"""
Get the quality of the faces in the image.
"""
@staticmethod
def get_similarity(emb1: paravision.recognition.types.Embedding, emb2: paravision.recognition.types.Embedding, scoring_mode: paravision.recognition.types.ScoringMode = ScoringMode.EnhancedEmbedding) -> float:
"""
Compute the difference score of two faces embeddings. A larger number indicates a
greater similarity between the two embeddings; a lower number indicates a
greater difference between the two embeddings.
"""
pass