Class weights semantic segmentation

Hi Everyone,
I am having a binary classification for an image with 2 labels. I realized that if I count the number of pixels corresponding to each class, one class has way more pixels compared to the other. I wanted to know how I can find the weights for my image classes and apply them to semantic segmentation. I am pretty new to this, any and all help is greatly appreciated