google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.79k stars 5.18k forks source link

MediaPipe Hands landmarks can not be obtained by poller (GPU version) when use latest mediapipe code #2182

Closed aiarcv closed 3 years ago

aiarcv commented 3 years ago

Please make sure that this is a solution issue.

System information (Linux Ubuntu 18.04 or 20.04)

  • Have I written custom code (as opposed to using a stock example script provided in Mediapipe):Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04, Android 11, iOS 14.4): Ubuntu 18.04 or 20.04
  • MediaPipe version: 0.8.4 or latest nightly build
  • Bazel version:3.7.4
  • Solution (e.g. FaceMesh, Pose, Holistic):hands
  • Programming Language and version ( e.g. C++, Python, Java):C++

Describe the expected behavior: https://github.com/google/mediapipe/issues/1971 https://github.com/google/mediapipe/issues/1973 Use the procedure described in above two issues , we Can obtain landmarks XYZ by poller (NormalizedLandmarkList) for CPU version, when do exactly same things for GPU , the procedure does not work and not able to get XYZ in GPU mode.
Standalone code you may have used to try to get what you need :

Other info / Complete Logs : Mediapipe by pass the landmarks can not get landmark in following codes ( the poller works and can get landmark in GPU mode when using 2020 Nov Mediapipe, but can not work for latest mediapipe) if (!multi_hand_landmarks_poller.Next(&multi_hand_landmarks_packet)) { LOG(INFO) << "landmarks cannot be polled\n"; break; }

sgowroji commented 3 years ago

Hi @aiarcv, Could you please provide the custom code changes performed on graphs with error logs.

txf- commented 3 years ago

@aiarcv

The problem is that the calculators are not always emitting packets and the pollers block the graph, effectively preventing the graph from sourcing new packets.

See #1532

or #850

Basically it involves editing the graphs and polling based on whether a packet is present

node {
  calculator: "PacketPresenceCalculator"
  input_stream: "PACKET:landmarks"
  output_stream: "PRESENCE:landmark_presence"
}
google-ml-butler[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

hadon commented 3 years ago

AddOutputStreamPoller() is designed for convenience by enabling synchronous graph input and output, all from a single application thread. However, because some MediaPipe calculators occasionally produce no output, AddOutputStreamPoller() is prone to deadlocks. I usually change from AddOutputStreamPoller() to ObserveOutputStream(), which doesn't block any thread. See related issue #1709.

google-ml-butler[bot] commented 3 years ago

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