【问题标题】:Snapdragon Neural Processing Engine (SNPE) and Tiny Yolo on Android AppAndroid 应用上的 Snapdragon 神经处理引擎 (SNPE) 和 Tiny Yolo
【发布时间】:2018-10-30 11:14:53
【问题描述】:

在我的期末大学考试中,我正在尝试将 SNPE 与 Tiny YOLO 一起用于 Android 应用程序中的实时对象检测。我成功地将模型转换为 DLC 格式,但我不明白如何准备输入张量以及如何处理输出张量。同一个人可以帮助我吗?谢谢。

【问题讨论】:

    标签: android yolo snpe


    【解决方案1】:

    构建SNPE神经网络并得到输出FloatTensor的步骤:

    1. 在Android/app目录下创建asset文件夹,并将模型文件(.dlc)保存在asset文件夹中。

      // assetFileName is the file name of .dlc
      InputStream assetInputStream = application.getAssets().open(assetFileName); // Create and build the neural network
      NeuralNetwork network = new SNPE.NeuralNetworkBuilder(application)
              .setDebugEnabled(false)
      //outputLayerNames can be got while converted model to DLC format
              .setOutputLayers(outputLayerNames)
              .setModel(assetInputStream, assetInputStream.available())
              .setPerformanceProfile(NeuralNetwork.PerformanceProfile.DEFAULT)
              .setRuntimeOrder(selectedRuntime) // Runtime.DSP, Runtime.GPU_FLOAT16, Runtime.GPU, Runtime.CPU
              .setCpuFallbackEnabled(needsCpuFallback)
              .build();
      // Close input
      assetInputStream.close();
      
    2. 创建输入张量

    3. 通过网络传播输入张量
    4. 处理神经网络输出

    请点击下面的链接,找到步骤 2,3 和 4 中提到的准备输入张量和处理输出张量的部分https://developer.qualcomm.com/docs/snpe/android_tutorial.html

    【讨论】:

      猜你喜欢
      • 2021-10-30
      • 2020-09-17
      • 1970-01-01
      • 1970-01-01
      • 2011-01-19
      • 1970-01-01
      • 2021-12-08
      • 2021-11-11
      • 2011-04-03
      相关资源
      最近更新 更多