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.

A problem: assert pred.size() == target.size() and target.numel() > 0

See original GitHub issue

2019-04-22 12:37:47,627 - INFO - Epoch [6][150/441] lr: 0.02000, eta: 1:00:51, time: 0.600, data_time: 0.008, memory: 3381, loss_rpn_cls: 0.0117, loss_rpn_reg: 0.0094, loss_cls: 0.1055, acc: 96.7344, loss_reg: 0.0567, loss: 0.1834 ^@2019-04-22 12:38:17,495 - INFO - Epoch [6][200/441] lr: 0.02000, eta: 0:59:10, time: 0.597, data_time: 0.008, memory: 3381, loss_rpn_cls: 0.0113, loss_rpn_reg: 0.0107, loss_cls: 0.1067, acc: 96.5859, loss_reg: 0.0580, loss: 0.1868 Traceback (most recent call last): File "./tools/train.py", line 90, in <module> main() File "./tools/train.py", line 86, in main logger=logger) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/apis/train.py", line 57, in train_detector _dist_train(model, dataset, cfg, validate=validate) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/apis/train.py", line 96, in _dist_train runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmcv-0.2.6-py3.7.egg/mmcv/runner/runner.py", line 355, in run epoch_runner(data_loaders[i], **kwargs) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmcv-0.2.6-py3.7.egg/mmcv/runner/runner.py", line 261, in train self.model, data_batch, train_mode=True, **kwargs) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/apis/train.py", line 37, in batch_processor losses = model(**data) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmcv-0.2.6-py3.7.egg/mmcv/parallel/distributed.py", line 50, in forward return self.module(*inputs[0], **kwargs[0]) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/models/detectors/base.py", line 84, in forward return self.forward_train(img, img_meta, **kwargs) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/models/detectors/two_stage.py", line 150, in forward_train *bbox_targets) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/models/bbox_heads/bbox_head.py", line 107, in loss avg_factor=bbox_targets.size(0)) File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/core/loss/losses.py", line 99, in weighted_smoothl1 loss = smooth_l1_loss(pred, target, beta, reduction='none') File "/1t_second/lzw2/tools/anaconda3/lib/python3.7/site-packages/mmdet-0.6.0+5970e13-py3.7.egg/mmdet/core/loss/losses.py", line 82, in smooth_l1_loss assert pred.size() == target.size() and target.numel() > 0 AssertionError

it’s trained successfully during first 5 epochs , but problem occurs at 6th epoch. Thank you in advance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
haoxuhaocommented, Aug 24, 2019

Hello @lzewhard , I also encountered this problem today. I checked that the category_id is all start from 1. Could you please show me more details of your solution? Thank you in advance.

1reaction
lzwhardcommented, Apr 23, 2019

solved, label class starts from 1, 0 for background

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for mmdet.models.losses.focal_loss
Args: pred (torch.Tensor): The prediction with shape (N, C), C is the number of classes target (torch.Tensor): The learning label of the prediction....
Read more >
PyTorch ValueError: Target size (torch.Size([64])) must be the ...
1 Answer 1 · When I implement these changes, I get a different error: RuntimeError: Calculated padded input size per channel: (4 x...
Read more >
mmdetection/docs/tutorials/customize_models.md ... - inovisao
Scripts e patches para facilitar o uso do mmdetection em novos bancos de ... target): assert pred.size() == target.size() and target.numel() > 0...
Read more >
SFA3D - Kaggle
if np.random.random() <= self.p: h = img.size(1) w = img.size(2) ... target): assert pred.size() == target.size() and target.numel() > 0 ...
Read more >
Function 'MulBackward0' returned nan values in its 0th output ...
I got MulBackward0 nan error in anomaly detection mode. the forward function that is causing ... assert pred.size() == target.size() and target.numel() >...
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