google-cloud-ml

How do I get a TensorFlow/Keras model that takes images as input to serve predictions on Cloud ML Engine?

℡╲_俬逩灬. 提交于 2019-11-27 09:09:29
There are multiple questions (examples: 1 , 2 , 3 , 4 , 5 , 6 , etc.) trying to address the question of how to handle image data when serving predictions for TensorFlow/Keras models in Cloud ML Engine. Unfortunately, some of the answers are out-of-date and none of them comprehensively addresses the problem. The purpose of this post is to provide a comprehensive, up-to-date answer for future reference. This answer is going to focus on Estimators , which are high-level APIs for writing TensorFlow code and currently the recommended way. In addition, Keras uses Estimators to export models for

Load numpy array in google-cloud-ml job

回眸只為那壹抹淺笑 提交于 2019-11-27 04:43:34
In the model I want to launch, I have some variables which have to be initialized with specific values. I currently store these variables into numpy arrays but I don't know how to adapt my code to make it work on a google-cloud-ml job. Currently I initialize my variable like this: my_variable = variables.model_variable('my_variable', shape=None, dtype=tf.float32, initializer=np.load('datasets/real/my_variable.npy')) Can someone help me ? rhaertel80 First, you'll need to copy/store the data on GCS (using, e.g., gsutil ) and ensure your training script has access to that bucket. The easiest way

Deploying Keras Models via Google Cloud ML

筅森魡賤 提交于 2019-11-27 01:40:27
问题 I am looking to use Google Cloud ML to host my Keras models so that I can call the API and make some predictions. I am running into some issues from the Keras side of things. So far I have been able to build a model using TensorFlow and deploy it on CloudML. In order for this to work I had to make some changes to my basic TF code. The changes are documented here: https://cloud.google.com/ml/docs/how-tos/preparing-models#code_changes I have also been able to train a similar model using Keras.

How convert a jpeg image into json file in Google machine learning

Deadly 提交于 2019-11-26 18:20:46
问题 I'm working on Google cloud ML, and I want to get prediction on jpeg image. To do this, I would like to use: gcloud beta ml predict --instances=INSTANCES --model=MODEL [--version=VERSION] (https://cloud.google.com/ml/reference/commandline/predict) Instances is the path to a json file with all info about image. How can I create the json file from my jpeg image? Many thanks!! 回答1: The first step is to make sure that the graph you export has a placeholder and ops that can accept JPEG data. Note

Deploy retrained inception SavedModel to google cloud ml engine

删除回忆录丶 提交于 2019-11-26 17:18:40
问题 I am trying to deploy a retrained version of the inception model on google cloud ml-engine. Gathering informations from the SavedModel documentation, this reference, and this post of rhaertel80, I exported successfully my retrained model to a SavedModel, uploaded it to a bucket and tried to deploy it to a ml-engine version. This last task actually creates a version, but it outputs this error: Create Version failed. Bad model detected with error: "Error loading the model: Unexpected error when

How to pass base64 encoded image to Tensorflow prediction?

百般思念 提交于 2019-11-26 14:38:19
问题 I have a google-cloud-ml model that I can run prediction by passing a 3 dimensional array of float32... { 'instances' [ { 'input' : '[ [ [ 0.0 ], [ 0.5 ], [ 0.8 ] ] ... ] ]' } ] } However this is not an efficient format to transmit images, so I'd like to pass base64 encoded png or jpeg. This document talks about doing that, but what is not clear is what the entire json object looks like. Does the { 'b64' : 'x0welkja...' } go in place of the '[ [ [ 0.0 ], [ 0.5 ], [ 0.8 ] ] ... ] ]' , leaving

Convert a graph proto (pb/pbtxt) to a SavedModel for use in TensorFlow Serving or Cloud ML Engine

亡梦爱人 提交于 2019-11-26 13:54:58
问题 I've been following the TensorFlow for Poets 2 codelab on a model I've trained, and have created a frozen, quantized graph with embedded weights. It's captured in a single file - say my_quant_graph.pb . Since I can use that graph for inference with the TensorFlow Android inference library just fine, I thought I could do the same with Cloud ML Engine, but it seems it only works on a SavedModel model. How can I simply convert a frozen/quantized graph in a single pb file to use on ML engine? 回答1

Load numpy array in google-cloud-ml job

不打扰是莪最后的温柔 提交于 2019-11-26 11:19:41
问题 In the model I want to launch, I have some variables which have to be initialized with specific values. I currently store these variables into numpy arrays but I don\'t know how to adapt my code to make it work on a google-cloud-ml job. Currently I initialize my variable like this: my_variable = variables.model_variable(\'my_variable\', shape=None, dtype=tf.float32, initializer=np.load(\'datasets/real/my_variable.npy\')) Can someone help me ? 回答1: First, you'll need to copy/store the data on

How do I get a TensorFlow/Keras model that takes images as input to serve predictions on Cloud ML Engine?

99封情书 提交于 2019-11-26 08:23:34
问题 There are multiple questions (examples: 1, 2, 3, 4, 5, 6, etc.) trying to address the question of how to handle image data when serving predictions for TensorFlow/Keras models in Cloud ML Engine. Unfortunately, some of the answers are out-of-date and none of them comprehensively addresses the problem. The purpose of this post is to provide a comprehensive, up-to-date answer for future reference. 回答1: This answer is going to focus on Estimators, which are high-level APIs for writing TensorFlow