Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using retrain.py to export model for ML Engine #118

Closed
Stroemgren opened this issue Jul 25, 2018 · 2 comments
Closed

Using retrain.py to export model for ML Engine #118

Stroemgren opened this issue Jul 25, 2018 · 2 comments
Labels
hub For all issues related to tf hub library and tf hub tutorials or examples posted by hub team stat:awaiting response subtype:Image Retraining type:support

Comments

@Stroemgren
Copy link

Hi

I've used retrain.py with the --saved_model_dir flag to export a model that I've deployed to ML Engine.
When trying to use it for prediction I get an error saying that it expects to float32 input but receives a string.

{"error": "Prediction failed: Error processing input: Expected float32, got '\\xff\\xd8\\xff\\xe0 ...' of type 'str' instead."}

My request looks like this

{"image": {"b64": "/9j/4AAQxh6AP/2Q== ..."}}

Am I missing something? Is the export method from retrain.py not meant for exporting to ML Engine? Can I modify it to do so?

@vbardiovskyg
Copy link
Contributor

Hi,

the input placeholder for exported graph is specified here: https://github.com/tensorflow/hub/blob/master/examples/image_retraining/retrain.py#L305.

The input will have to be converted to array of float32s unless the export graph is changed to accept string encoded jpeg on input.

@Harshini-Gadige Harshini-Gadige added the hub For all issues related to tf hub library and tf hub tutorials or examples posted by hub team label Mar 14, 2019
@Harshini-Gadige
Copy link

Closing this issue as it has been answered. For further questions, please open a new issue with the latest information. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hub For all issues related to tf hub library and tf hub tutorials or examples posted by hub team stat:awaiting response subtype:Image Retraining type:support
Projects
None yet
Development

No branches or pull requests

3 participants