mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 03:55:21 +00:00
23 lines
608 B
Python
23 lines
608 B
Python
from typing import Union, List
|
|
from abc import ABC, abstractmethod
|
|
import numpy as np
|
|
from deepface.commons import package_utils
|
|
|
|
tf_version = package_utils.get_tf_major_version()
|
|
if tf_version == 1:
|
|
from keras.models import Model
|
|
else:
|
|
from tensorflow.keras.models import Model
|
|
|
|
# Notice that all facial attribute analysis models must be inherited from this class
|
|
|
|
|
|
# pylint: disable=too-few-public-methods
|
|
class Demography(ABC):
|
|
model: Model
|
|
model_name: str
|
|
|
|
@abstractmethod
|
|
def predict(self, img: Union[np.ndarray, List[np.ndarray]]) -> Union[np.ndarray, np.float64]:
|
|
pass
|