RandLA-Net-pytorch icon indicating copy to clipboard operation
RandLA-Net-pytorch copied to clipboard

A bug about python main_SemanticKITTI.py

Open ksama777 opened this issue 2 years ago • 4 comments

I got a bug when I run python main_SemanticKITTI.py

**** EPOCH 000 **** 2022-08-01 17:14:40.759397 /media/wx/HDD/DQ/RandLA-Net-pytorch-master/RandLANet.py:265: UserWarning: torch.range is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin. Instead, use torch.arange, which produces values in [start, end). reducing_list = torch.range(0, cfg.num_classes).long().cuda() Traceback (most recent call last): File "main_SemanticKITTI.py", line 205, in train(start_epoch) File "main_SemanticKITTI.py", line 185, in train train_one_epoch() File "main_SemanticKITTI.py", line 105, in train_one_epoch loss, end_points = compute_loss(end_points, cfg) File "/media/wx/HDD/DQ/RandLA-Net-pytorch-master/RandLANet.py", line 270, in compute_loss loss = get_loss(valid_logits, valid_labels, cfg.class_weights) File "/media/wx/HDD/DQ/RandLA-Net-pytorch-master/RandLANet.py", line 282, in get_loss output_loss = criterion(logits, labels) File "/home/wx/anaconda3/envs/RandLA-Net-pytorch-master/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/wx/anaconda3/envs/RandLA-Net-pytorch-master/lib/python3.7/site-packages/torch/nn/modules/loss.py", line 1152, in forward label_smoothing=self.label_smoothing) File "/home/wx/anaconda3/envs/RandLA-Net-pytorch-master/lib/python3.7/site-packages/torch/nn/functional.py", line 2846, in cross_entropy return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing) RuntimeError: weight tensor should be defined either for all 18 classes or no classes but got weight tensor of shape: [1, 19]

can you help me thanks a lot

ksama777 avatar Aug 01 '22 09:08 ksama777

I have the same question with you.How can you save the question?

mzyCSDN avatar Oct 10 '22 07:10 mzyCSDN

I didn't solve it,too.  The author didn't reply me.

ksama @.***

 

------------------ 原始邮件 ------------------ 发件人: "qiqihaer/RandLA-Net-pytorch" @.>; 发送时间: 2022年10月10日(星期一) 下午3:28 @.>; @.@.>; 主题: Re: [qiqihaer/RandLA-Net-pytorch] A bug about python main_SemanticKITTI.py (Issue #22)

I have the same question with you.How can you save the question?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ksama777 avatar Oct 10 '22 07:10 ksama777

I have the same question with you.How can you save the question?

just change [1,19] to [19], and it work!

Sylva-Lin avatar Jun 30 '23 08:06 Sylva-Lin

Hi ,

i helper_tool.py i changed this line return np.expand_dims(ce_label_weight, axis=0) which is 2d array

to this one return ce_label_weight which is 1d array.

hope it helps you

MohamedMansour89 avatar Aug 24 '23 10:08 MohamedMansour89