yinguobing / cnn-facial-landmark

Training code for facial landmark detection based on deep convolutional neural network.
MIT License
626 stars 182 forks source link

这个问题怎么解决?很多人都遇到了,求指教 #13

Closed Happythinker closed 5 years ago

Happythinker commented 5 years ago

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

CNruxiangduan commented 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!

JeQer commented 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!

could you show the code?thanks

14211019 commented 5 years ago

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?

wangping1408 commented 5 years ago

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 tf.app.run() File "/home/wp/anaconda3/envs/tensorflow_dc/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "landmark.py", line 302, in main estimator.export_savedmodel('./saved_model', serving_input_receiver_fn) File "/home/wp/anaconda3/envs/tensorflow_dc/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py", line 511, in export_savedmodel config=self.config) File "/home/wp/anaconda3/envs/tensorflow_dc/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py", line 694, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "landmark.py", line 27, in cnn_model_fn inputs = tf.to_float(features['x'], name="input_to_float") KeyError: 'x'

In training, I have such a problem. Is there a solution?

yinguobing commented 5 years ago

This issue should be resolved in the latest commit.