Role of null class in semantic segmentation class_loss_weights? #1503
Replies: 1 comment
-
There are a number of ways of dealing with this. You can just assign it 1.0. In the default case, without weights, is equivalent to all weights being 1.0. Since you're trying to up-weight non-ag pixels, I think it would make sense to leave ag and null at 1.0 and increase non-ag to, say, 2.0. Also, unless you are seeing a lot of null pixels, the value isn't going to have much of an effect anyway. You can also choose to ignore the null class, so that it doesn't contribute to the loss at all. I believe the options is called You can even -- I think, not sure -- assign it a weight of zero which again will make it not affect the loss.
Yes, this is a problem with
The null class is the class that is assigned to NODATA pixels. Often, you might not care about whether your model can distinguish between the background class (in your case, not-ag) and NODATA pixels; in that case you can set not-ag to be your null class, which means that both actual not-ag pixels and NODATA pixels will be assigned the class not-ag. |
Beta Was this translation helpful? Give feedback.
-
I'm running a semantic segmentation model to predict two classes: agriculture and non-agriculture. Since my input data is biased with more agricultural pixels than non-agricultural pixels, I'm using the class_loss_weights argument in SolverConfig to correct for the data imbalance. I'm confused about why we need to include a value to weigh the null class by, and how this value affects the training of the model. I tried setting the non-agricultural class to the null class in ClassConfig in order to avoid providing a weight for the null class in SolverConfig, but then I only get evaluation metrics for the agricultural class in eval.json, and not for the non-agricultural/null class which is less than ideal.
I would also appreciate some clarification about what the null class is, functionally, and what it means to set a class to the null class.
Beta Was this translation helpful? Give feedback.
All reactions