Deploying Kendryte Training-Platform Models on RT-Smart#
Attention
This deployment flow uses the same single-camera dual-channel pattern as the task templates. Refer to single_model_example.md for single-model tasks and double_model_example.md for OCR detection plus recognition.
Overview#
cloudplat_deploy_code packages the deployment code for models exported from the Kendryte online training platform. Build the executable under rtos_sdk, then deploy the exported model package to the board.
For the firmware build flow, see:
Source Description#
cloudplat_deploy_code implements all task types currently supported by the training platform:
image classification
object detection
semantic segmentation
OCR detection
OCR recognition
OCR detection + recognition
metric learning
multi-label classification
The common logic for model inference, preprocessing helpers, config parsing, and result drawing is placed in common_files. Each task directory then implements the task-specific inference flow.
Code Structure#
The directory layout is:
cloudplat_deploy_code_linux
├── common_files
├── classification
├── detection
├── segmentation
├── ocr_detection
├── ocr_recognition
├── ocr
├── metric_learning
├── multilabel_classification
├── utils
│ └── SourceHanSansSC-Normal-Min.ttf
├── libs
├── CMakeLists.txt
└── build.sh
Each task directory contains the application entry, task-specific preprocess and postprocess logic, and deployment helpers for that task type.
Build Notes#
Parameter Configuration#
You can configure the display-related parameters in:
common_files/setting.h
The main macros are:
Macro |
Description |
|---|---|
|
ISP output width |
|
ISP output height |
|
Display mode, |
|
Display width |
|
Display height |
|
AI inference frame width |
|
AI inference frame height |
|
AI inference frame channel count |
|
Whether to enable OSD, |
|
OSD layer width for AI results |
|
OSD layer height for AI results |
|
OSD layer channel count |
These settings are mainly used to configure the board-side display path. As in the other AI guides, the AI frame resolution is the camera-side frame before preprocessing, while the model input resolution is the tensor size after preprocessing.
Source Build#
Enter src/rtsmart/examples/ai/cloudplat_deploy_code and run:
cd cloudplat_deploy_code
./build_app.sh
./build_app.sh classification
./build_app.sh detection
If you want to build all task deployment files directly, you can also run:
make -j
The build artifacts are collected in k230_bin.
Board Deployment#
Copy the generated .elf files, the bundled font file, the exported kmodel, deploy_config.json, and any test images to one directory on the board. Then run the command for the corresponding task.
# Classification, video inference. Input q then Enter to exit.
./classification.elf deploy_config.json None 0
# Classification, image inference.
./classification.elf deploy_config.json test.jpg 0
# Detection, video inference.
./detection.elf deploy_config.json None 0
# Detection, image inference.
./detection.elf deploy_config.json test.jpg 0
# Semantic segmentation, video inference.
./segmentation.elf deploy_config.json None 0
# Semantic segmentation, image inference.
./segmentation.elf deploy_config.json test.jpg 0
# OCR detection, video inference.
./ocr_detection.elf deploy_config.json None 0
# OCR detection, image inference.
./ocr_detection.elf deploy_config.json test.jpg 0
# OCR recognition, image inference only.
./ocr_recognition.elf deploy_config.json test.jpg 0
# OCR detection + recognition, video inference.
./ocr.elf ocrdet_deploy_config.json ocrrec_deploy_config.json None 0
# OCR detection + recognition, image inference.
./ocr.elf ocrdet_deploy_config.json ocrrec_deploy_config.json test.jpg 0
# Metric learning, video inference.
./metric_learning.elf deploy_config.json None 0
# Metric learning, image inference.
./metric_learning.elf deploy_config.json test.jpg 0
# Multi-label classification, video inference.
./multilabel_classification.elf deploy_config.json None 0
# Multi-label classification, image inference.
./multilabel_classification.elf deploy_config.json test.jpg 0
The last argument is the debug level and typically follows the same convention as the other AI samples:
0: no debug output1: timing-oriented debug output2: verbose debug output
