kdev
kdev

Reputation: 53

Tensorflow Serving Client / Base64 Issue / Error 3

I'd like to get the following model up and running on Tensorflow Serving:

https://github.com/mdietrichstein/tensorflow-open_nsfw

I've exported the model using this code: https://github.com/mdietrichstein/tensorflow-open_nsfw/blob/master/tools/export_model.py

But I'm getting the following error when trying to compute a result using a node.js client:

{ code: 3, 
  details: 'Invalid character found in base64.\n\t 
  [[Node: map/while/DecodeBase64 = DecodeBase64[_output_shapes=[[]],
  _device="/job:localhost/replica:0/task:0/cpu:0"](map/while/TensorArrayReadV3)]]',
  metadata: Metadata {
   _ internal_repr: {}
  }
}

The code for my client configured with the test server address can be found here:

https://github.com/delta9/tensorflow-serving-node-client

Did anyone face similar issues and if so, how did you solve it?

Many thanks

Upvotes: 2

Views: 449

Answers (1)

JavaFresher
JavaFresher

Reputation: 91

You should use web safe base64 encode. base64.urlsafe_b64encode(open('test.jpg', 'rb').read()) Because tensorflow.decode_base64 uses WEB-SAFE model to decode base64 encoding. The official document for tensorflow.decode_base64 is:

Decode web-safe base64-encoded strings. Input may or may not have padding at the end. See EncodeBase64 for padding. Web-safe means that input must use - and _ instead of + and /.

Upvotes: 3

Related Questions