Forums - SNPE can not build layers with 5 output dimension

5 posts / 0 new
Last post
SNPE can not build layers with 5 output dimension
byunghwy.choi
Join Date: 20 Aug 21
Posts: 4
Posted: Thu, 2022-01-27 00:58

Hi

I'm trying to use yolov5 with SNPE.

But I can't build my dlc model in runtime with following error.

Quote:

2022-01-24 18:42:33.195 13721-13760/android.example.com.SNPEdemo E/AndroidRuntime: FATAL EXCEPTION: CameraBackground
    Process: android.example.com.SNPEdemo, PID: 13721
    com.qualcomm.qti.snpe.SnpeError$NativeException: Unable to create network! Cause: error_code=902; error_message=Layer parameter value is invalid in DSP. error_code=902; error_message=Layer parameter value is invalid in DSP. Layer Reshape_259: Maximum number of output dimensions(4) exceeded. 5 output dimension were given for DSP runtime.; error_component=DSP Runtime; line_no=101; thread_id=485011494128; error_component=DSP Runtime; line_no=265; thread_id=485064963312
        at com.qualcomm.qti.snpe.SnpeError.getSnpeNativeError(SnpeError.java:35)
        at com.qualcomm.qti.snpe.internal.NativeNetwork.<init>(NativeNetwork.java:83)
        at com.qualcomm.qti.snpe.SNPE$NeuralNetworkBuilder.build(SNPE.java:414)
        at com.example.android.SNPEdemo.models.ObjectDetectorQuantizedYoloV5_SNPE.<init>(ObjectDetectorQuantizedYoloV5_SNPE.java:119)
        at com.example.android.SNPEdemo.Camera2BasicFragment.lambda$updateActiveModel$0$Camera2BasicFragment(Camera2BasicFragment.java:466)
        at com.example.android.SNPEdemo.-$$Lambda$Camera2BasicFragment$y8biyD425r7lo-ZVHRFV-5g-v5k.run(Unknown Source:8)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)

I read that SNPE does not support 5D input data. But this error happens in intermediate layer not in input layer.

Does SNPE not support 5D data in any intermediate layers or just did I messed up something?

Thank you

 

 

  • Up0
  • Down0
SahilBandar
Join Date: 23 May 18
Posts: 37
Posted: Tue, 2022-02-01 18:21

Hi byunghwy.choi,

Are you using a DSP as Runtime?
If Yes, Can you please try using other Runtime than DSP?

Please let me if issue persist with other Runtime also.

Regards,
Sahil Bandar

  • Up0
  • Down0
byunghwy.choi
Join Date: 20 Aug 21
Posts: 4
Posted: Thu, 2022-02-03 02:31

Hi Sahil Bandar.

 

It works perfectly well with CPU runtime but I got the following error with GPU runtime:

Quote:

2022-02-03 17:02:02.474 E/AndroidRuntime: FATAL EXCEPTION: CameraBackground

    Process: android.example.com.SNPEdemo, PID: 14997
    com.qualcomm.qti.snpe.SnpeError$NativeException: Unable to create network! Cause: error_code=802; error_message=Layer parameter value is invalid in GPU. error_code=802; error_message=Layer parameter value is invalid in GPU. Layer Mul_268: GPU does not support elementwise binary operations of rank higher than 4; error_component=GPU Runtime; line_no=313; thread_id=490969502960; error_component=GPU Runtime; line_no=265; thread_id=491041215728
        at com.qualcomm.qti.snpe.SnpeError.getSnpeNativeError(SnpeError.java:35)
        at com.qualcomm.qti.snpe.internal.NativeNetwork.<init>(NativeNetwork.java:83)
        at com.qualcomm.qti.snpe.SNPE$NeuralNetworkBuilder.build(SNPE.java:414)
        at com.example.android.SNPEdemo.models.ObjectDetectorQuantizedYoloV5_SNPE.<init>(ObjectDetectorQuantizedYoloV5_SNPE.java:110)
        at com.example.android.SNPEdemo.Camera2BasicFragment.lambda$updateActiveModel$0$Camera2BasicFragment(Camera2BasicFragment.java:470)
        at com.example.android.SNPEdemo.-$$Lambda$Camera2BasicFragment$y8biyD425r7lo-ZVHRFV-5g-v5k.run(Unknown Source:8)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)

        at android.os.HandlerThread.run(HandlerThread.java:65)

Mul_268 layer has input and output shape of [1x3x24x40x2], which is also 5-dimension.

 

After I saw this error, I checked my model with snpe-dlc-info layer by layer .

 

It says Reshape_259 layer, which caused problem with DSP, does not support DSP runtime, it supports only GPU and CPU. In facts, every layer with 5-dimension output did not support AIP and DSP, and elementwise_binary_op layer with 5-dimension output supported only CPU.

 

Okey, maybe SNPE does not support full operations in every processor if they have 5-dimension output, but what matters to me is how I can utilize my hardware resources. If reshape layer does not support DSP, I can use GPU. If elementwise_binary_op does not support GPU, I can use CPU.

 

So my question is, is there any method to utilize multiple runtimes in one neural network?

I set runtime order as following, but it doesn't seem to utilize multiple runtime. It just check the resources are available or not and choose the top of the list.

Quote:

.setRuntimeOrder(NeuralNetwork.Runtime.DSP, NeuralNetwork.Runtime.GPU, NeuralNetwork.Runtime.CPU)

  • Up0
  • Down0
wz.fan
Join Date: 20 Dec 21
Posts: 6
Posted: Tue, 2022-03-01 23:11

Exactly the same error. I faced it on c++_android version. 

I'm using SNPE 1.58.00, have you tried it under 1.59.00?

It seems like that I need to change the model of yolov5, which is tricky.

Did you fixed it? Or do you have any idea?

 

  • Up0
  • Down0
byunghwy.choi
Join Date: 20 Aug 21
Posts: 4
Posted: Sun, 2022-03-13 23:54

I'm also using 1.58.00.

I couldn't find any solution to utilize DSP for yolov5 in SNPE,  so I'm just using tensorflow lite with GPU instead.

My application uses multiple neural network model simultaneously, and some of them have only 4-dimension input and output for every layer, so I'm utilizing SNPE DSP for those models instead of yolov5.

SNPE do have some restrictions compared to tensorflow lite, but  I believe that quantization tool of SNPE shows less accuracy drop than that of tensorflow lite.

Currently I'm using both SNPE and tensorflow lite: SNPE for int8 quantized model, tensorflow lite for FP32 model

I hope SNPE supports 5-dimension data soon enough.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.