semantic-segmentation-pytorch
semantic-segmentation-pytorch copied to clipboard
Unable to train
Did you find a solution to this? I am having the same issue! Thanks.
I've been facing exactly the same errors too. The last one seems related to the fact that model and input don't run on the same device (one on GPU and one on CPU) as suggested here and here. Moreover, the traceback suggests that we need to locate the input into the GPU, because the model is already there.
Here is the modification I applied just before the computation done for the batch forward, it works for me.
# from models/models.py ln. 30
def forward(self, feed_dict, *, segSize=None):
# if the dataset is loaded as a list, this will
# raise a TypeError while trying to access it as a dictionary.
if type(feed_dict) is list:
feed_dict = feed_dict[0]
# also, convert to torch.cuda.FloatTensor
if torch.cuda.is_available():
feed_dict['img_data'] = feed_dict['img_data'].cuda()
feed_dict['seg_label'] = feed_dict['seg_label'].cuda()
else:
raise RunTimeError('Cannot convert torch.Floattensor into torch.cuda.FloatTensor')
Hope it helps!
@Fiordarancio it's RuntimeError not RunTimeError