XiaoMi/mace

模型部署到DSP

qdushuaicao opened this issue · 1 comments

Before you open an issue, please make sure you have tried the following steps:

  1. Make sure your environment is the same with (https://mace.readthedocs.io/en/latest/installation/env_requirement.html).
  2. Have you ever read the document for your usage?
  3. Check if your issue appears in HOW-TO-DEBUG or FAQ.
  4. The form below must be filled.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • NDK version(e.g., 15c):
  • GCC version(if compiling for host, e.g., 5.4.0):
  • MACE version (Use the command: git describe --long --tags):
  • Python version(2.7):
  • Bazel version (e.g., 0.13.0):

Model deploy file (*.yml)

library_name: mobilenet
target_abis: [arm64-v8a]
target_socs: [sdm660]
model_graph_format: code
model_data_format: code
models:
  mobilenet_v1_quant:
    platform: tensorflow
    model_file_path: http://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v1/mobilenet_v1_1.0_224_quant_retrain.pb
    model_sha256_checksum: c3faa9bd790310eb3dec411d2f2e2dd8802394e31ccb47daaa5e3b6369fadfa3
   subgraphs:
      - input_tensors:
          - input
          - input_shapes:
          - 1,224,224,3
          -  input_ranges:
          - -1.0,1.0
          - output_tensors:
          - MobilenetV1/Predictions/Softmax:0
          - output_shapes:
          - 1,1001
          - check_tensors:
          - MobilenetV1/Logits/Conv2d_1c_1x1/BiasAdd:0
          - check_shapes:
          - 1,1,1,1001
          - validation_inputs_data:
          - http://cnbj1.fds.api.xiaomi.com/mace/miai-models/mobilenet-v1/input_n01440764_15071.JPEG_input
     runtime: dsp
    limit_opencl_kernel_time: 0
    nnlib_graph_mode: 0
    obfuscate: 0
    winograd: 0
    quantize: 1

Describe the problem

您好,我使用提供的mobilenet_V1模型部署到cup和gpu上时,运行android/build.sh dynamic 得到如下信息:
INFO: Build completed successfully, 234 total actions
./build.sh: line 66: /opt/android-ndk-r19c/ndk-depends: No such file or directory
./build.sh: line 70: /opt/android-ndk-r19c/ndk-depends: No such file or directory
然后,我用android studio 打开android工程,ndk使用r19c,进行编译,最终生成apk可以运行。
最后我将上述yml模型按照同样的方式部署到DSP时,同时修改了build.sh,添加hexagon_enabled=true. 在android工程initdata.java中将DEVICES = new String[]{"CPU", "GPU"};修改成DEVICES = new String[]{"CPU", "GPU","HEXAGON"};,MODELS设置为 mobilenet_v1_quant 。将编译完成的模型再次用android studio打包成apk时,最终生成的apk运行出错。
已经按照FAQ中的步骤操作完成,root权限已经开启。希望大佬能帮助,怎么将模型部署到dsp中。

To Reproduce

Steps to reproduce the problem:

1. cd /path/to/mace
2. python tools/converter.py convert --config_file=/path/to/your/model_deployment_file

Error information / logs

Please include the full log and/or traceback here.

08-02 10:25:50.039  3244  3244 F DEBUG   : Abort message: 'runtime_registry.cc:66 Check failed: registry_.count(runtime_key) > 0 Current MACE doesn't support the runtime type. runtime_type: 3, runtime_sub_type: 0, perhaps you have specified A type runtime in yml file to convert model but specified B type runtime in yml file to run model'

08-02 10:22:01.506  1049  1365 E TaskPersister: File error accessing recents directory (directory doesn't exist?).

Additional context

Add any other context about the problem here, e.g., what you have modified about the code.

lu229 commented

@qdushuaicao 可以在ndk-depends找不到的话可以在 /opt/android-ndk-r16c/中拷贝一个。
DSP的问题比较麻烦,不是需要root,是需要签名。