Community
cancel
Showing results for 
Search instead for 
Did you mean: 
NPage1
Beginner
83 Views

Trouble Converting YOLOv3 to IE IR

Hello,

I've followed the instructions here to convert YOLOv3: https://software.intel.com/en-us/articles/OpenVINO-Using-TensorFlow

Also, I've referenced this that says to use a positive 1 for input shape: https://richardstechnotes.com/2018/12/01/running-yolov3-with-openvino-on-cpu-and-not-ncs-2/

However, I'm still getting this error (this is my complete console output following all the instructions):

nicholas@neuralone:~/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer$ cd ~/tensorflow-yolo-v3/
nicholas@neuralone:~/tensorflow-yolo-v3$ git checkout ed60b90
Note: checking out 'ed60b90'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at ed60b90... Merge pull request #53 from alexzhangxx/small_change
nicholas@neuralone:~/tensorflow-yolo-v3$ python3 convert_weights_pb.py --class_names coco.names --data_format NHWC --weights_file yolov3.weights

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /home/nicholas/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-03-11 21:52:34.085709: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2712000000 Hz
2019-03-11 21:52:34.086056: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x1856ac00 executing computations on platform Host. Devices:
2019-03-11 21:52:34.086086: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
WARNING:tensorflow:From /home/nicholas/tensorflow-yolo-v3/utils.py:53: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.convert_variables_to_constants
WARNING:tensorflow:From /home/nicholas/.local/lib/python3.5/site-packages/tensorflow/python/framework/graph_util_impl.py:245: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.extract_sub_graph
1186 ops written to frozen_darknet_yolov3_model.pb.
nicholas@neuralone:~/tensorflow-yolo-v3$ cp frozen_darknet_yolov3_model.pb ~/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer
nicholas@neuralone:~/tensorflow-yolo-v3$ cd ~/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer
nicholas@neuralone:~/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer$ python3 mo_tf.py --input_model frozen_darknet_yolov3_model.pb --tensorflow_use_custom_operations_config ./extensions/front/tf/yolo_v3.json --input_shape [1,416,416,3]
Model Optimizer arguments:
Common parameters:
	- Path to the Input Model: 	/home/nicholas/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer/frozen_darknet_yolov3_model.pb
	- Path for generated IR: 	/home/nicholas/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer/.
	- IR output name: 	frozen_darknet_yolov3_model
	- Log level: 	ERROR
	- Batch: 	Not specified, inherited from the model
	- Input layers: 	Not specified, inherited from the model
	- Output layers: 	Not specified, inherited from the model
	- Input shapes: 	[1,416,416,3]
	- Mean values: 	Not specified
	- Scale values: 	Not specified
	- Scale factor: 	Not specified
	- Precision of IR: 	FP32
	- Enable fusing: 	True
	- Enable grouped convolutions fusing: 	True
	- Move mean values to preprocess section: 	False
	- Reverse input channels: 	False
TensorFlow specific parameters:
	- Input model in text protobuf format: 	False
	- Offload unsupported operations: 	False
	- Path to model dump for TensorBoard: 	None
	- List of shared libraries with TensorFlow custom layers implementation: 	None
	- Update the configuration file with input/output node names: 	None
	- Use configuration file used to generate the model with Object Detection API: 	None
	- Operations to offload: 	None
	- Patterns to offload: 	None
	- Use the config file: 	/home/nicholas/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer/./extensions/front/tf/yolo_v3.json
Model Optimizer version: 	1.5.12.49d067a0
[ ERROR ]  List of operations that cannot be converted to IE IR:
[ ERROR ]      LeakyRelu (72)
[ ERROR ]          detector/darknet-53/Conv/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_1/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_2/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_3/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_4/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_5/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_6/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_7/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_8/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_9/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_10/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_11/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_12/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_13/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_14/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_15/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_16/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_17/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_18/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_19/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_20/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_21/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_22/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_23/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_24/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_25/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_26/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_27/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_28/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_29/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_30/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_31/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_32/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_33/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_34/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_35/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_36/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_37/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_38/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_39/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_40/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_41/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_42/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_43/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_44/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_45/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_46/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_47/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_48/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_49/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_50/LeakyRelu
[ ERROR ]          detector/darknet-53/Conv_51/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_1/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_2/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_3/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_4/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_7/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_8/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_9/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_10/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_11/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_12/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_13/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_15/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_16/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_17/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_18/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_19/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_20/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_21/LeakyRelu
[ ERROR ]          detector/yolo-v3/Conv_5/LeakyRelu
[ ERROR ]  Part of the nodes was not translated to IE. Stopped. 
 For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #24. 
nicholas@neuralone:~/intel/computer_vision_sdk_2018.5.455/deployment_tools/model_optimizer$

Can anyone please help me understand what I'm doing wrong here? Is there anything that I'm missing?

0 Kudos
2 Replies
Shubha_R_Intel
Employee
83 Views

Nicholas, please follow the detailed instructions that I posted here for Yolo V3. If you follow these steps, you will be successful.

https://github.com/opencv/dldt/issues/102

Thanks,

Shubha

NPage1
Beginner
83 Views

Hello Shubha,

I have previously found out that the old instructions posted in the official documentation worked here: https://software.intel.com/en-us/articles/OpenVINO-Using-TensorFlow

But only after I downgraded to tensorflow 1.12.0

I temporarily rewound my VM back to before that change to try out the documentation here: https://docs.openvinotoolkit.org/R5/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_YOLO_From_Tensorflow.html

And it does not work. I get this as the output after carefully following the directions:

nicholas@neuralone:~/tensorflow-yolo-v3$ nano demo.py 
nicholas@neuralone:~/tensorflow-yolo-v3$ python3 demo.py --weights_file ./yolov3.weights --class_names ./coco.names --input_img /home/nicholas/intel/computer_vision_sdk_2018.5.455/deployment_tools/demo/car.png --output_img ./out.jpg

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-03-14 19:06:46.777334: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-03-14 19:06:46.802210: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2712000000 Hz
2019-03-14 19:06:46.803013: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x56dc1d0 executing computations on platform Host. Devices:
2019-03-14 19:06:46.803032: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
WARNING:tensorflow:From demo.py:66: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.convert_variables_to_constants
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/graph_util_impl.py:245: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.extract_sub_graph
Traceback (most recent call last):
  File "demo.py", line 80, in <module>
    tf.app.run()
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "demo.py", line 69, in main
    detected_boxes = sess.run(boxes, feed_dict={inputs: [np.array(img_resized, dtype=np.float32)]})
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1128, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 416, 416, 4) for Tensor 'Placeholder:0', which has shape '(?, 416, 416, 3)'
nicholas@neuralone:~/tensorflow-yolo-v3$ 

It would be great to see about getting this to work with tensorflow 1.13.1. Please let me know if you have any input.

Reply