Objectives
- Master the
download.shmodel download flow - Deploy and run the multistream_detect demo
- Know deployment caveats such as NPU card resource exclusivity
1. Prepare the Environment
1.1 Hardware and Network
| Item | Requirement |
|---|---|
| Board | RK3588-class board + RK1828 NPU accelerator card, rknn3-rk182x-m2 runtime installed |
| PC | Ubuntu with adb installed, on the same subnet as the board |
| Disk | ~2GB download cache on the PC; ~2GB on board /userdata |
1.2 SDK Directory
applications/multistream_detect/
βββ download.sh # fetch resources (DEB/models/test videos) from the release drive by Runtime version
βββ deploy.sh # PC-side one-shot deployment (recommended: --prebuilt mode)
βββ install.sh # board-side install/resource check script (called automatically by deploy.sh)
βββ README_CN.md # full documentation
2. Task Overview
4 test video streams ββ> GStreamer decode ββ> YOLOv5n detection (pedestrians/vehicles) ββ> IoU tracking (object IDs)
β
ββ> license plate recognition
ββ> VLM (Qwen3-VL-2B) scene analysis β events like "possible accident"
βΌ
C++ data backend :18081 (/api/objects etc.)
β
FastAPI portal :18080 ββ> PC browser shows live streams + alert list
Two systemd services:
| Service | Responsibility |
|---|---|
multistream-detect.service |
C++ decode, inference, tracking, OSD overlay; listens on 18081 |
multistream-detect-traffic-web.service |
FastAPI traffic supervision portal, listens on 18080 (web entry) |
3. Steps
Step 1: Connect the Board
adb connect <board-IP>:5555
adb devices # confirm device state
Step 2: One-shot Deployment (prebuilt mode, recommended)
cd applications/multistream_detect
./deploy.sh --prebuilt "<adb-serial>" # parameter optional if only one device connected
--prebuilt automatically: reads the RKNN3 API version from the boardβs rknn-smi -v β
downloads the matching ARM64 DEB, CNN models, quad-core VLM and test videos (~2GB) from the
release drive β pushes everything to the board β installs and starts the services.
Cloud-drive credentials are built into
download.sh; no manual input needed.
Fallback when version probing fails (hit during testing): the boardβs rknn-smi -v printed
rknn3 API version: NA, so auto-detection failed. After confirming the Runtime is actually 1.1.0,
specify it manually:
MSD_RUNTIME_VERSION=1.1.0 ./deploy.sh --prebuilt "<adb-serial>"
Download only, deploy later (two steps for slow networks):
./download.sh 1.1.0 # resources cached in downloads/1.1.0/
./deploy.sh --prebuilt "<adb-serial>"
Step 3: (Optional) Source Build Mode
If no prebuilt package is available, drop --prebuilt for source mode β it pushes the source to
the board and builds/installs there:
./deploy.sh "<adb-serial>"
Step 4: Confirm Service Status
adb shell
systemctl status multistream-detect.service multistream-detect-traffic-web.service
Both services should be active (running). Resources land on the board at:
/userdata/multistream_detect/{models/{cv,Qwen3-VL-2B-Instruct}, test_videos, prebuilt}
/usr/bin/multistream_detect /usr/bin/run_traffic_demo.sh
/usr/share/multistream-detect/app/traffic/configs/ # configs
4. Verification
4.1 Health Check
adb shell curl -s http://127.0.0.1:18081/api/health # β {"status":"ok"}
adb shell curl -s http://127.0.0.1:18080/api/health # portal (depends on 18081; may be degraded briefly right after start, wait then it turns ok)
4.2 See Real Detection Results
adb shell curl -s http://127.0.0.1:18081/api/objects | head -c 500
The response looks like (file0-car-131: video stream 0, class car, tracking ID 131, confidence
0.31, normalized bbox coordinates):
{"file0-car-131":{"class":"car","score":0.31,"bbox":[0.41,0.55,0.72,0.87],"seen_count":12,...}}
4.3 Watch Streams in a Browser (final effect)
On the PC open http://<board-IP>:18080/ β 4 live video streams + detection boxes +
object list / alert events.
4.4 Confirm the VLM Is Working
adb shell "journalctl -u multistream-detect -n 100 | grep -i image"
# VLM multimodal inference log lines: '<image>describe the vehicle type and color' 384x384, n_image_tokens=144
5. FAQ
Q1: deploy.sh says it cannot read the RKNN3 Runtime version?
Run rknn-smi -v on the board and look for rknn3 API version; if it is NA (as measured),
override with MSD_RUNTIME_VERSION=1.1.0. Note rknn-smi needs root (adb shell is root);
if /tmp/rknnsmi.lock has a bad owner, rm -f /tmp/rknnsmi.lock first.
Q2: deploy.sh prints βdoneβ but services wonβt start / logs report missing test videos?
deploy.sh does not check the board-side install.sh exit code β do not use symlinks to
link files into the downloads/1.1.0/ cache (adb pushes only the 333-byte link file and board-side
verification fails). Use real files (cp -rL). Recovery: push the resources manually to
/userdata/multistream_detect/, then re-run sudo bash install.sh on the board.
Q3: Services restart repeatedly, log shows MODEL_SETUP ACK_FAIL?
The NPU card is occupied by another AI app (e.g. rkllm3-server). One card runs one AI app at a
time: pkill -f rkllm3-server, then
systemctl restart multistream-detect multistream-detect-traffic-web.
Q4: Web page on 18080 opens but stays degraded?
The 18081 backend is not ready yet (model loading takes a while); refresh once
curl 18081/api/health turns ok.
Q5: Want boot autostart?
sudo systemctl enable multistream-detect.service multistream-detect-traffic-web.service
Lesson Summary
- Prebuilt one-shot flow: download.sh (optional) β deploy.sh --prebuilt β browser on 18080
- Verify down at the API layer:
/api/healthfor status; only when/api/objectsreturns
class/score/bbox is inference really happening - The NPU card is an exclusive resource β when switching AI apps, stop the old one before starting the new