I don’t see any code snippets which would explain why the output is in the range [0, 255] and if I’m not missing something from the code I assume your output contains class logits in the range [-Inf, Inf] in the shape [batch_size, nb_classes, height, width].
If that’s the case, you can get the predicted classes for each pixel via:
pred = torch.argmax(output, dim=1)