xingwangsfu / caffe-yolo

YOLO (Real-Time Object Detection) in caffe
521 stars 337 forks source link

conversion error #7

Open yexiguafuqihao opened 8 years ago

yexiguafuqihao commented 8 years ago

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

xingwangsfu commented 8 years ago

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

stormkingz commented 8 years ago

@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.

Soledad89 commented 7 years ago

@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.

stormkingz commented 7 years ago

@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.

kevinkit commented 7 years ago

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.

Arpitharavi commented 6 years ago

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