Closed georgeokelly closed 5 years ago
Umm. the dim
is added in pytorch from 0.3.0. so check your pytorch version and update to the newest release one. Let me know whether it could fix this problem.
thank you for your reply. now it's the newest one and there seem to be some mistakes when load the weightfile
convert yolov2...
layer filters size input output
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32
0 Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
Traceback (most recent call last):
File "dark2pth.py", line 378, in <module>
yolo_v2 = yolo2pth(yolo_v2, './weights/yolov2.cfg', './weights/yolov2.weights')
File "dark2pth.py", line 246, in yolo2pth
start = load_conv_bn(buf, start, model[model_index].conv[model_sub*3], model[model_index].conv[model_sub*3+1])
File "dark2pth.py", line 188, in load_conv_bn
conv_model.weight.data.copy_(torch.from_numpy(buf[start:start+num_w])); start = start + num_w
RuntimeError: The expanded size of the tensor (3) must match the existing size (864) at non-singleton dimension 3
and the weightfile here is downloaded from the https://pjreddie.com/darknet/yolov2/
which pytorch version are you used? I just test in my computer with pytorch 0.3.1. it looks ok.
The networks define looks good. The reason to generate this error is caused by mismatch between two weights. Seems weird.
Hi, my pytorch is 0.4.0
print(torch.__version__)
0.4.0
and torchvision-cpu 0.2.1 The weightfile is the YOLOv2 544x544. Is there any difference between yours and that on website now?
Hi, when I run the dark2pth.py, it turns out like this
and I don't know how to fix it.