pytorch-yolo-v3
pytorch-yolo-v3 copied to clipboard
Sizes of tensors must match except in dimension 2. Got 26 and 4
Hello,
I am getting this error, when I run video_demo.py.
Loading network..... Network successfully loaded Traceback (most recent call last): File "video_demo.py", line 111, in <module> model(get_test_input(inp_dim, CUDA), CUDA) File "C:\Users\Salem\anaconda3\envs\yo1\lib\site-packages\torch\nn\modules\module.py", line 550, in __call__ result = self.forward(*input, **kwargs) File "C:\Users\Salem\yolov3\darknet.py", line 341, in forward x = torch.cat((map1, map2), 1) RuntimeError: Sizes of tensors must match except in dimension 2. Got 26 and 4
Dear khany27 , did you solve this error? I faced with same ! for me it was the input image, like "scream.jpg" gives error! bests.
I met semilar problem, I solved it. Date: 2020.12.2 how to fix: in detect.py around line 224, change: prediction[:,0] += i*batch_size into:
if len(prediction)!=0:
prediction[:,0] += i*batch_size
AND:
in util.py, around line 121: change: output = prediction.new(1, prediction.size(2) + 1) into: output = torch.tensor([])
in total, change two places, solved it.