在Tensorflow中导出推理图时出现``解析输入...形状不完整''错误 [英] 'Parsing Inputs... Incomplete shape' error while exporting the inference graph in Tensorflow

查看:403
本文介绍了在Tensorflow中导出推理图时出现``解析输入...形状不完整''错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am training a neural network using Tensorflow's object detetction API to detect cars. I used the following sentdex's youtube video to learn and execute the process.

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

他的视频的文字版本:

他的系列的第1至6部分.

Part 1 to 6 of his series.

我的训练数据有〜300张图像测试数据〜20张图像

My training data has ~300 images Test data ~ 20 images

由于我使用的是转移学习的概念,所以我选择了ssd_mobilenet_v1.model.

Since I am using the concept of transfer learning, I chose ssd_mobilenet_v1.model.

Tensorflow版本1.10(在CPU上)Python版本3.6

Tensorflow version 1.10 (on CPU) Python version 3.6

我训练了大约8000步,损失了约1.

I trained till ~ 8000 steps and an loss of ~1.

一切顺利,直到我尝试导出推理图.

Everything runs smoothly till I try to export the inference graph.

我运行以下命令:

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.

然后是此后的模型报告列表. (如果需要,我可以发布)

Then there is a list of model report after this. (I can post it if you want it)

我虽然导出了car_inference_graph文件夹,但其中包含检查点文件等.里面应该有它.

I have the exported car_inference_graph folder though, which has checkpoint files,etc. inside it like it should have.

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

But when I run this model on images of car(test images or new images), it doesn't detect cars. i.e. there is no bounding box!

我不确定此警告是否影响了检测,如果确实如此,请帮助我解决问题!

I am not sure if this warning has affected the detection and if it did, please help me solve it!

谢谢!

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

PS: to help identify the cause of 'no bounding box', it is worth mentioning that it doesn't even show the bounding boxes around the cars in images that the model has been trained with. This means there is something wrong with the export of inference graph or the bounding box function itself.

我刚刚发现".pbtxt"文件的名称是:macncheese,而不是名称:car.碰巧是引起问题的原因吗?

I just found out that '.pbtxt' file had name : macncheese instead of name : car. Did it happen to cause the problem?

推荐答案

加标签期间使用的标签名称和pbtxt条目应完全匹配.在您的情况下,由于名称不同,您将不得不在pbtxt文件中更改名称,然后重新运行培训.

The label name used during labelling and the pbtxt entry should exactly match . In your case as the names are different, you would have to change name in the pbtxt file and re-run the training.

这篇关于在Tensorflow中导出推理图时出现``解析输入...形状不完整''错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆