I got this problem when I run the code "python detect.py --image_folder data/samples/", the detail info is:
Traceback (most recent call last):
File "detect.py", line 52, in <module>
model.load_darknet_weights(opt.weights_path)
File "E:\Programing Project\python\UnderWaterDetection\PyTorch-YOLOv3-master\models.py", line 316, in load_darknet_weights
conv_w = torch.from_numpy(weights[ptr: ptr + num_w]).view_as(conv_layer.weight)
RuntimeError: shape '[1024, 512, 3, 3]' is invalid for input of size 113911
And it's a latest downloaded project.
I run it in Window10 1909, python 3.7, Pytorch 1.3.1, I use the sample image to detect and show this result.
You probably had ran create_custom_model.sh many times, delete yolov3-custom.cfg and run create_custom_model.sh once will be OK.
open yolov3-custom.cfg file, check if the filter size is the same as in the equation given in create_custom_model.sh.
Yeah, so I had used the create_custom_model.sh to create the yolov3-custom.cfg and also the number of classes and filters are in accordance to the argument ( i.e. number of classes) i gave. The error still seems to persist. What else can i do?
as I remember just running create_custom_model.sh did not change yolov3-custom.cfg. I had change to change the number of classes, number of filters, etc. manually.
Have you solved it? I had the same problem.
when i run the code detect.py --image_folder data/samples
Traceback (most recent call last):
File "detect.py", line 48, in
model.load_darknet_weights(opt.weights_path)
File "/dfsdata2/yanxd2_data/PyTorch_YOLOv3/PyTorch-YOLOv3-master/models.py", line 315, in load_darknet_weights
conv_w = torch.from_numpy(weights[ptr : ptr + num_w]).view_as(conv_layer.weight)
RuntimeError: shape '[512, 256, 3, 3]' is invalid for input of size 406862