Closed Samiddha99 closed 1 day ago
tensorflow related issue, not retinaface itself
try to downgrade your tf version
I can't downgrade tensorflow as some of my packages are dependent the updated version of tensorflow. Why are you not releasing updated version of retinaface with updated version of tensorflow?
As i mentioned, this is a tensorflow error not retinaface error, if it is retinaface error,then i can fix it.
Before You Report a Bug, Please Confirm You Have Done The Following...
RetinaFace's Version
0.0.17
Python Version
3.12.5
Operating System
Windows 10
Dependencies
absl-py==2.1.0 alabaster==1.0.0 albucore==0.0.20 albumentations==1.4.21 annotated-types==0.7.0 anyio==4.4.0 astroid==3.3.5 asttokens==2.4.1 astunparse==1.6.3 attrs==24.2.0 babel==2.16.0 beautifulsoup4==4.12.3 bleach==6.1.0 blinker==1.8.2 bokeh==3.5.2 build==1.2.1 cattrs==24.1.0 certifi==2024.7.4 cffi==1.17.0 charset-normalizer==3.3.2 click==8.1.7 cmake==3.30.2 colorama==0.4.6 contourpy==1.3.0 cycler==0.12.1 decorator==5.1.1 dill==0.3.9 dlib==19.24.99 docutils==0.21.2 esbonio==0.16.4 eval_type_backport==0.2.0 executing==2.1.0 face_detection==0.2.2 facenet-pytorch==2.6.0 filelock==3.15.4 fire==0.6.0 Flask==3.0.3 Flask-Cors==4.0.1 flatbuffers==24.3.25 fonttools==4.53.1 fsspec==2024.6.1 gast==0.6.0 gdown==5.2.0 google-pasta==0.2.0 graphviz==0.20.3 grpcio==1.66.1 gunicorn==23.0.0 h11==0.14.0 h5py==3.11.0 httpcore==1.0.5 httpx==0.27.2 idna==3.8 imagesize==1.4.1 ipython==8.28.0 isort==5.13.2 itsdangerous==2.2.0 jax==0.4.31 jaxlib==0.4.31 jedi==0.19.1 Jinja2==3.1.4 joblib==1.4.2 kaggle==1.6.17 keras==3.6.0 Keras-Preprocessing==1.1.2 kiwisolver==1.4.5 libclang==18.1.1 livelossplot==0.5.5 lsprotocol==2023.0.1 Markdown==3.7 markdown-it-py==3.0.0 MarkupSafe==2.1.5 matplotlib==3.9.2 matplotlib-inline==0.1.7 mccabe==0.7.0 mdurl==0.1.2 mediapipe==0.10.18 ml-dtypes==0.4.0 mpmath==1.3.0 mtcnn==0.1.1 namex==0.0.8 networkx==3.3 numpy==1.26.4 opencv-contrib-python==4.10.0.84 opencv-python==4.10.0.84 opencv-python-headless==4.10.0.84 opt-einsum==3.3.0 optree==0.12.1 packaging==24.1 pandas==2.2.2 parso==0.8.4 pillow==10.2.0 platformdirs==4.2.2 prompt_toolkit==3.0.48 protobuf==4.25.4 psutil==6.0.0 pure_eval==0.2.3 py-cpuinfo==9.0.0 pycparser==2.22 pydantic==2.9.2 pydantic_core==2.23.4 pydot==2.0.0 pygls==1.3.1 Pygments==2.18.0 pylint==3.3.1 pyparsing==3.1.4 pyproject_hooks==1.1.0 PySocks==1.7.1 pyspellchecker==0.8.1 python-dateutil==2.9.0.post0 python-slugify==8.0.4 Pytorch-detection==0.0.1 pytz==2024.1 PyYAML==6.0.2 requests==2.32.3 retina-face==0.0.17 rich==13.8.0 scikit-learn==1.5.2 scipy==1.14.1 screeninfo==0.8.1 seaborn==0.13.2 sentencepiece==0.2.0 setuptools==74.0.0 simsimd==5.9.11 six==1.16.0 sniffio==1.3.1 snowballstemmer==2.2.0 sounddevice==0.5.0 soupsieve==2.6 Sphinx==8.0.2 sphinxcontrib-applehelp==2.0.0 sphinxcontrib-devhelp==2.0.0 sphinxcontrib-htmlhelp==2.1.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==2.0.0 sphinxcontrib-serializinghtml==2.0.0 stack-data==0.6.3 stringzilla==3.10.7 sympy==1.13.2 tensorboard==2.18.0 tensorboard-data-server==0.7.2 tensorflow==2.18.0 tensorflow_intel==2.18.0 termcolor==2.4.0 text-unidecode==1.3 tf_keras==2.17.0 threadpoolctl==3.5.0 tomlkit==0.13.2 torch==2.2.2 torchvision==0.17.2 tornado==6.4.1 tqdm==4.66.5 traitlets==5.14.3 typing_extensions==4.12.2 tzdata==2024.1 ultralytics==8.2.83 ultralytics-thop==2.0.5 urllib3==2.2.2 utils==1.0.2 wcwidth==0.2.13 webencodings==0.5.1 Werkzeug==3.0.4 wheel==0.44.0 wrapt==1.16.0 xyzservices==2024.6.0 yunnet==2.0
Reproducible example
Relevant Log Output
File "E:\USER\Programs\project\venv\Lib\site-packages\retinaface\RetinaFace.py", line 96, in detect_faces model = build_model() ^^^^^^^^^^^^^ File "E:\USER\Programs\project\venv\Lib\site-packages\retinaface\RetinaFace.py", line 54, in build_model retinaface_model.build_model(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\USER\Programs\project\venv\Lib\site-packages\retinaface\model\retinaface_model.py", line 1027, in build_model x1_shape = tf.shape(ssh_c3_up) ^^^^^^^^^^^^^^^^^^^ File "E:\USER\Programs\project\venv\Lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler raise e.with_traceback(filtered_tb) from None File "E:\USER\Programs\project\venv\Lib\site-packages\keras\src\backend\common\keras_tensor.py", line 138, in __tf_tensor__ raise ValueError( ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces
keras.layers
andkeras.operations
). You are likely doing something like:What you should do instead is wrap
tf_fn
in a layer:Expected Result
The detected objects
What happened instead?
In the code
detector.detect_faces(img_path=input_image)
, it raising the error: ValueError: A KerasTensor cannot be used as input to a TensorFlow functionAdditional Info
No response