Closed Happythinker closed 5 years ago
I have solved this issue, it's very easy, the input value was a dict value feature['x'] when we trained this model,But when we saved this model in serving_input_receiver_fn() function, the input dict value have a different key, "receiver_tensor = {'image': image}",so you must keep the input dict key consistent, Enjoy it!
I have solved this issue, it's very easy, the input value was a dict value feature['x'] when we trained this model,But when we saved this model in serving_input_receiver_fn() function, the input dict value have a different key, "receiver_tensor = {'image': image}",so you must keep the input dict key consistent, Enjoy it!
could you show the code?thanks
INFO:tensorflow:Calling model_fn. Traceback (most recent call last): File "H:/F Disk/cnn/master/landmark.py", line 329, in tf.app.run() File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "H:/F Disk/cnn/master/landmark.py", line 308, in main estimator.export_savedmodel('./save_model', serving_input_receiver_fn) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 650, in export_savedmodel mode=model_fn_lib.ModeKeys.PREDICT) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 703, in _export_saved_model_for_mode strip_default_attrs=strip_default_attrs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 811, in _export_all_saved_models mode=model_fn_lib.ModeKeys.PREDICT) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 879, in _add_meta_graph_for_mode config=self.config) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1107, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "H:/F Disk/cnn/master/landmark.py", line 27, in cnn_model_fn inputs = tf.to_float(features['x'], name="input_to_float") KeyError: 'x'
Process finished with exit code 1
could you tell the details about your changing?
INFO:tensorflow:loss = 1.25362685e-05, step = 131101 (1.324 sec)
INFO:tensorflow:global_step/sec: 75.1802
INFO:tensorflow:loss = 8.772625e-06, step = 131201 (1.330 sec)
INFO:tensorflow:Saving checkpoints for 131250 into ./train/model.ckpt.
INFO:tensorflow:Loss for final step: 1.3543076e-05.
Traceback (most recent call last):
File "landmark.py", line 322, in
In training, I have such a problem. Is there a solution?
This issue should be resolved in the latest commit.
INFO:tensorflow:Calling model_fn. Traceback (most recent call last): File "H:/F Disk/cnn/master/landmark.py", line 329, in
tf.app.run()
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "H:/F Disk/cnn/master/landmark.py", line 308, in main
estimator.export_savedmodel('./save_model', serving_input_receiver_fn)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 650, in export_savedmodel
mode=model_fn_lib.ModeKeys.PREDICT)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 703, in _export_saved_model_for_mode
strip_default_attrs=strip_default_attrs)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 811, in _export_all_saved_models
mode=model_fn_lib.ModeKeys.PREDICT)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 879, in _add_meta_graph_for_mode
config=self.config)
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1107, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "H:/F Disk/cnn/master/landmark.py", line 27, in cnn_model_fn
inputs = tf.to_float(features['x'], name="input_to_float")
KeyError: 'x'
Process finished with exit code 1