I am using models.segmentation.deeplabv3_resnet101(pretrained=False, num_classes=12, progress=True) as model to train my own dataset.
Dataset consists of jpg and annotation in png(12 classes)
I transformed both to tensors using transforms.ToTensor()
training:
model.train()
outputs = model(inputs)
loss = criterion(outputs[‘out’], labels)
I get the following error
RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 ‘target’
I checked the dimension for output:
outputs[‘out’].size()
torch.Size([2, 12, 512, 512])
But the target has dimension:
labels.size()
torch.Size([2, 1, 512, 512])
How do I resolve this ? Thanks in advance