[英]How do I replace the tflites in Tensorflow's image classification example for Android with my own tflite?
I cloned the Tensorflow's Android image classification example and I want to now use my own tflite that I have downloaded from here to classify food.我克隆了Tensorflow 的 Android 图像分类示例,现在我想使用从这里下载的我自己的 tflite 对食物进行分类。 How do I replace the default tflites with my own tflite?如何用我自己的 tflite 替换默认的 tflite? I only have one tflite while in the Android example there's a couple so I'm not sure which tflite to get rid of.我只有一个 tflite,而在 Android 示例中有一对,所以我不确定要摆脱哪个 tflite。
First, add the model into the assets folder.首先,将 model 添加到assets文件夹中。 Alternatively, you can directly download the model from TFHub in the similar way as the models in download.gradle .或者,您可以直接从 TFHub 下载 model,方法与download.gradle 中的模型类似。
Then if you use Task library to run inference (which is simpler), you will need to add a similar class of ClassifierFloatEfficientNet.java and provide the model info.那么如果你使用任务库来运行推理(更简单),你需要添加一个类似的ClassifierFloatEfficientNet.java的 class 并提供 Z20F35E630DAF44DBFA4C3F68F539D 信息。 Register your new class in Classifier.java .在Classifier.java中注册您的新 class 。
If you use the TFLite Support library to run inference, you'll add the new class like this one .如果您使用 TFLite Support 库来运行推理,您将像这样添加新的 class 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.