I have taken cell nuclei dataset from a kaggle competition and attempting to use with the notebook from CamVid tiramisu. I created a toy dataset to run on my laptop to make sure things work before running on my GCP GPU on the full dataset. There are only two classes: ‘Cell’, ‘Background’. I can get everything to run up through lr_find and learn.fit_one_cycle The only thing I changed was getting validation from percentage rather than folder. But, I get the following error for both commands:
RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed. at
c:\a\w\1\s\tmp_conda_3.6_090826\conda\conda-
bld\pytorch_1550394668685\work\aten\src\thnn\generic/ClassNLLCriterion.c:93
I searched StackOverflow where it says that error is associated with using the wrong loss function.
So, then I explicitly defined the loss function:
learn = unet_learner(data, models.resnet34, loss_func = nn.CrossEntropyLoss(),
metrics=metrics, wd=wd, bottle=True)
But, then I get the following error:
RuntimeError: invalid argument 3: only batches of spatial targets supported (3D
tensors) but got targets of dimension: 4 at
c:\a\w\1\s\tmp_conda_3.6_090826\conda\conda-
bld\pytorch_1550394668685\work\aten\src\thnn\generic/SpatialClassNLLCriterion.c:59
Any thoughts?