# AI Application Development Guide

This section focuses on AI application development on RT-Smart, from low-level inference primitives to multi-task pipelines, multi-camera flows, and packaged scenario demos.

```{toctree}
:maxdepth: 1
:caption: Detailed Guides

nncase.md
usage_ai2d.md
usage_kpu.md
single_model_example.md
double_model_example.md
triple_camera_ai_example.md
uvc_face_detection.md
yolo.md
cloudplat_deploy.md
aidemo.md
multi_object_tracking.md
```

AI application examples for RT-Smart are mainly located in `src/rtsmart/examples/ai`. A practical way to approach the stack is to split the examples into three groups:

## Core Acceleration Basics

These examples explain the hardware-accelerated building blocks used by almost every deployment:

| Directory | Purpose | Why It Matters |
| --- | --- | --- |
| `usage_ai2d` | Demonstrates the five AI2D preprocessing modes: crop, shift, resize, pad, and affine | Learn how to offload preprocessing from the CPU |
| `usage_kpu` | Shows the full flow from model load to preprocess, inference, and postprocess | Learn the KPU runtime APIs and tensor handling |

## Reusable Task Templates

These examples are the main references when you want to build your own application:

| Directory | Type | Use Case |
| --- | --- | --- |
| `single_model_example` | Single-model pipeline | A basic AI application that runs one model |
| `double_model_example` | Multi-model pipeline | Cascaded tasks such as detection plus recognition |
| `triple_camera_ai_example` | Multi-camera pipeline | One application using three camera streams |
| `uvc_face_detection` | UVC-based pipeline | AI on a USB camera input |
| `yolo` | Unified YOLO wrapper | YOLOv5, YOLOv8, and YOLO11 tasks |
| `cloudplat_deploy` | Platform model deployment | Running models exported from the Kendryte training platform |

## Scenario Demos

These examples package lower-level media and AI components into more complete scenario applications:

| Directory | Purpose |
| --- | --- |
| `aidemo` | 50+ scenario demos spanning detection, recognition, OCR, speech, gesture, and more |
| `multi_object_tracking` | MOT demos integrating several tracking algorithms |
