segmenter.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:sldc 作者: waliens 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号