Hi,
I a new to PyTorch and also to deep learning. I am trying to produce a segmentation within four classes (background and 3 objects).
I obtained the U-Net model from online existing ones.
I do not understand the error I get: does it arise from the model, or cuda use:
RuntimeError Traceback (most recent call last)
in
11 l = torch.nn.functional.cross_entropy(prediction, y_train_batch)
12 my_optimizer.zero_grad()
—> 13 l.backward()
14 my_optimizer.step()
15 train_loss += l
Hi,
Thank you for your answer, and sorry for the delay. I am working from a jupiter notebook on floydhub so I set CUDA_LAUNCH_BLOCKING=1 into the terminal before running the notebook (I guess that is how to do it?). I have a different error:
RuntimeError Traceback (most recent call last)
in
11 l = torch.nn.functional.cross_entropy(prediction, y_train_batch)
12 my_optimizer.zero_grad()
—> 13 l.backward()
14 my_optimizer.step()
15 train_loss += l
Also, to explain what I do: I try to implement in PyTorch a segmentation protocol with U-Net that was existing in Tensorflow. For the tensorflow code the segmentation results were provided as 4 binary mask images. Since in PyTorch the cross_entropy function does not allow multi-channel target, I multiply each image with a factor (1,100,200,255) and then summed them to obtain a single image in level of gray. Is it a correct way to proceed?