-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Tensor shape error, what is the problem? #1264
Comments
with this explanation, i cannot reproduce that error. try to make it more modular. e.g. what is rgb? share it in the bug description. also, instead of sharing this snippet just share the problematic line with clear args. |
This sample code reads images from a webcam and calls the extract_faces function. rgb is the numpy array taken from the webcam by the opencv library and is of (480,640,3) shape. I read the image from the webcam and run the extract_faces function from the DeepFace library, but I get an error of this type: Also, if I run the function with the provided image tests/dataset/img59.jpg rather than the webcam image as input, the same error occurs. |
independent from webcam capture, the following code snippet throws same exception? result = DeepFace.extract_faces(
img_path="tests/dataset/img59.jpg",
detector_backend="fastmtcnn",
align=True,
) |
Yes, here is the error message. from deepface import DeepFace
result = DeepFace.extract_faces(
# img_path="test.jpg",
# img_path=rgb,
# detector_backend=backends[4],
# align=alignment_modes[0],
img_path="tests/dataset/img59.jpg",
detector_backend="fastmtcnn",
align=True,
)
print(result)
|
your pytorch installation seems not okay, can you try to change detector to opencv? |
You are right. I changed the detector and it worked fine. I don't know the cause, but it seems like a problem with my system. |
Before You Report a Bug, Please Confirm You Have Done The Following...
DeepFace's version
0.0.92
Python version
3.8.10
Operating System
Ubuntu 20.04
Dependencies
absl-py==2.1.0
addict==2.4.0
asttokens==2.4.1
astunparse==1.6.3
attrs==23.2.0
backcall==0.2.0
beautifulsoup4==4.12.3
blinker==1.8.2
cachetools==5.3.3
certifi==2024.6.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
comm==0.2.2
ConfigArgParse==1.7
contourpy==1.1.1
cycler==0.12.1
dash==2.17.1
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
dataclasses-json==0.5.14
decorator==5.1.1
-e git+ssh:https://[email protected]/serengil/deepface.git@c2a82e6153ee0dcf40bc8494b30a5fafa382f32d#egg=deepface
dlib==19.24.4
executing==2.0.1
facenet-pytorch==2.6.0
fastjsonschema==2.20.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.0
fsspec==2024.6.0
gast==0.4.0
gdown==5.2.0
google-auth==2.30.0
google-auth-oauthlib==1.0.0
google-pasta==0.2.0
grpcio==1.64.1
gunicorn==22.0.0
h5py==3.11.0
idna==3.7
importlib_metadata==7.2.1
importlib_resources==6.4.0
ipython==8.12.3
ipywidgets==8.1.3
itsdangerous==2.2.0
jax==0.4.13
jaxlib==0.4.13
jedi==0.19.1
Jinja2==3.1.4
joblib==1.4.2
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
jupyter_core==5.7.2
jupyterlab_widgets==3.0.11
keras==2.13.1
kiwisolver==1.4.5
libclang==18.1.1
Markdown==3.6
MarkupSafe==2.1.5
marshmallow==3.21.3
matplotlib==3.7.5
matplotlib-inline==0.1.7
mediapipe==0.10.11
ml-dtypes==0.2.0
mpmath==1.3.0
mtcnn==0.1.1
mypy-extensions==1.0.0
nbformat==5.7.0
nest-asyncio==1.6.0
networkx==3.1
numpy==1.24.3
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.19.3
nvidia-nvjitlink-cu12==12.5.40
nvidia-nvtx-cu12==12.1.105
oauthlib==3.2.2
open3d==0.17.0
opencv-contrib-python==4.10.0.84
opencv-python==4.10.0.84
opt-einsum==3.3.0
packaging==24.1
pandas==2.0.3
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==10.2.0
pkg_resources==0.0.0
pkgutil_resolve_name==1.3.10
platformdirs==4.2.2
plotly==5.22.0
prompt_toolkit==3.0.47
protobuf==3.20.3
psutil==6.0.0
ptyprocess==0.7.0
pure-eval==0.2.2
py-cpuinfo==9.0.0
pyasn1==0.6.0
pyasn1_modules==0.4.0
pycparser==2.22
Pygments==2.18.0
pyk4a==1.5.0
pyparsing==3.1.2
pypng==0.0.21
pypylon==2.3.0
pyquaternion==0.9.9
pyrealsense2==2.55.1.6486
PySocks==1.7.1
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
referencing==0.35.1
requests==2.32.3
requests-oauthlib==2.0.0
retina-face==0.0.17
retrying==1.3.4
rpds-py==0.18.1
rsa==4.9
scikit-learn==1.3.2
scipy==1.10.1
seaborn==0.13.2
six==1.16.0
sounddevice==0.4.7
soupsieve==2.5
stack-data==0.6.3
sympy==1.12.1
tenacity==8.4.2
tensorboard==2.13.0
tensorboard-data-server==0.7.2
tensorflow==2.13.1
tensorflow-estimator==2.13.0
tensorflow-io-gcs-filesystem==0.34.0
termcolor==2.4.0
threadpoolctl==3.5.0
torch==2.2.2
torchvision==0.17.2
tqdm==4.66.4
traitlets==5.14.3
triton==2.2.0
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
ultralytics==8.2.42
ultralytics-thop==2.0.0
ur-rtde==1.5.8
urllib3==2.2.2
wcwidth==0.2.13
Werkzeug==3.0.3
widgetsnbextension==4.0.11
wrapt==1.16.0
zipp==3.19.2
Reproducible example
Relevant Log Output
2024-06-25 16:36:12.329829: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-06-25 16:36:12.940596: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
The shape of the mask [10510] at index 0 does not match the shape of the indexed tensor [10551, 4] at index 0
Expected Result
No response
What happened instead?
No response
Additional Info
No response
The text was updated successfully, but these errors were encountered: