Using google cloud ml with Android app

落花浮王杯 提交于 2019-12-20 04:28:16

问题


I am studying this example on google cloud ml : link. I want to know how I can connect my Android app to this so that I can send in a data value and receive the prediction back to my app after processing it through Tensorflow.

I am thinking it has to be some sort of API connection that allows us to do this but I just can't find any documentation or examples that do this.

Please help!!


回答1:


You're right, the uploaded model is then provided to you as an API and you can make normal http POST requests and obtain predictions. This is their structure.

Perhaps read a little bit about the difference between batch and online predictions. It seem you are looking for online predictions - so make sure to make requests for those, not to submit jobs.

To use this inside of an application you also need to authenticate. The easiest way to do all that is to look for the documentation of the Cloud ML Java client library.

The steps to successfully implement Cloud ML predictions in your Android app might involve:
- deploy a trained model to Cloud ML (I assume you have this)
- create a service account in the Google Cloud project, give it appropriate Cloud ML rights and download its key
- use this key from within the application to get credentials (following the API Client docs) when the application starts
- make online prediction requests

I haven't seen any super easy to follow examples on doing this end to end just yet but surely they will come at some point. Right now your best bet is probably to go through the documentation.




回答2:


Training your model using the google cloud will be much faster compared to your model training on a laptop(CPU), thus saves lot of time.But you should be able to upload a trained model to the cloud and leverage it by calling it from the Android App.



来源:https://stackoverflow.com/questions/40823051/using-google-cloud-ml-with-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!