create_lmdb_data.py 文件源码

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

项目:visimportance 作者: cvzoya 项目源码 文件源码
def load_label(maindir, idx, split):
    """
    Load label image as 1 x height x width integer array of label indices.
    The leading singleton dimension is required by the loss.
    """

    if split=='train':
        im = Image.open('{}/GDI/gd_imp_train/{}.png'.format(maindir, idx)) 
    else:
        im = Image.open('{}/GDI/gd_imp_val/{}.png'.format(maindir, idx))

    label = np.array(im, dtype=np.uint8) 
    label = label/255.0

    label = label[np.newaxis, ...]
    return label
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号