Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
imihassan opened this issue Feb 22, 2023 · 1 comment

Comments

@imihassan
Copy link

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.

@MKmilky
Copy link

MKmilky commented Aug 14, 2023

code train.py also need to be editted
in line 135 image_size=608 ,you need to change it to your size as cfg.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants