它需要指定 NormalizationOptions 元数据来预处理输入图像

it requires specifying NormalizationOptions metadata to preprocess input images

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

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

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

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

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 元数据来处理图像。那么,如何解决这个问题呢?有什么建议吗?

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

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

如果您想使用 ML Kit 对更多对象进行分类,可以尝试使用 TFHub 上带有 ML Kit 标签的自定义图像分类器模型之一。 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).

最佳,