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.
6503 Discussions

Error in converting Yolov3_mobilenet model to IR

yu__jia
Beginner
852 Views

Hello everyone, 

When I used Yolo3+mobileNet,after training I got yolov3_mobilenet.weights. I am trying to convert those weights to tensorflow using this command

python convert_weights_pb.py --class_names myData.names --data_format NHWC --weights_file my_mobile_yolov3-tiny_100.weights 

But I am getting this error

Traceback (most recent call last):
  File "convert_weights_pb.py", line 56, in <module>
    tf.app.run()
  File "C:\Users\86178\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\platform\app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\86178\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 300, in run
    _run_main(main, args)
  File "C:\Users\86178\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "convert_weights_pb.py", line 46, in main
    load_ops = load_weights(tf.global_variables(scope='detector'), FLAGS.weights_file)
  File "E:\my_darknet_IR\utils.py", line 115, in load_weights
    (shape[3], shape[2], shape[0], shape[1]))
ValueError: cannot reshape array of size 4665440 into shape (1024,512,3,3)

Any help will be appreciated

Regards

Yujia

 

0 Kudos
3 Replies
Shubha_R_Intel
Employee
852 Views

Dear yu, jia,

May I know where you are getting this Yolo3+mobileNet model ? The Model Optimizer Yolo Documentation was written with https://github.com/mystic123/tensorflow-yolo-v3 in mind so I don't expect it would work with some other model without modifications. Can you kindly provide more details ?

Thanks,

Shubha

 

0 Kudos
yu__jia
Beginner
852 Views

Dear Shubha,

My own network modified on the basis of tiny_yolov3, the following attachment is my .weights file, I use the following command to convert the .weights file to .pb

Please help me to see how to solve it. If you need a network structure and other documents, can you send it to you privately?

Thanks,

Yujia

0 Kudos
Shubha_R_Intel
Employee
852 Views

Dear yu, jia,

May I ask why you wouldn't use the validated and supported yolo V3 that is recommended by the OpenVino team ? Unfortunately I cannot help you with  convert_weights_pb.py (unless it's really simple and obvious) since that's not an OpenVino tool.  This forum is dedicated to  OpenVino, namely Model Optimizer and Inference Engine. This mystic123 issue seems rather similar to yours. Maybe it will help you.

Thanks,

Shubha

0 Kudos
Reply