NPU Demo and source code

@Frank anything you got to know about the NPU utilization? Please tell.

@Dhruv_Gaba

TOTAL_READ_BANDWIDTH is total bandwidth when read data
TOTAL_WRITE_BANDWIDTH is total bandwidth when write data
AXI_READ_BANDWIDTH is axi bandwidth when read data from sram
AXI_WRITE_BANDWIDTH is axi bandwidth when write sram data to sram
DDR_READ_BANDWIDTH is ddr bandwidth when read data from ddr
DDR_WRITE_BANDWIDTH is ddr bandwidth when write data to ddr
GPUTOTALCYCLES: number of total cycles
GPUIDLECYCLES: number of cycles in idle state

NPU usage rateļ¼š ( GPUTOTALCYCLES - GPUIDLECYCLES ) / GPUTOTALCYCLES

Hope these are helpful to you

1 Like

@Archangel1235 Can you please tell me if you cloned the git repo to khadas or host pc?

hiā€¦

The repo should be cloned to khadas boardā€¦

1 Like

@Frank yes it is very helpful. Thank you so much.

@Archangel1235 Thank you so much :slight_smile:

@Frank @moderators @kevin.guo
I am recieving this error when Iā€™m trying to run the ā€œmakeā€ command within the ā€œdarknetā€ directory.
Please find the attached screenshot. Thank you for your help!

@Akkisony Where did you get the source code ļ¼Ÿ

Did you succeed with RTSP already ?

ANYONE HAVE trouble running the NPU :frowning:

Why is a fresh UBUNTU Desktop CRASHING when using a normal USB Logitech c930e Camera?

IĀ“ve got a Vim3 Version 13 - Fenix 1.0.6 Ubuntu DEKTOP 20.04.2 LTS Linux 4.9.241 with today version of npu demo.

Why is the desktop new image compiled with OpenCV3 instead of 4.2?
Why is updating opencv creating error??

sudo apt install libopencv-dev python3-opencv

Unpacking libopencv-dev (4.2.0+dfsg-5) ā€¦
dpkg: error processing archive /var/cache/apt/archives/libopencv-dev_4.2.0+dfsg-5_arm64.deb (ā€“unpack):
trying to overwrite ā€˜/usr/bin/opencv_annotationā€™, which is also in package opencv3 3.4.3-2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libopencv-dev_4.2.0+dfsg-5_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

What crash? Please provide the logs.

Because the npu demo based on Opencv3, we will move to system preinstall 4.2 version in future release.

Please donā€™t do this, opencv3 conflict with opencv4.
If you want to install opencv4, you need to remove opencv3 first.

$ sudo apt-get remove opencv3
1 Like

Thank for opencv.

Which log is required?

Here syslog where something doesnā€™t look right for wlan

`  

root@Khadas:/var/log# tail syslog
May 26 04:11:18 localhost systemd[1]: hostapd.service: Scheduled restart job, restart counter is at 22826.
May 26 04:11:18 localhost systemd[1]: Stopped Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
May 26 04:11:18 localhost systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticatorā€¦
May 26 04:11:18 localhost hostapd[30195]: Configuration file: /etc/hostapd/hostapd.conf
May 26 04:11:18 localhost hostapd[30195]: Could not open configuration file ā€˜/etc/hostapd/hostapd.confā€™ for reading.
May 26 04:11:18 localhost hostapd[30195]: Failed to set up interface with /etc/hostapd/hostapd.conf
May 26 04:11:18 localhost hostapd[30195]: Failed to initialize interface
May 26 04:11:18 localhost systemd[1]: hostapd.service: Control process exited, code=exited, status=1/FAILURE
May 26 04:11:18 localhost systemd[1]: hostapd.service: Failed with result ā€˜exit-codeā€™.
May 26 04:11:18 localhost systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.`

Crash log, you said your system crashed, right?

NO the ubuntu desktop goes black and the logitech camera light shuts off as well.

If I tail systemlog with ssh from remote the connection it also closes when Ubuntu desktop goes black.

Unfortunately after opencv upgrade to 4.2 the npu demo wont run anymore

Error libopencv_imgproc.so.3.4 which cant be found

I have told you above, the npu demo based on opecv3, if you need opencv4 you need to recompile the demo from source code.

OK for recompile i believe this the the right pages

How To Use

Preparation

  1. Apply sdk,and unzip.
  2. clone repository to you P

Then all ends :frowning:

so i believe the next steps are on - Description and Usage of aml_NPU_app Code Repository | Khadas Documentation

from Compile the repository source code

I only did Compile libnn_detect.so as the same was done in last guide

but now Iā€™m stuck @ Compile application demo

In which fold do i need to go after to compile x11_usb??
Where do i find the build_vx_cv4.sh

NPU SDK and APP are @ /home/khadas/Desktop/NPU_source

@Frank do you know anything about how does the NPU schedules multiple processes running concurrently.
for e.g. if we have 4 processes running concurrently, then will the NPU schedule them sequentially or do you have a specific way of scheduling the processes. Could you please shed some light on this topic? As it is really difficult to figure it out for developing applications with multiple processes running. Thanks and looking forward for your answer.
PS also considering each of these proceses are running image inference using a deep learning model (.nb format) for NPU execution?

@Dhruv_Gaba This depends on the bandwidth and memory of the NPU. Usually you can only run one model at the same time, because the bandwidth is limited, and you can only load one model at the same time because of the limited memory.

What if we just want to run a single model only but we have multiple processes/threads of camera streams running in parallel.
In this case lets say if we have 3 processes running, do you have any idea on how will they be scheduled by NPU.
Does the NPU schedules processes/threads in parallel or in sequential manner.

P1 -> P2 -> P3 : sequential way
Or
P1 ||P2|| P3 : parallel way

@Dhruv_Gaba NPU does not care about the running of your three camera processes, NPU only cares about the image data passed over, I think the scheduling of these three camera schedules should be determined by your C program

1 Like