0

While i am working with open vino to convert .pb file into inference format using model optimizer, i am continuously facing "graph contains a cycle error". And we have used TensorFlow Object Detection Models and SSD Inception V2 to generate .pb file.

[ 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/intel/computer_vision_sdk_2018.1.265/deployment_tools/model_optimizer/mo/main.py", line 222, in main
    return driver(argv)
  File "/opt/intel/computer_vision_sdk_2018.1.265/deployment_tools/model_optimizer/mo/main.py", line 190, in driver
    mean_scale_values=mean_scale)
  File "/opt/intel/computer_vision_sdk_2018.1.265/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 141, in tf2nx
    partial_infer(graph)
  File "/opt/intel/computer_vision_sdk_2018.1.265/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 55, in partial_infer
    nodes = nx.topological_sort(graph)
  File "/opt/intel/computer_vision_sdk_2018.1.265/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 ]  -------------------------------------------------
mahinlma
  • 1,208
  • 3
  • 11
  • 24

2 Answers2

0

I am not familiar with model optimizer, but having cycles in TensorFlow graphs is totally normal. If you model has a tf.while_loop somewhere, its graph will have a cycle. My guess is that model_optimizer folks do not handle such models.

iga
  • 3,571
  • 1
  • 12
  • 22
0

Execute the command with the following argument:

python3 mo_tf.py --input_model <MODEL_PATH> --tensorflow_use_custom_operations_config <OPENVINO_DIR>/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support.json

Then OpenVINO will successfully convert your model. Check out this link for more info

Rachit Tayal
  • 1,190
  • 14
  • 20