nyud_layers.py 文件源码

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

项目:NYUD-FCN8s 作者: yxliwhu 项目源码 文件源码
def load_label(self, idx):
        """
        Load label image as 1 x height x width integer array of label indices.
        Shift labels so that classes are 0-39 and void is 255 (to ignore it).
        The leading singleton dimension is required by the loss.
        """
        label = scipy.io.loadmat('{}/segmentation/img_{}.mat'.format(self.nyud_dir, idx))['groundTruth'][0,0][0,0]['SegmentationClass'].astype(np.uint16)
        for (x,y), value in np.ndenumerate(label):
            label[x,y] = self.class_map[0][value-1]
        label = label.astype(np.uint8)
        label -= 1  # rotate labels
        label = label[np.newaxis, ...]
        # pdb.set_trace()
        return label
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号