在Tensorflow中导出推理图时,“解析输入...不完整的形状”错误

问题描述 投票:2回答:2

我正在使用Tensorflow的物体检测API训练神经网络来检测汽车。我使用以下sentdex youtube视频来学习和执行该过程。

https://www.youtube.com/watch?v=srPndLNMMpk&t=65s

还有他的视频的文字版本:

https://pythonprogramming.net/testing-custom-object-detector-tensorflow-object-detection-api-tutorial/?completed=/training-custom-objects-tensorflow-object-detection-api-tutorial/

他系列的第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.

然后在此之后有一个模型报告列表。 (如果你愿意,我可以发布)

我有导出的create_inference_graph文件夹,其中包含检查点文件等。在里面它应该有它。

但是当我在汽车图像(测试图像或新图像)上运行此模型时,它不会检测到汽车。即没有边界框!

我不确定这个警告是否影响了检测,如果有,请帮我解决!

谢谢!

PS:为了帮助确定“无边界框”的原因,值得一提的是,它甚至没有显示模型已经训练过的图像中汽车周围的边界框。这意味着推理图或边界框函数本身的导出有问题。

我刚发现“.pbtxt”文件的名称为:macncheese而不是name:car。它是否恰巧导致了这个问题?

tensorflow machine-learning neural-network object-detection object-detection-api
2个回答
1
投票

标签期间使用的标签名称和pbtxt条目应完全匹配。在您的情况下,由于名称不同,您必须更改pbtxt文件中的名称并重新运行培训。


0
投票

有趣的是,如果你修复了这个 - 我遵循相同的教程,并认为我有完全相同的问题。

只有我有正确的pbtxt文件。我对于造成这种情况的原因缺乏想法,我接下来的步骤将是尝试不同的模型,并且可能会移出旧文件夹。

© www.soinside.com 2019 - 2024. All rights reserved.