gpt4 book ai didi

android - 高通神经处理引擎 (NPE) 加载模型失败

转载 作者:太空狗 更新时间:2023-10-29 13:51:46 24 4
gpt4 key购买 nike

我按照 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)

我该如何解决这个问题?

最佳答案

求解顺序如下:

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

该目录为空 - 因此您可以将预期的数据推送到正确的位置: 只需将其解压缩到特定目录并从目录中执行:

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

它应该可以工作。

关于android - 高通神经处理引擎 (NPE) 加载模型失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45993938/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com