Request Updated NPU Code for movenet.tflite for imx8mp

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Request Updated NPU Code for movenet.tflite for imx8mp

975件の閲覧回数
adarshkv
Contributor I

Dear NXP support, I’m trying to run movenet model (https://github.com/NXP/eiq-model-zoo/tree/main/tasks/vision/pose-estimation/movenet) on the imx8M Plus NPU using libvx_delegate.so, but I’m hitting unsupported ops and a segmentation fault. Here’s the output: Loading NPU delegate from /usr/lib/libvx_delegate.so Vx delegate: allowed_builtin_code set to 0. Vx delegate: error_during_init set to 0. Vx delegate: error_during_prepare set to 0. Vx delegate: error_during_invoke set to 0. ERROR: Fallback unsupported op 53 to TfLite ERROR: Fallback unsupported op 90 to TfLite ERROR: Fallback unsupported op 53 to TfLite ERROR: Fallback unsupported op 53 to TfLite ERROR: Fallback unsupported op 88 to TfLite ERROR: Fallback unsupported op 90 to TfLite ERROR: Fallback unsupported op 53 to TfLite ERROR: Fallback unsupported op 53 to TfLite ERROR: Fallback unsupported op 88 to TfLite Segmentation fault I’ve attached my Python script (example_npu.py) and movenet model. It works on CPU but crashes with the NPU. Could you provide an updated code example for running movenet.tflite (or a similar model) on the NPU , addressing these errors? Assistance with model optimization would also help.

0 件の賞賛
返信
5 返答(返信)

949件の閲覧回数
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

The refer the example.py in https://github.com/NXP/eiq-model-zoo/tree/main/tasks/vision/pose-estimation/movenet and test movenet with Gopoint

 

Snipaste_2025-03-03_08-59-27.jpg



Best Regards,
Zhiming

0 件の賞賛
返信

901件の閲覧回数
adarshkv
Contributor I

Hello, 

       Thank you for the response, im using phyboard pollux imx8mp , which doesnt have gopoint, and i tried with example.py and it is working fine for cpu but showing segmentation fault error for using npu (loaded delegate libvx_delegate.so) . It will be helpful if you can share the updated example.py code for using npu .

 

Thank you,

Adarsh

0 件の賞賛
返信

870件の閲覧回数
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

There is no such example.py that using NPU delegate, but you need add delegate entry in example.py.

To add the vx delegate in python, please refer below code to get interpreter object with external delegate support, replace line 40 in example.py.

ext_delegate = [tf.lite. experimental.load_delegate("/usr/lib/libvx_delegate.so")]
interpreter = interpreter = tf.lite.Interpreter(model_path=MODEL_FILENAME,
 experimental_delegates=ext_delegate, num_threads=4)

 

Reference API: https://www.tensorflow.org/api_docs/python/tf/lite/experimental/load_delegate

Best Regards,
Zhiming

0 件の賞賛
返信

854件の閲覧回数
adarshkv
Contributor I

Hello,

      Thank you for the update. I have tried with the line you provided in example.py line 40. Unfortunately i got the same segmentation fault error , and i tried with the below code , but got same result. I will share you the details below:
code:

import tensorflow as tf

try:
delegate = tf.lite.experimental.load_delegate('/usr/lib/libvx_delegate.so')
except ValueError:
# Fallback to CPU
delegate = None

if delegate:
interpreter = tf.lite.Interpreter(
model_path='movenet.tflite',
experimental_delegates=[delegate])
else:
interpreter = tf.lite.Interpreter(model_path='movenet.tflite')

output:

(myenv) root@phyboard-pollux-imx8mp-3:movenet# python3 delegate.py
Vx delegate: allowed_builtin_code set to 0.
Vx delegate: error_during_init set to 0.
Vx delegate: error_during_prepare set to 0.
Vx delegate: error_during_invoke set to 0.
ERROR: Fallback unsupported op 53 to TfLite
ERROR: Fallback unsupported op 90 to TfLite
ERROR: Fallback unsupported op 53 to TfLite
ERROR: Fallback unsupported op 53 to TfLite
ERROR: Fallback unsupported op 88 to TfLite
ERROR: Fallback unsupported op 90 to TfLite
ERROR: Fallback unsupported op 53 to TfLite
ERROR: Fallback unsupported op 53 to TfLite
ERROR: Fallback unsupported op 88 to TfLite
Segmentation fault

 

Seeking for solution.

Thank you,

Adarsh 

0 件の賞賛
返信

846件の閲覧回数
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello @adarshkv 

 

I found the source code of pose_estimation in the Gopoint, need to notice that you need choose correspond verison.

https://github.com/nxp-imx-support/nxp-demo-experience-demos-list/blob/lf-6.6.52_2.2.0/scripts/machi...

https://github.com/nxp-imx-support/nxp-demo-experience-demos-list/blob/lf-6.6.52_2.2.0/scripts/machi...

The errors you meet seems from the model, please try below model which is used by Gopoint 

https://www.kaggle.com/models/google/movenet/tfLite/singlepose-lightning-tflite-int8



Best Regards,
Zhiming

0 件の賞賛
返信