I.MX8M plus AI Robot platform tensor flow lite NNAPI accelerate issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I.MX8M plus AI Robot platform tensor flow lite NNAPI accelerate issue

Jump to solution
1,598 Views
刘国华
Contributor III

@xiaodong_zhang 

Dear xiaodong 

  I compile the 5.4.70 AI robot ROS image using the command "bitbake imx-robot-sdk" ,and I update the OS image with UUU tool, i can brinig up the AI robot EVK successully . 

Then I use the command "bitbake imx-robot-system -c populate_sdk" to generate the SDK , i have installed the SDK in my X86 ubuntu 18.04 . 

Then I download the tensorflow lite v2.3.1 source code :

git clone https://github.com/tensorflow/tensorflow.git

git checkout v2.3.1

cd /4Tdisk/king/NXP/King_application/tensorflow/tensorflow/lite/examples/label_image/

Compiled the label_image successfully using the command below :

$CC label_image.cc bitmap_helpers.cc ../../tools/evaluation/utils.cc -I=/usr/include/tensorflow/lite/tools/make/downloads/flatbuffers/include \

-I=/usr/include/tensorflow/lite/tools/make/downloads/absl -O1 -DTFLITE_WITHOUT_XNNPACK -ltensorflow-lite -lstdc++ -lpthread -lm -ldl -lrt

 

After i get the label_image output application a.out , I copy it to the AI robot EVK .

It can run successufly using the CPU  .

刘国华_1-1623378865346.png

 

But can not use the NNAPI accelerate . 

 

刘国华_0-1623378816389.png

 

But the Yocot pre-build label_image can use the NNAPI accelerate .

刘国华_2-1623378957615.png

 

How can i debug this issue?

 

 

 

Tags (1)
0 Kudos
1 Solution
1,583 Views
xiaodong_zhang
NXP Employee
NXP Employee

@刘国华 

Maybe you miss -DTFLITE_ENABLE_NNAPI=on

View solution in original post

0 Kudos
5 Replies
1,584 Views
xiaodong_zhang
NXP Employee
NXP Employee

@刘国华 

Maybe you miss -DTFLITE_ENABLE_NNAPI=on

0 Kudos
1,523 Views
刘国华
Contributor III

@xiaodong_zhang 

We must use the label_image source code located in the yocto bitbake path , then it can use the NNAPI acceleration . 

For the label_image source code download from tensorflow lite website , it is different from the one in Yocto BSP . 

938 Views
bret_harte
Contributor I

Can you be more specific where I can find the version of label_image source code that works with NNAPI acceleration, thanks.

0 Kudos
1,591 Views
xiaodong_zhang
NXP Employee
NXP Employee

@刘国华 

   Current i.MX Yocto don't support Tensorflow with NPU accelerate(I don't think it will be supported in future). You need to add tensorflow-lite into  variable IMAGE_INSTALL in imx-robot-sdk.bb when you want to deploy model trained and converted by TensorFlow tools.

BTW, I already add ML packages (include tensorflow-lite) in imx-robot-sdk.bb in last i.MX robot platform.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX-%E6%9C%BA%E5%99%A8%E4%BA%BA%E5%B9%B...

Please the below update

/////////////////////////////////////// update for v1.0-L5.4.70-2.3.2  ///////////////////////////////////////////////////////////

 

0 Kudos
1,573 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Good

 

0 Kudos