You would need the former, i.e. an input image and a target mask.
The target mask would now have the shape [batch_size, height, width] and contain the class indices for each pixel in the range [0, nb_classes-1] (similar to a vanilla classification task, but with the additional spatial dimensions).



 Yolkandwhite:

does the visualized weights shows the predicted mask image??


No. Your model could use e.g. a conv layer as the output layer, which would return class logits in the shape [batch_size, nb_classes, height, width]. Again this would be similar to a standard classification use case, but your output would also have the additional spatial dimensions.