# arm/optimized-runtimes architecture

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

- Interactive diagram: https://gitdiagram.com/arm/optimized-runtimes
- Repository: https://github.com/arm/optimized-runtimes

## Overview

This repository provides an Arm-optimized YOLO26n object-detection runtime for Raspberry Pi 5. The principal workflow accepts an image frame through the Python detector, preprocesses it, invokes the native runtime, and returns postprocessed detections. A separate conversion workflow validates a checkpoint and lowers its weights into a runtime model artifact. The graph also preserves the documented examples and benchmark capability; their internal wiring is not shown in the supplied excerpts.

Main entry points: [`yolo26-raspberry-pi-5/src/converter/export_yolo26n.py`](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/export_yolo26n.py) (Model export), [`yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp) (Native API), [`yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py`](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py) (Detection API), [`yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/yolo26n.py`](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/yolo26n.py) (Tensor session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversion["Model conversion"]
  node_checkpoint["Checkpoint decoding"]
  node_intake["Checkpoint intake"]
  node_validation["Model validation"]
  node_contract["Model contracts<br/>[model_contract.py]"]
  node_lowering["Weight lowering<br/>[weight_lowering.py]"]
  node_exporter["Model export<br/>[export_yolo26n.py]"]
  node_format["Model format<br/>[model_format.py]"]
end

subgraph group_python["Python API"]
  node_detector["Detection API<br/>[detector.py]"]
  node_tensor_api["Tensor session<br/>[yolo26n.py]"]
  node_model_loader["Model loading<br/>[_model.py]"]
end

subgraph group_native["Native inference"]
  node_native_api["Native API<br/>[arm_yolo26n.cpp]"]
  node_preprocess["Native preprocessing<br/>[preprocess.cpp]"]
  node_model_store[("Model store<br/>[model_store.cpp]")]
  node_graph["Fixed inference graphs<br/>[fixed_graph.cpp]"]
  node_schedule["Inference schedule<br/>[fixed_schedule.cpp]"]
  node_memory["Memory planning"]
  node_projection["Projection optimization"]
end

subgraph group_usage["Examples and benchmarks"]
  node_camera_example["Camera examples"]
  node_video_example["Video examples"]
  node_benchmarks["Benchmarks"]
end

node_frame(("Image frame"))
node_detections(("Detection results"))

node_intake -->|"decodes via"| node_checkpoint
node_intake -->|"validates with"| node_validation
node_validation -->|"uses contracts"| node_contract
node_exporter -->|"loads through"| node_intake
node_exporter -->|"uses contracts"| node_contract
node_exporter -->|"lowers weights"| node_lowering
node_exporter -->|"encodes model"| node_format
node_frame -->|"provides frame"| node_detector
node_detector -->|"executes session"| node_tensor_api
node_tensor_api -->|"loads model"| node_model_loader
node_tensor_api -->|"calls native API"| node_native_api
node_native_api -->|"dispatches preprocessing"| node_preprocess
node_native_api -->|"loads weights"| node_model_store
node_native_api -->|"builds graphs"| node_graph
node_native_api -->|"runs schedule"| node_schedule
node_schedule -->|"uses memory plan"| node_memory
node_schedule -->|"configures projections"| node_projection
node_detector -->|"returns detections"| node_detections
node_exporter -.->|"produces compatible artifact"| node_model_store
node_camera_example -.->|"uses API"| node_detector
node_video_example -.->|"uses API"| node_detector

click node_checkpoint "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/checkpoint_decoder.py"
click node_intake "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/checkpoint_intake.py"
click node_validation "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/model_validation.py"
click node_contract "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/model_contract.py"
click node_lowering "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/weight_lowering.py"
click node_exporter "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/export_yolo26n.py"
click node_format "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/model_format.py"
click node_detector "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py"
click node_tensor_api "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/yolo26n.py"
click node_model_loader "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/_model.py"
click node_native_api "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp"
click node_preprocess "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/preprocess.cpp"
click node_model_store "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/model_store.cpp"
click node_graph "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/fixed_graph.cpp"
click node_schedule "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/fixed_schedule.cpp"
click node_memory "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/fixed_memory_plan.cpp"
click node_projection "https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/projection_optimization.cpp"
click node_camera_example "https://github.com/arm/optimized-runtimes/tree/main/yolo26-raspberry-pi-5/examples/picamera2"
click node_video_example "https://github.com/arm/optimized-runtimes/tree/main/yolo26-raspberry-pi-5/examples/video"
click node_benchmarks "https://github.com/arm/optimized-runtimes/tree/main/yolo26-raspberry-pi-5/benchmarks"

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_checkpoint,node_intake,node_validation,node_contract,node_lowering,node_exporter,node_format toneBlue
class node_detector,node_tensor_api,node_model_loader toneAmber
class node_native_api,node_preprocess,node_model_store,node_graph,node_schedule,node_memory,node_projection toneMint
class node_camera_example,node_video_example,node_benchmarks toneRose
class node_frame,node_detections toneIndigo
```

## Components

### Model conversion

- [Checkpoint decoding](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/checkpoint_decoder.py): `yolo26-raspberry-pi-5/src/converter/checkpoint_decoder.py`
- [Checkpoint intake](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/checkpoint_intake.py): `yolo26-raspberry-pi-5/src/converter/checkpoint_intake.py`
- [Model validation](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/model_validation.py): `yolo26-raspberry-pi-5/src/converter/model_validation.py`
- [Model contracts](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/model_contract.py): `yolo26-raspberry-pi-5/src/converter/model_contract.py`
- [Weight lowering](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/weight_lowering.py): `yolo26-raspberry-pi-5/src/converter/weight_lowering.py`
- [Model export](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/export_yolo26n.py): `yolo26-raspberry-pi-5/src/converter/export_yolo26n.py`
- [Model format](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/converter/model_format.py): `yolo26-raspberry-pi-5/src/converter/model_format.py`

### Python API

- [Detection API](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py): `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py`
- [Tensor session](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/yolo26n.py): `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/yolo26n.py`
- [Model loading](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/_model.py): `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/_model.py`

### Native inference

- [Native API](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp): `yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`
- [Native preprocessing](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/preprocess.cpp): `yolo26-raspberry-pi-5/src/runtime/preprocess.cpp`
- [Model store](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/model_store.cpp): `yolo26-raspberry-pi-5/src/runtime/model_store.cpp`
- [Fixed inference graphs](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/fixed_graph.cpp): `yolo26-raspberry-pi-5/src/runtime/fixed_graph.cpp`
- [Inference schedule](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/fixed_schedule.cpp): `yolo26-raspberry-pi-5/src/runtime/fixed_schedule.cpp`
- [Memory planning](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/fixed_memory_plan.cpp): `yolo26-raspberry-pi-5/src/runtime/fixed_memory_plan.cpp`
- [Projection optimization](https://github.com/arm/optimized-runtimes/blob/main/yolo26-raspberry-pi-5/src/runtime/projection_optimization.cpp): `yolo26-raspberry-pi-5/src/runtime/projection_optimization.cpp`

### Examples and benchmarks

- [Camera examples](https://github.com/arm/optimized-runtimes/tree/main/yolo26-raspberry-pi-5/examples/picamera2): `yolo26-raspberry-pi-5/examples/picamera2`
- [Video examples](https://github.com/arm/optimized-runtimes/tree/main/yolo26-raspberry-pi-5/examples/video): `yolo26-raspberry-pi-5/examples/video`
- [Benchmarks](https://github.com/arm/optimized-runtimes/tree/main/yolo26-raspberry-pi-5/benchmarks): `yolo26-raspberry-pi-5/benchmarks`

### Other components

- **Image frame**
- **Detection results**

## Connections

- Checkpoint intake → Checkpoint decoding: decodes via (evidence: `yolo26-raspberry-pi-5/src/converter/checkpoint_intake.py`)
- Checkpoint intake → Model validation: validates with (evidence: `yolo26-raspberry-pi-5/src/converter/checkpoint_intake.py`)
- Model validation → Model contracts: uses contracts (evidence: `yolo26-raspberry-pi-5/src/converter/model_validation.py`)
- Model export → Checkpoint intake: loads through (evidence: `yolo26-raspberry-pi-5/src/converter/export_yolo26n.py`)
- Model export → Model contracts: uses contracts (evidence: `yolo26-raspberry-pi-5/src/converter/export_yolo26n.py`)
- Model export → Weight lowering: lowers weights (evidence: `yolo26-raspberry-pi-5/src/converter/export_yolo26n.py`)
- Model export → Model format: encodes model (evidence: `yolo26-raspberry-pi-5/src/converter/export_yolo26n.py`)
- Image frame → Detection API: provides frame (evidence: `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py`)
- Detection API → Tensor session: executes session (evidence: `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py`)
- Tensor session → Model loading: loads model (evidence: `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/yolo26n.py`)
- Tensor session → Native API: calls native API (evidence: `yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`)
- Native API → Native preprocessing: dispatches preprocessing (evidence: `yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`)
- Native API → Model store: loads weights (evidence: `yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`)
- Native API → Fixed inference graphs: builds graphs (evidence: `yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`)
- Native API → Inference schedule: runs schedule (evidence: `yolo26-raspberry-pi-5/src/runtime/arm_yolo26n.cpp`)
- Inference schedule → Memory planning: uses memory plan (evidence: `yolo26-raspberry-pi-5/src/runtime/fixed_schedule.cpp`)
- Inference schedule → Projection optimization: configures projections (evidence: `yolo26-raspberry-pi-5/src/runtime/fixed_schedule.cpp`)
- Detection API → Detection results: returns detections (evidence: `yolo26-raspberry-pi-5/src/runtime/api/python/arm_yolo26n/detector.py`)
- Model export → Model store: produces compatible artifact
- Camera examples → Detection API: uses API
- Video examples → Detection API: uses API
