Skip to content

Commit

Permalink
Refine type hints as per PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
RazaProdigy committed Dec 18, 2023
1 parent cfff587 commit 90a0282
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions deepface/DeepFace.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import time
import pickle
import logging
from typing import Any, Dict, List, Tuple
from typing import Any, Dict, List, Tuple, Union
from keras.engine.functional import Functional
from deepface.basemodels import DlibResNet, SFace

# 3rd party dependencies
import numpy as np
Expand Down Expand Up @@ -46,7 +48,7 @@
# -----------------------------------


def build_model(model_name: str) -> Any:
def build_model(model_name: str) -> Union[Functional, DlibResNet.DlibResNet, SFace.SFaceModel]:
"""
This function builds a deepface model
Parameters:
Expand Down Expand Up @@ -92,8 +94,8 @@ def build_model(model_name: str) -> Any:


def verify(
img1_path: str,
img2_path: str,
img1_path: Union[str, np.ndarray],
img2_path: Union[str, np.ndarray],
model_name: str = "VGG-Face",
detector_backend: str = "opencv",
distance_metric: str = "cosine",
Expand Down Expand Up @@ -232,7 +234,7 @@ def verify(


def analyze(
img_path: str,
img_path: Union[str, np.ndarray],,
actions: Tuple[str, ...] = ("emotion", "age", "gender", "race"),
enforce_detection: bool = True,
detector_backend: str = "opencv",
Expand Down Expand Up @@ -410,7 +412,7 @@ def analyze(


def find(
img_path: str,
img_path: Union[str, np.ndarray],
db_path : str,
model_name : str ="VGG-Face",
distance_metric : str ="cosine",
Expand Down Expand Up @@ -651,7 +653,7 @@ def find(


def represent(
img_path: str,
img_path: Union[str, np.ndarray],
model_name: str = "VGG-Face",
enforce_detection: bool = True,
detector_backend: str = "opencv",
Expand Down Expand Up @@ -817,7 +819,7 @@ def stream(


def extract_faces(
img_path: str,
img_path: Union[str, np.ndarray],
target_size: Tuple[int, int] = (224, 224),
detector_backend: str = "opencv",
enforce_detection: bool = True,
Expand Down

0 comments on commit 90a0282

Please sign in to comment.