Facing "Graph contains a cycle" error while using TensorFlow Object Detection Models

Viewed 893

I am using SSD Inception V2 to generate The .pb file, and Inturn using Open Vinos Model Optimizer for Converting TensorFlow Object Detection API Models for better Inference results. Facing the below issue in Stack Trace:

[ 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 Answers

We will get this errror if you have used tensoflow version <1.6 .

Please refer to the below documentation page on the same error

Doc path:

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

In order to fix this issue, it is necessary to specify output nodes of the graph manually using the --output command line parameter.

Command to convert:

Example Model Optimizer Command-Line for TensorFlow* SSD The final command line to convert SSDs from the TensorFlow Object Detection API Zoo is:

./mo_tf.py --input_model="path_to_frozen.pb" --tensorflow_use_custom_operations_config extensions/front/tf/legacy_ssd_support.json --output="detection_boxes,detection_scores,num_detections"

Thanks, Rajeswari Ponnuru.

Related