You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your error report and we appreciate it a lot.
Checklist
I have searched related issues but cannot get the expected help.
The bug has not been fixed in the latest version.
Describe the bug
RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 'target' in call to _thnn_nll_loss2d_forward
i modified the code in mmdet3d/datasets/pipelines/loading.pyline 521seg_3d_dtype=np.int64 to seg_3d_dtype=np.int32 because of the error: IndexError: index 12884901891 is out of bounds for axis 0 with size 14, and also i modified the code in tools/create_data.pyline 211mask = np.fromfile(mask, dtype=np.int64) to mask = np.fromfile(mask, dtype=np.int32) because of the similar error like above.
I use the S3DIS as the dataset of training model
Environment
fatal: not a git repository (or any of the parent directories): .git
sys.platform: win32
Python: 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 05:35:01) [MSC v.1916 64 bit (AMD64)]
CUDA available: True
GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1
NVCC: Cuda compilation tools, release 11.1, V11.1.74
MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30145 版
GCC: n/a
PyTorch: 1.7.1
PyTorch compiling details: PyTorch built with:
C++ Version: 199711
MSVC 192729112
Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191125 for Intel(R) 64 architecture applications
Error traceback
If applicable, paste the error trackback here.
Traceback (most recent call last):
File "D:/mmdetection3d-master/tools/train.py", line 263, in <module>
main()
File "D:/mmdetection3d-master/tools/train.py", line 259, in main
meta=meta)
File "D:\mmdetection3d-master\mmdet3d\apis\train.py", line 342, in train_model
meta=meta)
File "D:\mmdetection3d-master\mmdet3d\apis\train.py", line 177, in train_segmentor
runner.run(data_loaders, cfg.workflow)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 130, in run
epoch_runner(data_loaders[i], **kwargs)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 51, in train
self.run_iter(data_batch, train_mode=True, **kwargs)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 30, in run_iter
**kwargs)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmcv\parallel\data_parallel.py", line 75, in train_step
return self.module.train_step(*inputs[0], **kwargs[0])
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmseg\models\segmentors\base.py", line 138, in train_step
losses = self(**data_batch)
File "E:\Anaconda\envs\mmlab\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmcv\runner\fp16_utils.py", line 116, in new_func
return old_func(*args, **kwargs)
File "D:\mmdetection3d-master\mmdet3d\models\segmentors\base.py", line 67, in forward
return self.forward_train(**kwargs)
File "D:\mmdetection3d-master\mmdet3d\models\segmentors\encoder_decoder.py", line 168, in forward_train
pts_semantic_mask_cat)
File "D:\mmdetection3d-master\mmdet3d\models\segmentors\encoder_decoder.py", line 98, in _decode_head_forward_train
self.train_cfg)
File "D:\mmdetection3d-master\mmdet3d\models\decode_heads\decode_head.py", line 87, in forward_train
losses = self.losses(seg_logits, pts_semantic_mask)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmcv\runner\fp16_utils.py", line 205, in new_func
return old_func(*args, **kwargs)
File "D:\mmdetection3d-master\mmdet3d\models\decode_heads\decode_head.py", line 122, in losses
seg_logit, seg_label, ignore_index=self.ignore_index)
File "E:\Anaconda\envs\mmlab\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmseg\models\losses\cross_entropy_loss.py", line 280, in forward
**kwargs)
File "E:\Anaconda\envs\mmlab\lib\site-packages\mmseg\models\losses\cross_entropy_loss.py", line 50, in cross_entropy
ignore_index=ignore_index)
File "E:\Anaconda\envs\mmlab\lib\site-packages\torch\nn\functional.py", line 2468, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File "E:\Anaconda\envs\mmlab\lib\site-packages\torch\nn\functional.py", line 2292, in nll_loss
input, target, weight, reduction_enum, ignore_index)
RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 'target' in call to _thnn_nll_loss2d_forward
Process finished with exit code 1
Bug fix
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
The text was updated successfully, but these errors were encountered:
I have a similar problem RuntimeError: expected scalar type Long but found Int
when I run python tools\train.py configs\pointnet2\pointnet2_msg_16x2_cosine_80e_s3dis_seg-3d-13class.py
Thanks for your error report and we appreciate it a lot.
Checklist
Describe the bug
RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 'target' in call to _thnn_nll_loss2d_forward
Reproduction
i modified the code in mmdet3d/datasets/pipelines/loading.py line 521 seg_3d_dtype=np.int64 to seg_3d_dtype=np.int32 because of the error: IndexError: index 12884901891 is out of bounds for axis 0 with size 14, and also i modified the code in tools/create_data.py line 211 mask = np.fromfile(mask, dtype=np.int64) to mask = np.fromfile(mask, dtype=np.int32) because of the similar error like above.
I use the S3DIS as the dataset of training model
Environment
fatal: not a git repository (or any of the parent directories): .git
sys.platform: win32
Python: 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 05:35:01) [MSC v.1916 64 bit (AMD64)]
CUDA available: True
GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1
NVCC: Cuda compilation tools, release 11.1, V11.1.74
MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30145 版
GCC: n/a
PyTorch: 1.7.1
PyTorch compiling details: PyTorch built with:
TorchVision: 0.8.2
OpenCV: 4.6.0
MMCV: 1.5.3
MMCV Compiler: MSVC 192930145
MMCV CUDA Compiler: 11.1
MMDetection: 2.25.0
MMSegmentation: 0.25.0
MMDetection3D: 1.0.0rc2+
spconv2.0: False
Error traceback
If applicable, paste the error trackback here.
Bug fix
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
The text was updated successfully, but these errors were encountered: