Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This simple code while running causing me so much problem #5369

Closed
Karangautam870 opened this issue May 2, 2024 · 9 comments
Closed

This simple code while running causing me so much problem #5369

Karangautam870 opened this issue May 2, 2024 · 9 comments
Assignees
Labels
legacy:hands Hand tracking/gestures/etc platform:python MediaPipe Python issues type:support General questions

Comments

@Karangautam870
Copy link

import mediapipe as mp
import cv2 as cv
import time

cap = cv.VideoCapture(0)

mphands = mp.solutions.hands
hands = mphands.Hands()

while True:
success,img = cap.read()
imgRGB = cv.cvtColor(img,cv.COLOR_BGR2RGB)
results = hands.process(imgRGB)
cv.imshow("Image",img)

cv.waitKey(0)

i am trying to run this code but it is showing me this error
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.
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.
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.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
please help what should i do

@Karangautam870 Karangautam870 added the type:others issues not falling in bug, perfromance, support, build and install or feature label May 2, 2024
@kuaashish kuaashish added type:support General questions platform:python MediaPipe Python issues legacy:hands Hand tracking/gestures/etc and removed type:others issues not falling in bug, perfromance, support, build and install or feature labels May 2, 2024
@kuaashish
Copy link
Collaborator

Hi @Karangautam870,

After reviewing the code snippet you provided, it appears that you are using an legacy version of MediaPipe Hand Solution. We have recently launched enhanced MediaPipe Tasks APIs, which provide increased stability and functionality compared to the legacy version.

We strongly advise migrating to these updated APIs for Hand landmarks, as we no longer support legacy solutions. You can find the documentation for the Hand Landmarker here and implementation guide for Python here.

Unfortunately, aside from this, we won't be able to assist you much further.

Thank you!!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label May 2, 2024
Copy link

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label May 10, 2024
@Karangautam870
Copy link
Author

Karangautam870 commented May 14, 2024

`import mediapipe as mp
import cv2 as cv
import time

cap = cv.VideoCapture(0)

mphands = mp.solutions.hands
hands = mphands.Hands()

while True:
success, img = cap.read()
if not success:
print("Error reading frame from camera")
break

imgRGB = cv.cvtColor(img, cv.COLOR_BGR2RGB)
results = hands.process(imgRGB)

if results.multi_hand_landmarks:
    for hand_landmarks in results.multi_hand_landmarks:
        for landmark in hand_landmarks.landmark:
            # Get the pixel coordinates of the landmark
            h, w, c = img.shape
            cx, cy = int(landmark.x * w), int(landmark.y * h)
            cv.circle(img, (cx, cy), 5, (255, 0, 255), cv.FILLED)

cv.imshow("Image", img)

if cv.waitKey(1) & 0xFF == ord('d'):
    break

cap.release()
cv.destroyAllWindows()
`
the error message I got

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 i am getting this error message

I asked from chatgpt it is showing me this please help

The error message you're encountering seems to be originating from the MediaPipe framework. Specifically, it's related to the configuration of a calculator, possibly the ConstantSidePacketCalculator or the SplitTensorVectorCalculator.

The error message indicates that the number of output side packets doesn't match the number of packets configured in the options. This suggests there's a mismatch between the expected number of outputs and the actual number being produced by the calculator.

To resolve this issue, you need to check the configuration of your calculator, ensuring that the number of output side packets matches the number specified in the options. You might want to review the documentation or source code of the calculators you're using to understand how they're configured and ensure they align correctly.

@github-actions github-actions bot removed stale stat:awaiting response Waiting for user response labels May 15, 2024
@kuaashish
Copy link
Collaborator

Hi @Karangautam870,

As suggested above, please migrate to our new Task API. If you encounter any further issues, let us know. Note that we will no longer support the legacy solution, Unfortunately, We will be not able to help you out on this.

Thank you!!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label May 17, 2024
@Karangautam870
Copy link
Author

Hi @Karangautam870,

As suggested above, please migrate to our new Task API. If you encounter any further issues, let us know. Note that we will no longer support the legacy solution, Unfortunately, We will be not able to help you out on this.

Thank you!!

How to migrate like give me some links or steps to do this

@kuaashish
Copy link
Collaborator

Hi @Karangautam870,

You can find the documentation for the Hand Landmarker here and implementation guide for Python here.

@kuaashish kuaashish added stat:awaiting response Waiting for user response and removed stat:awaiting response Waiting for user response labels May 17, 2024
Copy link

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label May 25, 2024
Copy link

github-actions bot commented Jun 1, 2024

This issue was closed due to lack of activity after being marked stale for past 7 days.

@github-actions github-actions bot closed this as completed Jun 1, 2024
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@kuaashish kuaashish removed stat:awaiting response Waiting for user response stale labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy:hands Hand tracking/gestures/etc platform:python MediaPipe Python issues type:support General questions
Projects
None yet
Development

No branches or pull requests

2 participants