vbezgachev / tf_serving_example

Deployment of TensorFlow models into production with TensorFlow Serving, Docker, Kubernetes and Microsoft Azure
211 stars 94 forks source link

python client run failed #7

Open MaybeShewill-CV opened 5 years ago

MaybeShewill-CV commented 5 years ago

I have not built the docker from source tensorflow. I have pulled a image from docker hub supplied by tensorflow. Here is some information of my local env: Docker version: 18.09.3 Nvidia Docker version: 2.0.3 Os: linux ubuntu 16/04 LTS Image: tensorflow/serving:1.12.0-devel-gpu local tensorflow version 1.12.0 gpu cudnn version: cudnn 9.0 python version: 3.5.2 python grpc version: 1.19.0

The tensorflow_moedl_server run normally as I can tell server

But when I run the python client from https://github.com/Vetal1977/tf_serving_example/blob/master/svnh_semi_supervised_client.py, I got following error bug I have tried to change the host ip to 0.0.0.0 and localhost but nothing changed. Could you please help me with it:)

vbezgachev commented 5 years ago

Strange... What does docker network inspect bridge | grep IPv4Address tell? And how did you run the Docker container? Probably, you need to run it with port publishing: docker run --runtime=nvidia --name=tf_container_gpu -it -p 9000:9000 $USER/tensorflow-serving-devel-gpu

MaybeShewill-CV commented 5 years ago

@Vetal1977 It is very strange that if I close the vpn connect the server-client works file but will fail if I reconnect the vpn.

vbezgachev commented 5 years ago

VPN could definitely be a reason - I encountered problems when I was using Cisco AnyConnect. Out of curiosity, which VPN client are you using?

MaybeShewill-CV commented 5 years ago

@Vetal1977 Oops I use Cisco Anyconnect. I wonder if it will influence with the ip or such thing. I'm not that familiar with network.....==!

Rajamohanreddyai commented 5 years ago

Hi Vital, please help me out to get the solution ASAP.

here i am also getting the same error

Traceback (most recent call last): File “client.py”, line 39, in tf.contrib.util.make_tensor_proto({FLAGS.image})) File “/home/john/.local/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py”, line 562, in make_tensor_proto “supported type.” % (type(values), values)) TypeError: Failed to convert object of type <type ‘set’> to Tensor. Contents: set([‘./test/test1.jpg’]). Consider casting elements to a supported type.

after that i was replaced with

tf.make_tensor_proto(scipy.misc.imread(FLAGS.image), shape=[1] + list(img.shape)))

now again am getting below error, please help me how to resolve the error??

/home/john/.local/lib/python2.7/site-packages/tensorflow_serving/apis/prediction_service_pb2.py:131: DeprecationWarning: beta_create_PredictionService_stub() method is deprecated. This method will be removed in near future versions of TF Serving. Please switch to GA gRPC API in prediction_service_pb2_grpc. ‘prediction_service_pb2_grpc.’, DeprecationWarning) Traceback (most recent call last): File “client.py”, line 40, in tf.make_tensor_proto(scipy.misc.imread(FLAGS.image), shape=[1] + list(img.shape))) NameError: name ‘img’ is not defined

Thank you

Rajamohanreddyai commented 5 years ago

@MaybeShewill-CV may i know the bazel version here????

vbezgachev commented 5 years ago

Hi @Rajamohanreddyai

First question - what does the server expect as an input image? Array, JPEG, something else? Suppose, the server expects an image as a float array then the call could be

img = scipy.misc.imread(FLAGS.image)
tf.make_tensor_proto(img, shape=[1, img[0].shape])