I train the yolov3 model based on darknet with my own dataset. When i convert my yolo.weights to .h5 format, the error is followed:
Traceback (most recent call last):
File "convert.py", line 242, in
_main(parser.parse_args())
File "convert.py", line 140, in _main
buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array
How should i do to solve my problem?
Thanks and Regards.
Make sure .cfg file is consistent with .weights file. It is likely that you forgot to modify the value of num_classes in .cfg file.
I have change the num_class in .cfg file and already obtain the wights file. So i think .cfg file is consistent with .weights file
It seems like the problem about weights header. The original yolov3.weights uses 20 bytes, for the reason that the sum of its training data is type 'int64'. Try discarding only 16 bytes, and see the effect.
Thanks.The problem has solved.
Hello, I have a question: can convert the.h5 file to.weights file?
It seems like the problem about weights header. The original yolov3.weights uses 20 bytes, for the reason that the sum of its training data is type 'int64'. Try discarding only 16 bytes, and see the effect.
hello, I have a question :where to change to 16 ?
Where can I change the weights format?
Thanks.The problem has solved.
Hi, I have met the save problem, I have used the modified convert.py, but still not work:
I use darknet to train 2 classes in yolov3-voc.cfg with darknet53.conv.74 as the weights file, after the training process complete, yolov3-last.weights generated which tested well, then I tried to use the convert.py to convert the yolov3-voc.cfg and the yolov3-last.weights to keras h5 model file, but i got the exeption:
Parsing section convolutional_74
conv2d linear (1, 1, 256, 255)
Traceback (most recent call last):
File ".\myconvert.py", line 241, in
_main(parser.parse_args())
File ".\myconvert.py", line 118, in _main
buffer=weights_file.read(filters * 4))
TypeError: buffer is too small for requested array
then I change the classes to 80, and run convert.py again, but got another exception:
Parsing section convolutional_71
conv2d bn leaky (3, 3, 128, 256)
Traceback (most recent call last):
File ".\myconvert.py", line 241, in
_main(parser.parse_args())
File ".\myconvert.py", line 138, in _main
buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array
can you tell me how you solved the problem?
It seems like the problem about weights header. The original yolov3.weights uses 20 bytes, for the reason that the sum of its training data is type 'int64'. Try discarding only 16 bytes, and see the effect.
@qqwweee
@xiongmao5320 Did you able to convert the model to keras?
Most helpful comment
hello, I have a question :where to change to 16 ?