Self made dataset problem
xdw-123 opened this issue · comments
Hello, the author. It's a great honor to have access to your research results. Recently, I have been training with my own dataset, which is in the format of s3dis.
tensor([[2, 2, 2, ..., 2, 2, 2]], device='cuda:0')
....
Traceback (most recent call last):
File "/home/hzh005/RandLA-Net-pytorch/train.py", line 278, in
train(args)
File "/home/hzh005/RandLA-Net-pytorch/train.py", line 129, in train
loss = criterion(logp, labels)
File "/home/hzh005/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/hzh005/anaconda3/lib/python3.9/site-packages/torch/nn/modules/loss.py", line 1150, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "/home/hzh005/anaconda3/lib/python3.9/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 or no classes
I have the same issue.
Could you tell me how you solved this? Thank you!
I think you should check your code and change NUM_CLASS to the num of classes of your dataset also need to change the class_weights to the amount of points in each class of your dataset
Hello, the author. It's a great honor to have access to your research results. Recently, I have been training with my own dataset, which is in the format of s3dis. tensor([[2, 2, 2, ..., 2, 2, 2]], device='cuda:0') .... Traceback (most recent call last): File "/home/hzh005/RandLA-Net-pytorch/train.py", line 278, in train(args) File "/home/hzh005/RandLA-Net-pytorch/train.py", line 129, in train loss = criterion(logp, labels) File "/home/hzh005/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/hzh005/anaconda3/lib/python3.9/site-packages/torch/nn/modules/loss.py", line 1150, in forward return F.cross_entropy(input, target, weight=self.weight, File "/home/hzh005/anaconda3/lib/python3.9/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 or no classes
Hello, the author. It's a great honor to have access to your research results. Recently, I have been training with my own dataset, which is in the format of s3dis. tensor([[2, 2, 2, ..., 2, 2, 2]], device='cuda:0') .... Traceback (most recent call last): File "/home/hzh005/RandLA-Net-pytorch/train.py", line 278, in train(args) File "/home/hzh005/RandLA-Net-pytorch/train.py", line 129, in train loss = criterion(logp, labels) File "/home/hzh005/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/hzh005/anaconda3/lib/python3.9/site-packages/torch/nn/modules/loss.py", line 1150, in forward return F.cross_entropy(input, target, weight=self.weight, File "/home/hzh005/anaconda3/lib/python3.9/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 or no classes
Hello, I also have this problem now. My own dataset category is 4, class_ The program can run when the weight is 4, class_ An error will be reported if the weight is 5. However, there will always be a category whose Accuracy and Iou are 0. Please tell me what code needs to be changed if you want to run your own dataset. If we can, we can add a friend to communicate: 1002923065@qq.com
=== EPOCH 1/6 ===
Training loss: 1.5586808 Validation loss: 2.9165625
Accuracy | 0 | 1 | 2 | 3 | OA
Training: | 0.139 | 0.040 | 0.760 | 0.156 | 0.463
Validation: | 0.000 | 0.000 | 0.991 | 0.009 | 0.576
IoU | 0 | 1 | 2 | 3 | mIoU
Training: | 0.058 | 0.009 | 0.409 | 0.048 | 0.138
Validation: | 0.000 | 0.000 | 0.575 | 0.004 | 0.330
Time elapsed: 8 min 51 s
=== EPOCH 2/6 ===
Training loss: 1.0715053 Validation loss: 1.0353577
Accuracy | 0 | 1 | 2 | 3 | OA
Training: | 0.100 | 0.012 | 0.933 | 0.048 | 0.561
Validation: | 0.850 | 0.000 | 0.990 | 0.000 | 0.696
IoU | 0 | 1 | 2 | 3 | mIoU
Training: | 0.053 | 0.003 | 0.548 | 0.015 | 0.175
Validation: | 0.672 | 0.000 | 0.654 | 0.000 | 0.622
Time elapsed: 8 min 44 s
=== EPOCH 3/6 ===
Training loss: 1.2013940 Validation loss: 2.4099397
Accuracy | 0 | 1 | 2 | 3 | OA
Training: | 0.314 | 0.002 | 0.909 | 0.005 | 0.568
Validation: | 0.000 | 0.000 | 0.983 | 0.000 | 0.564
IoU | 0 | 1 | 2 | 3 | mIoU
Training: | 0.110 | 0.000 | 0.560 | 0.001 | 0.192
Validation: | 0.000 | 0.000 | 0.564 | 0.000 | 0.360
I have the same issue. Could you tell me how you solved this? Thank you!
Hello, I also have this problem now. My own dataset category is 4, class_ The program can run when the weight is 4, class_ An error will be reported if the weight is 5. However, there will always be a category whose Accuracy and Iou are 0. Please tell me what code needs to be changed if you want to run your own dataset. If we can, we can add a friend to communicate: 1002923065@qq.com
=== EPOCH 1/6 ===
Training loss: 1.5586808 Validation loss: 2.9165625
Accuracy | 0 | 1 | 2 | 3 | OA
Training: | 0.139 | 0.040 | 0.760 | 0.156 | 0.463
Validation: | 0.000 | 0.000 | 0.991 | 0.009 | 0.576
IoU | 0 | 1 | 2 | 3 | mIoU
Training: | 0.058 | 0.009 | 0.409 | 0.048 | 0.138
Validation: | 0.000 | 0.000 | 0.575 | 0.004 | 0.330
Time elapsed: 8 min 51 s
=== EPOCH 2/6 ===
Training loss: 1.0715053 Validation loss: 1.0353577
Accuracy | 0 | 1 | 2 | 3 | OA
Training: | 0.100 | 0.012 | 0.933 | 0.048 | 0.561
Validation: | 0.850 | 0.000 | 0.990 | 0.000 | 0.696
IoU | 0 | 1 | 2 | 3 | mIoU
Training: | 0.053 | 0.003 | 0.548 | 0.015 | 0.175
Validation: | 0.672 | 0.000 | 0.654 | 0.000 | 0.622
Time elapsed: 8 min 44 s
=== EPOCH 3/6 ===
Training loss: 1.2013940 Validation loss: 2.4099397
Accuracy | 0 | 1 | 2 | 3 | OA
Training: | 0.314 | 0.002 | 0.909 | 0.005 | 0.568
Validation: | 0.000 | 0.000 | 0.983 | 0.000 | 0.564
IoU | 0 | 1 | 2 | 3 | mIoU
Training: | 0.110 | 0.000 | 0.560 | 0.001 | 0.192
Validation: | 0.000 | 0.000 | 0.564 | 0.000 | 0.360
change the class_weights to your amount of points in each class in file: tools.py A-Chas @.> 于2023年1月25日周三 19:34写道:
…
I have the same issue. Could you tell me how you solved this? Thank you! Hello, I also have this problem now. My own dataset category is 4, class_ The program can run when the weight is 4, class_ An error will be reported if the weight is 5. However, there will always be a category whose Accuracy and Iou are 0. Please tell me what code needs to be changed if you want to run your own dataset. If we can, we can add a friend to communicate: @. === EPOCH 1/6 === Training loss: 1.5586808 Validation loss: 2.9165625 Accuracy | 0 | 1 | 2 | 3 | OA Training: | 0.139 | 0.040 | 0.760 | 0.156 | 0.463 Validation: | 0.000 | 0.000 | 0.991 | 0.009 | 0.576 IoU | 0 | 1 | 2 | 3 | mIoU Training: | 0.058 | 0.009 | 0.409 | 0.048 | 0.138 Validation: | 0.000 | 0.000 | 0.575 | 0.004 | 0.330 Time elapsed: 8 min 51 s === EPOCH 2/6 === Training loss: 1.0715053 Validation loss: 1.0353577 Accuracy | 0 | 1 | 2 | 3 | OA Training: | 0.100 | 0.012 | 0.933 | 0.048 | 0.561 Validation: | 0.850 | 0.000 | 0.990 | 0.000 | 0.696 IoU | 0 | 1 | 2 | 3 | mIoU Training: | 0.053 | 0.003 | 0.548 | 0.015 | 0.175 Validation: | 0.672 | 0.000 | 0.654 | 0.000 | 0.622 Time elapsed: 8 min 44 s === EPOCH 3/6 === Training loss: 1.2013940 Validation loss: 2.4099397 Accuracy | 0 | 1 | 2 | 3 | OA Training: | 0.314 | 0.002 | 0.909 | 0.005 | 0.568 Validation: | 0.000 | 0.000 | 0.983 | 0.000 | 0.564 IoU | 0 | 1 | 2 | 3 | mIoU Training: | 0.110 | 0.000 | 0.560 | 0.001 | 0.192 Validation: | 0.000 | 0.000 | 0.564 | 0.000 | 0.360 — Reply to this email directly, view it on GitHub <#40 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASFULI6OXQEPAIO7VVAGCRTWUEFVLANCNFSM5Z53JKIA . You are receiving this because you commented.Message ID: @.***>
I have changed the class_ Weight, but there are many 0 training results. Can I add my QQ: 1002923065 and ask you for advice