Pytorch-yolov3: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 64 and 63 in dimension 2

Created on 7 Feb 2020  ·  3Comments  ·  Source: eriklindernoren/PyTorch-YOLOv3

I have used the yolov3-custom.cfg generated by the given script and I am testing on a dataset of one image. Could anyone tell me what is going wrong? Thanks.

---- Evaluating Model ----
Detecting objects:   0%|          | 0/1 [00:05<?, ?it/s]
Traceback (most recent call last):
  File "/Workspaces/PycharmProjects/Final/YOLO/train.py", line 160, in <module>
    batch_size=1,
  File "/Workspaces/PycharmProjects/Final/YOLO/test.py", line 49, in evaluate
    outputs = model(imgs)
  File "/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/Workspaces/PycharmProjects/Final/YOLO/models.py", line 254, in forward
    x = torch.cat([layer_outputs[int(layer_i)] for layer_i in module_def["layers"].split(",")], 1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 64 and 63 in dimension 2 at /Users/distiller/project/conda/conda-bld/pytorch_1570710797334/work/aten/src/TH/generic/THTensor.cpp:689

Most helpful comment

I understand it now. Image size has to be set to multiples of 32.

All 3 comments

I am pretty sure it has something to do with the img_size argument. After changing back to default, it works fine. So is it possible to modify img_size without running into this issue?

I understand it now. Image size has to be set to multiples of 32.

我现在明白了 图片大小必须设置为32的倍数。

yes,thank you verey much

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codeyogi911 picture codeyogi911  ·  4Comments

MAP
nationalflag picture nationalflag  ·  5Comments

mylife126 picture mylife126  ·  3Comments

MessiahChen picture MessiahChen  ·  3Comments

mwharton3 picture mwharton3  ·  3Comments