Yolov8n timeout on imx95 NPU

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

Yolov8n timeout on imx95 NPU

515 Views
LucM
Contributor I

Hello, 

I am trying to test if I can run a yolov8n model exported from ultralytics on the IMX95. I saw that the "yolov8n_pcq_640.tflite" is part of the supported models supported models for the Neutron software in the eIQ Toolkit User Guide.

Follwing instructions in the user guide here are my steps to reproduce the error:

  1. exported ultralytics model onnx with channel last format
  2. quantized onnx model using eIQ Toolkit
    -> python -m onnx2quant yolov8n.onnx -c 'images;yolo_data_640_640_3' -o yolov8n_quant.onnx

  3. converted to tflite using eIQ Toolkit
    -> python -m onnx2tflite yolov8n_quant.onnx -o yolov8n_quant.tflite

  4. converted to target imx95 using MCU_SDK_25.06.00+Linux_6.12.20_2.0.0/neutron-converter
    -> ./neutron-converter --input yolov8n_quant.tflite --target imx95
    With shortened output logs:
    Conversion statistics:
    Number of operators after import = 270
    Number of operators after optimize = 337
    Number of operators converted = 305
    Number of operators NOT converted = 32
    Number of operators after extract = 34
    Number of Neutron graphs = 2
    Number of operators NOT converted = 32
    Operator conversion ratio = 305 / 337 = 0.905044



  5. finally I run the model on the i.MX95 replacing the example model
    -> /usr/bin/tensorflow-lite-2.19.0/examples# ./label_image -m yolov8n_base_quant_converted.tflite --external_delegate_path=/lib/libneutron_delegate.so -i grace_hopper.bmp -l labels.txt
    With shortened output logs:

    INFO: Loaded model yolov8n_quant_converted.tflite
    INFO: resolved reporter
    INFO: EXTERNAL delegate created.
    INFO: NeutronDelegate delegate: 2 nodes delegated out of 34 nodes with 2 partitions.

    INFO: Neutron delegate version: v1.0.0-be8bf399, zerocp enabled.
    INFO: Neutron delegate version: v1.0.0-be8bf399, zerocp enabled.
    INFO: Applied EXTERNAL delegate.
    INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
    Inference poll timeout
    Error: component='Neutron Driver', category='timeout', code=1501
    ERROR: /usr/src/debug/tensorflow-lite-neutron-delegate/2.19.0/neutron_delegate.cc:246 neutronRC != ENONE (384331 != 0)
    ERROR: Node number 34 (NeutronDelegate) failed to invoke.
    ERROR: Failed to invoke tflite!

What am I missing? Is the original yolov8n model not adequate? The program will probably not run to the end since I replaced a classifier model with a detection one but the invoke should still work and provide inference time. I have attached the successive model outputs of each step.

 

I was able to run the original example succesfully:

root@imx95-19x19-lpddr5-evk:/usr/bin/tensorflow-lite-2.19.0/examples# ./label_image -m mobilenet_v1_1.0_224_int8_converted.tflite --external_delegate_path=/lib/libneutron_delegate.so -i grace_hopper.bmp -l labels.txt
INFO: Loaded model mobilenet_v1_1.0_224_int8_converted.tflite
INFO: resolved reporter
INFO: EXTERNAL delegate created.
INFO: NeutronDelegate delegate: 1 nodes delegated out of 4 nodes with 1 partitions.

INFO: Neutron delegate version: v1.0.0-be8bf399, zerocp enabled.
INFO: Applied EXTERNAL delegate.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
INFO: invoked
INFO: average time: 1.403 ms
INFO: 0.756863: 653 military uniform
INFO: 0.145098: 907 Windsor tie
INFO: 0.0156863: 458 bow tie
INFO: 0.0117647: 466 bulletproof vest
INFO: 0.00784314: 835 suit

Thank you in advance for your help,

Sincerely,

Luc

0 Kudos
Reply
2 Replies

448 Views
LucM
Contributor I
I was able to fix it by updating the tool kit version to the latest available (eIQ Toolkit 1.17.0.110)
0 Kudos
Reply

322 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Good thanks for letting us know.

Regards

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2196755%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EYolov8n%20timeout%20on%20imx95%20NPU%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2196755%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EI%20am%20trying%20to%20test%20if%20I%20can%20run%20a%20yolov8n%20model%20exported%20from%20ultralytics%20on%20the%20IMX95.%20I%20saw%20that%20the%20%22yolov8n_pcq_640.tflite%22%20is%20part%20of%20the%20supported%20models%20supported%20models%20for%20the%20Neutron%20software%20in%20the%20eIQ%20Toolkit%20User%20Guide.%3CBR%20%2F%3E%3CBR%20%2F%3EFollwing%20instructions%20in%20the%20user%20guide%20here%20are%20my%20steps%20to%20reproduce%20the%20error%3A%3C%2FP%3E%3COL%3E%3CLI%3Eexported%20ultralytics%20model%20onnx%20with%20channel%20last%20format%3C%2FLI%3E%3CLI%3Equantized%20onnx%20model%20using%20eIQ%20Toolkit%3CBR%20%2F%3E-%26gt%3B%20python%20-m%20onnx2quant%20yolov8n.onnx%20-c%20'images%3Byolo_data_640_640_3'%20-o%20yolov8n_quant.onnx%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3Econverted%20to%20tflite%20using%20eIQ%20Toolkit%3CBR%20%2F%3E-%26gt%3B%20python%20-m%20onnx2tflite%20yolov8n_quant.onnx%20-o%20yolov8n_quant.tflite%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3Econverted%20to%20target%20imx95%20using%26nbsp%3BMCU_SDK_25.06.00%2BLinux_6.12.20_2.0.0%2Fneutron-converter%3CBR%20%2F%3E-%26gt%3B%26nbsp%3B.%2Fneutron-converter%20--input%20yolov8n_quant.tflite%20--target%20imx95%3CBR%20%2F%3EWith%20shortened%20output%20logs%3A%3CBR%20%2F%3EConversion%20statistics%3A%3CBR%20%2F%3ENumber%20of%20operators%20after%20import%20%3D%20270%3CBR%20%2F%3ENumber%20of%20operators%20after%20optimize%20%3D%20337%3CBR%20%2F%3ENumber%20of%20operators%20converted%20%3D%20305%3CBR%20%2F%3ENumber%20of%20operators%20NOT%20converted%20%3D%2032%3CBR%20%2F%3ENumber%20of%20operators%20after%20extract%20%3D%2034%3CBR%20%2F%3ENumber%20of%20Neutron%20graphs%20%3D%202%3CBR%20%2F%3ENumber%20of%20operators%20NOT%20converted%20%3D%2032%3CBR%20%2F%3EOperator%20conversion%20ratio%20%3D%20305%20%2F%20337%20%3D%200.905044%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CLI%3Efinally%20I%20run%20the%20model%20on%20the%20i.MX95%20replacing%20the%20example%20model%3CBR%20%2F%3E-%26gt%3B%26nbsp%3B%2Fusr%2Fbin%2Ftensorflow-lite-2.19.0%2Fexamples%23%20.%2Flabel_image%20-m%20yolov8n_base_quant_converted.tflite%20--external_delegate_path%3D%2Flib%2Flibneutron_delegate.so%20-i%20grace_hopper.bmp%20-l%20labels.txt%3CBR%20%2F%3EWith%20shortened%20output%20logs%3A%3CBR%20%2F%3E%3CP%3EINFO%3A%20Loaded%20model%20yolov8n_quant_converted.tflite%3CBR%20%2F%3EINFO%3A%20resolved%20reporter%3CBR%20%2F%3EINFO%3A%20EXTERNAL%20delegate%20created.%3CBR%20%2F%3EINFO%3A%20NeutronDelegate%20delegate%3A%202%20nodes%20delegated%20out%20of%2034%20nodes%20with%202%20partitions.%3C%2FP%3E%3CP%3EINFO%3A%20Neutron%20delegate%20version%3A%20v1.0.0-be8bf399%2C%20zerocp%20enabled.%3CBR%20%2F%3EINFO%3A%20Neutron%20delegate%20version%3A%20v1.0.0-be8bf399%2C%20zerocp%20enabled.%3CBR%20%2F%3EINFO%3A%20Applied%20EXTERNAL%20delegate.%3CBR%20%2F%3EINFO%3A%20Created%20TensorFlow%20Lite%20XNNPACK%20delegate%20for%20CPU.%3CBR%20%2F%3EInference%20poll%20timeout%3CBR%20%2F%3EError%3A%20component%3D'Neutron%20Driver'%2C%20category%3D'timeout'%2C%20code%3D1501%3CBR%20%2F%3EERROR%3A%20%2Fusr%2Fsrc%2Fdebug%2Ftensorflow-lite-neutron-delegate%2F2.19.0%2Fneutron_delegate.cc%3A246%20neutronRC%20!%3D%20ENONE%20(384331%20!%3D%200)%3CBR%20%2F%3EERROR%3A%20Node%20number%2034%20(NeutronDelegate)%20failed%20to%20invoke.%3CBR%20%2F%3EERROR%3A%20Failed%20to%20invoke%20tflite!%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EWhat%20am%20I%20missing%3F%20Is%20the%20original%20yolov8n%20model%20not%20adequate%3F%20The%20program%20will%20probably%20not%20run%20to%20the%20end%20since%20I%20replaced%20a%20classifier%20model%20with%20a%20detection%20one%20but%20the%20invoke%20should%20still%20work%20and%20provide%20inference%20time.%20I%20have%20attached%20the%20successive%20model%20outputs%20of%20each%20step.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20was%20able%20to%20run%20the%20original%20example%20succesfully%3A%3C%2FP%3E%3CP%3Eroot%40imx95-19x19-lpddr5-evk%3A%2Fusr%2Fbin%2Ftensorflow-lite-2.19.0%2Fexamples%23%20.%2Flabel_image%20-m%20mobilenet_v1_1.0_224_int8_converted.tflite%20--external_delegate_path%3D%2Flib%2Flibneutron_delegate.so%20-i%20grace_hopper.bmp%20-l%20labels.txt%3CBR%20%2F%3EINFO%3A%20Loaded%20model%20mobilenet_v1_1.0_224_int8_converted.tflite%3CBR%20%2F%3EINFO%3A%20resolved%20reporter%3CBR%20%2F%3EINFO%3A%20EXTERNAL%20delegate%20created.%3CBR%20%2F%3EINFO%3A%20NeutronDelegate%20delegate%3A%201%20nodes%20delegated%20out%20of%204%20nodes%20with%201%20partitions.%3C%2FP%3E%3CP%3EINFO%3A%20Neutron%20delegate%20version%3A%20v1.0.0-be8bf399%2C%20zerocp%20enabled.%3CBR%20%2F%3EINFO%3A%20Applied%20EXTERNAL%20delegate.%3CBR%20%2F%3EINFO%3A%20Created%20TensorFlow%20Lite%20XNNPACK%20delegate%20for%20CPU.%3CBR%20%2F%3EINFO%3A%20invoked%3CBR%20%2F%3EINFO%3A%20average%20time%3A%201.403%20ms%3CBR%20%2F%3EINFO%3A%200.756863%3A%20653%20military%20uniform%3CBR%20%2F%3EINFO%3A%200.145098%3A%20907%20Windsor%20tie%3CBR%20%2F%3EINFO%3A%200.0156863%3A%20458%20bow%20tie%3CBR%20%2F%3EINFO%3A%200.0117647%3A%20466%20bulletproof%20vest%3CBR%20%2F%3EINFO%3A%200.00784314%3A%20835%20suit%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%20in%20advance%20for%20your%20help%2C%3CBR%20%2F%3E%3CBR%20%2F%3ESincerely%2C%3C%2FP%3E%3CP%3ELuc%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2201916%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Yolov8n%20timeout%20on%20imx95%20NPU%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2201916%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGood%20thanks%20for%20letting%20us%20know.%3C%2FP%3E%0A%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2198333%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Yolov8n%20timeout%20on%20imx95%20NPU%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2198333%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EI%20was%20able%20to%20fix%20it%20by%20updating%20the%20tool%20kit%20version%20to%20the%20latest%20available%20(eIQ%20Toolkit%201.17.0.110)%3C%2FLINGO-BODY%3E