我想将Firebase ML Vision与默认模型一起用于人脸检测。
Android设置文档讨论了安装时间与检测时间的下载模型: https://firebase.google.com/docs/ml-kit/android/detect-faces#before-you-begin
但是我想要应用程序的apk /应用程序包中的模型。用户从Play商店下载该应用后,我需要它在没有任何其他依赖项的情况下运行。有可能吗?
iOS设置文档为什么没有提到有关下载模型的任何内容? https://firebase.google.com/docs/ml-kit/ios/detect-faces
此外,人脸模型资产有多少字节?
答案 0 :(得分:0)
It looks like it would not be possible to put the predefined face detection model in the apk. It may be that firebase does not want the model to be easy to copy or modify, so it does not output it as a file. In addition, they can thereby improve the model continuously.
What you can do is look for the tflite model file on the internet (maybe it's open source anyway and I just did not find it). You can then save this file as a custom model in the assets folder of your android project. Custom models can be saved both directly in the app and on the firebase server.
Alternatively, you can also look for other (not firebase) tflite face detection models or create one yourself and use it as a custom model. Here you will find a bunch of models that you can easily use or retrain. https://www.tensorflow.org/lite/guide/hosted_models
Probably the hardest part is getting this model file. Then integrating it into firebase should be as easy as seeing it here:
FirebaseLocalModel localSource =
new FirebaseLocalModel.Builder("my_local_model") // Assign a name to this model
.setAssetFilePath("my_model.tflite")
.build();
FirebaseModelManager.getInstance().registerLocalModel(localSource);