Sunday, June 28, 2026

Gemini Engineering AIoT With NPU Manufacturer Vivante SDK

 Moving Out Of Vivante NPU Demo Docker Container

The awnn demo package has yolo11 demo as such,
radxa@radxa-cubie-a7z:~$ cd awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11/install/yolo11_demo_linux_a733/
$ export LD_LIBRARY_PATH=../../../../common/npuruntime/lib_linux_aarch64/A733/:$LD_LIBRARY_PATH
$ ls -l /dev/vipcore
crw-rw-rw- 1 root root 199, 0 Jun 28 04:55 /dev/vipcore
$ ./yolo11_demo_a733 -nb model/yolo11s_6_uint8_a733.nb -i model/dog.jpg
model_file=model/yolo11s_6_uint8_a733.nb, input=model/dog.jpg, loop_count=1, malloc_mbyte=10 
VIPLite driver software version 2.0.3.2-AW-2024-08-30
input  0 dim 3 640 640 1, data_format=2, quant_format=0, name=input/output[0], none-quant
output 0 dim 80 80 64 1, data_format=0, name=uid_11_out_0b_uid_1_out_0, none-quant
output 1 dim 80 80 80 1, data_format=0, name=uid_10_out_0b_uid_1_out_0, none-quant
output 2 dim 40 40 64 1, data_format=0, name=uid_9_out_0ub_uid_1_out_0, none-quant
output 3 dim 40 40 80 1, data_format=0, name=uid_8_out_0ub_uid_1_out_0, none-quant
output 4 dim 20 20 64 1, data_format=0, name=uid_7_out_0ub_uid_1_out_0, none-quant
output 5 dim 20 20 80 1, data_format=0, name=uid_6_out_0ub_uid_1_out_0, none-quant
nbg name=model/yolo11s_6_uint8_a733.nb, size: 6850488. 
create network 0: 9417 us.
prepare network: 2358 us.
buffer ptr: 0xb186600, buffer size: 1228800 
network: 0, loop count: 1
run time for this network 0: 31966 us.
output 0, ptr 0xb2b2740, size 409600.
output 1, ptr 0xb4427c0, size 512000.
output 2, ptr 0xb636840, size 102400.
output 3, ptr 0xb69a8c0, size 128000.
output 4, ptr 0xb717980, size 25600.
output 5, ptr 0xb730a00, size 32000.
post process time : 5 ms
detection num: 3
 1:  94%, [ 127,  129,  569,  419], bicycle
16:  92%, [ 132,  220,  311,  541], dog
 2:  49%, [ 466,   75,  692,  171], car
destory npu finished. 
~NpuUint. 
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11/install/yolo11_demo_linux_a733$ 
We need to integrate converged_aiot's fcu_thread with detected object screen coordinates, such as the above bicycle at [127,129,569,419], to steer the craft around or onto the recognized object with OpenCV's video processing (YOLO itself doesn't know image input formats between NV12, RAW, or JPEG). But there is troubleshooting to do to merge yolo11_demo_linux_a733's source code:
Vivante's Yolo demo code "Model Zoo" uses a Vivante-shipped/included OpenCV .so library that is out of sync with the OpenCV in Radxa's official system image. So, we need to modify the Vivante demo building procedure, build_linux.sh of the Model Zoo's C++ demo code, for which we are not given the building g++ command lines as such,
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16$ grep -r vip_lite.h *
common/npuruntime/npu_util.cpp:#include <vip_lite.h>
common/npuruntime/npulib.cpp:#include <vip_lite.h>
functions/vpm_run/src/parse_sample_txt.cpp:#include <vip_lite.h>
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16$
...
root@104012560a4f:/workspace/examples/yolo11# ../build_linux.sh -t a733 -s debian11
Option TARGET_NAME with argument: a733
build TARGET=a733
=========== check target ok ===========
Option TARGET_SYSTEM with argument: debian11
-- cur dir of *.cmake: /workspace/cmake_toolchain
-- cur dir of *.cmake: /workspace/cmake_toolchain
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Check for working C compiler: /workspace/cmake_toolchain/../0-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/
-- Check for working C compiler: /workspace/cmake_toolchain/../0-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /workspace/cmake_toolchain/../0-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/
-- Check for working CXX compiler: /workspace/cmake_toolchain/../0-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- USE EXTERN DEFINE TARGET
-- USE EXTERN TOOLCHAIN BUILD
-- CMAKE_C_COMPILER = /workspace/cmake_toolchain/../0-toolchains/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/bin/aarch64
-- CMAKE_SYSTEM_NAME = Linux
-- TARGET_NAME = A733
-- Found OpenCV: /workspace/3rdparty/opencv/opencv-4.9.0-aarch64-linux-sunxi-glibc (found version "4.9.0") 
-- CMAKE_INSTALL_PREFIX = /workspace/examples/yolo11/install/yolo11_demo_linux_a733
-- Configuring done
-- Generating done
-- Build files have been written to: /workspace/examples/yolo11/build_linux_aarch64
Scanning dependencies of target yolo11_demo_a733
[ 16%] Building CXX object CMakeFiles/yolo11_demo_a733.dir/main.cpp.o
[ 33%] Building CXX object CMakeFiles/yolo11_demo_a733.dir/yolo11_6_post.cpp.o
[ 50%] Building CXX object CMakeFiles/yolo11_demo_a733.dir/yolo11_6_pre.cpp.o
[ 66%] Building CXX object CMakeFiles/yolo11_demo_a733.dir/workspace/common/npuruntime/npu_util.cpp.o
[ 83%] Building CXX object CMakeFiles/yolo11_demo_a733.dir/workspace/common/npuruntime/npulib.cpp.o
[100%] Linking CXX executable yolo11_demo_a733

Fortunately, we are given a glimpse of the "cc" command line to compile and build with vip_lite.h API with Radxa's AI-SDK ai-sdk demo program vpm_run, as so,
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ make install AI_SDK_PLATFORM=a733 INSTALL_PREFIX=./
cc -g -O0 -DDEBUG -D_DEBUG -DSAVE_OUTPUT_TXT_FILE -DSHOW_TOP5 -DNPU_SW_VERSION=2 -g -o vpm_run vpm_run.c 
-I.//usr/include -I../libawnn_viplite -I../libawutils -I../../viplite-tina/lib/aarch64-none-linux-gnu/v2.0/inc 
-L .//usr/lib -Wl,-rpath-link,.//usr/lib -L../../viplite-tina/lib/aarch64-none-linux-gnu/v2.0/ -lNBGlinker -lVIPhal -lm
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ grep vip_lite.h vpm_run.c 
#include <vip_lite.h>
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ cd etc/npu/vpm_run/
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run/etc/npu/vpm_run$ ./vpm_run -s sample.txt -l 1
loop_count=1, device_index=0, core_index=-1, file_name=sample.txt, time_out=0x0, bypass=1
enable_npd=0, preload=0
show_top50, save_txt=0
init vip lite, driver version=0x00020003...
VIPLite driver software version 2.0.3.2-AW-2024-08-30
vip lite init OK.

cid=0x1000003b, device_count=1
  device[0] core_count=1
config file read network count=1
init test resources, task_count: 1 ...
create/prepare networks ...
task i=0, binary name: ./network_binary.nb
nbg name=./network_binary.nb
create network 0: 1749 us.
input 0 dim 224 224 3 1, data_format=2, quant_format=2, name=input[0], scale=0.003922, zero_point=0
ouput 0 dim 2 1 0 0, data_format=2, name=uid_1_out_0, scale=0.001625, zero_point=128
memory pool size=1092352byte
network core count=1
prepare network 0: 1044 us.
golden file count=0
input 0 name: ./input_0.dat
read input and golden 0: 439 us.
task: 0, loop count: 1
start to run network=./network_binary.nb
run time for this network 0: 3229 us.
run network done...
profile inference time=2876us, cycle=2785921
destroy test resource task_count=1
vpm run ret=0
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run/etc/npu/vpm_run$
This means that we need to use the cc lines to replace build_linux.sh's content but with adjusted file paths based on "awnpu_model_zoo" instead of "ai-sdk" and system OpenCV instead of local OpenCV because both yolo11_demo_linux_a733 and vpm_run use the vip_lite.h API and identical .so shared objects, as investigated here,
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime/lib_linux_aarch64/A733$ ls -l
total 212
-rwxr-xr-x 1 radxa radxa 174728 Apr 23 07:56 libNBGlinker.so
-rwxr-xr-x 1 radxa radxa  39416 Apr 23 07:56 libVIPhal.so
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime/lib_linux_aarch64/A733$ 
...
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls .//usr/include
ls: cannot access './/usr/include': No such file or directory
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls ../libawnn_viplite
awnn_internal.h  awnn_lib.c  awnn_lib.h  awnn_quantize.c  awnn_quantize.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls ../libawutils
image_utils.c  image_utils.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls ../../viplite-tina/lib/aarch64-none-linux-gnu/v2.0/inc
vip_lite_common.h  vip_lite.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls .//usr/lib
ls: cannot access './/usr/lib': No such file or directory
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls ../../viplite-tina/lib/aarch64-none-linux-gnu/v2.0/
debug  inc  libNBGlinker.so  libVIPhal.so
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ ls -l ../../viplite-tina/lib/aarch64-none-linux-gnu/v2.0/
total 220
drwxr-xr-x 5 radxa radxa   4096 Jun 27 14:08 debug
drwxr-xr-x 2 radxa radxa   4096 Jun 27 14:08 inc
-rw-r--r-- 1 radxa radxa 174728 Jun 27 14:08 libNBGlinker.so
-rw-r--r-- 1 radxa radxa  39416 Jun 27 14:08 libVIPhal.so
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ find ~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/ -name awnn_quantize.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ find ~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/ -name awnn_internal.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ find ~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/ -name image_utils.c
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ find ~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/ -name image_utils.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ find ~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/ -name vip_lite_common.h
/home/radxa/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime/include_85x/vip_lite_common.h
/home/radxa/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime/include/vip_lite_common.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ find ~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/ -name vip_lite.h
/home/radxa/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime/include_85x/vip_lite.h
/home/radxa/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime/include/vip_lite.h
radxa@radxa-cubie-a7z:~/ai-sdk/examples/vpm_run$ 


And the solution is so,
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ cat make.sh 
#radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime$ g++ -c npulib.cpp -o npulib.cpp.o -I ../../common/npuruntime/include/
#radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime$ g++ -c npu_util.cpp -o npu_util.cpp.o -I ../../common/npuruntime/include/
gcc -I /usr/include/opencv4 -c yolo11_6_pre.cpp -o yolo11_6_pre.cpp.o
gcc -I /usr/include/opencv4 -c yolo11_6_post.cpp -o yolo11_6_post.cpp.o
gcc -I ../../common/npuruntime/ -c main.cpp -o main.cpp.o
g++ main.cpp.o yolo11_6_post.cpp.o yolo11_6_pre.cpp.o ../../common/npuruntime/npulib.cpp.o ../../common/npuruntime/npu_util.cpp.o -o yolo11_demo_a733 \
-L ../../common/npuruntime/lib_linux_aarch64/A733/ \
-lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lNBGlinker -lVIPhal -lm
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ sudo apt install libopencv-dev
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ rm -f *.cpp.o ./yolo11_demo_a733
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ echo "  " >> main.cpp 
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ source make.sh
$ export LD_LIBRARY_PATH=../../common/npuruntime/lib_linux_aarch64/A733/:$LD_LIBRARY_PATH
$ ./yolo11_demo_a733 -nb model/yolo11s_6_uint8_a733.nb -i model/dog.jpg
model_file=model/yolo11s_6_uint8_a733.nb, input=model/dog.jpg, loop_count=1, malloc_mbyte=10 
VIPLite driver software version 2.0.3.2-AW-2024-08-30
input  0 dim 3 640 640 1, data_format=2, quant_format=0, name=input/output[0], none-quant
output 0 dim 80 80 64 1, data_format=0, name=uid_11_out_0b_uid_1_out_0, none-quant
output 1 dim 80 80 80 1, data_format=0, name=uid_10_out_0b_uid_1_out_0, none-quant
output 2 dim 40 40 64 1, data_format=0, name=uid_9_out_0ub_uid_1_out_0, none-quant
output 3 dim 40 40 80 1, data_format=0, name=uid_8_out_0ub_uid_1_out_0, none-quant
output 4 dim 20 20 64 1, data_format=0, name=uid_7_out_0ub_uid_1_out_0, none-quant
output 5 dim 20 20 80 1, data_format=0, name=uid_6_out_0ub_uid_1_out_0, none-quant
nbg name=model/yolo11s_6_uint8_a733.nb, size: 6850488. 
create network 0: 13090 us.
prepare network: 2349 us.
buffer ptr: 0xaaaae93ae240, buffer size: 1228800 
network: 0, loop count: 1
run time for this network 0: 31237 us.
output 0, ptr 0xaaaae94da340, size 409600.
output 1, ptr 0xaaaae966a3c0, size 512000.
output 2, ptr 0xaaaae985e480, size 102400.
output 3, ptr 0xaaaae98c2500, size 128000.
output 4, ptr 0xaaaae993f580, size 25600.
output 5, ptr 0xaaaae9958600, size 32000.
post process time : 8 ms
detection num: 3
 1:  94%, [ 127,  129,  569,  419], bicycle
16:  92%, [ 132,  220,  311,  541], dog
 2:  49%, [ 466,   75,  692,  171], car
destory npu finished. 
~NpuUint. 
radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ 

Gemini Says

Magenta is my prompt
Please simplify this compiling//building: radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$ cat make.sh #radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime$ g++ -c npulib.cpp -o npulib.cpp.o -I ../../common/npuruntime/include/ #radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/common/npuruntime$ g++ -c npu_util.cpp -o npu_util.cpp.o -I ../../common/npuruntime/include/ gcc -I /usr/include/opencv4 -c yolo11_6_pre.cpp -o yolo11_6_pre.cpp.o gcc -I /usr/include/opencv4 -c yolo11_6_post.cpp -o yolo11_6_post.cpp.o gcc -I ../../common/npuruntime/ -c main.cpp -o main.cpp.o g++ main.cpp.o yolo11_6_post.cpp.o yolo11_6_pre.cpp.o ../../common/npuruntime/npulib.cpp.o ../../common/npuruntime/npu_util.cpp.o -o yolo11_demo_a733 \ -L ../../common/npuruntime/lib_linux_aarch64/A733/ \ -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lNBGlinker -lVIPhal -lm radxa@radxa-cubie-a7z:~/awnpu_model_zoo-v1.0.0-20260423-f562dd16/examples/yolo11$, including rebuilding the commented out components.

This build script compiles C and C++ source files for a YOLO11 NPU demo on a Radxa board. It first builds the NPU runtime library objects (npulib and npu_util), then compiles the OpenCV pre/post-processing and main program files, and finally links everything together with the NPU hardware libraries into an executable named yolo11_demo_a733.

Step 1: Build NPU Runtime Objects

The script starts by compiling the common NPU runtime source files into object files.
  • Compile npulib.cpp:
    g++ -c npulib.cpp -o npulib.cpp.o -I ../../common/npuruntime/include/
  • Compile npu_util.cpp:
    g++ -c npu_util.cpp -o npu_util.cpp.o -I ../../common/npuruntime/include/

Step 2: Compile Application Files

Next, it compiles the specific YOLO11 pre-processing, post-processing, and main application code using OpenCV headers.
  • Compile pre-processing:
    gcc -I /usr/include/opencv4 -c yolo11_6_pre.cpp -o yolo11_6_pre.cpp.o
  • Compile post-processing:
    gcc -I /usr/include/opencv4 -c yolo11_6_post.cpp -o yolo11_6_post.cpp.o
  • Compile main program:
    gcc -I ../../common/npuruntime/ -c main.cpp -o main.cpp.o

Step 3: Link Everything Together

Finally, it links all compiled object files with the A733 NPU libraries, math library, and OpenCV modules to create the final executable.
  • Link command:
    g++ main.cpp.o yolo11_6_post.cpp.o yolo11_6_pre.cpp.o ../../common/npuruntime/npulib.cpp.o ../../common/npuruntime/npu_util.cpp.o -o yolo11_demo_a733 -L ../../common/npuruntime/lib_linux_aarch64/A733/ -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lNBGlinker -lVIPhal -lm
Condense all commands into one command line, if possible.

Yes, you can combine all step-by-step compilation and linking commands into a single g++ command line execution.
g++ -I /usr/include/opencv4 -I ../../common/npuruntime/ -I ../../common/npuruntime/include/ main.cpp yolo11_6_pre.cpp yolo11_6_post.cpp ../../common/npuruntime/npulib.cpp ../../common/npuruntime/npu_util.cpp -o yolo11_demo_a733 -L ../../common/npuruntime/lib_linux_aarch64/A733/ -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lNBGlinker -lVIPhal -lm

What Changed?

  • Skipped Object Files: Compiles the .cpp source files directly to the executable without saving intermediate .o files.
  • Unified Include Paths: Merged all -I flags so the compiler can find every required header file at once.
  • Unified Compiler: Used g++ for the entire command to cleanly handle the mixed C and C++ source files and automated linking.
If you plan to modify this project frequently, I can help you convert this into a Makefile or a CMakeLists.txt file. Let me know if you would like to see that!
will this single command line generate npu*.o object files, and if so, where will they be generated?
No. This single command line will not generate any .o object files anywhere on your system.
By passing the raw source files (like main.cpp and npulib.cpp) directly to g++ without the -c flag, the compiler processes everything in memory and outputs only the final executable file (yolo11_demo_a733).
If you want to create a clean build system that manages object files automatically, I can help you write a Makefile or an automated shell script. Which one would you prefer?
what binary components (no source code to modify them) are given by manufacturer Vivante, by Allwinner and by Radxa? Given this code snippet and available public information.
Based on the provided compiler commands, directory structure, and public documentation for the Radxa Cubie A7Z (which features the Allwinner A733 SoC housing a VeriSilicon/Vivante VIP9000 series NPU), the responsibilities and proprietary binary components are divided as follows: [1, 2]

1. Vivante (VeriSilicon)

Vivante is the original IP vendor for the Neural Processing Unit (NPU) core inside the processor. They provide the lowest-level, core-specific proprietary acceleration binaries. [1]
  • libVIPhal.so (Hardware Abstraction Layer): This closed-source binary directly translates high-level NPU instructions into register-level commands that the Vivante NPU hardware can execute. [1, 3]
  • libNBGlinker.so (Network Binary Graph Linker): Vivante NPUs rely on compiled compilation graphs called NBG (Network Binary Graph) files. This proprietary runtime library dynamically reads, links, allocates memory, and loads the pre-compiled neural network configurations into the NPU. [1, 3, 4]
  • The VIPLite Runtime Framework Core: This is Vivante's proprietary, lightweight inference engine layer utilized inside the container environments to manage tensors. [1, 5]

2. Allwinner

Allwinner is the System-on-Chip (SoC) manufacturer that licensed Vivante's NPU IP and packaged it inside the A733 chip. They supply the system-level adaptation code and developer kits. [2, 6]
  • A733 Tailored System Libraries: Found under the directory path ../../common/npuruntime/lib_linux_aarch64/A733/. Allwinner tweaks and repackages Vivante's base driver binaries specifically to match the memory mappings, interrupt allocations, and internal clock systems of their physical A733 silicon layout.
  • The NPU Linux Kernel Driver: While the interface exposes a node like /dev/vipcore, the module or kernel binary managing low-level hardware communication, system power states, and Direct Memory Access (DMA) between the CPU and NPU is delivered as pre-compiled or integrated vendor kernel binaries by Allwinner. [1]
  • The ACUITY Toolchain / NPU Docker Container: Though not explicitly invoked in this exact script, Allwinner delivers the proprietary quantization and network compilation tools (like VPM or Acuity) inside the Ubuntu NPU development container required to generate the model files in the first place. [4, 5]

3. Radxa

Radxa is the Single Board Computer (SBC) manufacturer that designed the Cubie A7Z board using Allwinner's chip. They act as the final system integrators. [6]
  • Operating System Images & Package Repositories: Radxa provides the pre-compiled Linux kernel (vendor kernel), root file system, and package repositories (npu-runtime Debian/Ubuntu packages). They ensure that Vivante and Allwinner's libraries are correctly pre-installed or populated into system paths like /usr/lib/ or /home/radxa/.
  • awnpu_model_zoo Package & Sample Infrastructure: Radxa aggregates Allwinner's base SDK and packages it cleanly into the awnpu_model_zoo folder. They provide the open-source C++ scaffolding (npulib.cpp, main.cpp, yolo11_6_pre.cpp) as an open wrapper interface, but the under-the-hood acceleration mechanics remain bound to the underlying closed binaries mentioned above. [1, 5, 7, 8]
Would you like help looking at how your open-source application files (main.cpp or pre/post files) map data directly into these Vivante VIPLite structures?



in the single building command line, can you group a source code with its relevant -I and library together delimited by unix terminal line continuation but present it as multiple lines of their respective relevant component?
Yes, you can break the command into multiple lines using the Unix line continuation character (\).
This format groups each source file visually with the specific header include paths (-I) or library search paths (-L / -l) that it directly relies on to compile or link.
g++ \
  main.cpp -I ../../common/npuruntime/ \
  yolo11_6_pre.cpp -I /usr/include/opencv4 \
  yolo11_6_post.cpp -I /usr/include/opencv4 \
  ../../common/npuruntime/npulib.cpp -I ../../common/npuruntime/include/ \
  ../../common/npuruntime/npu_util.cpp -I ../../common/npuruntime/include/ \
  -L ../../common/npuruntime/lib_linux_aarch64/A733/ -lNBGlinker -lVIPhal \
  -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lm \
  -o yolo11_demo_a733

How This Breaks Down

  • Lines 2–6: Each source file is placed on its own line next to the exact directory where its internal #include statements look for headers.
  • Line 7: Groups the vendor NPU source code files with the closed-source Vivante/Allwinner NPU library search path and binaries.
  • Line 8: Groups the application requirements with the system OpenCV and Math (-lm) shared linking libraries.
  • Line 9: Defines the final compiled output executable name.
Would you like to explore how to add standard optimization flags like -O3 to this command to speed up the pre- and post-processing steps?

why two different -I directory folders, ../../common/npuruntime/include/ for compiling npu*.c but ../../common/npuruntime/ for compiling main.cc?
The reason for the two different -I paths comes down to how the header files were written and where they are physically located on your disk.

1. The Structure of the Files

The folder structure inside your repository looks like this:
awnpu_model_zoo-v1.0.0-.../
├── common/
│   └── npuruntime/
│       ├── npulib.cpp
│       ├── npu_util.cpp
│       └── include/
│           ├── vip_lite.h      <-- (Example hardware headers)
│           └── npulib.h        <-- (The wrapper header)
└── examples/
    └── yolo11/
        └── main.cpp

2. Why main.cpp uses ../../common/npuruntime/

Inside your main.cpp file, the author wrote the #include statement like this:
#include "include/npulib.h" 
Because the code explicitly includes the include/ subfolder name in the text string, the compiler only needs to be pointed to the directory just above it (../../common/npuruntime/). The compiler looks inside that folder, finds the include/ subfolder, and successfully opens npulib.h.

3. Why npu*.cpp files use ../../common/npuruntime/include/

Inside the NPU runtime helper files (npulib.cpp and npu_util.cpp), the code includes the vendor hardware headers directly without any folder prefix:
#include "vip_lite.h"
Because there is no path prefix in the code string, the compiler must be pointed directly inside the folder where those specific files sit. Therefore, it needs the deeper path ending exactly in /include/.

Summary

  • main.cpp includes files using "include/filename.h" $\rightarrow$ needs the parent directory.
  • npu*.cpp files include files using "filename.h" $\rightarrow$ need the exact subfolder.
Would you like to know how to rewrite the #include lines in the source code so you can standardize on a single unified include path?
what binary OpenCV .so or .o files are likely invoked during building and executing to crop an image frame, and interconvert jpeg, YUY, YUV, and actual integers fed into neural network?

To perform image manipulation, format parsing, and data type transformation, the runtime execution relies heavily on specific modules inside the OpenCV shared libraries (.so) passed via your link flags. [1]
At build time, the linker uses no .o files for OpenCV; it directly queries the symbols exposed by the system's dynamic loaders. At run time, the operations you described trigger a sequence of actions across specific libraries:

1. libopencv_imgcodecs.so (The Decoder/Parser)

This binary handles reading and parsing structured disk or memory stream data.
  • JPEG Decoding: When your application loads a .jpg or .jpeg file (or intercepts a compressed MJPEG network payload), it executes cv::imread() or cv::imdecode().
  • Under the Hood: libopencv_imgcodecs.so acts as a wrapper wrapper. It instantly invokes a downstream dependency—typically libjpeg.so or libjpeg-turbo.so—to handle Huffman decoding and decompress the raw bitstream into an uncompressed memory buffer. [2, 3, 4]

2. libopencv_imgproc.so (The Heavy Lifter)

This component handles image processing, structural alterations, matrix manipulation, and pixel color translations.
  • Cropping Image Frames: Cropping in OpenCV does not use a dedicated function; it leverages structural Region of Interest (ROI) slicing via cv::Mat operator() (e.g., cv::Mat crop = image(rect);). This operation allocates no new image memory pixels; it simply calculates offset bounds inside libopencv_imgproc.so and libopencv_core.so. [5]
  • Interconverting YUY, YUV, and BGR/RGB: Transforming raw formats to a uniform color layout uses cv::cvtColor(). This function uses specific internal tables within imgproc:
    • YUYV (Packed 4:2:2) to BGR: Triggers cv::COLOR_YUV2BGR_YUY2.
    • YUV (Planar/Semi-planar like NV12) to BGR: Triggers cv::COLOR_YUV2BGR_NV12.
    • These operations compute floating-point or fixed-point matrix multiplications mapping color spaces ($Y, U, V$) directly to standard hardware-renderable pixel coordinates ($R, G, B$). [6, 7, 8, 9]

3. Neural Network Interconversion: Integer Preparation

Before pixel buffers can pass into the underlying Vivante/Allwinner NPU processing structures, standard OpenCV floating-point math converts into actual normalized integers (quantized fixed-point structures required by edge hardware). [10]
  • The Layer Invoked: This calculation is divided between your local processing loops (yolo11_6_pre.cpp.o) and standard tensor scaling modules.
  • Data Flow: Normal operations read from 8-bit unsigned matrices (CV_8UC3 representing integers 0-255). Scaling operations apply normalization coefficients via matrix methods like image.convertTo(normalized, CV_32FC3, scale_factor) or through tensor creation blocks (cv::dnn::blobFromImage()). [1]
  • For your target NPU runtime, after calculating floating-point metrics, the data is quantized down into raw int8_t or uint8_t values based on the calibration model profile. The matrix elements copy directly to target NPU array contexts via pointer references handled by libopencv_core.so. [3, 9]

Executable Binary Map Summary

Operation TaskOpenCV InterfaceMain Shared Library CalledDeep System Dependency
Parse/Decompress JPEGcv::imread() / imdecode()libopencv_imgcodecs.solibjpeg.so / libjpeg-turbo.so
Slice Frame / Cropcv::Mat crop(image, rect)libopencv_core.so / imgproc.soDirect RAM memory pointer offset
YUY / YUV Conversioncv::cvtColor()libopencv_imgproc.soFixed-point matrix calculation arrays
Blob / Tensor PrepblobFromImage() / convertTo()libopencv_core.soCPU Vector extensions (NEON/ARM Aarch64)
Would you like to analyze how your yolo11_6_pre.cpp specifically sets up memory pointers to directly push these converted pixel arrays to the NPU input registers?