4

我按照 Qualcomm 神经处理引擎教程构建示例应用程序。

当应用程序加载模型发生错误。错误信息如下

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)

我怎么解决这个问题?

4

1 回答 1

3

解决它的顺序如下:

1)下载并打包 alexnet 模型,如https://developer.qualcomm.com/software/snapdragon-neural-processing-engine-ai/getting-started 具体,您需要:

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

2)之后,你可能会遇到这个问题: 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.

为了解决这个问题,您可以在此处使用第一个绕过(Android Studio“错误:更新到 3.0.0 后无法读取元数据”),因为这是 aapt2 中的持续错误

3)如果仍然没有解决,使用 adb shell 验证所有文件都在 android 设备上:

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 $ 

我们在这里可以看到:问题是 SNPE 搜索的文件不在正确的位置,因此您可以将目录移动到正确的位置

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

湾。该目录是空的 - 因此您可以将预期的数据推送到正确的位置:只需将其提取到某个目录并从目录中执行:

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

它应该工作。

于 2018-02-07T13:49:25.360 回答