Forums - SNPE Android Tutorial is not working for DSP runtime

4 posts / 0 new
Last post
SNPE Android Tutorial is not working for DSP runtime
Animesh
Join Date: 7 Dec 22
Posts: 4
Posted: Wed, 2022-12-07 08:30

I am trying to run the SNPE Android tutorial on S22 Ultra device. I have validated DSP support using the snpe-platform-validator command. 
The android tutorial shown at Snapdragon Neural Processing Engine SDK: Android Tutorial (qualcomm.com) works fine for CPU and GPU runtimes, but crashes and gives the following error in case of DSP:

--------- beginning of crash
11-30 02:53:31.410 30375 30436 E AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
11-30 02:53:31.410 30375 30436 E AndroidRuntime: Process: com.qualcomm.qti.snpe.imageclassifiers, PID: 30375
11-30 02:53:31.410 30375 30436 E AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at android.os.AsyncTask$4.done(AsyncTask.java:415)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:269)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: Caused by: com.qualcomm.qti.snpe.SnpeError$NativeException: Unable to create network! Cause: error_code=401; error_message=Network creation has failed. error_code=401; error_message=Network creation has failed. QnnGraph_finalize failed: 75546; error_component=Dl Network; line_no=796; thread_id=470243728560; error_component=Dl Network; line_no=342; thread_id=472151293104
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at com.qualcomm.qti.snpe.SnpeError.getSnpeNativeError(SnpeError.java:35)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at com.qualcomm.qti.snpe.internal.NativeNetwork.<init>(NativeNetwork.java:135)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at com.qualcomm.qti.snpe.SNPE$NeuralNetworkBuilder.build(SNPE.java:421)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at com.qualcomm.qti.snpe.imageclassifiers.tasks.LoadNetworkTask.doInBackground(LoadNetworkTask.java:70)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at com.qualcomm.qti.snpe.imageclassifiers.tasks.LoadNetworkTask.doInBackground(LoadNetworkTask.java:22)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at android.os.AsyncTask$3.call(AsyncTask.java:394)
11-30 02:53:31.410 30375 30436 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:264)
11-30 02:53:31.410 30375 30436 E AndroidRuntime:  ... 4 more
I am trying this tutorial with Inception_v3 model. 
Please let me know if I am missing anything or if any other pre-requisites are needed that are not mentioned on the tutorial page.



 
  • Up0
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 270
Posted: Sat, 2022-12-10 23:37

Dear developer,

What's SNPE version you are testing?

You can help to check below,

1 Model need to quantize if run on cDSP runtime.

2 unsingedPD:OFF is added to snpe-net-run or sample code.

BR.

Wei

  • Up0
  • Down0
SahilBandar
Join Date: 23 May 18
Posts: 37
Posted: Tue, 2022-12-13 00:19
Hi a.081005,
As mentioned in document,
https://developer.qualcomm.com/sites/default/files/docs/snpe/dsp_runtime...
 

ADSP_LIBRARY_PATH must be set for Android APKs as well, and it cannot be done using an "export" command. It must be done within code running in the APK.

The SNPE Android Java APIs automatically sets the ADSP_LIBRARY_PATH. The supplied SNPE Java AAR library automatically sets up the DSP environment for your Android application.

Android applications that do not use the SNPE Java AAR must set the ADSP_LIBRARY_PATH explicitly in native code. An example is provided below.

bool SetAdspLibraryPath(std::string nativeLibPath) {
std::stringstream path;
path << nativeLibPath << ";/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp";
 
return setenv("ADSP_LIBRARY_PATH", path.str().c_str(), 1 /*override*/) == 0;
}

Assuming that the DSP loadable module (libsnpe_dsp_v65_domains_v2_skel.so and/or libsnpe_dsp_v66_domains_v2_skel.so) is placed in the same location as libSNPE.so in the Android application, the "nativeLibPath" input passed to the above method should be the string returned by the the following Android API:

application.getApplicationInfo().nativeLibraryDir

Hope this resolve your problem.

Regards,
Sahil Bandar

  • Up0
  • Down0
Animesh
Join Date: 7 Dec 22
Posts: 4
Posted: Tue, 2022-12-13 00:31

Hi weihuan,

I am using SNPE 1.66.0.3729 for this.

I have checked the above mentioned points:

1. I am using the `inception_v3_quantized.dlc` model for running this tutorial.
2. unsignedPD:OFF is added to the sample code.

I have also tried running after checking for the above points and the error is still the same.

Thanks.

  • 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.