PartialResidualNetworks icon indicating copy to clipboard operation
PartialResidualNetworks copied to clipboard

How to convert yolov3-tiny-prn weights into tensorflow?

Open srikar242 opened this issue 4 years ago • 3 comments

Hi @WongKinYiu , Thanks for your great work. I have trained yolov3-tiny prn model on my custom objects using darknet source. Now how to convert this into tensorflow .pb file? Can I use the same conversion which is used for yolov3 tiny model? If any changes are to be made,could you mention them. I didnt find any repo which converts prn tiny yolov3 model into tensorflow.

srikar242 avatar Sep 22 '20 12:09 srikar242

Hello, There are no different type of layer of yolov3-tiny and yolov3-tiny-prn. If you can convert yolov3-tiny to tensorflow, just use same way to convert the weights of yolov3-tiny-prn.

WongKinYiu avatar Sep 22 '20 14:09 WongKinYiu

Okay.Thanks. I will try that.

srikar242 avatar Sep 23 '20 12:09 srikar242

Hello @WongKinYiu I am trying to convert my custom trained yolov3-tiny-prn darknet weights into tensorflow. I am using the same method to convert like yolov3-tiny as suggested by you. But while converting, I am getting the following error:

Traceback (most recent call last):
  File "save_model.py", line 58, in <module>
    app.run(main)
  File "/home/srikar/anaconda3/envs/yolo/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/srikar/anaconda3/envs/yolo/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "save_model.py", line 54, in main
    save_tf()
  File "save_model.py", line 49, in save_tf
    utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny)
  File "/home/srikar/Downloads/tensorflow-yolov4-tflite-master/core/utils.py", line 63, in load_weights
    conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 3285758 into shape (1024,512,3,3)

Yours thoughts on this?

I am following this repo to convert: https://github.com/hunglc007/tensorflow-yolov4-tflite Using this repo, I was able to convert other models. As far as input and output are considered, they are alright.

srikar242 avatar Oct 05 '20 14:10 srikar242