yzhou359 / MakeItTalk

Other
975 stars 217 forks source link

'NoneType' object has no attribute 'ndim' #48

Closed dataes closed 3 years ago

dataes commented 3 years ago

Hi, after struggling to get a good configuration of conda + pytorch + pyvision + cuda etc..(first time). I managed to run the script but I'm facing another problem;

(makeittalk_env) vincent@denaes:~/Desktop/development/MakeItTalk-main$ python main_end2end.py --jpg examples/327-3275260_leonardo-dicaprio-png-famous-actor.png
Downloading: "https://www.adrianbulat.com/downloads/python-fan/3DFAN4-4a694010b9.zip" to /home/vincent/.cache/torch/hub/checkpoints/3DFAN4-4a694010b9.zip
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 91.9M/91.9M [03:41<00:00, 434kB/s]
Downloading: "https://www.adrianbulat.com/downloads/python-fan/depth-6c4283c0e0.zip" to /home/vincent/.cache/torch/hub/checkpoints/depth-6c4283c0e0.zip
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 224M/224M [09:08<00:00, 429kB/s]
Traceback (most recent call last):
  File "main_end2end.py", line 72, in <module>
    shapes = predictor.get_landmarks(img)
  File "/home/vincent/anaconda3/envs/makeittalk_env/lib/python3.6/site-packages/face_alignment/api.py", line 110, in get_landmarks
    return self.get_landmarks_from_image(image_or_path, detected_faces, return_bboxes, return_landmark_score)
  File "/home/vincent/anaconda3/envs/makeittalk_env/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "/home/vincent/anaconda3/envs/makeittalk_env/lib/python3.6/site-packages/face_alignment/api.py", line 138, in get_landmarks_from_image
    image = get_image(image_or_path)
  File "/home/vincent/anaconda3/envs/makeittalk_env/lib/python3.6/site-packages/face_alignment/utils.py", line 342, in get_image
    if image.ndim == 2:
AttributeError: 'NoneType' object has no attribute 'ndim'

If you have a clue, thank you !

StephanPan commented 3 years ago

did you solve the problem?

MohammedAlghamdi commented 3 years ago

You could fix this by passing only the filename not the absolute path of the image for example python main_end2end.py --jpg trump.jpg The code expects you to choose one the image files in examples directory. Hope this helps

dataes commented 3 years ago

thank you @MohammedAlghamdi it works now, I was indeed putting the full path... The result is something like that : Screenshot from 2021-10-19 09-48-13 Quality is not awesome with the audio embeded but anyway (out.mp4 without the sound is good).

I wonder if it's possible to get the middle image only, but that's another topic.

Thank you !