# Class weights semantic segmentation

**URL:** <https://discuss.pytorch.org/t/class-weights-semantic-segmentation/49307>\
**Category:** vision\
**Created:** [June 30, 2019, 4:32am UTC](https://discuss.pytorch.org/t/class-weights-semantic-segmentation/49307 "2019-06-30T04:32:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nishanth\_Sasankan](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nishanth_sasankan/32/13219_2.png) [@Nishanth\_Sasankan](https://discuss.pytorch.org/u/Nishanth_Sasankan)\
**Post date:** [June 30, 2019, 4:32am UTC](https://discuss.pytorch.org/t/class-weights-semantic-segmentation/49307/1 "2019-06-30T04:32:02Z")

</div>

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

Thanks  
Nishanth
