alievk/avatarify-python

AttributeError: _2D error and no face detection after change to TWO_D

peterujah opened this issue · 6 comments

Describe the bug
Please i need help in setting up avatarify on my pc, when i run run_windows.bat, it showed below error.

Traceback (most recent call last):
  File "afy/cam_fomm.py", line 218, in <module>
    **predictor_args
  File "C:\Users\User\avatarify-python\afy\predictor_local.py", line 49, in __init__
    self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device=self.device)
  File "C:\Users\User\miniconda3\envs\avatarify\lib\enum.py", line 354, in __getattr__
    raise AttributeError(name) from None
AttributeError: _2D

To Reproduce

And i changed line 49 in predictor_local.py
from self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device=self.device)
to self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D, flip_input=True, device=self.device)

And run again, it passed but it shows below warning before opening camera window. but it doesn't detect my face nor preview the window is totally blank.

C:\Users\User\miniconda3\envs\avatarify\lib\site-packages\torch\nn\functional.py:3103: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed")

And when i press X on the blank cam window, it exit with below error

  warnings.warn("No faces were detected.")
Traceback (most recent call last):
  File "afy/cam_fomm.py", line 316, in <module>
    out = predictor.predict(frame)
  File "C:\Users\User\avatarify-python\afy\predictor_local.py", line 104, in predict
    use_relative_jacobian=self.relative, adapt_movement_scale=self.adapt_movement_scale)
  File "C:\Users\User\avatarify-python\afy\predictor_local.py", line 28, in normalize_kp
    jacobian_diff = torch.matmul(kp_driving['jacobian'], torch.inverse(kp_driving_initial['jacobian']))
RuntimeError: CUDA error: operation not supported when calling `cusparseCreate(handle)

What steps can we follow to reproduce the issue?

Info (please complete the following information):

  • OS (e.g., Windows 10 pro):
  • GPU model: NVIDIA GeForce RTX 4060 Ti

Any other relevant information

conda_infos.txt
run_window_bat.txt

Screenshots
blank_window

?
Yes i have camera, when i run my system camera app, my cam works fine.

Go to an avatarify folder in the user
Delete the cam.yaml file .
Then, relaunch the program
Run_windows.bat

I want to believe that you are doing this with a gaming pc .

If that does not work, then ask me for help on whatsapp +2347081306010 .

https://youtube.com/shorts/keEIZVnbT48?si=akCdghB55-zrLddg

If you need any help on avatarify related issues contact me on Whatsapp+2349036407102

If you have any problem with avatarify . Contact me for solutions 100% results on apple macbook and any windows.
You can also watch my installation video that shows you how to do it yourself. Or simply ask for help from my whatsapp contact
https://wa.me/message/GXQYWX4XRTXGB1
+2347081306010

pip install face-alignment==1.0.0 msgpack_numpy pyyaml==6.0.1

Telegram
@King_Gabos

Describe the bug Please i need help in setting up avatarify on my pc, when i run run_windows.bat, it showed below error.

Traceback (most recent call last):
  File "afy/cam_fomm.py", line 218, in <module>
    **predictor_args
  File "C:\Users\User\avatarify-python\afy\predictor_local.py", line 49, in __init__
    self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device=self.device)
  File "C:\Users\User\miniconda3\envs\avatarify\lib\enum.py", line 354, in __getattr__
    raise AttributeError(name) from None
AttributeError: _2D

To Reproduce

And i changed line 49 in predictor_local.py from self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device=self.device) to self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D, flip_input=True, device=self.device)

And run again, it passed but it shows below warning before opening camera window. but it doesn't detect my face nor preview the window is totally blank.

C:\Users\User\miniconda3\envs\avatarify\lib\site-packages\torch\nn\functional.py:3103: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed")

And when i press X on the blank cam window, it exit with below error

  warnings.warn("No faces were detected.")
Traceback (most recent call last):
  File "afy/cam_fomm.py", line 316, in <module>
    out = predictor.predict(frame)
  File "C:\Users\User\avatarify-python\afy\predictor_local.py", line 104, in predict
    use_relative_jacobian=self.relative, adapt_movement_scale=self.adapt_movement_scale)
  File "C:\Users\User\avatarify-python\afy\predictor_local.py", line 28, in normalize_kp
    jacobian_diff = torch.matmul(kp_driving['jacobian'], torch.inverse(kp_driving_initial['jacobian']))
RuntimeError: CUDA error: operation not supported when calling `cusparseCreate(handle)

What steps can we follow to reproduce the issue?

Info (please complete the following information):

  • OS (e.g., Windows 10 pro):
  • GPU model: NVIDIA GeForce RTX 4060 Ti

Any other relevant information

conda_infos.txt run_window_bat.txt

Screenshots blank_window

? Yes i have camera, when i run my system camera app, my cam works fine.

Did you get it resolved?
Please help how to change 2D to TWO D