# arm-examples/arm-ethos-zephyr-playground architecture

> Architecture diagram of the GitHub repository arm-examples/arm-ethos-zephyr-playground, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arm-examples/arm-ethos-zephyr-playground
- Repository: https://github.com/arm-examples/arm-ethos-zephyr-playground

## Overview

This Zephyr sample runs MobileNetV2 inference on a selected, pre-quantized animal image, then aggregates ImageNet outputs into Dog/Cat/Other percentages and a prediction. The runtime path is main entry, interpreter setup and tensor allocation, input preparation, inference, and result reporting. The classifier selects standard or Vela model data at compile time; README documents Cortex-M and optional Ethos-U execution. Source excerpts show the main calls and classifier internals; input-data and embedded-model implementation files were not sampled, so their connections are limited to references shown in the classifier and documented options.

Main entry points: [`src/animal_classification.cpp`](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/animal_classification.cpp) (Classifier API), [`src/main.cpp`](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/main.cpp) (Application entry), [`inc/dog_cat_indices.h`](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/inc/dog_cat_indices.h) (Dog cat indices), [`src/input_data.cpp`](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/input_data.cpp) (Image inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime workflow"]
  node_main["Application entry<br/>[main.cpp]"]
end

subgraph group_classification["Inference and classification"]
  node_classifier["Classifier API"]
  node_tflm["TFLite Micro"]
  node_class_indices["Dog cat indices<br/>[dog_cat_indices.h]"]
end

subgraph group_assets["Inputs and models"]
  node_input_provider["Image inputs<br/>[input_data.cpp]"]
  node_standard_model["Standard model data<br/>[model_data.cc]"]
  node_vela_model["Vela model data<br/>[vela_model_data.cc]"]
end

node_zephyr(("Zephyr runtime"))
node_console(("Console output"))

node_zephyr -.->|"starts"| node_main
node_main -->|"sets up"| node_classifier
node_main -->|"allocates tensors"| node_classifier
node_main -->|"prepares input"| node_classifier
node_classifier -->|"loads input"| node_input_provider
node_main -->|"invokes"| node_tflm
node_main -->|"reports output"| node_classifier
node_classifier -->|"configures interpreter"| node_tflm
node_classifier -->|"aggregates classes"| node_class_indices
node_classifier -->|"selects standard"| node_standard_model
node_classifier -->|"selects Vela"| node_vela_model
node_main -->|"prints status"| node_console
node_classifier -->|"prints results"| node_console

click node_main "https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/main.cpp"
click node_classifier "https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/animal_classification.cpp"
click node_input_provider "https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/input_data.cpp"
click node_class_indices "https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/inc/dog_cat_indices.h"
click node_standard_model "https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/model/model_data.cc"
click node_vela_model "https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/model/compiled_model/vela_model_data.cc"

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_main toneBlue
class node_classifier,node_tflm,node_class_indices toneAmber
class node_input_provider,node_standard_model,node_vela_model toneMint
class node_zephyr,node_console toneIndigo
```

## Components

### Runtime workflow

- [Application entry](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/main.cpp): `src/main.cpp`

### Inference and classification

- [Classifier API](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/animal_classification.cpp): `src/animal_classification.cpp`
- **TFLite Micro**
- [Dog cat indices](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/inc/dog_cat_indices.h): `inc/dog_cat_indices.h`

### Inputs and models

- [Image inputs](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/src/input_data.cpp): `src/input_data.cpp`
- [Standard model data](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/model/model_data.cc): `model/model_data.cc`
- [Vela model data](https://github.com/arm-examples/arm-ethos-zephyr-playground/blob/main/model/compiled_model/vela_model_data.cc): `model/compiled_model/vela_model_data.cc`

### Other components

- **Zephyr runtime**
- **Console output**

## Connections

- Zephyr runtime → Application entry: starts
- Application entry → Classifier API: sets up (evidence: `src/main.cpp`)
- Application entry → Classifier API: allocates tensors (evidence: `src/main.cpp`)
- Application entry → Classifier API: prepares input (evidence: `src/main.cpp`)
- Classifier API → Image inputs: loads input (evidence: `src/animal_classification.cpp`)
- Application entry → TFLite Micro: invokes (evidence: `src/main.cpp`)
- Application entry → Classifier API: reports output (evidence: `src/main.cpp`)
- Classifier API → TFLite Micro: configures interpreter (evidence: `src/animal_classification.cpp`)
- Classifier API → Dog cat indices: aggregates classes (evidence: `src/animal_classification.cpp`)
- Classifier API → Standard model data: selects standard (evidence: `src/animal_classification.cpp`)
- Classifier API → Vela model data: selects Vela (evidence: `src/animal_classification.cpp`)
- Application entry → Console output: prints status (evidence: `src/main.cpp`)
- Classifier API → Console output: prints results (evidence: `src/animal_classification.cpp`)
