Hello Adam!



 aszmul:

I was thinking if there is a simple way providing a binary mask, where I have labels, which would be included in the loss function?


Let me speak as if you have images that are labelled on a per-pixel
basis, and that have only a small fraction of their pixels actually
labelled.  Each pixel is either unlabelled, or is labelled with one
of five classes.
(My comments apply more generally to unlabelled / labelled data,
but it’s easier for me to speak concretely.)
I would treat this a a six-class classification problem, but use
class weights that assign a weight of zero to the “unlabelled”
class.  (The five weights for the five real classes could either be
all one, or could be non-trivial weights that compensate for an
unbalanced dataset.)
Now (because they get multiplied by zero) your unlabelled pixels
won’t contribute to your loss function – your loss function and
training won’t care what your network predicted for those
unlabelled pixels.
Does this make sense (and would it apply to / work for your use
case)?
Good luck.
K. Frank