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

L1_loss error while training SMOKE model (kitti dataset) #8

Open
Einhartd opened this issue Dec 4, 2023 · 0 comments
Open

L1_loss error while training SMOKE model (kitti dataset) #8

Einhartd opened this issue Dec 4, 2023 · 0 comments

Comments

@Einhartd
Copy link

Einhartd commented Dec 4, 2023

Dist: Pop OS 22.04
I have encountered error in l1_loss.py while training SMOKE.

pred.size(): torch.Size([0, 2])
target.size(): torch.Size([0, 2])
target.numel(): 0
Traceback (most recent call last):
  File "/home/einhart/MonoDetector/tools/train.py", line 63, in <module>
    main()
  File "/home/einhart/MonoDetector/tools/train.py", line 58, in main
    engine.train()
  File "/home/einhart/MonoDetector/tools/../engine/base_engine.py", line 115, in train
    avg_loss, elapsed_time = self.train_one_epoch()
  File "/home/einhart/MonoDetector/tools/../utils/decorators.py", line 7, in wrapper
    result = function(*args, **kwargs)
  File "/home/einhart/MonoDetector/tools/../engine/mono_engine.py", line 85, in train_one_epoch
    _, loss_dict = self.model(data_dict)
  File "/home/einhart/anaconda3/envs/MonoDetector/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/einhart/anaconda3/envs/MonoDetector/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/einhart/MonoDetector/tools/../model/detector/base_mono_detector.py", line 66, in forward
    pred_dict, loss_dict = self.head.forward_train(feat, data_dict)
  File "/home/einhart/MonoDetector/tools/../model/dense_heads/base_dense_heads.py", line 106, in forward_train
    loss_dict = self._get_losses(pred_dict, target_dict)
  File "/home/einhart/MonoDetector/tools/../model/dense_heads/smoke_heads.py", line 206, in _get_losses
    offset_loss = self.crit_offset(offset_pred, offset_target)
  File "/home/einhart/anaconda3/envs/MonoDetector/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/einhart/anaconda3/envs/MonoDetector/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/einhart/MonoDetector/tools/../losses/l1_loss.py", line 43, in forward
    return self.loss_weight * l1_loss(pred, target, weight, reduction=reduction, avg_factor=avg_factor)
  File "/home/einhart/MonoDetector/tools/../losses/utils.py", line 46, in wrapper
    loss = loss_func(pred, target, **kwargs)
  File "/home/einhart/MonoDetector/tools/../losses/l1_loss.py", line 19, in l1_loss
    assert pred.size() == target.size() and target.numel() > 0
AssertionError

I have added few lines in l1_loss to print pred.size(), target.size() and target.numel():

if pred.size() != target.size() or target.numel() <= 0:
print('pred.size():',pred.size())
print('target.size():',target.size())
print('target.numel():',target.numel())

Do you have any idea how could I fix this problem?

@Einhartd Einhartd changed the title L1_loss error while training model L1_loss error while training SMOKE model (kitti dataset) Dec 4, 2023
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

1 participant