Cuda runtime error (59) : device-side assert triggered at /opt/conda/conda-bld/pytorch_1549636813070/work/aten/src/THCUNN/generic/ClassNLLCriterion.cu:111

I am working on multi class Image segmentation of CT scans. I have to segment 4 organs. While training of model given below (unet with resnet34), I am having this error cuda runtime error (59) : device-side assert triggered at /opt/conda/conda-bld/pytorch_1549636813070/work/aten/src/THCUNN/generic/ClassNLLCriterion.cu:111
My image size is (512,512,3), batch size = 2, No. of masks and images are 7340.
Any help would be appreciated.
Thank you

I used the UNET architecture with RESNET34 with dice loss function.
I compared it with the camvid fastai notebook and I was not able to find the error.

Did you solve this already? I have had this problem today with segmentation models and it was because the list of classes I passed in the datablock API code was a different length from the number of classes found in the masks.
I had four types of defect so I passed: classes=[1,2,3,4]. My mistake was to forget the ‘no-defect’ class 0. Was fixed with classes=[0,1,2,3,4].
Hope this helps someone.

1 Like