【问题标题】:How to get landmarks of iris detection in mediapipe c++?如何在 mediapipe c++ 中获取虹膜检测的地标?
【发布时间】:2022-06-29 15:40:37
【问题描述】:

我正在尝试将面部+眼睛的地标写入终端

我在 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();
}

我正在使用最新 Mediapipe 版本的 MacOs M1 上运行

我希望程序向我展示面部和虹膜的标志 + 显示带有这些标志的我脸上的实时流

它将所有内容写入INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

然后它就停止了。 一点点调试告诉我,处理需要很长时间

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

那么,我哪里错了?

查看我的完整代码:https://pastebin.com/H8JV6hsM

【问题讨论】:

    标签: c++ machine-learning mediapipe


    【解决方案1】:

    我发现如果 poller.QueenSize() 返回 0 会阻塞程序。

    试试这个:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-10-13
      • 2021-08-24
      • 2011-02-22
      • 1970-01-01
      • 1970-01-01
      • 2021-07-12
      • 2013-07-27
      相关资源
      最近更新 更多