Skip to content

RuntimeError: The size of tensor a (52) must match the size of tensor b (19) at non-singleton dimension 3 #559

@imihassan

Description

@imihassan

I have same problem I faced few months ago but I am not able to solve. Is this implementation is not compatible with changing input image size.

In configuration file I changed image size form 608 to 416 as shown below

Cfg.width = 416
Cfg.height = 416

I got the following error.

Traceback (most recent call last):
File "./pytorch-YOLOv4/train.py", line 445, in
train(model=model,
File "./pytorch-YOLOv4/train.py", line 321, in train
loss, loss_xy, loss_wh, loss_obj, loss_cls, loss_l2 = criterion(bboxes_pred, bboxes)
File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "./pytorch-YOLOv4/train.py", line 205, in forward
pred[..., 0] += self.grid_x[output_id]
RuntimeError: The size of tensor a (52) must match the size of tensor b (19) at non-singleton dimension 3

Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions