pytorch-YOLOv4 icon indicating copy to clipboard operation
pytorch-YOLOv4 copied to clipboard

RuntimeError: The size of tensor a (28) must match the size of tensor b (76) at non-singleton dimension 3 when Image size is changed from 608 to 224

Open imihassan opened this issue 2 years ago • 4 comments

Hi, I changed the image size in Cfg file to

Cfg.width = 224
Cfg.height = 224

I got the below error. I am not able to resolve it. Can you help me to find out the problem.

Epoch 1/3:   0%|           | 0/2 [00:03<?, ?img/s]
Traceback (most recent call last):
  File "train.py", line 634, in <module>
    train(model=model,
  File "train.py", line 383, in train
    loss, loss_xy, loss_wh, loss_obj, loss_cls, loss_l2 = criterion(bboxes_pred, bboxes)
  File "C:\ProgramData\Anaconda3\envs\yolov4t\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "train.py", line 249, in forward
    pred[..., 0] += self.grid_x[output_id]
RuntimeError: The size of tensor a (28) must match the size of tensor b (76) at non-singleton dimension 3

imihassan avatar Apr 29 '22 22:04 imihassan

any suggestions?

imihassan avatar May 04 '22 02:05 imihassan

I am still not able to solve this problem. Any one know this?

imihassan avatar May 09 '22 09:05 imihassan

try change strides in train.py (from [8, 16, 32] to [32, 16, 8]

I am still not able to solve this problem. Any one know this?

pavlik-tikhomirov avatar Aug 11 '22 11:08 pavlik-tikhomirov

try change strides in train.py (from [8, 16, 32] to [32, 16, 8]

I am still not able to solve this problem. Any one know this?

I changed but still no success.

imihassan avatar Feb 22 '23 13:02 imihassan