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

조회 수: 1 (최근 30일)
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!

채택된 답변

Matheus Ferreira
Matheus Ferreira 2020년 6월 24일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by