Giter Club home page Giter Club logo

tf_serving_example's Introduction

TensorFlow Serving test project

The purpose of this project is to test capabilities of the TensorFlow Serving. It should host a GAN model to predict Street View House Numbers.
Mentioned GAN model is trained using semi-supervised learning technique and bases on the model taught at Udacity Deep Learning Foundations course. The original Jupyter Notebook can be found at GitHub.
Additionally I made it possible to export trained model into Protobuf and implemented a client to request the prediction for a number image.
More details on the project can be found at my blog.

tf_serving_example's People

Contributors

vbezgachev avatar zh794390558 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tf_serving_example's Issues

create model for inception model

Hello Vetal1977
In program, svnh_semi_supervised_model_saved.py, at line 71 you create the GAN model. Similarly how can I create an InceptionV3 model Keras model?
I am trying to adapt your code to serve an inception model.

Thanks
Rminer

NotFoundError (see above for traceback): Key Variable not found in checkpoint

Hey,

I got the error while running this running the following command:


WARNING:tensorflow:From /home/gr8-adakron/Adakron_bay/ImageClassification/Datax.ai/datax-api/future_model/29June_serving_research/tf_serving_example/gan.py:94: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See @{tf.nn.softmax_cross_entropy_with_logits_v2}.

2018-06-29 17:15:29.869615: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key Variable not found in checkpoint
Traceback (most recent call last):
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
    return fn(*args)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.NotFoundError: Key Variable not found in checkpoint
	 [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "svnh_semi_supervised_model_saved.py", line 116, in <module>
    tf.app.run()
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "svnh_semi_supervised_model_saved.py", line 75, in main
    saver.restore(sess, ckpt.model_checkpoint_path)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1802, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
    run_metadata_ptr)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
    run_metadata)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key Variable not found in checkpoint
	 [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

Caused by op 'save/RestoreV2', defined at:
  File "svnh_semi_supervised_model_saved.py", line 116, in <module>
    tf.app.run()
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "svnh_semi_supervised_model_saved.py", line 70, in main
    saver = tf.train.Saver()
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1338, in __init__
    self.build()
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1347, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1384, in _build
    build_save=build_save, build_restore=build_restore)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 835, in _build_internal
    restore_sequentially, reshape)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 472, in _AddRestoreOps
    restore_sequentially)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 886, in bulk_restore
    return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1463, in restore_v2
    shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
    op_def=op_def)
  File "/home/gr8-adakron/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

NotFoundError (see above for traceback): Key Variable not found in checkpoint
	 [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]


python svnh_semi_supervised_model_saved.py --checkpoint-dir=./checkpoints --output_dir=./gan-export --model-version=2

These are my checkpoint files

Whats wrong in the saving part? help, please.

Add License to Project

Hi, I know this project was used for your blog post. In there you specifically reference this repo to try out the work flow. Does this repo have a permissive license associated with it, or are you holding all rights?

Generic conv implementation only supports NHWC tensor format for now

Hi,

I want to speed up the time when making tensor_proto, so I followed your sample code in svnh_semi_supervised_client_no_tf.py. While in this case, I got the error message specified in the title. My model is in NCHW format and can work well if input is made using make_tensor_proto. Any thoughts on this situation?

multiple input/output model, slice index error

Hi,
I am trying to serve a complex model with multiple input and multiple output. To test the saved model (pb model), I try to load the model and run an example. But I am facing slice index error. Here is the information about my model:
Bildschirmfoto 2019-06-01 um 12 35 49

And here my code to load and run the mode:
Bildschirmfoto 2019-06-01 um 12 38 02

And here the slice index error:
Bildschirmfoto 2019-06-01 um 12 41 59

I hope you can help me!

best Regards

python client run failed

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:)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.