caffe-yolo icon indicating copy to clipboard operation
caffe-yolo copied to clipboard

conversion error

Open yexiguafuqihao opened this issue 8 years ago • 6 comments

it's nice to import your excellent project, but have you ever meet this error when you convert yolo model to caffemodel? Traceback (most recent call last): File "create_yolo_caffemodel.py", line 76, in main(sys.argv[1:]) File "create_yolo_caffemodel.py", line 70, in main net.params[pr][0].data[...] = np.reshape(netWeights[count:count+weightSize], dims) File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 218, in reshape return reshape(newshape, order=order) ValueError: total size of new array must be unchanged

yexiguafuqihao avatar Sep 19 '16 13:09 yexiguafuqihao

Hi, Are you trying to convert your own yolo models to caffemodels? If yes, you should make sure the configuration in your caffe prototxt file matches the one in .cfg file in yolo. Otherwise, the weight size won't match.

Edit: One thing that should be paid attention to is that you should set the value of pad to be half of the filter size (round down) for CONV layers in caffe prototxt file, but not the one in the (.cfg) files

xingwangsfu avatar Sep 22 '16 21:09 xingwangsfu

@yexiguafuqihao I met the problem too, it probably because that your prototxt and .weights don't match. Please notice that the yolo tiny prototxt provided by this repository is not same as the lastest yolo tiny cfg from darknet repository.

stormkingz avatar Sep 26 '16 02:09 stormkingz

@stormkingz I met the same error as you mentioned above. I wonder how you solve the issue. Change the yolo tiny prototxt or the lastest yolo tiny cfg? And how? Thanks soooooo much.

Soledad89 avatar Nov 08 '16 11:11 Soledad89

@Soledad89 Sorry, I don't have the yolo tiny model data that matches with the prototxt of this repo, and Darknet homepage also don't provide the history model. Old model don't have batchnorm in convolution layer, but the latest yolo model has batchnorm. I have tried to convert from latest yolo tiny model to caffe model, but after conversion, I found the result is likely not correct. I also have confusion about this now.

stormkingz avatar Nov 10 '16 03:11 stormkingz

Are there any updates on this issue? Now Batchnorm is supported, but this should not have been a problem at the first place, because Batchnorm-Layer do not hold any weights. They are only used in training, and not used for deployment. However, I still ran into this problem when using yolov1 and the provided weight files from the darknet home page - and all for yolov1 - sadly, this error still occurs.

kevinkit avatar Feb 01 '17 10:02 kevinkit

Hi, I am new to using this platform so i just have a couple of questions, 1.Does this work on windows as i have caffe installed in it and i run the commands through windows power shell. 2.When i run the " python create_yolo_caffemodel.py "as per the instructions i get the run time error and its unable to open the yolo_train_val.prototxt Any help would be appreciated

Arpitharavi avatar Apr 17 '18 19:04 Arpitharavi