HiLab-git / CDMA

offical code for: Semi-supervised Pathological Image Segmentation via Cross Distillation of Multiple Attentions. MICCAI 2023.
48 stars 4 forks source link

one issue about code. #5

Open 7tu opened 10 months ago

7tu commented 10 months ago

Thank you very much for your excellent work, which has benefited me a lot. I have encountered some problems when replicating your code and would like to consult you. The errors are as follows. If possible, would you like to tell me how to solve this problem? Sorry for taking up your time. We hope to get your reply as soon as possible. Thank you again. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [866,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [4,0,0], thread: [480,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [4,0,0], thread: [992,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [4,0,0], thread: [224,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [4,0,0], thread: [736,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [613,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [615,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [96,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [98,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [102,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [353,0,0] Assertion t >= 0 && t < n_classes failed. ../aten/src/ATen/native/cuda/NLLLoss2d.cu:103: nll_loss2d_forward_kernel: block: [2,0,0], thread: [356,0,0] Assertion t >= 0 && t < n_classes failed.

return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing) RuntimeError: CUDA error: device-side assert triggered

lanfz2000 commented 10 months ago

This error may occur because the dimension mismatch of prediction of networks and ground truth.

7tu commented 10 months ago

Thank you very much for your reply. I am currently using the DigestPath2019 data set. Should it be a binary classification problem? The code is based on the code published on your github. First, move_file.py and slide_window.py are executed for data preparation, and then run.sh is run. This error appears. The error location is during cross_entropy calculation. I saw that num_class is also set to 2 in the code, which should be consistent. I tried mapping the label value to two values ​​0 and 1 and then performing cross_entropy calculation. In this way, the cross_entropy function executed smoothly, but the same error occurred in other places. This bothers me too. Sorry to bother you again, thank you again for your excellent work and look forward to hearing from you.

lanfz2000 commented 10 months ago

Yes, it may be the problem of ground truth. Make sure it has two values, 0 and 1, not 0 and 255.

7tu commented 10 months ago

I have set the values to 0 and 1, but the same error still occurs elsewhere, could you please tell me if you have done any additional operations, if so, would you mind sharing them?

lanfz2000 commented 10 months ago

I am sorry I did not make the error you have, maybe you can check the dataset.

7tu commented 10 months ago

The problem may indeed lie in the dataset. Can you share the dataset to my email address 819709535@qq.com, because the official online download channel has been closed. Thank you again for your great work.

hqy2020 commented 8 months ago

Hi~Can you share the dataset to my email address hqy200091@163.com, because the official online download channel has been closed. Thank you again for your great work.