Skip to content
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

ValueError: mutable default <class 'numpy.ndarray'> for field LANDMARKS is not allowed: use default_factory, when running demo.py #42

Open
Plank99 opened this issue Sep 11, 2023 · 1 comment

Comments

@Plank99
Copy link

Plank99 commented Sep 11, 2023

Hi,
I am trying to run the demo but for some reason it only throws me an error. Can anybody help me with this?

File "F:\Users\Daniel\Downloads\pytorch_mpiigaze_demo-master\pytorch_mpiigaze_demo-master\ptgaze\demo.py", line 11, in
from gaze_estimator import GazeEstimator
File "F:\Users\Daniel\Downloads\pytorch_mpiigaze_demo-master\pytorch_mpiigaze_demo-master\ptgaze\gaze_estimator.py", line 12, in
from utils import get_3d_face_model
File "F:\Users\Daniel\Downloads\pytorch_mpiigaze_demo-master\pytorch_mpiigaze_demo-master\ptgaze\utils.py", line 13, in
from common.face_model_mediapipe import FaceModelMediaPipe
File "F:\Users\Daniel\Downloads\pytorch_mpiigaze_demo-master\pytorch_mpiigaze_demo-master\ptgaze\common\face_model_mediapipe.py", line 8, in
@dataclasses.dataclass(frozen=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\danie\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1213, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\danie\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\danie\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'numpy.ndarray'> for field LANDMARKS is not allowed: use default_factory

@drewp
Copy link

drewp commented Oct 3, 2023

Python, numpy, and torch (at least) have changed their APIs since the versions this repo was written against.

I hacked in some fixes here:
drewp@e30d064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants