【问题标题】:I want integrate the firebase custom model in flutter app. how i integrate?我想将 firebase 自定义模型集成到颤振应用程序中。我如何整合?
【发布时间】:2020-02-29 10:31:45
【问题描述】:

我不知道在 Firebase 中将我的 ML 模型保存在哪里

查看下面的代码并得到一个错误:

断言失败:第 259 行 pos 12: 'remoteModelName != null || localModelName != null': 不正确。

这是按下时的空白:

Future runmodel() async {

    manager.registerLocalModelSource(FirebaseLocalModelSource(
    modelName: 'mobilenet_v10',
    assetFilePath: 'assets/mobilenet_v2.tflite'));

    var imageBytes = (await rootBundle.load('assets/download.jpg')).buffer;
    img.Image image = img.decodeJpg(imageBytes.asUint8List());
    image = img.copyResize(image, height: 224, width: 224);

    var results = await interpreter.run();

    print(results);}

【问题讨论】:

  • 你能提供一些示例代码和/或图像吗?
  • 这个问题似乎根本没有包括任何解决问题的尝试。请编辑问题以显示您尝试过的内容,并使用Minimal, Complete, and Verifiable example 显示您遇到的特定障碍。欲了解更多信息,请参阅How to Ask
  • 是的,我可以上传图片,我上传我的尝试

标签: firebase flutter


【解决方案1】:

将本地模型注册到管理器后,请务必为解释器定义 localModelName。

   await interpreter.run(
      localModelName: modelName,
      inputOutputOptions: io, 
      inputBytes: bytes
    );

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2020-08-12
    • 2021-01-30
    • 1970-01-01
    • 2021-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-28
    • 1970-01-01
    相关资源
    最近更新 更多