tf2-yolov4
tf2-yolov4 copied to clipboard
Cannot convert custom darknet .weights to .h5, AssertionError
I try to convert my custom darknet .weights to .h5 but i got error 'AssertionError'
this is my command :
!convert-darknet-weights ./yolov4-digits-digital_best.weights -o yolov4-digits_digital_best.h5 -n 11
and this is the error :
Hopefully the PR above is merged but in the mean time I found that the AssertionError is caused by the --n_classes (-n)
arg being used in two places. The first to convert the original yolov4.weights to .h5 which requires -n=80
and the second for the custom model which will be -n=N_CUSTOM_CLASSES
By the running the program twice, once for each N, you can get generate the required weights. Just note that when you run with n=80
the first time you raise a ValueError of ValueError: cannot reshape array of size 4559937 into shape (1024,512,3,3)
Just ignore this and run again with the correct -n
for your custom weights.