Simple NPU demo on VIM3 Ubuntu Bionic

Preparation

You need to flash ubuntu image V190830.

Update kernel

You need to update the kernel to add NPU module support.

khadas@Khadas:~$ sudo -i
root@Khadas:~# apt-get update
root@Khadas:~# apt-get upgrade
root@Khadas:~# echo galcore >> /etc/modules
root@Khadas:~# sync
root@Khadas:~# reboot

After reboot, you can check whether the NPU module exist or not.

root@Khadas:~# lsmod | grep galcore
galcore               442368  0

If you find the galcore module, indicate that the NPU module is loaded.

Install NPU libraries and demo

khadas@Khadas:~$ sudo apt-get update
khadas@Khadas:~$ sudo apt-get install aml-npu aml-npu-demo

There is a Inception V3 demo, you can run it.

khadas@Khadas:~$ sudo -i
root@Khadas:~# cd /usr/share/npu/inceptionv3
root@Khadas:/usr/share/npu/inceptionv3# ./run.sh
Create Neural Network: 82ms or 82537us
Verify...



********pid is 136 *********


Verify Graph: 181ms or 181495us
Start run graph [1] times...
Run the 1 time: 22ms or 22021us
vxProcessGraph execution time:
Total   22ms or 22050us
Average 22.00ms or 22050.00us
 --- Top5 ---
  2: 0.897461
795: 0.004154
974: 0.001733
408: 0.001349
399: 0.001191

You can check the result with labels in imagenet_slim_labels.txt .

In the End

We are working on the documentation and model convert tools, and we will release them soon.

Thanks.

5 Likes

great!

will you support accelerated NPU for object detection too ? (with Tensorflow)

Yes, but we need to wait for the camera.

Need to convert the TF model to case code.

1 Like

I am waiting for the camera too :wink: any ETA ?

Do you realise that if you can deliver 5 TOPS NPU + CS mount 1080p@60FPS, the VIM3 will be hands down the best SBC.

Thank you very much. The performance looks very promising.
Will there be document for a bit lower level library as well. I notice that the example use library from ovxlib. I do not mind interfacing with it directly.

Hi,
Based from the demo program, I am able to write a code to create my own graph and execute a simple convolution operations (VSI_NN_OP_CONV_RELU) . However, the parameter of the operation seems to be coded in a special format (VSI_NN_TYPE_VDATA) and I do not know how to make one myself. It seems to compress somehow. Right now, I pulled the data out from the demo program and used it in my testing.

While I understand that there is no model conversion tool, yet, I don’t mind writing my own tool to convert the network myself if there is a way to create the parameters (VDATA). Would it be possible for you to provide that ?

Thanks!!

@pitchaya

Yes, we need conversion tools to achieve conversion. We have been preparing the relevant content, and we need some time to prepare all the tools and documents we need, and then we will open them to users.

2 Likes

hi Frank, is there any new progress of the Big NPU Package?

Thanks.

Hi @alcohol:
Please sent email to hello@khadas.com and I will sent to you first.

Good day!

Thanks for your attention, an email with my order number has been sent out.

Replied already, I just noticed you sent two emails :slight_smile:

1 Like

Thanks Gouwa, its done ,very useful

Hi,

I compiled case code for inception demo with ndk-build (v17 and v21). Then I push the vnn_inceptionv3 file into khadas vim3 (Android OS). When I run it give error:
CANNOT LINK EXECUTABLE “./vnn_inceptionv3”: cannot locate symbol “vxCreateTensorFromHandle2” referenced by “/vendor/lib/libovxlib.so”…

Why it cannot locate symbol?
Does my libovxlib.so has problem? where is the original and working libovxlib.so file located ? (I push it from aml_npu_sdk_6.4.3/Android-sdk/lib/libovxlib.so to /vendor/lib)
Best,
Ehsan

@Ehsan @jasonl Please help about this.

sudo apt-get install aml-npu aml-npu-demo

when i work at root mode ,It did not work

E:unable to locate package aml_npu_demo
khadas@Khadas:~$ sudo apt-get install aml-npu aml-npu-demo

Why you do this ? Which image you used? You just need to follow this docs to upgrade your system, you don’t need to install the npu package manually.

https://docs.khadas.com/vim3/HowToUpgradeTheSystem.html

I did as you said,but it could do nothing

Which image you used?

the first or third one , I can not remember it clearly

Please use this one:

https://dl.khadas.com/Firmware/VIM3/Ubuntu/EMMC/VIM3_Ubuntu-gnome-focal_Linux-4.9_arm64_EMMC_V1.0.5-210430.img.xz

And update to latest version: