调用姿态估计库 mp.solutions.pose.Pose,出现下面的问题
Traceback (most recent call last):
File "D:/cv/feilei/cc.py", line 11, in <module>
detector = PoseDetector()
File "D:\cv\feilei\poseutil.py", line 32, in __init__
self.min_detection_confidence, self.min_tracking_confidence)
File "D:\ProgramData\Anaconda3\lib\site-packages\mediapipe\python\solutions\pose.py", line 162, in __init__
outputs=['pose_landmarks', 'pose_world_landmarks', 'segmentation_mask'])
File "D:\ProgramData\Anaconda3\lib\site-packages\mediapipe\python\solution_base.py", line 260, in __init__
for name, data in (side_inputs or {}).items()
File "D:\ProgramData\Anaconda3\lib\site-packages\mediapipe\python\solution_base.py", line 260, in <dictcomp>
for name, data in (side_inputs or {}).items()
File "D:\ProgramData\Anaconda3\lib\site-packages\mediapipe\python\solution_base.py", line 513, in _make_packet
return getattr(packet_creator, 'create_' + packet_data_type.value)(data)
TypeError: create_bool(): incompatible function arguments. The following argument types are supported:
1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet
这个是由于版本更新了,新增了个参数:enable_segmentation=False,加上即可。
将
# 创建一个Pose对象用于检测人体姿势
self.pose = mp.solutions.pose.Pose(self.static_image_mode, self.upper_body_only, self.smooth_landmarks,
self.min_detection_confidence, self.min_tracking_confidence)
改为:
self.pose = mp.solutions.pose.Pose(self.static_image_mode, self.upper_body_only, self.smooth_landmarks,False,self.min_detection_confidence, self.min_tracking_confidence)