question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"RuntimeError: The expanded size of the tensor (1200) must match the existing size (1199) at non-singleton dimension 1. Target sizes: [600, 1200, 3]. Tensor sizes: [600, 1199, 3] "

See original GitHub issue

Hi All, got a Runtime error while training on the Open Images dataset after around 9000 iterations in the first epoch.

issue in: https://github.com/jwyang/faster-rcnn.pytorch/blob/358cecacf876717ff13988dc6396de10e265279c/lib/roi_data_layer/roibatchLoader.py#L177

File "/home/munzueta/Kaggle/ObjectDetection2019/faster-rcnn.pytorch/lib/roi_data_layer/roibatchLoader.py", line 177, in __getitem__ padding_data[:, :data_width, :] = data[0]

RuntimeError: The expanded size of the tensor (1200) must match the existing size (1199) at non-singleton dimension 1. Target sizes: [600, 1200, 3]. Tensor sizes: [600, 1199, 3]

I am not sure what might cause it, as I have not change the implementation of roibatchLoader.py yet and I been able to run the training for around 3h… Wondering with the np.ceil function might be causing the issue…

I could ignore it as the training works, but crashes when encountering a corner case

thanks!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
elefleacommented, Aug 31, 2019

It might because a bug in croping image, it change data’s shape. I add a reassignment line to data_height and data_width. It seems solve this problem. https://github.com/jwyang/faster-rcnn.pytorch/blob/624608fd2f1fb332ef585062cfe51fabf718430d/lib/roi_data_layer/roibatchLoader.py#L160 data_height, data_width = data[0].size(0), data[0].size(1) add this line after line 160.

0reactions
peach1995commented, Jan 4, 2021

i delete all files of .pkl in caches in the folder,and made it. i dont konw why ,maybe the older .pkl made it worse,you may try

I have fixed the problem with it, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The expanded size of the tensor must match the existing size
I have a tensor with shape [2,3] and I want to expand it to [4,3]. If I use torch.expand directly, a error occurs....
Read more >
python - RuntimeError: The size of tensor a (133) must match ...
Well, the error is because the nn.MSELoss() and nn.CrossEntropyLoss() expect different input / target combinations. You cannot simply change ...
Read more >
How to solve the error: The size of tensor a (16) must match ...
Currently, I'm working on an image motion deblurring problem with PyTorch. I have two kinds of images: Blurry images (variable = blur_image) ...
Read more >
PyTorch: torch/onnx/symbolic_opset9.py - Fossies
2 3 Opset 9 is supported by ONNX release 1.4.1 4 release on ... Opset version 11 supports squeezing on " 1186 +...
Read more >
Densenet121minus1 | Kaggle
Conv2d(bn_size * growth_rate, growth_rate, kernel_size=3, stride=1, ... Epoch: 1 Batch: 1199 (16) Train Loss: 1.238446 Epoch: 1 Batch: 1200 (16) Train Loss: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found