This chapter introduces the GK7206 integrated quick-demo sample, sample_quickstart. It runs a complete end-to-end AI vision pipeline: video capture, VPSS processing, VENC encoding, NPU face detection, and a web display.
The source lives in sample/quickstart/ in the SDK. It is a quick-start example that touches the full feature set of the GK7206.
| Parameter | Value |
|---|---|
Sensor resolution |
2560 x 1440 (SC465SL) |
Detection input resolution |
640 x 360 |
NPU inference rate |
~15 FPS |
Web service port |
80 |
Video codec |
MJPEG |
Model format |
.xmm (GK7206 NPU format) |
sample/quickstart/
├── Makefile # build script
├── sample_quickstart.c # main program
└── models/ # NPU model files (download separately)
└── person_detect.xmm # person detection model
Before building this application, make sure the following are ready:
models/ directory# enter the sample directory
cd <SDK_PATH>/sample
# build the quickstart sample
make -C quickstart clean && make -C quickstart
# mount the SD card (recommended)
mkdir -p /sd_card
mount -t vfat /dev/mmcblk1p1 /sd_card
# transfer to the board over SCP
scp sample/quickstart/sample_quickstart root@<board-IP>:/sd_card/
# transfer the NPU models
scp -Or sample/quickstart/models root@<board-IP>:/sd_card/
# make it executable
chmod +x /sd_card/sample_quickstart
# enter the SD card directory
cd /sd_card
# run
./sample_quickstart
After a successful start the terminal prints output like this:
sample_quickstart running
sensor: 2560x1440 @ 30fps
npu: Initializing...
npu: Loading person_detect.xmm
npu: Model loaded!
pipeline: VI→VPSS→VENC(MJPEG) + VPSS→NPU(640x360)
web: http://192.168.1.100/
rtsp://192.168.1.100:554/livestream/0
Open http://<board-ip>/ in a browser to see the live face detection view.
This application uses the following architecture:
Sensor -> VI -> VPSS -> VENC(MJPEG) -> web display
↓
NPU inference -> overlay the detections
// Step 1: initialize the video pipeline
sample_comm_sys_init(&sys_config);
sample_comm_isp_init();
sample_comm_vi_start(...);
sample_comm_vpss_start(...);
sample_comm_venc_start(...);
// Step 2: initialize the NPU
init_npu();
// Step 3: start the NPU inference thread
pthread_create(&npu_thread, NULL, npu_inference_thread, NULL);
// Step 4: start the web server
web_server_run();
xmedia_cl_graph graph;
xmedia_u64 work_phy, weight_phy;
void *work_buf, *weight_buf;
// query the memory the model needs
xmedia_cl_graph_querysize_from_file("models/person_detect.xmm",
&worksize, &weightsize);
// allocate MMZ memory
work_buf = xmedia_mmz_alloc_map("npu_work", &work_phy, worksize);
weight_buf = xmedia_mmz_alloc_map("npu_weight", &weight_phy, weightsize);
// load the model
xmedia_cl_graph_loadmodel_from_file_withmem(&ctx, "models/person_detect.xmm",
work_buf, worksize, weight_buf, weightsize, &graph);
void *npu_inference_thread(void *arg)
{
while (running) {
// acquire a frame from VPSS
xmedia_vpss_acquire_ochn_frame(pipe, ochn, &frame, timeout);
// pre-processing (YUV -> RGB)
yuv420sp_to_rgb888(frame.y_vir, frame.c_vir, rgb_buf, width, height);
// NPU inference
xmedia_cl_graph_process(graph);
// post-processing (parse the detections)
parse_detections(output_buf, &detections);
// release the frame
xmedia_vpss_release_ochn_frame(pipe, ochn, &frame);
}
}
| Problem | Likely cause | Fix |
|---|---|---|
svp create fail |
NPU model file missing or malformed | Check that the model file exists and is valid |
| Detection results are inaccurate | Wrong model input image format | Check the YUV to RGB conversion |
| Out of memory (OOM) | NPU plus video encoding on 26 MB easily OOMs | Mount an SD card and free memory |