I am doing semantic segmentation and was wondering if there is a method in PyTorch that will allow me to compute the CRF loss shown below? I am not trying to do inference. I just want to compute the loss based on the unary and pairwise terms.
I could do it myself. Replicate the output 8 times, shift the pixels accordingly and compute the difference to determine if the labels are similar but I don’t know if that would be efficient.
image1299×237 28 KB