2

I am trying to write the landmarks of face+eyes to terminal

I have added a couple of lines to demo_run_graph_main:

#include "mediapipe/calculators/util/landmarks_to_render_data_calculator.pb.h"
#include "mediapipe/framework/formats/landmark.pb.h"
constexpr char kDetectionsStream[] = "face_landmarks_with_iris";
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller_detection,
graph.AddOutputStreamPoller(kDetectionsStream));
mediapipe::Packet detection_packet;
if (!poller_detection.Next(&detection_packet)) break;
auto& output_landmarks = detection_packet.Get<std::vector<::mediapipe::NormalizedLandmarkList>>();
for (const ::mediapipe::NormalizedLandmarkList& normalizedlandmarkList : output_landmarks) {
LOG(INFO) << normalizedlandmarkList.DebugString();
}

I am running on MacOs M1 with latest Mediapipe version

I want the program to show me the landmarks of face and iris + show the resulting live-stream with these landmarks on my face

It writes everything up to INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

and then it just stops. A little bit of debugging showed me that it takes forever to process

if (!poller_detection.Next(&detection_packet)) break;

So, where do I go wrong?

to see my full code: https://pastebin.com/H8JV6hsM

Efim Rubin
  • 173
  • 1
  • 16

1 Answers1

0

I find out that will blocking the program if poller.QueenSize() returns 0.

Try this:

...
mediapipe::Packet detection_packet;
// add this 
if(poller_detection.QueueSize()<=0) continue;
if (!poller_detection.Next(&detection_packet)) break;
...