Weighted loss for segmentation

Do we need to give larger weight to zero class which has more occurrence in the mask ? or the other way round ? because in this reference it says we to need to give more weights to classes which are less.