【发布时间】:2018-08-24 10:13:09
【问题描述】:
我正在使用 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.
然后是模型报告列表。 (你要的话我可以发)
我有导出的 car_inference_graph 文件夹,其中包含检查点文件等。里面应该有的样子。
但是当我在汽车图像(测试图像或新图像)上运行此模型时,它不会检测到汽车。即没有边界框!
我不确定这个警告是否影响了检测,如果有,请帮我解决!
谢谢!
PS:为了帮助确定“无边界框”的原因,值得一提的是,它甚至没有在模型训练过的图像中显示汽车周围的边界框。这意味着推理图的导出或边界框函数本身存在问题。
我刚刚发现“.pbtxt”文件的名称是:macncheese,而不是名称:car。是不是碰巧导致了这个问题?
【问题讨论】:
-
标注时使用的标签名称和pbtxt条目要完全匹配。在您的情况下,由于名称不同,您必须更改 pbtxt 文件中的名称并重新运行培训。
-
@Srinivas Bringu 是的,我在标签和 pbtxt 文件中都放入了“汽车”,而关于警告(我的问题的标题),我只是忽略了它们。它检测汽车!瞧!但很明显,当我只用 300 张图像进行训练时,它有时无法检测到汽车,但我现在将使用基于 GPU 的系统进行训练,并使用更多图像进行训练以提高准确性。非常感谢:)
-
移动了上面的评论来回答,因为它解决了问题
标签: tensorflow machine-learning neural-network object-detection object-detection-api