def _get_labels(self, mask):
"""Transform a mask of class index into a mask containing actual classification labels.
Parameters
----------
mask: ndarray (shape: [width, height])
An NumPy representation of a segmentation mask. Each pixel should be a class index (see
`SemanticSegmenter.segment` function docstring).
Returns
-------
mask: ndarray (shape: [width, height])
A NumPy representation of the mask containing the true labels of the image
Raises
------
ValueError: if the true labels were not defined
"""
if self.classes is None:
raise ValueError("Class labels are not defined.")
return np.take(self.classes, mask)
评论列表
文章目录