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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
2,204 次查看
刘国华
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?

 

 

 

标记 (1)
0 项奖励
回复
1 解答
2,189 次查看
xiaodong_zhang
NXP Employee
NXP Employee

@刘国华 

Maybe you miss -DTFLITE_ENABLE_NNAPI=on

在原帖中查看解决方案

0 项奖励
回复
5 回复数
2,190 次查看
xiaodong_zhang
NXP Employee
NXP Employee

@刘国华 

Maybe you miss -DTFLITE_ENABLE_NNAPI=on

0 项奖励
回复
2,129 次查看
刘国华
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 . 

1,544 次查看
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 项奖励
回复
2,197 次查看
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 项奖励
回复
2,179 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Good

 

0 项奖励
回复