8000 RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. ...: 1333 · Issue #55 · andy-yun/pytorch-0.4-yolov3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. ...: 1333 #55
Open
@mrkieumy

Description

@mrkieumy

Hi @andy-yun ,
I meet this error (the same with #33):
Traceback (most recent call last):
File "train.py", line 385, in
main()
File "train.py", line 160, in main
nsamples = train(epoch)
File "train.py", line 229, in train
for batch_idx, (data, target) in enumerate(train_loader):
File "/home/kieumy/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 623, in next
return self._process_next_batch(batch)
File "/home/kieumy/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/home/kieumy/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/kieumy/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 232, in default_collate
return [default_collate(samples) for samples in transposed]
File "/home/kieumy/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 232, in
return [default_collate(samples) for samples in transposed]
File "/home/kieumy/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 209, in default_collate
return torch.stack(batch, 0, out=out)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 480 and 416 in dimension 2 at /pytorch/aten/src/TH/generic/THTensorMoreMath.cpp:1333

I think that the problem cause the get_difference_scale() method, because when I turn of it by setting shape = (img.width,img.height), the error has gone.
I set my image with and height is (544 x 480) because original size is 640x512 and w don't want to scale too small (416x416) so I used 544 x 480 (it still divides for 32)
Do you have any recommendation to fix this error?
Thanks & best regards.

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

      0