mirror of
https://github.com/serengil/deepface.git
synced 2025-06-08 04:25:21 +00:00
Merge pull request #1083 from serengil/feat-task-0902-enhancements
Feat task 0902 enhancements
This commit is contained in:
commit
cdb0fa0b95
@ -111,7 +111,7 @@ def verify(
|
||||
|
||||
- 'model' (str): The chosen face recognition model.
|
||||
|
||||
- 'similarity_metric' (str): The chosen similarity metric for measuring distances.
|
||||
- 'distance_metric' (str): The chosen similarity metric for measuring distances.
|
||||
|
||||
- 'facial_areas' (dict): Rectangular regions of interest for faces in both images.
|
||||
- 'img1': {'x': int, 'y': int, 'w': int, 'h': int}
|
||||
|
@ -44,6 +44,15 @@ class DeepFaceClient(FacialRecognition):
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
major = package_utils.get_tf_major_version()
|
||||
minor = package_utils.get_tf_minor_version()
|
||||
if major == 2 and minor > 12:
|
||||
# Ref: https://github.com/serengil/deepface/pull/1079
|
||||
raise ValueError(
|
||||
"DeepFace model requires LocallyConnected2D but it is no longer supported"
|
||||
f" after tf 2.12 but you have {major}.{minor}. You need to downgrade your tf."
|
||||
)
|
||||
|
||||
self.model = load_model()
|
||||
self.model_name = "DeepFace"
|
||||
self.input_shape = (152, 152)
|
||||
|
@ -20,6 +20,15 @@ def get_tf_major_version() -> int:
|
||||
return int(tf.__version__.split(".", maxsplit=1)[0])
|
||||
|
||||
|
||||
def get_tf_minor_version() -> int:
|
||||
"""
|
||||
Find tensorflow's minor version
|
||||
Returns
|
||||
minor_version (int)
|
||||
"""
|
||||
return int(tf.__version__.split(".", maxsplit=-1)[1])
|
||||
|
||||
|
||||
def find_hash_of_file(file_path: str) -> str:
|
||||
"""
|
||||
Find the hash of given image file with its properties
|
||||
|
@ -4,7 +4,7 @@ gdown>=3.10.1
|
||||
tqdm>=4.30.0
|
||||
Pillow>=5.2.0
|
||||
opencv-python>=4.5.5.64
|
||||
tensorflow>=1.9.0,<=2.12.0
|
||||
tensorflow>=1.9.0
|
||||
keras>=2.2.0
|
||||
Flask>=1.1.2
|
||||
mtcnn>=0.1.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user