PaddlePaddle / PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
https://arxiv.org/abs/2101.06175
Apache License 2.0
8.68k stars 1.68k forks source link

Assertion `p_in_data[idx] >= 0 && p_in_data[idx] < depth` failed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [2], but received [0]. #3684

Open monsterlyg opened 7 months ago

monsterlyg commented 7 months ago

问题确认 Search before asking

请提出你的问题 Please ask your question

Error: ../paddle/phi/kernels/gpu/one_hot_kernel.cu:37 Assertion p_in_data[idx] >= 0 && p_in_data[idx] < depth failed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [2], but received [0]. Error: ../paddle/phi/kernels/gpu/one_hot_kernel.cu:37 Assertion p_in_data[idx] >= 0 && p_in_data[idx] < depth failed. Illegal index value, Input(input) value should be greater than or equal to 0, and less than depth [2], but received [0]. Traceback (most recent call last): File "/ssd2/lyg/code/baidu/third-party/paddle-seg/tools/train.py", line 194, in main(args) File "/ssd2/lyg/code/baidu/third-party/paddle-seg/tools/train.py", line 173, in main train( File "/ssd2/lyg/code/baidu/third-party/paddle-seg/paddleseg/core/train.py", line 194, in train loss_list = loss_computation( File "/ssd2/lyg/code/baidu/third-party/paddle-seg/paddleseg/core/train.py", line 50, in loss_computation loss_list.append(losses['coef'][i] loss_i(logits, labels)) File "/root/anaconda3/lib/python3.9/site-packages/paddle/nn/layer/layers.py", line 1254, in call return self.forward(inputs, *kwargs) File "/ssd2/lyg/code/baidu/third-party/paddle-seg/paddleseg/models/losses/mixed_loss.py", line 56, in forward output = loss(logits, labels) File "/root/anaconda3/lib/python3.9/site-packages/paddle/nn/layer/layers.py", line 1254, in call return self.forward(inputs, **kwargs) File "/ssd2/lyg/code/baidu/third-party/paddle-seg/paddleseg/models/losses/lovasz_loss.py", line 52, in forward vprobas, vlabels = flatten_probas(probas, labels, self.ignore_index) File "/ssd2/lyg/code/baidu/third-party/paddle-seg/paddleseg/models/losses/lovasz_loss.py", line 218, in flatten_probas indexs = paddle.nonzero(valid_mask) File "/root/anaconda3/lib/python3.9/site-packages/paddle/tensor/search.py", line 433, in nonzero outs = _C_ops.nonzero(x) OSError: (External) CUDA error(719), unspecified launch failure. [Hint: 'cudaErrorLaunchFailure'. An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointerand accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases canbe found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work willreturn the same error. To continue using CUDA, the process must be terminated and relaunched.] (at ../paddle/phi/backends/gpu/cuda/cuda_info.cc:260)

就是两个类别,标签是0,居然还提示错误。。。

shiyutang commented 7 months ago

你好,看上去是one-hot op存在问题,请前往官网提问或者切换其他常用损失。

pobi123 commented 6 months ago

你好,请问你这个问题解决了吗?我也遇到了这个问题。