# mobilint/mblt-sdk-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/mobilint/mblt-sdk-tutorial
- Repository: https://github.com/mobilint/mblt-sdk-tutorial

## Overview

This repository is a Mobilint SDK tutorial: users prepare and compile models into MXQ artifacts, then run those artifacts on a Mobilint NPU. It covers vision, language, speech, vision-language, and mask-generation workflows, with Python and C++ runtime examples. The README documents the compiler-to-runtime handoff; sampled inference code shows selected runtime calls and helper use. Many task-specific paths are represented by their enclosing directories because their source was not sampled, so their internal steps and connections are not asserted.

Main entry points: [`compilation/mask_generation/prepare_calibration.py`](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/prepare_calibration.py) (Mask calibration prep), [`runtime/python/object_detection/inference_mxq.py`](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/object_detection/inference_mxq.py) (Vision inference), [`runtime/python/mask_generation/inference_mxq.py`](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/mask_generation/inference_mxq.py) (Mask inference), [`compilation`](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation) (qbcompiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_compilation["Model compilation"]
  node_compiler["qbcompiler"]
  node_vision_compile["Vision compilation"]
  node_language_compile["LLM compilation"]
  node_speech_compile["Speech compilation"]
  node_vlm_compile["VLM compilation"]
end

subgraph group_specialized["Specialized preparation"]
  node_mask_calibration["Mask calibration prep"]
  node_sav_dataset["SA-V dataset<br/>[sav_dataset.py]"]
  node_sam2_host["SAM2 host code<br/>[sam2_host.py]"]
  node_mask_compile["Mask model compilation"]
end

subgraph group_python["Python runtime"]
  node_python_runtime["Python inference examples"]
  node_vision_inference["Vision inference<br/>[inference_mxq.py]"]
  node_postprocess["Detection postprocess<br/>[postprocess.py]"]
  node_visualizer["Vision visualizers<br/>[visualize.py]"]
  node_llm_inference["LLM inference<br/>[inference_mxq.py]"]
  node_llama_wrapper["Llama wrapper<br/>[llama_model.py]"]
  node_mask_inference["Mask inference<br/>[inference_mxq.py]"]
  node_mask_contracts["Mask contracts<br/>[contracts.py]"]
  node_speech_inference["Speech inference"]
  node_vlm_inference["VLM inference"]
end

subgraph group_cpp["C++ runtime"]
  node_cpp_runtime["C++ inference examples"]
  node_cpp_instance["C++ instance segmentation<br/>[infer_seg.cc]"]
end

node_user(("SDK user"))
node_mxq["MXQ model"]

node_user -->|"compiles models"| node_compiler
node_compiler -->|"produces MXQ"| node_mxq
node_mxq -->|"runs on NPU"| node_python_runtime
node_mxq -->|"runs on NPU"| node_cpp_runtime
node_mask_calibration -->|"uses dataset"| node_sav_dataset
node_mask_calibration -->|"uses host code"| node_sam2_host
node_mask_compile -.->|"produces models"| node_mxq
node_vision_inference -->|"postprocesses outputs"| node_postprocess
node_vision_inference -->|"renders results"| node_visualizer
node_llm_inference -->|"delegates inference"| node_llama_wrapper
node_mask_inference -->|"uses contracts"| node_mask_contracts
node_mask_inference -->|"uses host code"| node_sam2_host
node_cpp_instance -.->|"runs inference"| node_cpp_runtime

click node_compiler "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation"
click node_vision_compile "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/image_classification"
click node_language_compile "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/llm"
click node_speech_compile "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/stt"
click node_vlm_compile "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/vlm"
click node_mask_calibration "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/prepare_calibration.py"
click node_sav_dataset "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/sav_dataset.py"
click node_sam2_host "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/sam2_host.py"
click node_mask_compile "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/mask_generation"
click node_python_runtime "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/python"
click node_vision_inference "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/object_detection/inference_mxq.py"
click node_postprocess "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/face_detection/postprocess.py"
click node_visualizer "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/face_detection/visualize.py"
click node_llm_inference "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/llm/inference_mxq.py"
click node_llama_wrapper "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/llm/wrapper/llama_model.py"
click node_mask_inference "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/mask_generation/inference_mxq.py"
click node_mask_contracts "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/mask_generation/contracts.py"
click node_speech_inference "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/python/stt"
click node_vlm_inference "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/python/vlm"
click node_cpp_runtime "https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/cpp"
click node_cpp_instance "https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/cpp/instance_segmentation/infer_seg.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_compiler,node_vision_compile,node_language_compile,node_speech_compile,node_vlm_compile,node_user toneBlue
class node_mask_calibration,node_sav_dataset,node_sam2_host,node_mask_compile toneAmber
class node_python_runtime,node_vision_inference,node_postprocess,node_visualizer,node_llm_inference,node_llama_wrapper,node_mask_inference,node_mask_contracts,node_speech_inference,node_vlm_inference toneMint
class node_cpp_runtime,node_cpp_instance toneRose
class node_mxq toneIndigo
```

## Components

### Model compilation

- [qbcompiler](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation): `compilation`
- [Vision compilation](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/image_classification): `compilation/image_classification`
- [LLM compilation](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/llm): `compilation/llm`
- [Speech compilation](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/stt): `compilation/stt`
- [VLM compilation](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/vlm): `compilation/vlm`

### Specialized preparation

- [Mask calibration prep](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/prepare_calibration.py): `compilation/mask_generation/prepare_calibration.py`
- [SA-V dataset](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/sav_dataset.py): `compilation/mask_generation/sav_dataset.py`
- [SAM2 host code](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/compilation/mask_generation/sam2_host.py): `compilation/mask_generation/sam2_host.py`
- [Mask model compilation](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/compilation/mask_generation): `compilation/mask_generation`

### Python runtime

- [Python inference examples](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/python): `runtime/python`
- [Vision inference](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/object_detection/inference_mxq.py): `runtime/python/object_detection/inference_mxq.py`
- [Detection postprocess](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/face_detection/postprocess.py): `runtime/python/face_detection/postprocess.py`
- [Vision visualizers](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/face_detection/visualize.py): `runtime/python/face_detection/visualize.py`
- [LLM inference](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/llm/inference_mxq.py): `runtime/python/llm/inference_mxq.py`
- [Llama wrapper](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/llm/wrapper/llama_model.py): `runtime/python/llm/wrapper/llama_model.py`
- [Mask inference](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/mask_generation/inference_mxq.py): `runtime/python/mask_generation/inference_mxq.py`
- [Mask contracts](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/python/mask_generation/contracts.py): `runtime/python/mask_generation/contracts.py`
- [Speech inference](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/python/stt): `runtime/python/stt`
- [VLM inference](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/python/vlm): `runtime/python/vlm`

### C++ runtime

- [C++ inference examples](https://github.com/mobilint/mblt-sdk-tutorial/tree/master/runtime/cpp): `runtime/cpp`
- [C++ instance segmentation](https://github.com/mobilint/mblt-sdk-tutorial/blob/master/runtime/cpp/instance_segmentation/infer_seg.cc): `runtime/cpp/instance_segmentation/infer_seg.cc`

### Other components

- **SDK user**
- **MXQ model**

## Connections

- SDK user → qbcompiler: compiles models
- qbcompiler → MXQ model: produces MXQ
- MXQ model → Python inference examples: runs on NPU
- MXQ model → C++ inference examples: runs on NPU
- Mask calibration prep → SA-V dataset: uses dataset (evidence: `compilation/mask_generation/prepare_calibration.py`)
- Mask calibration prep → SAM2 host code: uses host code (evidence: `compilation/mask_generation/prepare_calibration.py`)
- Mask model compilation → MXQ model: produces models
- Vision inference → Detection postprocess: postprocesses outputs (evidence: `runtime/python/object_detection/inference_mxq.py`)
- Vision inference → Vision visualizers: renders results (evidence: `runtime/python/object_detection/inference_mxq.py`)
- LLM inference → Llama wrapper: delegates inference (evidence: `runtime/python/llm/inference_mxq.py`)
- Mask inference → Mask contracts: uses contracts (evidence: `runtime/python/mask_generation/inference_mxq.py`)
- Mask inference → SAM2 host code: uses host code (evidence: `runtime/python/mask_generation/inference_mxq.py`)
- C++ instance segmentation → C++ inference examples: runs inference (evidence: `runtime/cpp/instance_segmentation/infer_seg.cc`)
