kleinlee / DH_live

每个人都能用的数字人
711 stars 155 forks source link

AttributeError: 'NoneType' object has no attribute 'shape' #42

Open lonngxiang opened 1 month ago

lonngxiang commented 1 month ago

用自己视频训练后的模型运行 报错 python demo.py /home/loong/Downloads/loong/loong1_bk video_data/audio0.wav 3.mp4 image

lonngxiang commented 1 month ago
python demo1.py /home/loong/Downloads/loong/loong1_bk video_data/audio0.wav 3.mp4
(256, 256, 3)
Video path is set to: /home/loong/Downloads/loong/loong1_bk
Audio path is set to: video_data/audio0.wav
output video name is set to: 3.mp4
/home/loong/miniconda3/envs/dh_live/lib/python3.12/site-packages/sklearn/base.py:376: InconsistentVersionWarning: Trying to unpickle estimator PCA from version 1.3.0 when using version 1.5.2. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations
  warnings.warn(
/ai/DH_live/talkingface/audio_model.py:46: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  self.__net.load_state_dict(torch.load(ckpt_path))
/ai/DH_live/talkingface/render_model.py:37: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  checkpoint = torch.load(ckpt_path)
请检查当前视频, 错误帧数: 18
Traceback (most recent call last):
  File "/ai/DH_live/demo1.py", line 63, in <module>
    main()
  File "/ai/DH_live/demo1.py", line 33, in main
    renderModel.reset_charactor(video_path, pkl_path)
  File "/ai/DH_live/talkingface/render_model.py", line 46, in reset_charactor
    prepare_video_data(video_path, Path_pkl, ref_img_index_list)
  File "/ai/DH_live/talkingface/run_utils.py", line 226, in prepare_video_data
    ref_img = get_ref_images_fromVideo(cap_input, ref_img_index_list, pts_driven[:, :, :2])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ai/DH_live/talkingface/data/few_shot_dataset.py", line 78, in get_ref_images_fromVideo
    ref_img = generate_ref(frame, ref_keypoints[index])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ai/DH_live/talkingface/data/few_shot_dataset.py", line 50, in generate_ref
    crop_coords = crop_face(keypoints, size=img.shape[:2], is_train=is_train)
                                            ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
v3ucn commented 1 month ago

是numpy版本的问题,请运行命令 pip3 install numpy==1.26.4 即可

然后重新生成检查点文件