Object-Detection-API icon indicating copy to clipboard operation
Object-Detection-API copied to clipboard

Unable to convert weights file into tf

Open cat768 opened this issue 5 years ago • 7 comments

my custom weights file is junglecamp0.6.weights, based on yolov3 (not yolov3-tiny) 31 classes

When I run the command " python load_weights.py --weights ./weights/junglecamp0.6.weights --output ./weights/junglecamp0.6.tf " it gives me the following error message:

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

cat768 avatar May 12 '20 20:05 cat768

image

cat768 avatar May 12 '20 20:05 cat768

Here is my cfg file:

junglecamp0.5.txt

(saved it to a txt file instead of cfg because github won't allow me to upload cfg)

cat768 avatar May 12 '20 20:05 cat768

You should provide number of custom classes you have as parameters.

safayildirim avatar May 20 '20 01:05 safayildirim

You should provide number of custom classes you have as parameters.

How do I do that? (I have 31 classes)

cat768 avatar May 21 '20 07:05 cat768

Screen Shot 2020-06-22 at 1 59 21 AM

in the load_weights.py file, change the number of classes from 80 to 31 in your case.

Also make sure to make the changes in app.py and detect.py

Screen Shot 2020-06-22 at 2 19 29 AM Screen Shot 2020-06-22 at 2 19 14 AM

ejri avatar Jun 22 '20 09:06 ejri

I did this, but got the same error...

Object-Detection-API/yolov3_tf2/utils.py", line 68, in load_darknet_weights conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 209204 into shape (512,256,3,3)

Shreyas0812 avatar Jul 14 '20 21:07 Shreyas0812

Screen Shot 2020-06-22 at 1 59 21 AM

in the load_weights.py file, change the number of classes from 80 to 31 in your case.

Also make sure to make the changes in app.py and detect.py

Screen Shot 2020-06-22 at 2 19 29 AM Screen Shot 2020-06-22 at 2 19 14 AM

This works for me! Thank you!

Zwj321123 avatar Feb 11 '21 01:02 Zwj321123