Thanks for replying @ptrblck , I am using deeplab v3+ architecture and my segmentation output shape is in [batch_size, nb_classes, height, width] format. I just printed out the unique values to check whether ignore index is their or not.
During training output tensor is of shape [batch, 23, 512, 512] after that i calculated the labels using _, pred = torch.max(scores, dim=1) .List of unique values of pred contain 22 (which is ignore index),
But at inference time when i use the trained weights, output is of shape [batch, 23, 512, 512] and the the unique values contains max label upto 21.