eIQ ML: i.MX93: object detection model fails to be converted with vela

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

eIQ ML: i.MX93: object detection model fails to be converted with vela

ソリューションへジャンプ
1,392件の閲覧回数
ihermida
Contributor II

Hi guys,

This is the link to the ML guide,  https://www.nxp.com/docs/en/user-guide/IMX-MACHINE-LEARNING-UG.pdf.

Chapter "8.1.2 SSD object detection demo" uses the model ssd_mobilenet_v1_quant.tflite. The problem I found with that model is that cannot be converted with vela, thereby I cannot use the i.MX93 NPU.

Compiling manually the model "ssd_mobilenet_v1_quant.tflite", it cannot be converted, returning the next error

Error: Invalid TFLite file. Got "unpack_from requires a buffer of at least 1836597056 bytes for unpacking 4 bytes at offset 1836597052 (actual buffer size is 298)" while parsing buffers length.

 

 

 

 So, here there are two points.

  1. The script "download_models.py" should check the value when converting a model to notify about its failure, something like

 

-            os.system('vela ' + model + " --output-dir " + vela_dir)
+            ret = os.system('vela ' + model + " --output-dir " + vela_dir)
+            if ret != 0:
+                print(f"Error: Failed to convert model {name} with vela")
+                import sys
+                sys.exit(1)

 

  •  Model "ssd_mobilenet_v1_quant.tflite" is not compatible with vela/npu.
    Is it a problem of that specific model?
    What can I do to use the NPU (Ethos-U65)?

BR / Isaac

0 件の賞賛
返信
1 解決策
1,348件の閲覧回数
pengyong_zhang
NXP Employee
NXP Employee

Hi @ihermida 

a) do you plan to fix download_models.py to report error on failure when downloading or converting the model?

>>>Actually, we have found this error before, And will fix it on the next version BSP code

b) do you know of any well known mirror where to obtain the ssd_mobilenet_v1_quant.tflite model?

>>>You can use the attachment ssd_mobilenet_v1.tflite file.

元の投稿で解決策を見る

3 返答(返信)
1,349件の閲覧回数
pengyong_zhang
NXP Employee
NXP Employee

Hi @ihermida 

a) do you plan to fix download_models.py to report error on failure when downloading or converting the model?

>>>Actually, we have found this error before, And will fix it on the next version BSP code

b) do you know of any well known mirror where to obtain the ssd_mobilenet_v1_quant.tflite model?

>>>You can use the attachment ssd_mobilenet_v1.tflite file.

1,354件の閲覧回数
ihermida
Contributor II

Hi @pengyong_zhang ,

 

The problem is that link is broken, I get an access denied from the link https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/2...

The error is

<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object. Permission 'storage.objects.get' denied on resource (or it may not exist).</Details>
</Error>
 

So, as commented initially, there are two problems:

  1. The download_models.py does not report an error on failure (or well checking the downloaded file or well checking it was converted with vela)
  2. The link is broken

 

I can download that model from other locations manually, but this failure is currently broking my yocto build (as I do check if the model was correctly downloaded).

 

a) do you plan to fix download_models.py to report error on failure when downloading or converting the model?

b) do you know of any well known mirror where to obtain the ssd_mobilenet_v1_quant.tflite model?

 

BR / Isaac

0 件の賞賛
返信
1,364件の閲覧回数
pengyong_zhang
NXP Employee
NXP Employee

HI @ihermida 

If you can not be converted to vela model, you can delete it and re-download by yourself, then re-covert again by vela command.

I can convert it to vela model without any error on my  iMX93 EVK board.

B.R

0 件の賞賛
返信
%3CLINGO-SUB%20id%3D%22lingo-sub-2015934%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EeIQ%20ML%3A%20i.MX93%3A%20%E7%89%A9%E4%BD%93%E6%A4%9C%E5%87%BA%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%20vela%20%E3%81%A7%E5%A4%89%E6%8F%9B%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2015934%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%80%81%E3%81%BF%E3%82%93%E3%81%AA%E3%80%82%3C%2FP%3E%3CP%3E%E3%81%93%E3%82%8C%E3%81%AF%E3%80%81ML%20%E3%82%AC%E3%82%A4%E3%83%89%E3%81%AE%20%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fuser-guide%2FIMX-MACHINE-LEARNING-UG.pdf%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fuser-guide%2FIMX-MACHINE-LEARNING-UG.pdf%3C%2FA%3E%20%E3%81%B8%E3%81%AE%E3%83%AA%E3%83%B3%E3%82%AF%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%E3%83%81%E3%83%A3%E3%83%97%E3%82%BF%E3%83%BC%E3%80%8C8.1.2%E3%80%8CSSD%E7%89%A9%E4%BD%93%E6%A4%9C%E5%87%BA%E3%83%87%E3%83%A2%E3%80%8D%E3%81%AF%3CSPAN%3Essd_mobilenet_v1_quant.tflite%E3%81%A8%E3%81%84%E3%81%86%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E3%81%9D%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A7%E8%A6%8B%E3%81%A4%E3%81%91%E3%81%9F%E5%95%8F%E9%A1%8C%E3%81%AF%E3%80%81vela%E3%81%A7%E5%A4%89%E6%8F%9B%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84%E3%81%9F%E3%82%81%E3%80%81i.MX93%20NPU%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84%E3%81%93%E3%81%A8%E3%81%A7%E3%81%99%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E3%83%A2%E3%83%87%E3%83%AB%E3%80%8C%3CSPAN%3Essd_mobilenet_v1_quant.tflite%3C%2FSPAN%3E%E3%80%8D%E3%82%92%E6%89%8B%E5%8B%95%E3%81%A7%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E3%81%99%E3%82%8B%E3%81%A8%E3%80%81%E5%A4%89%E6%8F%9B%E3%81%A7%E3%81%8D%E3%81%9A%E3%80%81%E6%AC%A1%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E8%BF%94%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%20translate%3D%22no%22%3EError%3A%20Invalid%20TFLite%20file.%20Got%20%22unpack_from%20requires%20a%20buffer%20of%20at%20least%201836597056%20bytes%20for%20unpacking%204%20bytes%20at%20offset%201836597052%20(actual%20buffer%20size%20is%20298)%22%20while%20parsing%20buffers%20length.%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%E3%81%97%E3%81%9F%E3%81%8C%E3%81%A3%E3%81%A6%E3%80%81%E3%81%93%E3%81%93%E3%81%AB%E3%81%AF2%E3%81%A4%E3%81%AE%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CSPAN%3E%3CSPAN%3E%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E3%80%8C%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx%2Feiq-example%2Fblob%2Flf-6.6.52_2.2.0%2Fdownload_models.py%23L106%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Edownload_models.py%3C%2FA%3E%E3%80%8D%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E5%A4%89%E6%8F%9B%E3%81%99%E3%82%8B%E3%81%A8%E3%81%8D%E3%81%AB%E5%80%A4%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%97%E3%81%A6%E3%80%81%E3%81%9D%E3%81%AE%E5%A4%B1%E6%95%97%E3%82%92%E9%80%9A%E7%9F%A5%E3%81%99%E3%82%8B%E5%BF%85%E8%A6%81%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-python%22%3E%3CCODE%20translate%3D%22no%22%3E-%20%20%20%20%20%20%20%20%20%20%20%20os.system('vela%20'%20%2B%20model%20%2B%20%22%20--output-dir%20%22%20%2B%20vela_dir)%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20ret%20%3D%20os.system('vela%20'%20%2B%20model%20%2B%20%22%20--output-dir%20%22%20%2B%20vela_dir)%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20if%20ret%20!%3D%200%3A%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20print(f%22Error%3A%20Failed%20to%20convert%20model%20%7Bname%7D%20with%20vela%22)%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20import%20sys%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20sys.exit(1)%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CUL%3E%3CLI%3E%E3%83%A2%E3%83%87%E3%83%AB%20%22%3CSPAN%3Essd_mobilenet_v1_quant.tflite%E3%80%8D%E3%81%AFVELA%2FNPU%E3%81%AB%E5%AF%BE%E5%BF%9C%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82%3CBR%20%2F%3E%E3%81%9D%E3%81%AE%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%81%AE%E5%95%8F%E9%A1%8C%E3%81%AA%E3%81%AE%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%3F%3CBR%20%2F%3ENPU(Ethos-U65)%E3%82%92%E5%88%A9%E7%94%A8%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSPAN%3EBR%20%2F%20%E3%82%A2%E3%82%A4%E3%82%B6%E3%83%83%E3%82%AF%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E