Reshape error when convert_weights of Yolov3 to .pb format

asked 2020-04-14 02:47:59 -0600

I have custom trained a Yolo v3 model with 2 classes and it is working great. I then tried to use OpenVINO tool convert_weights_pb to convert the YoLo v3 model to a .pb file, but got this error: ValueError: cannot reshape array of size 283925 into shape (256,128,3,3)

What should I do to avoid this error? Can I train the YOLOv3 model with a different configuration, so it be more like the COCO trained model with yolov3/weights that I can convert succesful with convert_weights_pb.py

Or what else can I do to solve this error? please advise, thanks

JadeDragon

(venv) plp@pihlungs-laptop:~/Documents/code/asl_cust_pt_demo$ python3 convert_weights_pb.py --class_names classes.names --data_format NHWC --weights_file asl_2class_1800.weights

Traceback (most recent call last):

File "convert_weights_pb.py", line 56, in <module>

tf.app.run()

File "/home/plp/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run

_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)

File "/home/plp/.local/lib/python3.6/site-packages/absl/app.py", line 299, in run

_run_main(main, args)

File "/home/plp/.local/lib/python3.6/site-packages/absl/app.py", line 250, 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 "/home/plp/Documents/code/asl_cust_pt_demo/utils.py", line 115, in load_weights

(shape[3], shape[2], shape[0], shape[1]))

ValueError: cannot reshape array of size 283925 into shape (256,128,3,3)

edit retag flag offensive close merge delete