【问题标题】:In flutter, How to add tflite as a dependency in pubspec.yaml ?file?在颤振中,如何在 pubspec.yaml 文件中添加 tflite 作为依赖项?
【发布时间】:2019-07-15 05:47:36
【问题描述】:

我对此有点困惑。现在我有 .tflitelabel.txt 但现在我想使用 Flutter Plugin 访问 TensorFlow lite。 在这里,我对在 pubspec.yaml 中添加 tflite 作为依赖项感到困惑

【问题讨论】:

    标签: android flutter tensorflow-lite


    【解决方案1】:

    cupertino_icons: ^0.1.2

    下添加 tflite: ^1.0.4

    1. 在您的项目中创建一个名为 assets 的新目录。
    2. 将您的文件复制到 assets 文件夹中。
    3. uses-material-design:true 下面的资产添加到您的 pubspec.yaml 例如。
      资产:
      - 资产/label.txt

    【讨论】:

      【解决方案2】:

      您需要在资产部分提供:

        assets:
          - path/to/your/file
      

      要访问您的资产:

      import 'dart:async' show Future;
      import 'package:flutter/services.dart' show rootBundle;
      
      Future<String> loadAsset() async {
        return await rootBundle.loadString('path/to/your/file');
      }
      

      Adding assets and images

      【讨论】:

        【解决方案3】:

        Pubspec.yaml

        version: 1.0.0+1
        environment:
          sdk: ">=2.0.0-dev.68.0 <3.0.0"
        
        dependencies:
          flutter:
            sdk: flutter
        
          # The following adds the Cupertino Icons font to your application.
          # Use with the CupertinoIcons class for iOS style icons.
          cupertino_icons: ^0.1.2
        
        dev_dependencies:
          flutter_test:
            sdk: flutter
        
          camera: 0.4.0
        
          tflite: 1.0.4  
        

        在 Asset 文件夹中是您的 .tflite 文件,这些文件可以生成您自己的训练、标签和推理,也可以从 GitHub 文件手动复制生成,因为它们是由 TensorFlow 图像数据专门生成的。 See here for more details

        资产文件夹

        【讨论】:

          猜你喜欢
          • 2022-11-04
          • 2022-01-14
          • 2021-12-26
          • 1970-01-01
          • 2021-09-02
          • 1970-01-01
          • 2020-05-03
          • 2021-01-06
          • 1970-01-01
          相关资源
          最近更新 更多