theAIGuysCode / yolov3_deepsort

Object tracking implemented with YOLOv3, Deep Sort and Tensorflow.
GNU General Public License v3.0
337 stars 183 forks source link

error while loading custom yolov3 weights #26

Open shiragit opened 3 years ago

shiragit commented 3 years ago

got this error while trying to load weights from a custom yolov3 model:

  File "/home/tes/workspace/yolov3_deepsort/yolov3_tf2/utils.py", line 70, in load_darknet_weights
    conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 19880 into shape (512,256,3,3)
robisen1 commented 3 years ago

are you using the same labels file as the one you trained with?

shiragit commented 3 years ago

Yes, I've replaced the .names file on data/labels

This is the command I've used: python load_weights.py --weights /yolov3_deepsort/weights/tes-slimyolo_best.weights --output ./weights/yolov3-custom.tf --num_classes 10

My custom weights were trained by darknet yolo-v3.

robisen1 commented 3 years ago

So you are using the coco labels not your own? It looks like you are not. is your model build from scratch meaning your not using the yolo.weights? i see this issue mostly with people trying to load models that they made with transfer learning using yolo.weights. and then trying to load a custom set of labels. Also, could you share your full error message?

jessiffmm commented 2 years ago

I have the same problem. I execute: python3 load_weights.py --weights ./weights/yolov3-voc_custom.weights --output ./weights/yolov3-custom.tf --num_classes 8

But I got the following error: bn_weights = bn_weights.reshape((4, filters))[[1, 0, 2, 3]] ValueError: cannot reshape array of size 28 into shape (4,32)

Is there a solution?