conda环境下face_alignment.LandmarksType._2D AttributeError: _2D解决方法

文章讲述了在运行视频重述模型时遇到的FaceAlignment异常,原因在于LandmarksType中没有_2D属性。给出了两种解决方案:直接替换为TWO_D常量或升级face_alignment库。同时介绍了Conda环境管理器在包管理和依赖性问题上的优势和用法。

1 问题描述

运行retalking模型时,代码抛出异常,信息如下所示:

Traceback (most recent call last):
  File "D:/ml/video-retalking/inference.py", line 345, in <module>
    main()
  File "D:/ml/video-retalking/inference.py", line 81, in main
    kp_extractor = KeypointExtractor()
  File "D:\ml\video-retalking\third_part\face3d\extract_kp_videos.py", line 16, in __init__
    self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D)
  File "D:\.conda\retalking\lib\enum.py", line 384, in __getattr__
    raise AttributeError(name) from None
AttributeError: _2D

2 问题分析

从异常信息可知,在face_alignment.LandmarksType中没有_2D这个属性,查看face_alignment.LandmarksType源代码,如下所示:

class LandmarksType(IntEnum):
    """Enum class defining the type of landmarks to detect.

    ``TWO_D`` - the detected points ``(x,y)`` are detected in a 2D space and follow the visible contour of the face
    ``TWO_HALF_D`` - this points represent the projection of the 3
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

源启智能

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值