How to make the layer automatically ignores a given pixel label during network training?

1 visualizzazione (ultimi 30 giorni)
I would like to train a semantic segmentation network without considering a given class label during training. I want that pixels from that class do not propagate the loss.
I want to implement a cross-entropy loss function similar to this Python example. The function ignores the last label during loss computation so the network does not "learn" to classify a given class, although this class is present in the training patch.
I know about the dicePixelClassificationLayer function that says "The layer automatically ignores undefined pixel labels during training.", but how to set a given class label to "undefined" so that the layer automatically ignores it?
Please help!

Risposta accettata

Matheus Ferreira
Matheus Ferreira il 24 Giu 2020
Already solved: Just use the standardizeMissing function to substitut the ID of a given class by NaN. For example, if the class label to ignore is 99 run the following:
img = standardizeMissing(img,99);
Save variable img to the TIFF format and create a pixelLabelDatastore with the class names and label IDs without the class 99, for example. The pixels os the class 99 will be converted to <undefined> and the pixelClassificationLayer ignores undefined pixel labels during training.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by