# google-ai-edge/mediapipe architecture

> Architecture diagram of the GitHub repository google-ai-edge/mediapipe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/google-ai-edge/mediapipe
- Repository: https://github.com/google-ai-edge/mediapipe

## Overview

MediaPipe is an on-device machine-learning toolkit spanning cross-platform Tasks APIs and a lower-level packet-and-calculator graph framework. A typical user supplies media or other task input and receives inference results; the repository also includes specialized processing such as face-landmark-to-3D-geometry conversion. The tree and excerpts show framework primitives, inference support, and geometry implementations, but not a complete task invocation path, so uncertain workflow links are dashed. The README documents broader audio, decision, generative-AI, retrieval, text, and vision capabilities not individually sampled here.

Main entry points: [`mediapipe/framework/calculator_graph.h`](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/calculator_graph.h) (Calculator graph), [`mediapipe/tasks`](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks) (Solution families), [`mediapipe/calculators/tensor/inference_calculator.cc`](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_calculator.cc) (Tensor inference), [`mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc`](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc) (Geometry calculator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Product interfaces"]
  node_taskapi["Tasks APIs"]
  node_solutions["Solution families"]
  node_results["Task results"]
end

subgraph group_runtime["Graph runtime"]
  node_framework["Framework API"]
  node_graph["Calculator graph<br/>[calculator_graph.h]"]
  node_packets["Packets<br/>[packet.h]"]
  node_streaming["Stream management"]
  node_calculators["Calculator library"]
end

subgraph group_inference["Inference processing"]
  node_tensorprep["Tensor preparation"]
  node_inference["Tensor inference"]
  node_iomap["Inference I/O mapping"]
  node_feedback["Inference feedback"]
end

subgraph group_domains["Domain processing"]
  node_landmarks["Face landmarks"]
  node_geometrycalc["Geometry calculator"]
  node_geometry["3D geometry pipeline"]
  node_taskgeometry["Tasks geometry"]
  node_taskgeometrylib["Tasks geometry pipeline"]
  node_audio["Audio processing"]
  node_vision["Vision processing"]
  node_text["Text processing"]
end

node_developer(("App developer"))
node_media(("Media input"))
node_output(("Application output"))

node_developer -->|"uses"| node_taskapi
node_developer -->|"builds with"| node_framework
node_media -.->|"supplies input"| node_taskapi
node_taskapi -->|"exposes"| node_solutions
node_taskapi -.->|"routes through"| node_graph
node_framework -->|"provides graph API"| node_graph
node_graph -.->|"exchanges"| node_packets
node_graph -.->|"dispatches streams"| node_streaming
node_graph -->|"runs"| node_calculators
node_calculators -.->|"prepares tensors"| node_tensorprep
node_tensorprep -.->|"provides tensors"| node_inference
node_inference -.->|"remaps I/O"| node_iomap
node_inference -.->|"manages feedback"| node_feedback
node_inference -.->|"produces results"| node_results
node_solutions -->|"supports audio"| node_audio
node_solutions -->|"supports vision"| node_vision
node_solutions -->|"supports text"| node_text
node_landmarks -.->|"feeds geometry"| node_geometrycalc
node_geometrycalc -->|"invokes pipeline"| node_geometry
node_taskgeometry -->|"invokes pipeline"| node_taskgeometrylib
node_results -.->|"returns result"| node_output
node_geometrycalc -.->|"emits geometry"| node_output

click node_taskapi "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks"
click node_solutions "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks"
click node_framework "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/calculator_framework.h"
click node_graph "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/calculator_graph.h"
click node_packets "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/packet.h"
click node_streaming "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/input_stream_manager.cc"
click node_calculators "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators"
click node_tensorprep "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/tensor"
click node_inference "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_calculator.cc"
click node_iomap "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_io_mapper.h"
click node_feedback "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_feedback_manager.cc"
click node_results "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks"
click node_landmarks "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc"
click node_geometrycalc "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc"
click node_geometry "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/libs/geometry_pipeline.cc"
click node_taskgeometry "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/cc/vision/face_geometry/calculators/geometry_pipeline_calculator.cc"
click node_taskgeometrylib "https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/cc/vision/face_geometry/libs/geometry_pipeline.cc"
click node_audio "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/audio"
click node_vision "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/image"
click node_text "https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/tensor"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_taskapi,node_solutions,node_results toneBlue
class node_framework,node_graph,node_packets,node_streaming,node_calculators toneAmber
class node_tensorprep,node_inference,node_iomap,node_feedback toneMint
class node_landmarks,node_geometrycalc,node_geometry,node_taskgeometry,node_taskgeometrylib,node_audio,node_vision,node_text toneRose
class node_developer,node_media,node_output toneIndigo
```

## Components

### Product interfaces

- [Tasks APIs](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks): `mediapipe/tasks`
- [Solution families](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks): `mediapipe/tasks`
- [Task results](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/tasks): `mediapipe/tasks`

### Graph runtime

- [Framework API](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/calculator_framework.h): `mediapipe/framework/calculator_framework.h`
- [Calculator graph](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/calculator_graph.h): `mediapipe/framework/calculator_graph.h`
- [Packets](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/packet.h): `mediapipe/framework/packet.h`
- [Stream management](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/framework/input_stream_manager.cc): `mediapipe/framework/input_stream_manager.cc`
- [Calculator library](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators): `mediapipe/calculators`

### Inference processing

- [Tensor preparation](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/tensor): `mediapipe/calculators/tensor`
- [Tensor inference](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_calculator.cc): `mediapipe/calculators/tensor/inference_calculator.cc`
- [Inference I/O mapping](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_io_mapper.h): `mediapipe/calculators/tensor/inference_io_mapper.h`
- [Inference feedback](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/calculators/tensor/inference_feedback_manager.cc): `mediapipe/calculators/tensor/inference_feedback_manager.cc`

### Domain processing

- [Face landmarks](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc): `mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc`
- [Geometry calculator](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc): `mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc`
- [3D geometry pipeline](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/modules/face_geometry/libs/geometry_pipeline.cc): `mediapipe/modules/face_geometry/libs/geometry_pipeline.cc`
- [Tasks geometry](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/cc/vision/face_geometry/calculators/geometry_pipeline_calculator.cc): `mediapipe/tasks/cc/vision/face_geometry/calculators/geometry_pipeline_calculator.cc`
- [Tasks geometry pipeline](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/cc/vision/face_geometry/libs/geometry_pipeline.cc): `mediapipe/tasks/cc/vision/face_geometry/libs/geometry_pipeline.cc`
- [Audio processing](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/audio): `mediapipe/calculators/audio`
- [Vision processing](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/image): `mediapipe/calculators/image`
- [Text processing](https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/calculators/tensor): `mediapipe/calculators/tensor`

### Other components

- **App developer**
- **Media input**
- **Application output**

## Connections

- App developer → Tasks APIs: uses (evidence: `README.md`)
- App developer → Framework API: builds with (evidence: `README.md`)
- Media input → Tasks APIs: supplies input
- Tasks APIs → Solution families: exposes (evidence: `README.md`)
- Tasks APIs → Calculator graph: routes through
- Framework API → Calculator graph: provides graph API (evidence: `mediapipe/framework/calculator_framework.h`)
- Calculator graph → Packets: exchanges
- Calculator graph → Stream management: dispatches streams
- Calculator graph → Calculator library: runs
- Calculator library → Tensor preparation: prepares tensors (evidence: `mediapipe/calculators/tensor/inference_feedback_manager_litert.cc`)
- Tensor preparation → Tensor inference: provides tensors
- Tensor inference → Inference I/O mapping: remaps I/O
- Tensor inference → Inference feedback: manages feedback
- Tensor inference → Task results: produces results
- Solution families → Audio processing: supports audio (evidence: `README.md`)
- Solution families → Vision processing: supports vision (evidence: `README.md`)
- Solution families → Text processing: supports text (evidence: `README.md`)
- Face landmarks → Geometry calculator: feeds geometry (evidence: `mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc`)
- Geometry calculator → 3D geometry pipeline: invokes pipeline (evidence: `mediapipe/modules/face_geometry/geometry_pipeline_calculator.cc`)
- Tasks geometry → Tasks geometry pipeline: invokes pipeline (evidence: `mediapipe/tasks/cc/vision/face_geometry/calculators/geometry_pipeline_calculator.cc`)
- Task results → Application output: returns result
- Geometry calculator → Application output: emits geometry
