S.L*_*uja 7 android tensorflow yolo google-mlkit
Yolov3-tiny-416.tflite 是从 yolov3-tiny.weights 创建的 yolov3 tiny 模型的 tflite 模型,我曾尝试在 android 中使用谷歌提供的 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));
Run Code Online (Sandbox Code Playgroud)
现在,我遇到了一个错误:
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.
Run Code Online (Sandbox Code Playgroud)
据我从错误中得知,我需要指定 NormalizationOptions 元数据来处理图像。那么,问题如何解决呢?有什么建议吗?
小智 2
以下是 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或使用 AutoML 或 TFLite ModelMaker 训练您自己的分类器(请参阅https://developers.google.com/ml-kit/custom-models#automl_vision_edge)。
最好的,
归档时间: |
|
查看次数: |
9310 次 |
最近记录: |