problem of "ValueError: Expected input batch_size (2) to match target batch_size (1)."
Closed this issue · 2 comments
zhaodejian commented
train_cylinder_asym.py
Namespace(config_path='config/semantickitti.yaml')
[480 360 32]
0%| | 0/1136 [00:00<?, ?it/s]epoch 0 iter 0, loss: 4.095
88%|████████▊ | 1000/1136 [22:35<02:54, 1.29s/it]epoch 0 iter 1000, loss: 1.071
100%|█████████▉| 1135/1136 [25:31<00:01, 1.11s/it]Traceback (most recent call last):
File "train_cylinder_asym.py", line 167, in <module>
main(args)
File "train_cylinder_asym.py", line 134, in main
outputs, point_label_tensor)
File "/home/zdj/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/zdj/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/loss.py", line 1165, in forward
label_smoothing=self.label_smoothing)
File "/home/zdj/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/functional.py", line 2998, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
ValueError: Expected input batch_size (4) to match target batch_size (1).
100%|█████████▉| 1135/1136 [25:32<00:01, 1.35s/it]
when i set the batch_size=2 of train_data_loader
in semantickitti.yaml , it got the above error
zhaodejian commented
当我用了这个问题的方法后 #118 (comment)
新的错误又出现了,如下:
After I use this problem method, #118 #Issue-1162504609
New mistakes appear again, as follows:
train_cylinder_asym.py
Namespace(config_path='config/semantickitti.yaml')
[480 360 32]
0%| | 0/2271 [00:00<?, ?it/s]epoch 0 iter 0, loss: 4.133
44%|████▍ | 1000/2271 [11:58<15:10, 1.40it/s]epoch 0 iter 1000, loss: 1.198
88%|████████▊ | 2000/2271 [23:35<03:06, 1.45it/s]epoch 0 iter 2000, loss: 1.028
100%|██████████| 2271/2271 [26:42<00:00, 1.42it/s]
32%|███▏ | 729/2271 [08:53<20:49, 1.23it/s]epoch 1 iter 729, loss: 0.737
76%|███████▌ | 1729/2271 [20:30<06:46, 1.33it/s]epoch 1 iter 1729, loss: 0.704
100%|██████████| 2271/2271 [26:44<00:00, 1.42it/s]
3%|▎ | 57/2271 [00:50<28:05, 1.31it/s]epoch 2 iter 56, loss: 0.668
Traceback (most recent call last):
File "train_cylinder_asym.py", line 169, in <module>
main(args)
File "train_cylinder_asym.py", line 110, in main
iou = per_class_iu(sum(hist_list))
File "/home/zdj/Cylinder3D/utils/metric_util.py", line 16, in per_class_iu
return np.diag(hist) / (hist.sum(1) + hist.sum(0) - np.diag(hist))
File "<__array_function__ internals>", line 6, in diag
File "/home/zdj/anaconda3/envs/pytorch/lib/python3.7/site-packages/numpy/lib/twodim_base.py", line 303, in diag
raise ValueError("Input must be 1- or 2-d.")
ValueError: Input must be 1- or 2-d.
3%|▎ | 57/2271 [00:51<33:31, 1.10it/s]
Does anyone know what the problem is?
请问有人知道这是什么问题吗?
yyccphus commented
Same problem, do you have any progress?