簡體   English   中英

如何使用 google ml kit 在顫振中進行圖像標記?

[英]How to use google ml kit for image labelling in flutter?

如何將帶有 google ml kit 包的圖像標記功能添加到顫振應用程序中,沒有示例,所有示例都向我展示了他們使用的是 firebase ml kit!

那么我們該如何實現呢?

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

Google ML Kit Basic (Imp. update): google_ml_kit包具有所有功能,如文本識別、圖像標記、條形碼掃描、人臉檢測。 所以應用程序的大小正在增加。 最近這個包的創建者將其拆分為特定於功能的子包。 現在由於子包應用程序大小問題沒有發生,因為我們可以使用所需的包而不是使用整個包。

因此,對於圖像標簽,您可以使用從google_ml_kit包中拆分出來的 google_mlkit_image_labeling 包。

圖像標簽代碼:對於圖像標簽,您可以使用以下代碼片段,

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
}

除此之外,您還需要進行一些配置。 要了解有關所需配置的更多信息並通過示例詳細了解圖像標記代碼,請參閱此鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM