mirror of
https://github.com/serengil/deepface.git
synced 2025-06-06 11:35:21 +00:00
LocallyConnected2D not supported after tf 2.12
- this requirements is just for deepface model. so, instead of enforcing lower tf versions we should check the current tf version in deepface model initializaiton.
This commit is contained in:
parent
46f0141a2c
commit
65c47badb5
@ -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