Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6413 Discussions

Recommended method for converting customized yolov3-tiny to OpenVino


I have problem in converting customized yolov3-tiny model to OpenVino model.

I have custom trained YoloV3-tiny.weights file. And it works on darknet platform.

I have succeeded in converting original both of yolov3.weights and yolov3-tiny.weights using  'smart-video-workshop/object-detection/tensorflow-yolo-v3'

And converted OpenVino model works.


However I have not succeeded in converting  custom trained YoloV3-tiny.weights file to OpenVino model.

The number of classes is different from yolov3-tiny.cfg.

I know that I have to use customized json file from  yolo_v3_tiny.json.

Does anybody knows how to convert customized yolov3-tiny model?

I have found some Github repositories converting YoloV3 models, but I could not complete model conversion.

Please let me know

Recommended method for converting customized yolov3-tiny to OpenVino .


I am waiting your reply



$ cat 

export MO_ROOT=/opt/intel/openvino/deployment_tools/model_optimizer
export DARKNET_ROOT=darknet_model
export MODELNAME=yolov3-tiny-grayscale-6classes

python3 --class_names ${DARKNET_ROOT}/6classes.names --data_format NHWC --weights_file ${DARKNET_ROOT}/yolov3-tiny-grayscale-6classes.weights --tiny --output_graph ${MODELNAME}_model.pb

python3 $MO_ROOT/ --input_model ${MODELNAME}_model.pb --tensorflow_use_custom_operations_config my_yolo_v3_tiny.json --batch 1

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From /home/someone/.venv/lib/python3.7/site-packages/tensorflow/python/framework/ 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.
Traceback (most recent call last):
  File "", line 52, in <module>
  File "/home/someone/.venv/lib/python3.7/site-packages/tensorflow/python/platform/", line 125, in run
  File "", line 42, in main
    load_ops = load_weights(tf.global_variables(scope='detector'), FLAGS.weights_file)
  File "/media/someone/ExtremeSSD/gx-front-camera/yolov3-tiny-openvino/", line 115, in load_weights
    (shape[3], shape[2], shape[0], shape[1]))
ValueError: cannot reshape array of size 8160 into shape (33,256,1,1)

This is the first error in converting using 'smart-video-workshop/object-detection/tensorflow-yolo-v3' information.


I need your help.







0 Kudos
3 Replies

Dear Waragai, Katsunori,

As long as you haven't changed the structure  of a tiny yolo v3 model, then OpenVino (both Model Optimizer and Inference Engine) should not have any issues.

I assume you have carefully followed the steps outlined in the Model Optimizer Yolo Doc.

If the only thing you did was custom-trained the model, then you should not have errors with Model Optimizer.

If you do still have errors however, this could be a bug.

Please attach your custom-trained tiny yolo v3 pb to this post as a *.zip and I will take a look.

Thanks !



0 Kudos

Thank you for your information.

I succeeded in converting gray-scale yolo v3 tiny model.


The only modification is 

<     inputs = tf.placeholder(tf.float32, [None, FLAGS.size, FLAGS.size, 3], "inputs")
>     inputs = tf.placeholder(tf.float32, [None, FLAGS.size, FLAGS.size, 1], "inputs") # for gray scale







0 Kudos

Dear Waragai, Katsunori,

Congratulations ! And thank you kindly for sharing your knowledge with the OpenVino community !



0 Kudos