MediaPipe框架源码分析

背景

MediaPipe的介绍。
源代码位置 https://github.com/google/mediapipe

框架介绍(截至2022-01)

主要是graph

官方介绍说明
https://google.github.io/mediapipe/framework_concepts/framework_concepts.html#the-basics

从hello-world开始

hello-world.cc位于https://github.com/google/mediapipe/blob/master/mediapipe/examples/desktop/hello_world/hello_world.cc

这个hello-world文件,包含了所有框架运行,需要的组件。

graph是怎么运行起来的?

准备config文件
根据config文件,初始化graph
graph初始化,调用Initialize
创建输出读取 OutputStreamPoller
graph开始运行
给graph添加输入
流程结束,进入关闭状态
读取输出
等待graph结束

main
CalculatorGraph graph
graph.Initialize(config)
OutputStreamPoller poller = graph.AddOutputStreamPoller('out')
graph.StartRun({})
graph.AddPacketToInputStream
graph.CloseInputStream('in')
poller.Next(&packet)
graph.WaitUntilDone()
CalculatorGraph::Initialize
validated_graph->Initialize()
Initialize
CalculatorGraph::InitializeExecutors
CalculatorGraph::InitializePacketGeneratorGraph
CalculatorGraph::InitializeStreams
CalculatorGraph::InitializeCalculatorNodes
CalculatorGraph::AddOutputStreamPoller
CalculatorGraph::StartRun
CalculatorGraph::PrepareForRun
Scheduler::Start
CalculatorGraph::AddPacketToInputStreamInternal
CalculatorGraph::CloseInputStream
OutputStreamPoller::Next
CalculatorGraph::WaitUntilDone

你可能感兴趣的:(MediaPipe,Machine,Learning,图像处理)