Qualcomm Neural Processing Engine (NPE) loading model failed

2.1k views Asked by At

I follow Qualcomm Neural Processing Engine tutorial to build the sample app.

When app loads model occur error. Error message following

09-01 12:21:20.600 30650-30681/com.qualcomm.qti.snpe.imageclassifiers E/LoadNetworkTask: Unable to create network! Cause: error_code=307; error_message=Model record is missing in dlc. Missing mandatory record model; error_component=Dl Container; line_no=447; thread_id=-1422036112
                            java.lang.IllegalStateException: Unable to create network! Cause: error_code=307; error_message=Model record is missing in dlc. Missing mandatory record model; error_component=Dl Container; line_no=447; thread_id=-1422036112
                            at com.qualcomm.qti.snpe.internal.NativeNetwork.nativeInitFromFile(Native Method)
                            at com.qualcomm.qti.snpe.internal.NativeNetwork.<init>(NativeNetwork.java:90)
                            at com.qualcomm.qti.snpe.SNPE$NeuralNetworkBuilder.build(SNPE.java:214)
                            at com.qualcomm.qti.snpe.imageclassifiers.tasks.LoadNetworkTask.doInBackground(LoadNetworkTask.java:50)
                            at com.qualcomm.qti.snpe.imageclassifiers.tasks.LoadNetworkTask.doInBackground(LoadNetworkTask.java:20)
                            at android.os.AsyncTask$2.call(AsyncTask.java:292)
                            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                            at java.lang.Thread.run(Thread.java:818)

How can I solve this problem?

1

There are 1 answers

0
Netanell Avisdris On BEST ANSWER

The sequence to solve it is as follows:

1) download and pack alexnet models as in https://developer.qualcomm.com/software/snapdragon-neural-processing-engine-ai/getting-started specific, you need to :

cd $SNPE_ROOT/examples/android/image-classifiers
cp ../../../android/snpe-release.aar ./app/libs # copies the NPE runtime library
bash ./setup_models.sh

2) after it, you may face this problem : https://developer.qualcomm.com/forum/qdn-forums/software/snapdragon-neural-processing-engine-sdk/35375

/raw_alexnet.zip.flat: error: failed to read data meta data.

to solve this, you can use first bypass here ( Android Studio "error: failed to read metadata" after update to 3.0.0) as this is ongoing bug in aapt2

3) If it still not solved , validate that all files are on the android device by using adb shell:

adb shell
sifiers/files $ ls -R /storage/emulated/0/Android/data/com.qualcomm.qti.snpe.i>ssifiers/files $ 

/storage/emulated/0/Android/data/com.qualcomm.qti.snpe.imageclassifiers/files/models/:
alexnet

/storage/emulated/0/Android/data/com.qualcomm.qti.snpe.imageclassifiers/files/models//alexnet:
images

/storage/emulated/0/Android/data/com.qualcomm.qti.snpe.imageclassifiers/files/models//alexnet/images:
shell@msm8996:/storage/emulated/0/Android/data/com.qualcomm.qti.snpe.imageclassifiers/files $ 

What we can see here is: a. the problem is that the SNPE search the files not in the right place so you can move the directory to the right place

cd /storage/emulated/0/Android/data/
mv com.qualcomm.qti.snpe.imageclassifiers com.qualcomm.qti.snpe

b. the directory is empty - so you can push the expected data to the right place: just extract it to certain directory and from the directory do :

adb push ./ /storage/emulated/0/Android/data/com.qualcomm.qti.snpe/files/models/alexnet/

And it should work.