def encode_segmap(self, mask):
        """Sets void classes to zero so they won't be considered for training."""
        for voidc in self.void_labels:
            mask[mask == voidc] = self.ignore_index
        for validc in self.valid_labels:
            mask[mask == validc] = self.class_map[validc]
        # remove extra idxs from updated dataset
        mask[mask > 18] = self.ignore_index
        return mask
Sets void classes to zero so they won't be considered for training.
examples/pytorch/domain_templates/semantic_segmentation.py