adept-thu / Dual-Radar

Apache License 2.0
131 stars 8 forks source link

RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0 #9

Open Jayefo opened 10 months ago

Jayefo commented 10 months ago

2.0000000e+00 1.6646250e+09]] epochs: 91%|███████████████████████████████████████████████████████████▎ | 73/80 [5:15:45<30:16, 259.53s/it, loss=nan, lr=7.72e-5, d_time=0.00(0.00), f_time=0.12(0.11), b_time=0.20(0.20)] Traceback (most recent call last): File "train.py", line 240, in main() File "train.py", line 192, in main train_model( File "/home/oem/data/Dual-Radar/tools/train_utils/train_utils.py", line 111, in train_model accumulated_iter = train_one_epoch( File "/home/oem/data/Dual-Radar/tools/train_utils/train_utils.py", line 47, in train_one_epoch loss, tb_dict, disp_dict = model_func(model, batch) File "../pcdet/models/init.py", line 42, in model_func ret_dict, tb_dict, disp_dict = model(batch_dict) File "/home/oem/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "../pcdet/models/detectors/pointpillar.py", line 14, in forward loss, tb_dict, disp_dict = self.get_training_loss() File "../pcdet/models/detectors/pointpillar.py", line 27, in get_training_loss loss_rpn, tb_dict = self.dense_head.get_loss() File "../pcdet/models/dense_heads/anchor_head_template.py", line 322, in get_loss cls_loss, tb_dict = self.get_cls_layer_loss() File "../pcdet/models/dense_heads/anchor_head_template.py", line 187, in get_cls_layer_loss cls_loss_src = self.cls_loss_func(cls_preds, one_hot_targets, weights=cls_weights) # [N, M] File "/home/oem/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, *kwargs) File "../pcdet/utils/loss_utils.py", line 71, in forward pt = target (1.0 - pred_sigmoid) + (1.0 - target) * pred_sigmoid RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0 是不是数据有问题?

ylwhxht commented 8 months ago

2.0000000e+00 1.6646250e+09]] epochs: 91%|███████████████████████████████████████████████████████████▎ | 73/80 [5:15:45<30:16, 259.53s/it, loss=nan, lr=7.72e-5, d_time=0.00(0.00), f_time=0.12(0.11), b_time=0.20(0.20)] Traceback (most recent call last): File "train.py", line 240, in main() File "train.py", line 192, in main train_model( File "/home/oem/data/Dual-Radar/tools/train_utils/train_utils.py", line 111, in train_model accumulated_iter = train_one_epoch( File "/home/oem/data/Dual-Radar/tools/train_utils/train_utils.py", line 47, in train_one_epoch loss, tb_dict, disp_dict = model_func(model, batch) File "../pcdet/models/init.py", line 42, in model_func ret_dict, tb_dict, disp_dict = model(batch_dict) File "/home/oem/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "../pcdet/models/detectors/pointpillar.py", line 14, in forward loss, tb_dict, disp_dict = self.get_training_loss() File "../pcdet/models/detectors/pointpillar.py", line 27, in get_training_loss loss_rpn, tb_dict = self.dense_head.get_loss() File "../pcdet/models/dense_heads/anchor_head_template.py", line 322, in get_loss cls_loss, tb_dict = self.get_cls_layer_loss() File "../pcdet/models/dense_heads/anchor_head_template.py", line 187, in get_cls_layer_loss cls_loss_src = self.cls_loss_func(cls_preds, one_hot_targets, weights=cls_weights) # [N, M] File "/home/oem/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, *kwargs) File "../pcdet/utils/loss_utils.py", line 71, in forward pt = target (1.0 - pred_sigmoid) + (1.0 - target) * pred_sigmoid RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0 是不是数据有问题?

We also encountered the same problem. Have you finally resolved it