tensorflow / tensorflow/models
Problem with Inference/Exporting Graph: ValueError Attempted to map inputs that were not found in grah_def[image_tensor:0]
@pkulzc is already working on this.
Since Jun 25, 2020.
- Dominant language
- Python
- Stars
- 77.7k
- Forks
- 44.8k
- PR merge metrics
- No merged PRs in 30d
Description
System information
- What is the top-level directory of the model you are using: /tensorflow/models/research/object_detection/
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): 16.04
-Have I written custom code: Yes (to create tfrecord files, see above) - TensorFlow installed from (source or binary): N/A
- TensorFlow version (use command below): 1.12-.0-rc2
- Bazel version (if compiling from source): N/A
- CUDA/cuDNN version: 10.0
- GPU model and memory: GeForce GTX 980 Ti
- Exact command to reproduce: see below
Error Description
I created a custom tfrecord file for the object detection task and fine-tuned a pre-trained Kitti Resnet101 Faster RCNN network with "my" data. I exported the graph by using the following code:
python object_detection/export_inference_graph.py \
--input_type=tf_record \
--pipeline_config_path= {Path_to_Config_File_Used_In_Training} \
--trained_checkpoint_prefix={Path_To_CKPT_FIle} \
--output_directory=${Export_Directory}
The Model Analysis Reports starts with
Incomplete Shape followed by a large list of output statements.
I executed the inference with following command:
python -m object_detection/inference/infer_detections \
--input_tfrecord_paths={Path_To_TfRecord_File} \
--output_tfrecord_path={Path_To_Output_TfRecord_File}.tfrecord-00000-of-00001 \
--inference_graph={Path_To_Exported_Directory_See_Above}/frozen_inference_graph.pb \
--discard_image_pixels
However, I got the following error code:
Traceback (most recent call last):
File "infer_detections.py", line 96, in <module>
tf.app.run()
File "/home/user/.local/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "infer_detections.py", line 74, in main
image_tensor, FLAGS.inference_graph)
File "/home/user/tensorflow/models/research/object_detection/inference/detection_inference.py", line 74, in build_inference_graph
graph_def, name='', input_map={'image_tensor': image_tensor})
File "/home/user/.local/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/user/.local/lib/python3.5/site-packages/tensorflow/python/framework/importer.py", line 455, in import_graph_def
', '.join(missing_unused_input_keys))
ValueError: Attempted to map inputs that were not found in graph_def: [image_tensor:0]
I am struggling with this error for some days and do not know what is wrong. Does anybody know why this error appear? I only work with tfrecord data.
I appreciate every hint/remark/solution.
Thanks a lot in advance.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.