【问题标题】:Tensorflow Lite ApplicationTensorFlow Lite 应用程序
【发布时间】:2020-08-07 20:54:21
【问题描述】:

如何将自定义模型应用于 tensorflowlite? 在指令中,我想将模型粘贴到资产中并删除下载模型 gradle,但是当它被应用时,应用程序简单粉碎,有什么问题?

已编辑:

我在 tensorflow lite 中使用自定义训练时遵循说明,但在将 api 模型文件更改为我的模型并评论下载模型后,应用程序简单崩溃。我尝试使用 microsoft general compact 和 compact[s1] 的自定义 ai 并按照指令https://medium.com/datadriveninvestor/how-to-train-your-own-custom-model-with-tensorflow-object-detection-api-and-deploy-it-into-android-aeacab7fa76f 两者都不起作用,compact[s1] 使应用程序混乱和崩溃,而 compact 完全崩溃所以,有什么问题,自定义 AI 简单不能在 tensorflowlite 中使用吗?

这个东西以调试模式显示:

    java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: Regular TensorFlow ops are not supported by this interpreter. Make sure you apply/link the Flex delegate before inference.
    Node number 328 (FlexNonMaxSuppressionV4) failed to prepare.

        at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegate(Native Method)
        at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegates(NativeInterpreterWrapper.java:324)
        at org.tensorflow.lite.NativeInterpreterWrapper.init(NativeInterpreterWrapper.java:82)
        at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:63)
        at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:237)
        at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.create(TFLiteObjectDetectionAPIModel.java:140)
        at org.tensorflow.lite.examples.detection.DetectorActivity.onPreviewSizeChosen(DetectorActivity.java:112)
        at org.tensorflow.lite.examples.detection.CameraActivity.onPreviewFrame(CameraActivity.java:200)
        at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1222)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6316)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)```

Edited v2:
Yes, it show up in netron.
[![this is the image of the other persons model][1]][1]
[![this one is my model in microsoft compact[s1][2]][2]
the other model of microsoft compact is to big for png so, it was saved as svg don't know how to show it here.

[![here is the properties of compact[s1][3]][3]
[![here is the properties of compact][4]][4]
[![here is the properties of other person][5]][5]


  [1]: https://i.stack.imgur.com/BtkZ1.jpg
  [2]: https://i.stack.imgur.com/ffnOU.png
  [3]: https://i.stack.imgur.com/mx7dx.png
  [4]: https://i.stack.imgur.com/AyXrt.png
  [5]: https://i.stack.imgur.com/K1odl.png

【问题讨论】:

  • 你能发布更多信息吗? Stacktrace,logcat中的崩溃报告?简化代码?
  • 我刚刚编辑了问题

标签: tensorflow tensorflow-lite


【解决方案1】:

TensorFlow Lite 不支持您的模型使用的运算符。这是supported ops的列表。

您可以查看如何创建model easily convertible to TensorFlow Lite

【讨论】:

  • 我不认为运算符不受支持,因为当我不使用自己的模型时它正在工作。
  • 您能否使用此工具可视化两个模型(您的模型和另一个模型)并附上图表? lutzroeder.github.io/netron
猜你喜欢
  • 2021-08-16
  • 2021-11-19
  • 1970-01-01
  • 2019-07-12
  • 1970-01-01
  • 2020-06-20
  • 1970-01-01
  • 1970-01-01
  • 2019-07-06
相关资源
最近更新 更多