高通神经处理引擎 (NPE) 加载模型失败
Qualcomm Neural Processing Engine (NPE) loading model failed
我按照 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.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.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)
我该如何解决这个问题?
求解顺序如下:
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 "error: failed to read metadata" after update to 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
b。该目录为空 - 因此您可以将预期的数据推送到正确的位置:
只需将其解压缩到某个目录并从目录中执行:
adb push ./ /storage/emulated/0/Android/data/com.qualcomm.qti.snpe/files/models/alexnet/
它应该可以工作。
我按照 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.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.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)
我该如何解决这个问题?
求解顺序如下:
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 "error: failed to read metadata" after update to 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
b。该目录为空 - 因此您可以将预期的数据推送到正确的位置: 只需将其解压缩到某个目录并从目录中执行:
adb push ./ /storage/emulated/0/Android/data/com.qualcomm.qti.snpe/files/models/alexnet/
它应该可以工作。