【问题标题】:How to use google ml kit for image labelling in flutter?如何使用 google ml kit 在颤振中进行图像标记?
【发布时间】:2022-06-22 09:41:04
【问题描述】:

如何将带有 google ml kit 包的图像标签功能添加到 Flutter 应用程序中,没有示例,所有示例都向我展示了他们使用的是 firebase ml kit!

那么我们该如何实现呢?

【问题讨论】:

    标签: flutter


    【解决方案1】:

    google_ml_kit 是相当新的。看看 pub.dev 例子 https://pub.dev/packages/google_ml_kit/example

    【讨论】:

      【解决方案2】:

      Google ML Kit Basic(Imp. 更新): google_ml_kit 包具有文本识别、图像标记、条形码扫描、人脸检测等所有功能。所以应用程序的大小正在增加。最近这个包的创建者将其拆分为特定于功能的子包。现在由于子包应用程序大小问题没有发生,因为我们可以使用所需的包而不是使用整个包。

      因此,对于图像标签,您可以使用从 google_ml_kit 包中拆分出来的 google_mlkit_image_labeling 包。

      图片标注代码:图片标注可以使用下面的代码sn-p,

      XFile image = await ImagePicker().pickImage(ImageSource.Gallery); //Get image using image picker
      final InputImage inputImage = InputImage.fromFilePath(image.path); //Get input image object
      final ImageLabelerOptions options = ImageLabelerOptions(confidenceThreshold: 0.5);//ImageLabeler option is required to set confident threshold, if we want labels above any confidence, we can set threshold here. confidence is a probability of a label.
      final imageLabeler = ImageLabeler(options: options);
      final List<ImageLabel> labels = await imageLabeler.processImage(inputImage);
      
      for (ImageLabel label in labels) {
        final String text = label.text; // Image Label
        final double confidence = label.confidence; // Label Confidence, confidence is a probability of label
      }
      

      除此之外,您还需要进行一些配置。要了解有关所需配置的更多信息并通过示例详细了解图像标记代码,请参阅link

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-09-07
        • 2021-08-05
        • 1970-01-01
        • 2020-11-09
        • 2019-11-19
        • 1970-01-01
        • 2021-07-21
        • 2022-01-15
        相关资源
        最近更新 更多