'Parsing Inputs... Incomplete shape' 在 Tensorflow 中导出推理图时出错
'Parsing Inputs... Incomplete shape' error while exporting the inference graph in Tensorflow
我正在使用 Tensorflow 的对象检测 API 训练神经网络来检测汽车。我使用以下 senddex 的 youtube 视频来学习和执行该过程。
https://www.youtube.com/watch?v=srPndLNMMpk&t=65s
还有他视频的文字版:
他的系列的第 1 到 6 部分。
我的训练数据有 ~300 张图片测试数据~20 张图片
由于我使用的是迁移学习的概念,所以我选择了ssd_mobilenet_v1.model。
Tensorflow 版本 1.10(在 CPU)Python 版本 3.6
我训练了 ~ 8000 步,损失了 ~1。
一切都运行很顺利,直到我尝试导出推理图。
我运行以下命令:
python3 export_inference_graph.py \
--input_type image_tensor \
--pipeline_config_path training/ssd_mobilenet_v1_pets.config \
--trained_checkpoint_prefix training/model.ckpt-7882 \
--output_directory car_inference_graph
执行此命令后,我得到
警告:
WARNING:tensorflow:From
/home/mydir/Desktop/models/research/object_detection/exporter.py:280:
get_or_create_global_step (from
tensorflow.contrib.framework.python.ops.variables) is deprecated and will be
removed in a future version.
Instructions for updating:
Please switch to tf.train.get_or_create_global_step
WARNING:tensorflow:From
/home/mydir/Desktop/models/research/object_detection/exporter.py:434:
print_model_analysis (from tensorflow.contrib.tfprof.model_analyzer) is
deprecated and will be removed after 2018-01-01.
Instructions for updating:
Use `tf.profiler.profile(graph, run_meta, op_log, cmd, options)`. Build
`options` with `tf.profiler.ProfileOptionBuilder`. See README.md for details
106 ops no flops stats due to incomplete shapes.
Parsing Inputs...
Incomplete shape.
然后是模型报告列表。 (你要的话我可以post)
不过我有导出的 car_inference_graph 文件夹,其中有检查点文件等。里面应该有。
但是当我 运行 这个模型在汽车图像(测试图像或新图像)上时,它没有检测到汽车。即没有边界框!
我不确定这个警告是否影响了检测,如果影响了,请帮我解决!
谢谢!
PS:为了帮助确定 'no bounding box' 的原因,值得一提的是,它甚至没有在训练模型的图像中显示汽车周围的边界框。这意味着推理图或边界框函数本身的导出有问题。
我刚刚发现“.pbtxt”文件的名称为:macncheese 而不是名称:car。是否恰好导致了问题?
很高兴看看您是否解决了这个问题 - 我遵循了相同的教程并认为我遇到了完全相同的问题。
只有我有正确的 pbtxt 文件。我不知道是什么原因造成的,我的下一步将是尝试不同的模型,也许会移出旧文件夹。
标记时使用的标签名称和 pbtxt 条目应完全匹配。在您的情况下,由于名称不同,您必须更改 pbtxt 文件中的名称并重新 运行 培训。
我正在使用 Tensorflow 的对象检测 API 训练神经网络来检测汽车。我使用以下 senddex 的 youtube 视频来学习和执行该过程。
https://www.youtube.com/watch?v=srPndLNMMpk&t=65s
还有他视频的文字版:
他的系列的第 1 到 6 部分。
我的训练数据有 ~300 张图片测试数据~20 张图片
由于我使用的是迁移学习的概念,所以我选择了ssd_mobilenet_v1.model。
Tensorflow 版本 1.10(在 CPU)Python 版本 3.6
我训练了 ~ 8000 步,损失了 ~1。
一切都运行很顺利,直到我尝试导出推理图。
我运行以下命令:
python3 export_inference_graph.py \
--input_type image_tensor \
--pipeline_config_path training/ssd_mobilenet_v1_pets.config \
--trained_checkpoint_prefix training/model.ckpt-7882 \
--output_directory car_inference_graph
执行此命令后,我得到
警告:
WARNING:tensorflow:From
/home/mydir/Desktop/models/research/object_detection/exporter.py:280:
get_or_create_global_step (from
tensorflow.contrib.framework.python.ops.variables) is deprecated and will be
removed in a future version.
Instructions for updating:
Please switch to tf.train.get_or_create_global_step
WARNING:tensorflow:From
/home/mydir/Desktop/models/research/object_detection/exporter.py:434:
print_model_analysis (from tensorflow.contrib.tfprof.model_analyzer) is
deprecated and will be removed after 2018-01-01.
Instructions for updating:
Use `tf.profiler.profile(graph, run_meta, op_log, cmd, options)`. Build
`options` with `tf.profiler.ProfileOptionBuilder`. See README.md for details
106 ops no flops stats due to incomplete shapes.
Parsing Inputs...
Incomplete shape.
然后是模型报告列表。 (你要的话我可以post)
不过我有导出的 car_inference_graph 文件夹,其中有检查点文件等。里面应该有。
但是当我 运行 这个模型在汽车图像(测试图像或新图像)上时,它没有检测到汽车。即没有边界框!
我不确定这个警告是否影响了检测,如果影响了,请帮我解决!
谢谢!
PS:为了帮助确定 'no bounding box' 的原因,值得一提的是,它甚至没有在训练模型的图像中显示汽车周围的边界框。这意味着推理图或边界框函数本身的导出有问题。
我刚刚发现“.pbtxt”文件的名称为:macncheese 而不是名称:car。是否恰好导致了问题?
很高兴看看您是否解决了这个问题 - 我遵循了相同的教程并认为我遇到了完全相同的问题。
只有我有正确的 pbtxt 文件。我不知道是什么原因造成的,我的下一步将是尝试不同的模型,也许会移出旧文件夹。
标记时使用的标签名称和 pbtxt 条目应完全匹配。在您的情况下,由于名称不同,您必须更改 pbtxt 文件中的名称并重新 运行 培训。