它需要指定 NormalizationOptions 元数据来预处理输入图像 [英] it requires specifying NormalizationOptions metadata to preprocess input images

查看:53
本文介绍了它需要指定 NormalizationOptions 元数据来预处理输入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Yolov3-tiny-416.tflite 是从 yolov3-tiny.weights 创建的 yolov3 tiny 模型的 tflite 模型我曾尝试从谷歌在 android 中提供的 ML kit Vision 模块中使用它.在回购:https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart

Yolov3-tiny-416.tflite is a tflite model for yolov3 tiny model created from yolov3-tiny.weights I had tried to use this from ML kit Vision module provided by google in android. In repo: https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart

这是我为 yolo v3 tiny tflite 模型加载和选择检测选项的方式.

This is the way I have load and and choose detection options for yolo v3 tiny tflite model.

LocalModel localModel = new LocalModel.Builder()
              .setAssetFilePath("yolov3-tiny-416.tflite")
              .build();
CustomObjectDetectorOptions customObjectDetectorOptions = PreferenceUtils.getCustomObjectDetectorOptionsForLivePreview(this,localModel);
cameraSource.setMachineLearningFrameProcessor(new ObjectDetectorProcessor(this,customObjectDetectorOptions));

现在,我遇到了一个错误:

Now, I have encounterd a error that says:

E/MobileVisionBase: Error preloading model resource
b.a.d.a.a: Failed to initialize detector. Input tensor has type kTfLiteFloat32: it requires specifying NormalizationOptions metadata to preprocess input images. 

我从错误中了解到,我需要指定 NormalizationOptions Metadata 来处理 Image.那么,如何解决问题呢?有什么建议吗?

As I know from error, I need to specify NormalizationOptions Metadata to process Image. So, How the problem can be solved? any Suggestion?

推荐答案

这里是 ML Kit 自定义对象检测和跟踪的自定义模型要求.https://developers.google.com/ml-kit/custom-models如果您查看页面底部的元数据部分,它会提供一些有关添加 NormalizationOptions 元数据的说明.

Here is the custom model requirements for ML Kit custom object detection&tracking. https://developers.google.com/ml-kit/custom-models If you check the Metadata section at the bottom of the page, it has some instructions about adding NormalizationOptions Metadata.

但是,ML Kit 自定义对象检测和跟踪的最基本要求是模型需要是图像分类模型,而 yolov3 不是.

However, the very basic requirement for ML Kit custom object detection&tracking is that the model needs to be an image classification model, while yolov3 is not.

如果您想使用 ML Kit 对更多对象进行分类,您可以尝试使用 TFHub 上带有 ML Kit 标签的自定义图像分类器模型之一.https://tfhub.dev/ml-kit/collections/image-classification/1 或使用 AutoML 或 TFLite ModelMaker 训练您自己的分类器(参见 https://developers.google.com/ml-kit/custom-models#automl_vision_edge).

If you want to classify more object with ML Kit, you can try one of the custom image classifier models with ML Kit tag on TFHub. https://tfhub.dev/ml-kit/collections/image-classification/1 or train your own classifier using AutoML or TFLite ModelMaker (see https://developers.google.com/ml-kit/custom-models#automl_vision_edge).

最好,

这篇关于它需要指定 NormalizationOptions 元数据来预处理输入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆