使用TensorFlow对象检测模型时遇到“图形包含循环”错误

时间:2018-09-07 07:27:52

标签: python-3.x tensorflow

我正在使用SSD Inception V2生成.pb文件,然后使用 打开Vinos模型优化器以转换TensorFlow对象检测API模型以获得更好的推理结果。在堆栈跟踪中面临以下问题:

[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  Graph contains a cycle.
[ ERROR ]  Traceback (most recent call last):
File "/opt/ryme/computer_vision_sdk_2018.0.011/deployment_tools /model_optimizer/mo/main.py", line 222, in main
return driver(argv)
File "/opt/ryme/computer_vision_sdk_2018.0.011/deployment_tools/model_optimizer/mo/main.py", line 190, in driver
mean_scale_values=mean_scale)
File "/opt/ryme/computer_vision_sdk_2018.0.011/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 141, in tf2nx
partial_infer(graph)
File "/opt/ryme/computer_vision_sdk_2018.0.011/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 55, in partial_infer
nodes = nx.topological_sort(graph)
File "/opt/ryme/computer_vision_sdk_2018.0.011/deployment_tools/model_optimizer/venv/lib64/python3.5/site-packages/networkx/algorithms/dag.py", line 157, in topological_sort
raise nx.NetworkXUnfeasible("Graph contains a cycle.")
networkx.exception.NetworkXUnfeasible: Graph contains a cycle.

[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------

1 个答案:

答案 0 :(得分:4)

如果您使用过Tensoflow版本<1.6,我们将得到此错误。

关于同一错误,请参考以下文档页面

文档路径:

computer_vision_sdk_2018./deployment_tools/documentation/docs/TensorFlowObjectDetectionSSD.html

为了解决此问题,必须使用--output命令行参数手动指定图的输出节点。

要转换的命令:

用于TensorFlow * SSD的示例模型优化器命令行 从TensorFlow Object Detection API Zoo转换SSD的最终命令行是:

./ mo_tf.py --input_model =“ path_to_frozen.pb” -tensorflow_use_custom_operations_config扩展/front/tf/legacy_ssd_support.json --output =“ detection_boxes,detection_scores,num_detections”

谢谢, 拉杰斯瓦里·蓬努鲁(Rajeswari Ponnuru)。