当我运行代码时,出现此错误。另外,我已经安装了所需的依赖项,例如
cvzone
和mediapipe
,但仍然错误。
有人可以帮我解决这个问题或者知道问题出在哪里吗?
import cv2
from cvzone.PoseModule import PoseDetector
cap = cv2.VideoCapture('Video.mp4')
detector = PoseDetector()
while True:
success, img = cap.read()
img = detector.findPose(img)
lmList, bboxInfo = detector.findPosition(img)
cv2.imshow("Image", img)
cv2.waitKey(1)
结果:
Traceback (most recent call last):
File "/Users/chashanefaith.babanto/Desktop/CRYSTHEL/Motion Capture/MotionCap.py", line 6, in <module>
detector = PoseDetector()
File "/Users/chashanefaith.babanto/Desktop/CRYSTHEL/Motion Capture/.venv/lib/python3.9/site-packages/cvzone/PoseModule.py", line 42, in __init__
self.pose = self.mpPose.Pose(static_image_mode=self.staticMode,
File "/Users/chashanefaith.babanto/Desktop/CRYSTHEL/Motion Capture/.venv/lib/python3.9/site-packages/mediapipe/python/solutions/pose.py", line 146, in __init__
super().__init__(
File "/Users/chashanefaith.babanto/Desktop/CRYSTHEL/Motion Capture/.venv/lib/python3.9/site-packages/mediapipe/python/solution_base.py", line 248, in __init__
self._graph = calculator_graph.CalculatorGraph(
RuntimeError: ValidatedGraphConfig Initialization failed.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required.
InferenceCalculatorCpu: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:63) !options.model_path().empty() ^ kSideInModel(cc).IsConnected()Either model as side packet or model path in options is required.
SplitDetectionVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
我也遇到同样的问题了!!!!我通过安装旧版本的mediapipe(0.10.0)解决了这个问题。